SceneCasinoSlot.cs 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  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 f_strMsg = string.Format("スロットをするには最低でも\nコインが{0:#,##0}枚必用です", 300);
  78. GameMain.Instance.SysDlg.Show(f_strMsg, SystemDialog.TYPE.OK, null, null);
  79. return;
  80. }
  81. if (this.sManager.state == 1)
  82. {
  83. this.sManager.state = 2;
  84. this.startButton.GetComponent<Image>().sprite = this.sprite[1];
  85. SlotUImgr.Instance.UpdateUI();
  86. }
  87. }
  88. else if (buttonNo == 1)
  89. {
  90. if (!this.sManager.buttonFlg[0] && !this.sManager.isBlock)
  91. {
  92. GameMain.Instance.SoundMgr.PlaySe("casino_SE007.ogg", false);
  93. this.reels[0].GetComponent<Reel>().ChangeState(3);
  94. base.StartCoroutine(this.sManager.LightLamp(this.buttons[0].transform.GetChild(0).gameObject, false, this.sManager.lightingTime));
  95. this.sManager.buttonFlg[0] = true;
  96. this.sManager.isBlock = true;
  97. this.sManager.StopButtons[0].interactable = false;
  98. }
  99. }
  100. else if (buttonNo == 2)
  101. {
  102. if (!this.sManager.buttonFlg[1] && !this.sManager.isBlock)
  103. {
  104. GameMain.Instance.SoundMgr.PlaySe("casino_SE007.ogg", false);
  105. this.reels[1].GetComponent<Reel>().ChangeState(3);
  106. base.StartCoroutine(this.sManager.LightLamp(this.buttons[1].transform.GetChild(0).gameObject, false, this.sManager.lightingTime));
  107. this.sManager.buttonFlg[1] = true;
  108. this.sManager.isBlock = true;
  109. this.sManager.StopButtons[1].interactable = false;
  110. }
  111. }
  112. else if (buttonNo == 3 && !this.sManager.buttonFlg[2] && !this.sManager.isBlock)
  113. {
  114. GameMain.Instance.SoundMgr.PlaySe("casino_SE007.ogg", false);
  115. this.reels[2].GetComponent<Reel>().ChangeState(3);
  116. base.StartCoroutine(this.sManager.LightLamp(this.buttons[2].transform.GetChild(0).gameObject, false, this.sManager.lightingTime));
  117. this.sManager.buttonFlg[2] = true;
  118. this.sManager.isBlock = true;
  119. this.sManager.StopButtons[2].interactable = false;
  120. }
  121. int num = 0;
  122. for (int i = 0; i < 3; i++)
  123. {
  124. if (this.sManager.buttonFlg[i])
  125. {
  126. num++;
  127. }
  128. }
  129. if (num == 1)
  130. {
  131. this.sManager.state = 7;
  132. }
  133. else if (num == 3)
  134. {
  135. }
  136. }
  137. private void OnCompleteFadeIn()
  138. {
  139. this.m_eMode = SceneCasinoSlot.Mode.ClickWait;
  140. }
  141. private void OnCompleteFadeOut()
  142. {
  143. }
  144. private bool GetAnyMouseAndKey()
  145. {
  146. return NInput.GetMouseButtonUp(0) || NInput.GetMouseButtonUp(1) || NInput.GetMouseButtonUp(2) || Input.GetKeyUp(KeyCode.Return) || GameMain.Instance.IsForceSkip();
  147. }
  148. public void SlotEnd()
  149. {
  150. GameMain.Instance.SysDlg.Close();
  151. GameMain.Instance.MainCamera.FadeOut(0.5f, false, delegate
  152. {
  153. if (!string.IsNullOrEmpty(this.m_CancelLabel))
  154. {
  155. GameMain.Instance.ScriptMgr.adv_kag.JumpLabel(this.m_CancelLabel);
  156. GameMain.Instance.ScriptMgr.adv_kag.Exec();
  157. }
  158. }, true, default(Color));
  159. }
  160. private SceneCasinoSlot.Mode m_eMode;
  161. public GameObject slotMachine;
  162. public GameObject lever;
  163. public GameObject ballLamp;
  164. public GameObject topLamp;
  165. public GameObject winMark;
  166. public GameObject heartLamp;
  167. public GameObject startButton;
  168. public GameObject fadeMask;
  169. public GameObject[] reels = new GameObject[3];
  170. public GameObject[] reelLights = new GameObject[3];
  171. public GameObject[] buttons = new GameObject[3];
  172. public GameObject[] slotLight = new GameObject[3];
  173. public GameObject[] hitLight = new GameObject[5];
  174. public GameObject[] payoutNumber = new GameObject[6];
  175. public GameObject[] creditNumber = new GameObject[6];
  176. public GameObject[] customMaidLamp = new GameObject[10];
  177. public GameObject[] sevenLamp = new GameObject[3];
  178. public GameObject[] bigbonus = new GameObject[8];
  179. public Texture[] tex = new Texture[4];
  180. public Sprite[] sprite = new Sprite[2];
  181. public SlotManager sManager;
  182. [SerializeField]
  183. [Header("カメラ設定")]
  184. private Vector3 m_vCamResetTargetPos;
  185. [SerializeField]
  186. private float m_fCamResetDistance;
  187. [SerializeField]
  188. private Vector2 m_vCamResetAngle;
  189. [SerializeField]
  190. private string m_BGMName = "BGM009.ogg";
  191. private string m_CancelLabel;
  192. [SerializeField]
  193. [Header("ショートカットキー")]
  194. private KeyCode m_ShortCutStart = KeyCode.Space;
  195. private uGUIButtonSE m_ButtonSe;
  196. private enum Mode
  197. {
  198. FadeIn,
  199. ClickWait,
  200. FadeOut
  201. }
  202. }