메시지 시스템 외부로 연결중.
This commit is contained in:
+28
-10
@@ -8,32 +8,49 @@ class MessageTarget extends Target {
|
||||
public $nationName;
|
||||
/** @var string */
|
||||
public $color;
|
||||
/** @var string */
|
||||
public $icon;
|
||||
|
||||
public function __construct(int $generalID, string $generalName, int $nationID, string $nationName, string $color){
|
||||
public function __construct(
|
||||
int $generalID,
|
||||
string $generalName,
|
||||
int $nationID,
|
||||
string $nationName,
|
||||
string $color,
|
||||
string $icon=''
|
||||
){
|
||||
|
||||
parent::__construct($generalID, $nationID);
|
||||
|
||||
if($mailbox > Message::MAILBOX_NATIONAL){
|
||||
$this->isGeneral = false;
|
||||
}
|
||||
else{
|
||||
$this->isGeneral = true;
|
||||
if(!$icon){
|
||||
$icon = ServConfig::getSharedIconPath().'/default.jpg';
|
||||
}
|
||||
|
||||
$this->generalName = $generalName;
|
||||
$this->nationName = $nationName;
|
||||
$this->color = $color;
|
||||
$this->icon = $icon;
|
||||
}
|
||||
|
||||
public static function buildFromArray(array $arr) : MessageTarget
|
||||
{
|
||||
if(!Util::array_get($arr['nation'])){
|
||||
if(!$arr){
|
||||
return null;
|
||||
}
|
||||
if(!Util::array_get($arr['nation_id'])){
|
||||
$arr['nation'] = '재야';
|
||||
$arr['color'] = '#ffffff';
|
||||
$arr['color'] = '#000000';
|
||||
$arr['nation_id'] = 0;
|
||||
}
|
||||
|
||||
return new MessageTarget($arr['id'], $arr['name'], $arr['nation_id'], $arr['nation'], $arr['color']);
|
||||
return new MessageTarget(
|
||||
$arr['id'],
|
||||
$arr['name'],
|
||||
$arr['nation_id'],
|
||||
$arr['nation'],
|
||||
$arr['color'],
|
||||
$arr['icon']??''
|
||||
);
|
||||
}
|
||||
|
||||
public function toArray() : array{
|
||||
@@ -42,7 +59,8 @@ class MessageTarget extends Target {
|
||||
'name'=>$this->generalName,
|
||||
'nation_id'=>$this->nationID,
|
||||
'nation'=>$this->nationName,
|
||||
'color'=>$this->color
|
||||
'color'=>$this->color,
|
||||
'icon'=>$this->icon
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user