|
8 | 8 |
|
9 | 9 | namespace VectorNetworkProject\TheMix\game; |
10 | 10 |
|
11 | | -use VectorNetworkProject\TheMix\provider\YAML; |
12 | 11 | use VectorNetworkProject\TheMix\TheMix; |
13 | 12 |
|
14 | 13 | class DefaultConfig |
15 | 14 | { |
16 | | - public const STAGE_NAME = 'stage-world-name'; |
| 15 | + /** @var string */ |
| 16 | + const VERSION = 'version'; |
17 | 17 |
|
18 | | - public const DEVELOP_MODE = 'develop-mode'; |
| 18 | + /** @var string */ |
| 19 | + const STAGE_NAME = 'stage-world-name'; |
19 | 20 |
|
20 | | - public const EVENT_TIME = 'event-time'; |
| 21 | + /** @var string */ |
| 22 | + const DEVELOP_MODE = 'dev-mode'; |
21 | 23 |
|
22 | | - public const RED = 'red'; |
| 24 | + /** @var string */ |
| 25 | + const EVENT_TIME = 'event-time'; |
23 | 26 |
|
24 | | - public const BLUE = 'blue'; |
| 27 | + /** @var string */ |
| 28 | + const TIMEZONE = 'timezone'; |
25 | 29 |
|
26 | | - public static function init() |
| 30 | + /** @var string */ |
| 31 | + const RED = 'red'; |
| 32 | + |
| 33 | + /** @var string */ |
| 34 | + const BLUE = 'blue'; |
| 35 | + |
| 36 | + /** |
| 37 | + * @return int |
| 38 | + */ |
| 39 | + public static function getVersion(): int |
27 | 40 | { |
28 | | - $db = new YAML(); |
29 | | - $db->init([ |
30 | | - 'version' => TheMix::PLUGIN_CONFIG_VERSION, |
31 | | - 'develop-mode' => true, |
32 | | - 'stage-world-name' => 'stage', |
33 | | - 'event-time' => 30, |
34 | | - 'red' => [ |
35 | | - 'spawn1' => [ |
36 | | - 'x' => -131, |
37 | | - 'y' => 81, |
38 | | - 'z' => 25, |
39 | | - ], |
40 | | - 'spawn2' => [ |
41 | | - 'x' => -131, |
42 | | - 'y' => 81, |
43 | | - 'z' => -25, |
44 | | - ], |
45 | | - 'core' => [ |
46 | | - 'x' => -152, |
47 | | - 'y' => 85, |
48 | | - 'z' => 0, |
49 | | - ], |
50 | | - ], |
51 | | - 'blue' => [ |
52 | | - 'spawn1' => [ |
53 | | - 'x' => 131, |
54 | | - 'y' => 81, |
55 | | - 'z' => -25, |
56 | | - ], |
57 | | - 'spawn2' => [ |
58 | | - 'x' => -131, |
59 | | - 'y' => 81, |
60 | | - 'z' => 25, |
61 | | - ], |
62 | | - 'core' => [ |
63 | | - 'x' => 152, |
64 | | - 'y' => 85, |
65 | | - 'z' => 0, |
66 | | - ], |
67 | | - ], |
68 | | - ]); |
| 41 | + return TheMix::getInstance()->getConfig()->get(self::VERSION); |
69 | 42 | } |
70 | 43 |
|
| 44 | + /** |
| 45 | + * @return string |
| 46 | + */ |
71 | 47 | public static function getStageLevelName(): string |
72 | 48 | { |
73 | | - $db = new YAML(); |
74 | | - |
75 | | - return $db->get(self::STAGE_NAME); |
| 49 | + return TheMix::getInstance()->getConfig()->get(self::STAGE_NAME); |
76 | 50 | } |
77 | 51 |
|
| 52 | + /** |
| 53 | + * @return bool |
| 54 | + */ |
78 | 55 | public static function isDev(): bool |
79 | 56 | { |
80 | | - $db = new YAML(); |
81 | | - |
82 | | - return $db->get(self::DEVELOP_MODE); |
| 57 | + return TheMix::getInstance()->getConfig()->get(self::DEVELOP_MODE); |
83 | 58 | } |
84 | 59 |
|
| 60 | + /** |
| 61 | + * @return int |
| 62 | + */ |
85 | 63 | public static function getEventTime(): int |
86 | 64 | { |
87 | | - $db = new YAML(); |
| 65 | + return TheMix::getInstance()->getConfig()->get(self::EVENT_TIME); |
| 66 | + } |
88 | 67 |
|
89 | | - return $db->get(self::EVENT_TIME); |
| 68 | + public static function getTimezone(): string |
| 69 | + { |
| 70 | + return TheMix::getInstance()->getConfig()->get(self::TIMEZONE); |
90 | 71 | } |
91 | 72 |
|
| 73 | + /** |
| 74 | + * @return array |
| 75 | + */ |
92 | 76 | public static function getRedConfig(): array |
93 | 77 | { |
94 | | - $db = new YAML(); |
95 | | - |
96 | | - return $db->get(self::RED); |
| 78 | + return TheMix::getInstance()->getConfig()->get(self::RED); |
97 | 79 | } |
98 | 80 |
|
| 81 | + /** |
| 82 | + * @return array |
| 83 | + */ |
99 | 84 | public static function getBlueConfig(): array |
100 | 85 | { |
101 | | - $db = new YAML(); |
102 | | - |
103 | | - return $db->get(self::BLUE); |
| 86 | + return TheMix::getInstance()->getConfig()->get(self::BLUE); |
104 | 87 | } |
105 | 88 | } |
0 commit comments