StartDailyAPI.cs 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. using System;
  2. using System.Collections;
  3. using UnityEngine;
  4. public class StartDailyAPI
  5. {
  6. public void SceneStart(MonoBehaviour f_parent, StartDailyAPI.dgOnSceneStartCallBack f_dgLoadedFinish)
  7. {
  8. this.m_dgStart = f_dgLoadedFinish;
  9. GameMain.Instance.MainCamera.FadeOut(0f, false, null, true, default(Color));
  10. GameMain.Instance.ScriptMgr.adv_kag.MessageWindowMgr.CloseMessageWindowPanel();
  11. GameMain.Instance.MainLight.Reset();
  12. GameMain.Instance.MainCamera.Reset(CameraMain.CameraType.Target, true);
  13. GameMain.Instance.MainCamera.Vignett(true);
  14. GameMain.Instance.MainCamera.SetTargetOffset(Vector3.zero, false);
  15. Action<string> action = delegate(string bgName)
  16. {
  17. CameraMain mainCamera = GameMain.Instance.MainCamera;
  18. if (bgName == "EmpireClub_Rotary")
  19. {
  20. mainCamera.SetTargetPos(new Vector3(-17.42608f, 1.62898f, 18.58508f), true);
  21. mainCamera.SetDistance(0.7999998f, true);
  22. mainCamera.SetAroundAngle(new Vector2(-227.0059f, -10.18634f), true);
  23. }
  24. else if (bgName == "EmpireClub_Entrance")
  25. {
  26. mainCamera.SetTargetPos(new Vector3(4.084215f, 5.501422f, 11.13918f), true);
  27. mainCamera.SetDistance(1.1f, true);
  28. mainCamera.SetAroundAngle(new Vector2(-165.0296f, 11.24223f), true);
  29. }
  30. else if (bgName == "MyRoom")
  31. {
  32. mainCamera.SetTargetPos(new Vector3(5.273936f, 2.515735f, 3.353783f), true);
  33. mainCamera.SetDistance(0.1f, true);
  34. mainCamera.SetAroundAngle(new Vector2(-110.838f, 16.8323f), true);
  35. }
  36. else if (bgName == "HeroineRoom_B1")
  37. {
  38. mainCamera.SetTargetPos(new Vector3(2.837114f, 2.19285f, 3.352386f), true);
  39. mainCamera.SetDistance(0.1f, true);
  40. mainCamera.SetAroundAngle(new Vector2(-128.5022f, 12.48449f), true);
  41. }
  42. else if (bgName == "HeroineRoom_A1")
  43. {
  44. mainCamera.SetTargetPos(new Vector3(2.837114f, 2.19285f, 3.352386f), true);
  45. mainCamera.SetDistance(0.1f, true);
  46. mainCamera.SetAroundAngle(new Vector2(-128.5022f, 12.48449f), true);
  47. }
  48. else if (bgName == "HeroineRoom_C1")
  49. {
  50. mainCamera.SetTargetPos(new Vector3(2.837114f, 2.19285f, 3.352386f), true);
  51. mainCamera.SetDistance(0.1f, true);
  52. mainCamera.SetAroundAngle(new Vector2(-128.5022f, 12.48449f), true);
  53. }
  54. else if (bgName == "ShinShitsumu")
  55. {
  56. mainCamera.SetTargetPos(new Vector3(-2.828141f, 2.77968f, 4.463314f), true);
  57. mainCamera.SetDistance(0.1f, true);
  58. mainCamera.SetAroundAngle(new Vector2(-210.2392f, 18.07455f), true);
  59. }
  60. else if (bgName == "Theater")
  61. {
  62. mainCamera.SetTargetPos(new Vector3(-10.00124f, 0.8031937f, 3.407116f), true);
  63. mainCamera.SetDistance(0.1f, true);
  64. mainCamera.SetAroundAngle(new Vector2(-311.137f, 2.236061f), true);
  65. }
  66. else if (bgName == "DanceRoom")
  67. {
  68. mainCamera.SetTargetPos(new Vector3(0.7564614f, 1.38443f, -1.607882f), true);
  69. mainCamera.SetDistance(2f, true);
  70. mainCamera.SetAroundAngle(new Vector2(-138.9819f, 14.03727f), true);
  71. }
  72. else
  73. {
  74. mainCamera.SetTargetPos(new Vector3(0.7564614f, 1.38443f, -1.607882f), true);
  75. mainCamera.SetDistance(2f, true);
  76. mainCamera.SetAroundAngle(new Vector2(-138.9819f, 14.03727f), true);
  77. bgName = "DanceRoom";
  78. }
  79. GameMain.Instance.BgMgr.ChangeBg(bgName);
  80. };
  81. string[] array = new string[]
  82. {
  83. "EmpireClub_Rotary",
  84. "EmpireClub_Entrance",
  85. "MyRoom",
  86. "HeroineRoom_B1",
  87. "HeroineRoom_A1",
  88. "HeroineRoom_C1",
  89. "ShinShitsumu",
  90. "Theater",
  91. "DanceRoom"
  92. };
  93. string obj = array[UnityEngine.Random.Range(0, array.Length)];
  94. action(obj);
  95. GameMain.Instance.CharacterMgr.DeactivateCharaAll();
  96. f_parent.StartCoroutine(this.CoCharaLoad());
  97. }
  98. private IEnumerator CoCharaLoad()
  99. {
  100. while (GameMain.Instance.CharacterMgr.IsBusy())
  101. {
  102. yield return null;
  103. }
  104. GameMain.Instance.CharacterMgr.ResetCharaPosAll();
  105. GameMain.Instance.MainCamera.FadeIn(1f, false, null, true, true, default(Color));
  106. if (this.m_dgStart != null)
  107. {
  108. this.m_dgStart();
  109. }
  110. yield break;
  111. }
  112. public void EndNextScene(StartDailyAPI.dgOnSceneFinalCallBack f_dgEnd)
  113. {
  114. this.m_dgFinal = f_dgEnd;
  115. GameMain.Instance.SoundMgr.StopBGM(1f);
  116. GameMain.Instance.MainCamera.FadeOut(1f, false, new CameraMain.dgOnCompleteFade(this.OnFinishFadeOut), true, default(Color));
  117. }
  118. private void OnFinishFadeOut()
  119. {
  120. GameMain.Instance.MainCamera.Reset(CameraMain.CameraType.Target, true);
  121. if (this.m_dgFinal != null)
  122. {
  123. this.m_dgFinal();
  124. }
  125. }
  126. public void SceneFinish()
  127. {
  128. if (GameMain.Instance.MainCamera != null)
  129. {
  130. GameMain.Instance.MainCamera.SetTargetOffset(Vector3.zero, false);
  131. }
  132. if (GameMain.Instance.CharacterMgr != null)
  133. {
  134. GameMain.Instance.CharacterMgr.DeactivateCharaAll();
  135. }
  136. }
  137. private StartDailyAPI.dgOnSceneStartCallBack m_dgStart;
  138. private StartDailyAPI.dgOnSceneFinalCallBack m_dgFinal;
  139. public delegate void dgOnSceneStartCallBack();
  140. public delegate void dgOnSceneFinalCallBack();
  141. }