SceneCasinoSlot.cs 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. using System;
  2. using UnityEngine;
  3. using UnityEngine.UI;
  4. public class SceneCasinoSlot : MonoBehaviour
  5. {
  6. public static SceneCasinoSlot Instance { get; private set; }
  7. private void Awake()
  8. {
  9. SceneCasinoSlot.Instance = this;
  10. this.m_ButtonSe = this.startButton.GetComponent<uGUIButtonSE>();
  11. if (GameMain.Instance.ScriptMgr.adv_kag.tag_backup.ContainsKey("cancel_label"))
  12. {
  13. this.m_CancelLabel = GameMain.Instance.ScriptMgr.adv_kag.tag_backup["cancel_label"];
  14. }
  15. }
  16. private void Start()
  17. {
  18. GameMain.Instance.MainCamera.FadeOut(0f, false, null, true, default(Color));
  19. GameMain.Instance.SoundMgr.PlayBGM(this.m_BGMName, 0f, true);
  20. GameMain.Instance.MainLight.Reset();
  21. GameMain.Instance.MainCamera.Reset(CameraMain.CameraType.Target, true);
  22. GameMain.Instance.BgMgr.ChangeBg("CasinoMini");
  23. GameMain.Instance.MainCamera.SetTargetPos(this.m_vCamResetTargetPos, true);
  24. GameMain.Instance.MainCamera.SetDistance(this.m_fCamResetDistance, true);
  25. GameMain.Instance.MainCamera.SetAroundAngle(this.m_vCamResetAngle, true);
  26. GameMain.Instance.CharacterMgr.DeactivateCharaAll();
  27. GameMain.Instance.MainCamera.FadeIn(1f, false, new CameraMain.dgOnCompleteFade(this.OnCompleteFadeIn), true, true, default(Color));
  28. GameMain.Instance.MainCamera.FadeInNoUI(0f, true);
  29. this.m_eMode = SceneCasinoSlot.Mode.FadeIn;
  30. if (GameMain.Instance.VRMode)
  31. {
  32. }
  33. if (!CasinoDataMgr.Instance.DealerMaid)
  34. {
  35. GameMain.Instance.CharacterMgr.status.casinoCoin = 499999L;
  36. }
  37. uGUITutorialPanel.OpenTutorial("SceneCasinoSlot", null, false);
  38. GameMain.Instance.SysShortcut.strSceneHelpName = "SceneCasinoSlot";
  39. }
  40. private void Update()
  41. {
  42. if (SlotUImgr.Instance.uiActive && Input.GetKeyDown(this.m_ShortCutStart))
  43. {
  44. if (this.sManager.state == 1)
  45. {
  46. this.m_ButtonSe.ClickSEPlay();
  47. this.onClick(0);
  48. }
  49. else if (this.sManager.StopButtons[0].interactable)
  50. {
  51. this.onClick(1);
  52. }
  53. else if (this.sManager.StopButtons[1].interactable)
  54. {
  55. this.onClick(2);
  56. }
  57. else if (this.sManager.StopButtons[2].interactable)
  58. {
  59. this.onClick(3);
  60. }
  61. }
  62. }
  63. public void onClick(int buttonNo)
  64. {
  65. if (this.sManager == null)
  66. {
  67. if (!(GameObject.Find("SlotManager") != null))
  68. {
  69. return;
  70. }
  71. this.sManager = GameObject.Find("SlotManager").GetComponent<SlotManager>();
  72. }
  73. if (buttonNo == 0)
  74. {
  75. if (GameMain.Instance.CharacterMgr.status.casinoCoin < 300L)
  76. {
  77. string messageTerm = "SceneCasino/ダイアログ/スロットをするには最低でもコインが必用です";
  78. GameMain.Instance.SysDlg.ShowFromLanguageTerm(messageTerm, new string[]
  79. {
  80. string.Format("{0:#,##0}", 300)
  81. }, SystemDialog.TYPE.OK, null, null);
  82. return;
  83. }
  84. if (this.sManager.state == 1)
  85. {
  86. this.sManager.state = 2;
  87. this.startButton.GetComponent<Image>().sprite = this.sprite[1];
  88. SlotUImgr.Instance.UpdateUI();
  89. }
  90. }
  91. else if (buttonNo == 1)
  92. {
  93. if (!this.sManager.buttonFlg[0] && !this.sManager.isBlock)
  94. {
  95. GameMain.Instance.SoundMgr.PlaySe("casino_SE007.ogg", false);
  96. this.reels[0].GetComponent<Reel>().ChangeState(3);
  97. base.StartCoroutine(this.sManager.LightLamp(this.buttons[0].transform.GetChild(0).gameObject, false, this.sManager.lightingTime));
  98. this.sManager.buttonFlg[0] = true;
  99. this.sManager.isBlock = true;
  100. this.sManager.StopButtons[0].interactable = false;
  101. }
  102. }
  103. else if (buttonNo == 2)
  104. {
  105. if (!this.sManager.buttonFlg[1] && !this.sManager.isBlock)
  106. {
  107. GameMain.Instance.SoundMgr.PlaySe("casino_SE007.ogg", false);
  108. this.reels[1].GetComponent<Reel>().ChangeState(3);
  109. base.StartCoroutine(this.sManager.LightLamp(this.buttons[1].transform.GetChild(0).gameObject, false, this.sManager.lightingTime));
  110. this.sManager.buttonFlg[1] = true;
  111. this.sManager.isBlock = true;
  112. this.sManager.StopButtons[1].interactable = false;
  113. }
  114. }
  115. else if (buttonNo == 3 && !this.sManager.buttonFlg[2] && !this.sManager.isBlock)
  116. {
  117. GameMain.Instance.SoundMgr.PlaySe("casino_SE007.ogg", false);
  118. this.reels[2].GetComponent<Reel>().ChangeState(3);
  119. base.StartCoroutine(this.sManager.LightLamp(this.buttons[2].transform.GetChild(0).gameObject, false, this.sManager.lightingTime));
  120. this.sManager.buttonFlg[2] = true;
  121. this.sManager.isBlock = true;
  122. this.sManager.StopButtons[2].interactable = false;
  123. }
  124. int num = 0;
  125. for (int i = 0; i < 3; i++)
  126. {
  127. if (this.sManager.buttonFlg[i])
  128. {
  129. num++;
  130. }
  131. }
  132. if (num == 1)
  133. {
  134. this.sManager.state = 7;
  135. }
  136. else if (num == 3)
  137. {
  138. }
  139. }
  140. private void OnCompleteFadeIn()
  141. {
  142. this.m_eMode = SceneCasinoSlot.Mode.ClickWait;
  143. }
  144. private void OnCompleteFadeOut()
  145. {
  146. }
  147. private bool GetAnyMouseAndKey()
  148. {
  149. return NInput.GetMouseButtonUp(0) || NInput.GetMouseButtonUp(1) || NInput.GetMouseButtonUp(2) || Input.GetKeyUp(KeyCode.Return) || GameMain.Instance.IsForceSkip();
  150. }
  151. public void SlotEnd()
  152. {
  153. GameMain.Instance.SysDlg.Close();
  154. GameMain.Instance.MainCamera.FadeOut(0.5f, false, delegate
  155. {
  156. if (!string.IsNullOrEmpty(this.m_CancelLabel))
  157. {
  158. GameMain.Instance.ScriptMgr.adv_kag.JumpLabel(this.m_CancelLabel);
  159. GameMain.Instance.ScriptMgr.adv_kag.Exec();
  160. }
  161. }, true, default(Color));
  162. }
  163. private SceneCasinoSlot.Mode m_eMode;
  164. public GameObject slotMachine;
  165. public GameObject lever;
  166. public GameObject ballLamp;
  167. public GameObject topLamp;
  168. public GameObject winMark;
  169. public GameObject heartLamp;
  170. public GameObject startButton;
  171. public GameObject fadeMask;
  172. public GameObject[] reels = new GameObject[3];
  173. public GameObject[] reelLights = new GameObject[3];
  174. public GameObject[] buttons = new GameObject[3];
  175. public GameObject[] slotLight = new GameObject[3];
  176. public GameObject[] hitLight = new GameObject[5];
  177. public GameObject[] payoutNumber = new GameObject[6];
  178. public GameObject[] creditNumber = new GameObject[6];
  179. public GameObject[] customMaidLamp = new GameObject[10];
  180. public GameObject[] sevenLamp = new GameObject[3];
  181. public GameObject[] bigbonus = new GameObject[8];
  182. public Texture[] tex = new Texture[4];
  183. public Sprite[] sprite = new Sprite[2];
  184. public SlotManager sManager;
  185. [SerializeField]
  186. [Header("カメラ設定")]
  187. private Vector3 m_vCamResetTargetPos;
  188. [SerializeField]
  189. private float m_fCamResetDistance;
  190. [SerializeField]
  191. private Vector2 m_vCamResetAngle;
  192. [SerializeField]
  193. private string m_BGMName = "BGM009.ogg";
  194. private string m_CancelLabel;
  195. [SerializeField]
  196. [Header("ショートカットキー")]
  197. private KeyCode m_ShortCutStart = KeyCode.Space;
  198. private uGUIButtonSE m_ButtonSe;
  199. private enum Mode
  200. {
  201. FadeIn,
  202. ClickWait,
  203. FadeOut
  204. }
  205. }