Advertisement
primadog

Untitled

Aug 10th, 2018
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.40 KB | None | 0 0
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using AssetHolder;
  5. using data;
  6. using GameScene.scene;
  7. using Scream.Api;
  8.  
  9. namespace GameUI.dialog
  10. {
  11. // Token: 0x020009CE RID: 2510
  12. public static class ItemGetFunction
  13. {
  14. // Token: 0x06004196 RID: 16790 RVA: 0x00132D64 File Offset: 0x00131164
  15. public static ItemGetBaseData GetSearchItem(List<item_get_correlation.Data> searchCorreelationList, List<int> activeEventGroupList = null, ItemGetFunction.ItemStoryType storyType = ItemGetFunction.ItemStoryType.Invalid)
  16. {
  17. if (searchCorreelationList.Count == 0)
  18. {
  19. return null;
  20. }
  21. ItemGetBaseData itemGetBaseData = null;
  22. for (int i = 0; i < searchCorreelationList.Count; i++)
  23. {
  24. item_get_correlation.Data data = searchCorreelationList[i];
  25. if (data.mode == "0")
  26. {
  27. itemGetBaseData = ItemGetFunction.Story(data, activeEventGroupList, storyType);
  28. }
  29. if (itemGetBaseData != null)
  30. {
  31. break;
  32. }
  33. }
  34. return itemGetBaseData;
  35. }
  36.  
  37. // Token: 0x06004197 RID: 16791 RVA: 0x00132DCC File Offset: 0x001311CC
  38. public static bool JumpScene(ItemGetBaseData data, List<object> parameter)
  39. {
  40. ItemGetFunction.<JumpScene>c__AnonStorey2 <JumpScene>c__AnonStorey = new ItemGetFunction.<JumpScene>c__AnonStorey2();
  41. <JumpScene>c__AnonStorey.parameter = parameter;
  42. if (data == null)
  43. {
  44. return false;
  45. }
  46. ItemGetFunction.ItemModeType type = data.type;
  47. if (type == ItemGetFunction.ItemModeType.Invalid)
  48. {
  49. throw new Exception("モードが未設定");
  50. }
  51. if (type != ItemGetFunction.ItemModeType.Story)
  52. {
  53. throw new Exception("モードが未設定");
  54. }
  55. ItemGetStoryData tmpStoryData = data as ItemGetStoryData;
  56. ItemGetFunction.ItemStoryType story_type = tmpStoryData.story_type;
  57. if (story_type == ItemGetFunction.ItemStoryType.Invalid)
  58. {
  59. throw new Exception("ストーリータイプが未設定");
  60. }
  61. if (story_type != ItemGetFunction.ItemStoryType.Main)
  62. {
  63. if (story_type != ItemGetFunction.ItemStoryType.Event)
  64. {
  65. return false;
  66. }
  67. SingletonMonoBehaviour<SceneRoot>.Instance.ChangeInstantScene("StoryDetail", delegate
  68. {
  69. StoryDetail component = SingletonMonoBehaviour<SceneRoot>.Instance.activeScene.GetComponent<StoryDetail>();
  70. component.SettingEvent((DifficultyType)tmpStoryData.story_master_data.difficulty_type, tmpStoryData.story_event_group.story_event_group_id, (int)tmpStoryData.story_event_group.story_event_episode_id, <JumpScene>c__AnonStorey.parameter);
  71. }, null, SceneRoot.SceneChangeProductionType.None);
  72. return true;
  73. }
  74. else
  75. {
  76. StoryFunction.Number number = StoryFunction.Number.CreateMain(tmpStoryData.story_main_data, (DifficultyType)tmpStoryData.story_master_data.difficulty_type);
  77. if (!StoryFunction.GetIsUnlock(number))
  78. {
  79. SingletonMonoBehaviour<SceneRoot>.Instance.OpenScene("CommonDialog", delegate
  80. {
  81. game_mode_unlock_master game_mode_unlock_master = SingletonMonoBehaviour<DataBaseRoot>.Instance.MasterData.original.game_mode_unlock_master;
  82. LanguageMasterData languageMasterData = SingletonMonoBehaviour<AssetHolderRoot>.Instance.commonHolder.GetLanguageMasterData();
  83. LanguageData data2 = languageMasterData.GetData(LanguageMasterData.Kind.COM);
  84. string text = data2.GetInfo(9103).text;
  85. CommonDialog component = SingletonMonoBehaviour<SceneRoot>.Instance.piledScene.GetComponent<CommonDialog>();
  86. component.SetupNotice(text, null);
  87. }, null, null, true, SceneRoot.SceneChangeProductionType.None, SceneRoot.FadePattern.Default);
  88. return false;
  89. }
  90. SingletonMonoBehaviour<SceneRoot>.Instance.ChangeInstantScene("StoryDetail", delegate
  91. {
  92. StoryDetail component = SingletonMonoBehaviour<SceneRoot>.Instance.activeScene.GetComponent<StoryDetail>();
  93. component.SettingMain((DifficultyType)tmpStoryData.story_master_data.difficulty_type, (int)tmpStoryData.story_main_data.story_part_id, (int)tmpStoryData.story_main_data.story_chapter_id, (int)tmpStoryData.story_main_data.story_episode_id, tmpStoryData.is_latest_story, <JumpScene>c__AnonStorey.parameter);
  94. }, null, SceneRoot.SceneChangeProductionType.None);
  95. return true;
  96. }
  97. }
  98.  
  99. // Token: 0x06004198 RID: 16792 RVA: 0x00132F08 File Offset: 0x00131308
  100. public static IEnumerator GetEventGroup(Action<List<int>> finish)
  101. {
  102. List<int> tmpEventGroupList = new List<int>();
  103. byte storyType = 2;
  104. yield return SingletonMonoBehaviour<SceneRoot>.Instance.DownloadStoryInfoList(storyType, false, true);
  105. List<StoryInfo> list = SingletonMonoBehaviour<UserDataRoot>.Instance.UserData.Story.GetStoryInfoList(storyType);
  106. for (int i = 0; i < list.Count; i++)
  107. {
  108. tmpEventGroupList.Add(list[i].StoryGroupId);
  109. }
  110. finish(tmpEventGroupList);
  111. yield break;
  112. }
  113.  
  114. // Token: 0x06004199 RID: 16793 RVA: 0x00132F24 File Offset: 0x00131324
  115. private static ItemGetStoryData Story(item_get_correlation.Data searchItemCorrelation, List<int> activeEventGroupList, ItemGetFunction.ItemStoryType storyType)
  116. {
  117. story_master story_master = SingletonMonoBehaviour<DataBaseRoot>.Instance.MasterData.original.story_master;
  118. story_master.Data data4 = story_master.data.Find((story_master.Data data) => data.story_master_id == searchItemCorrelation.story_id);
  119. if (data4 == null)
  120. {
  121. return null;
  122. }
  123. if (storyType == ItemGetFunction.ItemStoryType.Invalid || storyType == ItemGetFunction.ItemStoryType.Main)
  124. {
  125. bool lastStory = false;
  126. story_main.Data data2 = ItemGetFunction.MainStory(data4, out lastStory);
  127. if (data2 != null)
  128. {
  129. return new ItemGetStoryData(data4, data2, lastStory);
  130. }
  131. }
  132. if (storyType == ItemGetFunction.ItemStoryType.Invalid || storyType == ItemGetFunction.ItemStoryType.Event)
  133. {
  134. story_event_group.Data data3 = ItemGetFunction.EventStory(data4, activeEventGroupList);
  135. if (data3 != null)
  136. {
  137. return new ItemGetStoryData(data4, data3, false);
  138. }
  139. }
  140. return null;
  141. }
  142.  
  143. // Token: 0x0600419A RID: 16794 RVA: 0x00132FC8 File Offset: 0x001313C8
  144. private static story_main.Data MainStory(story_master.Data searchItemStoryMaster, out bool isLatestStory)
  145. {
  146. story_master story_master = SingletonMonoBehaviour<DataBaseRoot>.Instance.MasterData.original.story_master;
  147. story_main story_main = SingletonMonoBehaviour<DataBaseRoot>.Instance.MasterData.original.story_main;
  148. isLatestStory = false;
  149. story_main.Data data3 = story_main.data.Find(delegate(story_main.Data data)
  150. {
  151. int story_master_id = searchItemStoryMaster.story_master_id;
  152. return data.story_master_normal_id == story_master_id || data.story_master_hard_id == story_master_id || data.story_master_scream_id == story_master_id || data.story_master_despair_id == story_master_id;
  153. });
  154. if (data3 == null)
  155. {
  156. return null;
  157. }
  158. StoryFunction.Number number = StoryFunction.Number.CreateMain(data3, (DifficultyType)searchItemStoryMaster.difficulty_type);
  159. if (!StoryFunction.GetIsUnlock(number))
  160. {
  161. return null;
  162. }
  163. StoryFunction.PlayableProgress playableProgress = StoryFunction.GetPlayableProgress(searchItemStoryMaster.story_master_id);
  164. if (playableProgress != null && !playableProgress.isAchived)
  165. {
  166. return null;
  167. }
  168. UserData.StoryData.StatusData statusData = SingletonMonoBehaviour<UserDataRoot>.Instance.UserData.Story.Status.Find((UserData.StoryData.StatusData data) => data.StoryId == searchItemStoryMaster.story_master_id);
  169. isLatestStory = (statusData == null);
  170. if (statusData != null)
  171. {
  172. return data3;
  173. }
  174. List<UserData.StoryData.StatusData> tmpUserClearStoryList = SingletonMonoBehaviour<UserDataRoot>.Instance.UserData.Story.Status.FindAll((UserData.StoryData.StatusData data) => data.StoryType == 0);
  175. tmpUserClearStoryList.Sort((UserData.StoryData.StatusData a, UserData.StoryData.StatusData b) => b.StoryId - a.StoryId);
  176. if (tmpUserClearStoryList.Count == 0)
  177. {
  178. if (searchItemStoryMaster.difficulty_type != 0 || data3.id != 1)
  179. {
  180. return null;
  181. }
  182. return data3;
  183. }
  184. else
  185. {
  186. story_master.Data tmpUserClearStory = story_master.data.Find((story_master.Data data) => data.story_master_id == tmpUserClearStoryList[0].StoryId);
  187. story_main.Data data2 = story_main.data.Find(delegate(story_main.Data data)
  188. {
  189. int story_master_id = tmpUserClearStory.story_master_id;
  190. return data.story_master_normal_id == story_master_id || data.story_master_hard_id == story_master_id || data.story_master_scream_id == story_master_id || data.story_master_despair_id == story_master_id;
  191. });
  192. if (data2 == null)
  193. {
  194. return null;
  195. }
  196. int num = data3.id - data2.id;
  197. if (num > 1)
  198. {
  199. return null;
  200. }
  201. if (num == 0)
  202. {
  203. isLatestStory = false;
  204. int num2 = (int)(searchItemStoryMaster.difficulty_type - tmpUserClearStory.difficulty_type);
  205. if (num2 > 1)
  206. {
  207. return null;
  208. }
  209. }
  210. else if (num == 1 && searchItemStoryMaster.difficulty_type != 0)
  211. {
  212. return null;
  213. }
  214. return data3;
  215. }
  216. }
  217.  
  218. // Token: 0x0600419B RID: 16795 RVA: 0x001331F4 File Offset: 0x001315F4
  219. private static story_event_group.Data EventStory(story_master.Data searchItemStoryMaster, List<int> activeEventGroupList)
  220. {
  221. if (activeEventGroupList == null || activeEventGroupList.Count == 0)
  222. {
  223. return null;
  224. }
  225. story_master story_master = SingletonMonoBehaviour<DataBaseRoot>.Instance.MasterData.original.story_master;
  226. story_event_group story_event_group = SingletonMonoBehaviour<DataBaseRoot>.Instance.MasterData.original.story_event_group;
  227. story_event_group.Data tmpActiveEventGroup = story_event_group.data.Find(delegate(story_event_group.Data data)
  228. {
  229. bool flag = data.story_event_story_master_normal_id == searchItemStoryMaster.story_master_id || data.story_event_story_master_hard_id == searchItemStoryMaster.story_master_id || data.story_event_story_master_scream_id == searchItemStoryMaster.story_master_id || data.story_event_story_master_despair_id == searchItemStoryMaster.story_master_id;
  230. return activeEventGroupList.Contains(data.story_event_group_id) && flag;
  231. });
  232. if (tmpActiveEventGroup == null)
  233. {
  234. return null;
  235. }
  236. StoryFunction.Number number = StoryFunction.Number.CreateEvent(tmpActiveEventGroup, (DifficultyType)searchItemStoryMaster.difficulty_type);
  237. if (!StoryFunction.GetIsUnlock(number))
  238. {
  239. return null;
  240. }
  241. StoryFunction.PlayableProgress playableProgress = StoryFunction.GetPlayableProgress(searchItemStoryMaster.story_master_id);
  242. if (playableProgress != null && !playableProgress.isAchived)
  243. {
  244. return null;
  245. }
  246. List<story_event_group.Data> list = story_event_group.data.FindAll((story_event_group.Data data) => tmpActiveEventGroup.story_event_group_id == data.story_event_group_id);
  247. list.Sort((story_event_group.Data a, story_event_group.Data b) => (int)(a.story_event_episode_id - b.story_event_episode_id));
  248. UserData.StoryData.StatusData statusData = SingletonMonoBehaviour<UserDataRoot>.Instance.UserData.Story.Status.Find((UserData.StoryData.StatusData data) => data.StoryId == searchItemStoryMaster.story_master_id && activeEventGroupList.Contains(data.GroupId));
  249. if (statusData != null)
  250. {
  251. return tmpActiveEventGroup;
  252. }
  253. List<UserData.StoryData.StatusData> tmpUserClearStoryList = SingletonMonoBehaviour<UserDataRoot>.Instance.UserData.Story.Status.FindAll((UserData.StoryData.StatusData data) => data.StoryType == 2 && data.GroupId == tmpActiveEventGroup.story_event_group_id);
  254. tmpUserClearStoryList.Sort((UserData.StoryData.StatusData a, UserData.StoryData.StatusData b) => a.StoryId - b.StoryId);
  255. if (tmpUserClearStoryList.Count == 0)
  256. {
  257. if (searchItemStoryMaster.difficulty_type != 0 || tmpActiveEventGroup.story_event_episode_id != list[0].story_event_episode_id)
  258. {
  259. return null;
  260. }
  261. return tmpActiveEventGroup;
  262. }
  263. else
  264. {
  265. story_master.Data data3 = story_master.data.Find((story_master.Data data) => data.story_master_id == tmpUserClearStoryList[0].StoryId);
  266. story_event_group.Data data2 = list.Find(delegate(story_event_group.Data data)
  267. {
  268. int storyId = tmpUserClearStoryList[0].StoryId;
  269. return data.story_event_story_master_normal_id == searchItemStoryMaster.story_master_id || data.story_event_story_master_hard_id == searchItemStoryMaster.story_master_id || data.story_event_story_master_scream_id == searchItemStoryMaster.story_master_id || data.story_event_story_master_despair_id == searchItemStoryMaster.story_master_id;
  270. });
  271. if (data2 == null)
  272. {
  273. return null;
  274. }
  275. int num = tmpActiveEventGroup.id - data2.id;
  276. if (num > 1)
  277. {
  278. return null;
  279. }
  280. if (num == 0)
  281. {
  282. int num2 = (int)(searchItemStoryMaster.difficulty_type - data3.difficulty_type);
  283. if (num2 > 1)
  284. {
  285. return null;
  286. }
  287. }
  288. else if (num == 1 && searchItemStoryMaster.difficulty_type != 0)
  289. {
  290. return null;
  291. }
  292. return tmpActiveEventGroup;
  293. }
  294. }
  295.  
  296. // Token: 0x020009CF RID: 2511
  297. public enum ItemModeType
  298. {
  299. // Token: 0x04003247 RID: 12871
  300. Invalid,
  301. // Token: 0x04003248 RID: 12872
  302. Story
  303. }
  304.  
  305. // Token: 0x020009D0 RID: 2512
  306. public enum ItemStoryType
  307. {
  308. // Token: 0x0400324A RID: 12874
  309. Invalid,
  310. // Token: 0x0400324B RID: 12875
  311. Main,
  312. // Token: 0x0400324C RID: 12876
  313. Sub,
  314. // Token: 0x0400324D RID: 12877
  315. Event
  316. }
  317. }
  318. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement