From b7237140c8442e37434564a2dd6ea7bdb929c0c1 Mon Sep 17 00:00:00 2001 From: hide_d Date: Wed, 28 Mar 2018 17:48:05 +0900 Subject: [PATCH] =?UTF-8?q?Scenario\Nation=20=ED=81=B4=EB=9E=98=EC=8A=A4?= =?UTF-8?q?=20=EC=B4=88=EA=B8=B0=ED=99=94=20-=20=EB=B2=84=EA=B7=B8=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- twe/sammo/Scenario.php | 24 +++++++++++++++++++++++ twe/sammo/Scenario/NPC.php | 4 +++- twe/sammo/Scenario/Nation.php | 36 ++++++++++++++++++++++++++++++++++- twe/scenario/scenario_4.json | 2 +- 4 files changed, 63 insertions(+), 3 deletions(-) diff --git a/twe/sammo/Scenario.php b/twe/sammo/Scenario.php index 1caffe4a..4297fe0d 100644 --- a/twe/sammo/Scenario.php +++ b/twe/sammo/Scenario.php @@ -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(){ diff --git a/twe/sammo/Scenario/NPC.php b/twe/sammo/Scenario/NPC.php index 2c9dcf8e..9f3514ef 100644 --- a/twe/sammo/Scenario/NPC.php +++ b/twe/sammo/Scenario/NPC.php @@ -2,5 +2,7 @@ namespace sammo\Scenario; class NPC{ - + public function build($env=[]){ + + } } \ No newline at end of file diff --git a/twe/sammo/Scenario/Nation.php b/twe/sammo/Scenario/Nation.php index 49d51ccf..d3680176 100644 --- a/twe/sammo/Scenario/Nation.php +++ b/twe/sammo/Scenario/Nation.php @@ -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=[]){ + + } } \ No newline at end of file diff --git a/twe/scenario/scenario_4.json b/twe/scenario/scenario_4.json index cc6ba904..459cf69f 100644 --- a/twe/scenario/scenario_4.json +++ b/twe/scenario/scenario_4.json @@ -46,7 +46,7 @@ ["장연", "#87CEEB", 10000, 10000, "장연", 1000, "도가", 2, [ "진양" ]], - ["장양", "#483D8B", 10000, 10000, "장양", 1000, 2, "묵가", [ + ["장양", "#483D8B", 10000, 10000, "장양", 1000, "묵가", 1, [ "하내" ]] ],