Scenario\Nation 클래스 초기화

- 버그 수정
This commit is contained in:
2018-03-28 17:48:05 +09:00
parent f442ae3b97
commit b7237140c8
4 changed files with 63 additions and 3 deletions
+24
View File
@@ -9,6 +9,10 @@ class Scenario{
private $data;
private $nations;
private $generals;
private $generalsEx;
private $initialEvents;
private $events;
@@ -23,6 +27,26 @@ class Scenario{
$this->initialEvents = array_map(function($rawEvent){
return new \sammo\Event\EventHandler($rawEvent[0], array_slice($rawEvent, 1));
}, Util::array_get($this->data['initialEvents'], []));
$this->nations = [];
$this->nations[0] = new Scenario\Nation(0, '재야', '#ffffff', 0, 0);
foreach (Util::array_get($this->data['nation'],[]) as $idx=>$nationRaw) {
list($name, $color, $gold, $rice, $infoText, $tech, $type, $nationLevel, $cities) = $nationRaw;
$nationID = $idx+1;
$this->nations[$nationID] = new Scenario\Nation(
$nationID,
$name,
$color,
$gold,
$rice,
$infoText,
$tech,
$type,
$nationLevel,
$cities
);
}
}
public function getScenarioIdx(){
+3 -1
View File
@@ -2,5 +2,7 @@
namespace sammo\Scenario;
class NPC{
public function build($env=[]){
}
}
+35 -1
View File
@@ -2,5 +2,39 @@
namespace sammo\Scenario;
class Nation{
private $id;
private $name;
private $color;
private $gold;
private $rice;
private $infoText;
private $tech;
private $type;
private $nationLevel;
private $cities = [];
private $generals = [];
public function __construct(
int $id = null,
string $name = '국가',
string $color = '#ffffff',
int $gold = 0,
int $rice = 2000,
string $infoText = '국가 설명',
int $tech = 0,
string $type = '유가',
int $nationLevel = 0,
array $cities = []
){
}
public function setID(int $id){
$this->id = $id;
}
public function build($env=[]){
}
}
+1 -1
View File
@@ -46,7 +46,7 @@
["장연", "#87CEEB", 10000, 10000, "장연", 1000, "도가", 2, [
"진양"
]],
["장양", "#483D8B", 10000, 10000, "장양", 1000, 2, "묵가", [
["장양", "#483D8B", 10000, 10000, "장양", 1000, "묵가", 1, [
"하내"
]]
],