OSDN Git Service

次のマスが何戦目かを表示する
[kancollesniffer/KancolleSniffer.git] / KancolleSniffer / CellInfo.cs
1 // Copyright (C) 2018 Kazuhiro Fujieda <fujieda@users.osdn.me>\r
2 //\r
3 // Licensed under the Apache License, Version 2.0 (the "License");\r
4 // you may not use this file except in compliance with the License.\r
5 // You may obtain a copy of the License at\r
6 //\r
7 //    http://www.apache.org/licenses/LICENSE-2.0\r
8 //\r
9 // Unless required by applicable law or agreed to in writing, software\r
10 // distributed under the License is distributed on an "AS IS" BASIS,\r
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
12 // See the License for the specific language governing permissions and\r
13 // limitations under the License.\r
14 \r
15 namespace KancolleSniffer\r
16 {\r
17     public class CellInfo\r
18     {\r
19         private int _batttleCount;\r
20 \r
21         public string Text { get; set; }\r
22 \r
23         private string _info;\r
24 \r
25         public void Port()\r
26         {\r
27             Text = _info;\r
28         }\r
29 \r
30         public void StartBattle()\r
31         {\r
32             Text = _info;\r
33         }\r
34 \r
35         public void InspectMapStart(dynamic json)\r
36         {\r
37             _batttleCount = 0;\r
38             InspectMapNext(json);\r
39         }\r
40 \r
41         public void InspectMapNext(dynamic json)\r
42         {\r
43             SetInfo(json);\r
44             Text = "次" + _info;\r
45         }\r
46 \r
47         private void SetInfo(dynamic json)\r
48         {\r
49             switch ((int)json.api_color_no)\r
50             {\r
51                 case 2:\r
52                     _info = "資源";\r
53                     break;\r
54                 case 3:\r
55                     _info = "渦潮";\r
56                     break;\r
57                 case 4:\r
58                     switch ((int)json.api_event_id)\r
59                     {\r
60                         case 4:\r
61                             _batttleCount++;\r
62                             _info = $"{BattleCount}戦目";\r
63                             break;\r
64                         case 6:\r
65                             _info = "気のせい";\r
66                             break;\r
67                     }\r
68                     break;\r
69                 case 5:\r
70                     _info = "ボス戦";\r
71                     break;\r
72                 case 6:\r
73                     _info = "揚陸地点";\r
74                     break;\r
75                 case 7:\r
76                     _batttleCount++;\r
77                     _info = $"{BattleCount}戦目(航空)";\r
78                     break;\r
79                 case 8:\r
80                     _info = "護衛成功";\r
81                     break;\r
82                 case 9:\r
83                     _info = "航空偵察";\r
84                     break;\r
85                 case 10:\r
86                     _batttleCount++;\r
87                     _info = $"{BattleCount}戦目(空襲)";\r
88                     break;\r
89             }\r
90         }\r
91 \r
92         private string BattleCount => ((char)('0' + _batttleCount)).ToString();\r
93     }\r
94 }