TitleCtrl.cs 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using com.workman.cm3d2.scene.dailyEtc;
  5. using I2.Loc;
  6. using UnityEngine;
  7. using wf;
  8. public class TitleCtrl : MonoBehaviour
  9. {
  10. public void Init(TitleMgr titleMgr, SceneMgr sceneMgr, GameObject goTitlePanel)
  11. {
  12. this.m_titleMgr = titleMgr;
  13. this.m_sceneMgr = sceneMgr;
  14. this.m_goTitlePanel = goTitlePanel;
  15. if (Product.isPublic)
  16. {
  17. Localize component = UTY.GetChildObject(goTitlePanel, "Title/TitleLogo", false).GetComponent<Localize>();
  18. Utility.SetLocalizeTerm(component, "SceneTitle/タイトルロゴ_全年齢", true);
  19. if (Product.lockDLCSiteLink)
  20. {
  21. UIButton component2 = UTY.GetChildObject(goTitlePanel, "ButtonGroup/ShopGroup/Shop", false).GetComponent<UIButton>();
  22. component2.normalSprite = "title_menu_officialsite";
  23. }
  24. }
  25. this.m_listButton = new List<GameObject>();
  26. this.m_dicTitleButton = new Dictionary<TitleMgr.ButtonType, TitleCtrl.TitleButton>();
  27. int num = 0;
  28. IEnumerator enumerator = Enum.GetValues(typeof(TitleMgr.ButtonType)).GetEnumerator();
  29. try
  30. {
  31. while (enumerator.MoveNext())
  32. {
  33. object obj = enumerator.Current;
  34. TitleMgr.ButtonType buttonType = (TitleMgr.ButtonType)obj;
  35. TitleCtrl.TitleButton titleButton = new TitleCtrl.TitleButton();
  36. string text = buttonType.ToString();
  37. GameObject childObject = UTY.GetChildObject(goTitlePanel, "ButtonGroup/" + text + "Group/" + text, false);
  38. if (buttonType == TitleMgr.ButtonType.Shop)
  39. {
  40. if (!GameMain.Instance.CMSystem.NetUse)
  41. {
  42. childObject.SetActive(false);
  43. continue;
  44. }
  45. childObject.SetActive(true);
  46. }
  47. if (Product.isPublic && buttonType == TitleMgr.ButtonType.Guest)
  48. {
  49. num += -61;
  50. childObject.SetActive(false);
  51. }
  52. else
  53. {
  54. Vector3 localPosition = childObject.transform.localPosition;
  55. childObject.transform.localPosition = new Vector3(localPosition.x, localPosition.y - (float)num, localPosition.z);
  56. childObject.AddComponent<TitleMouseOver>();
  57. UIButton component3 = childObject.GetComponent<UIButton>();
  58. EventDelegate.Add(component3.onClick, new EventDelegate.Callback(BaseMgr<TitleMgr>.Instance.ClickButton));
  59. GameObject childObject2 = UTY.GetChildObject(childObject, "SelectCursor", false);
  60. titleButton.selectCursor = childObject2;
  61. titleButton.name = buttonType;
  62. titleButton.active = false;
  63. this.m_dicTitleButton.Add(titleButton.name, titleButton);
  64. this.m_listButton.Add(UTY.GetChildObject(goTitlePanel, "ButtonGroup/" + text + "Group", false));
  65. }
  66. }
  67. }
  68. finally
  69. {
  70. IDisposable disposable;
  71. if ((disposable = (enumerator as IDisposable)) != null)
  72. {
  73. disposable.Dispose();
  74. }
  75. }
  76. this.SetActiveButton(TitleMgr.ButtonType.Start);
  77. this.PrepareAnimation(goTitlePanel);
  78. if (PluginData.IsEnabled("GP003") && string.IsNullOrEmpty(GameMain.Instance.CMSystem.GetSystemVers("CR_EDIT_SYSTEM_START_HELP")))
  79. {
  80. GameMain.Instance.SysDlg.Show("CR Edit Sytemへの連携を確認しました\nCR Edit Sytemで作成した新ボディでは、COM3D2の一部コンテンツが制限されます。\n詳細はオンラインマニュアルにて確認出来ます。\nこのマニュアルは右上のシステムメニューからいつでもアクセスすることが出来ます。\nオンラインマニュアルを開きますか?\n※ネット環境が必要です\n", SystemDialog.TYPE.OK_CANCEL, delegate
  81. {
  82. GameMain.Instance.CMSystem.SetSystemVers("CR_EDIT_SYSTEM_START_HELP", "1");
  83. GameMain.Instance.SysDlg.Close();
  84. Application.OpenURL("http://cr-edit.jp/com3d2/manual");
  85. }, delegate
  86. {
  87. GameMain.Instance.CMSystem.SetSystemVers("CR_EDIT_SYSTEM_START_HELP", "1");
  88. GameMain.Instance.SysDlg.Close();
  89. });
  90. }
  91. }
  92. public void SetActiveButton(TitleMgr.ButtonType activeButton)
  93. {
  94. IEnumerator enumerator = Enum.GetValues(typeof(TitleMgr.ButtonType)).GetEnumerator();
  95. try
  96. {
  97. while (enumerator.MoveNext())
  98. {
  99. object obj = enumerator.Current;
  100. TitleMgr.ButtonType buttonType = (TitleMgr.ButtonType)obj;
  101. if (buttonType != TitleMgr.ButtonType.Shop || GameMain.Instance.CMSystem.NetUse)
  102. {
  103. if (!Product.isPublic || buttonType != TitleMgr.ButtonType.Guest)
  104. {
  105. if (activeButton == buttonType)
  106. {
  107. this.m_dicTitleButton[buttonType].active = true;
  108. this.m_dicTitleButton[buttonType].selectCursor.SetActive(true);
  109. BaseMgr<TitleMgr>.Instance.m_currentActiveButton = activeButton;
  110. }
  111. else
  112. {
  113. this.m_dicTitleButton[buttonType].active = false;
  114. this.m_dicTitleButton[buttonType].selectCursor.SetActive(false);
  115. }
  116. }
  117. }
  118. }
  119. }
  120. finally
  121. {
  122. IDisposable disposable;
  123. if ((disposable = (enumerator as IDisposable)) != null)
  124. {
  125. disposable.Dispose();
  126. }
  127. }
  128. }
  129. private void PrepareAnimation(GameObject goTitlePanel)
  130. {
  131. foreach (GameObject gameObject in this.m_listButton)
  132. {
  133. gameObject.transform.localPosition = new Vector2(-600f, 0f);
  134. }
  135. }
  136. public void StartComponentAnimation()
  137. {
  138. this.TitleButtonAnimation();
  139. }
  140. private IEnumerator StartAnimator(Animator animator, float wait)
  141. {
  142. yield return new WaitForSeconds(wait);
  143. animator.SetBool("Active", true);
  144. yield break;
  145. }
  146. private void TitleLogoAnimation()
  147. {
  148. TweenAlpha tweenAlpha = this.m_goTitleLogo.AddComponent<TweenAlpha>();
  149. tweenAlpha.from = 0f;
  150. tweenAlpha.to = 1f;
  151. tweenAlpha.delay = 4f;
  152. tweenAlpha.duration = 1.5f;
  153. TweenScale tweenScale = this.m_goTitleLogo.AddComponent<TweenScale>();
  154. tweenScale.from = new Vector2(0f, 0f);
  155. tweenScale.to = new Vector2(1f, 1f);
  156. tweenScale.delay = 4f;
  157. tweenScale.duration = 1.5f;
  158. EventDelegate.Set(tweenScale.onFinished, new EventDelegate.Callback(this.TitleButtonAnimation));
  159. tweenAlpha.PlayForward();
  160. tweenScale.PlayForward();
  161. }
  162. private void TitleButtonAnimation()
  163. {
  164. base.StartCoroutine(this.TweenAniamtion());
  165. }
  166. private IEnumerator TweenAniamtion()
  167. {
  168. foreach (GameObject go in this.m_listButton)
  169. {
  170. iTween.MoveTo(go, iTween.Hash(new object[]
  171. {
  172. "x",
  173. 0,
  174. "y",
  175. 0,
  176. "time",
  177. 0.7f,
  178. "islocal",
  179. true
  180. }));
  181. yield return new WaitForSeconds(0.3f);
  182. }
  183. yield break;
  184. }
  185. public void OnStart()
  186. {
  187. GameMain.Instance.MainCamera.FadeOut(3f, false, delegate
  188. {
  189. this.m_sceneMgr.CloseScene();
  190. }, true, default(Color));
  191. TweenAlpha.Begin(this.m_goTitlePanel, 3f, 0f);
  192. }
  193. public void OnContinue(SaveAndLoadMgr saveAndLoadMgr)
  194. {
  195. saveAndLoadMgr.CallbackAfterFadeOut = new Action(this.m_titleMgr.OpenTitlePanel);
  196. this.m_titleMgr.CloseTitlePanel(new Action(saveAndLoadMgr.OpenLoadPanel));
  197. }
  198. public void OnConfig()
  199. {
  200. BaseMgr<ConfigMgr>.Instance.OpenConfigPanel();
  201. }
  202. public void OnEnd()
  203. {
  204. GameMain.Instance.ToApplicationQuit(false);
  205. }
  206. public void OnShop()
  207. {
  208. if (Product.lockDLCSiteLink)
  209. {
  210. Application.OpenURL("http://com3d2.world/?shop");
  211. }
  212. else
  213. {
  214. Application.OpenURL(GameMain.Instance.CMSystem.ShopURL);
  215. }
  216. }
  217. public void OnGuestMode(SaveAndLoadMgr saveAndLoadMgr)
  218. {
  219. saveAndLoadMgr.CallbackAfterFadeOut = new Action(this.m_titleMgr.OpenTitlePanel);
  220. this.m_titleMgr.CloseTitlePanel(new Action(saveAndLoadMgr.OpenLoadPanelKasiduki));
  221. }
  222. public void OnBenchMark()
  223. {
  224. GameMain.Instance.MainCamera.FadeOut(3f, false, delegate
  225. {
  226. this.m_sceneMgr.GoToLabel("label_benchmarksetting");
  227. }, true, default(Color));
  228. TweenAlpha.Begin(this.m_goTitlePanel, 3f, 0f);
  229. }
  230. public void OnDance()
  231. {
  232. GameMain.Instance.MainCamera.FadeOut(3f, false, delegate
  233. {
  234. this.m_sceneMgr.GoToLabel("label_vsdance");
  235. }, true, default(Color));
  236. TweenAlpha.Begin(this.m_goTitlePanel, 3f, 0f);
  237. }
  238. public void OnCredit()
  239. {
  240. GameMain.Instance.MainCamera.FadeOut(3f, false, delegate
  241. {
  242. this.m_sceneMgr.GoToLabel("label_staffroll");
  243. }, true, default(Color));
  244. TweenAlpha.Begin(this.m_goTitlePanel, 3f, 0f);
  245. }
  246. private TitleMgr m_titleMgr;
  247. private SceneMgr m_sceneMgr;
  248. private GameObject m_goTitleLogo;
  249. private GameObject m_goTitleForScale;
  250. private GameObject m_goTitlePanel;
  251. private Dictionary<TitleMgr.ButtonType, TitleCtrl.TitleButton> m_dicTitleButton;
  252. private TitleMgr.ButtonType m_currentActiveButton;
  253. private List<GameObject> m_listButton;
  254. private const string SCENE_NAME_FROM_START = "SceneUserEdit";
  255. private const string SCENE_NAME_FROM_CONTINUE = "SceneGeneral";
  256. private const string SCENE_NAME_FROM_CONFIG = "SceneConfig";
  257. private const float INIT_TITLE_LOGO_SCALE = 0f;
  258. private const float INIT_BUTTON_POS = -600f;
  259. private const float TITLELOGO_FADEIN_DELAY = 4f;
  260. private const float TITLELOGO_FADEIN_DURATION = 1.5f;
  261. private const float BUTTON_FADEIN_DURATION = 0.7f;
  262. private const float BUTTON_FADEIN_INTERVAL = 0.3f;
  263. private const float DURATION_TO_FADE = 3f;
  264. [SerializeField]
  265. private Animator m_animatorBenchMark;
  266. [SerializeField]
  267. private Animator m_animatorDance;
  268. private class TitleButton
  269. {
  270. public TitleMgr.ButtonType name;
  271. public GameObject selectCursor;
  272. public bool active;
  273. }
  274. }