SlotManager.cs 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. using UnityEngine.UI;
  6. using wf;
  7. public class SlotManager : MonoBehaviour
  8. {
  9. public long credit
  10. {
  11. get
  12. {
  13. return this.m_Mycredit;
  14. }
  15. set
  16. {
  17. this.m_Mycredit = wf.Math.RoundMinMax(value, 0L, 999999L);
  18. }
  19. }
  20. private void Start()
  21. {
  22. SceneCasinoSlot component = GameObject.Find("_SceneCasinoSlot_").GetComponent<SceneCasinoSlot>();
  23. this.slotMachine = component.slotMachine;
  24. this.lever = component.lever;
  25. this.ballLamp = component.ballLamp;
  26. this.topLamp = component.topLamp;
  27. this.winMark = component.winMark;
  28. this.heartLamp = component.heartLamp;
  29. this.startButton = component.startButton;
  30. this.fadeMask = component.fadeMask;
  31. this.reels = component.reels;
  32. this.reelLights = component.reelLights;
  33. this.buttons = component.buttons;
  34. this.slotLight = component.slotLight;
  35. this.hitLight = component.hitLight;
  36. this.payoutNumber = component.payoutNumber;
  37. this.creditNumber = component.creditNumber;
  38. this.customMaidLamp = component.customMaidLamp;
  39. this.sevenLamp = component.sevenLamp;
  40. this.bigbonus = component.bigbonus;
  41. this.tex = component.tex;
  42. this.sprite = component.sprite;
  43. this.dispState = "初期状態";
  44. this.dispSymbol = "確定絵柄なし";
  45. for (int i = 0; i < 3; i++)
  46. {
  47. this.buttonFlg[i] = true;
  48. this.StopButtons[i].interactable = false;
  49. base.StartCoroutine(this.LightLamp(this.buttons[i].transform.GetChild(0).gameObject, false, this.lightingTime));
  50. this.stopIdArray[i] = -1;
  51. this.idReach[i] = 0;
  52. }
  53. this.GetCsv();
  54. ExChangeUI instance = ExChangeUI.Instance;
  55. instance.FadeOutStartAction = (Action)Delegate.Combine(instance.FadeOutStartAction, new Action(delegate
  56. {
  57. this.credit = GameMain.Instance.CharacterMgr.status.casinoCoin;
  58. this.CreditUpdate();
  59. }));
  60. this.Init();
  61. }
  62. private void Init()
  63. {
  64. this.isChanceMode = false;
  65. this.reachFlg = false;
  66. this.cherryWin = 0;
  67. this.normalCount = 0;
  68. this.chanceModeCount = 0;
  69. this.chanceCorrect = 0;
  70. this.credit = GameMain.Instance.CharacterMgr.status.casinoCoin;
  71. this.CreditUpdate();
  72. this.stopCount = 0;
  73. this.PayoutUpdate(0);
  74. this.state = 0;
  75. this.fixedWinSymbol = -1;
  76. this.fixedLine = -1;
  77. this.fixedBar = false;
  78. this.isBlock = true;
  79. this.reachSymbolList = new List<int>();
  80. this.idList = new List<int>();
  81. this.reelNoList = new List<int>();
  82. this.reachLine = new List<int>();
  83. this.fadeMask.SetActive(false);
  84. Material[] materials = this.slotMachine.GetComponent<Renderer>().materials;
  85. foreach (Material material in materials)
  86. {
  87. Debug.Log("mat = " + material.name);
  88. if (material.name == "Slot_Panel (Instance)")
  89. {
  90. Debug.Log("mat.texture = " + material.mainTexture);
  91. material.mainTexture = this.tex[3];
  92. }
  93. }
  94. }
  95. private void GetCsv()
  96. {
  97. CsvImporter component = GameObject.Find("SlotManager").GetComponent<CsvImporter>();
  98. this.msCount = component.GetCsvDataMs("casino_slot_byou.nei");
  99. component.GetCsvData("casino_slot_haitou.nei");
  100. this.normalMaxProb = component.GetCsvDataParse(0);
  101. this.chanceMaxProb = component.GetCsvDataParse(1);
  102. this.payDividend = component.GetCsvDataParseList(0);
  103. this.normalDividend = component.GetCsvDataParseList(1);
  104. this.chanceDividend = component.GetCsvDataParseList(2);
  105. }
  106. private void Update()
  107. {
  108. this.StateCheck();
  109. this._UpdateDispDescription();
  110. }
  111. public void _UpdateDispDescription()
  112. {
  113. int num = this.fixedWinSymbol;
  114. switch (num + 1)
  115. {
  116. case 0:
  117. this.dispSymbol = "確定絵柄なし";
  118. break;
  119. case 1:
  120. this.dispSymbol = "スリーセブン";
  121. break;
  122. case 2:
  123. this.dispSymbol = "BAR";
  124. break;
  125. case 3:
  126. this.dispSymbol = "ピエロ";
  127. break;
  128. case 4:
  129. this.dispSymbol = "ベル";
  130. break;
  131. case 5:
  132. this.dispSymbol = "サイ";
  133. break;
  134. case 6:
  135. this.dispSymbol = "マスカット";
  136. break;
  137. case 7:
  138. this.dispSymbol = "チェリー";
  139. break;
  140. }
  141. switch (this.state)
  142. {
  143. case 0:
  144. this.dispState = "初期状態";
  145. break;
  146. case 1:
  147. this.dispState = "開始待機";
  148. break;
  149. case 2:
  150. this.dispState = "ベット開始";
  151. break;
  152. case 3:
  153. this.dispState = "ベット中";
  154. break;
  155. case 4:
  156. this.dispState = "レバーオン開始";
  157. break;
  158. case 5:
  159. this.dispState = "レバーオン中";
  160. break;
  161. case 6:
  162. this.dispState = "プレイ開始";
  163. break;
  164. case 7:
  165. this.dispState = "プレイ中";
  166. break;
  167. case 8:
  168. this.dispState = "1個目停止";
  169. break;
  170. case 9:
  171. if (this.reachFlg)
  172. {
  173. this.dispState = "リーチ";
  174. }
  175. else
  176. {
  177. this.dispState = "2個目停止";
  178. }
  179. break;
  180. case 10:
  181. this.dispState = "全部停止";
  182. break;
  183. case 11:
  184. this.dispState = "停止後の処理";
  185. break;
  186. case 12:
  187. this.dispState = "当選時の処理";
  188. break;
  189. case 13:
  190. this.dispState = "チャンスモード判定";
  191. break;
  192. case 14:
  193. this.dispState = "BIGBONUS当選";
  194. break;
  195. case 15:
  196. this.dispState = "BIGBONUS処理";
  197. break;
  198. }
  199. }
  200. public void StateCheck()
  201. {
  202. if (this.state == 0)
  203. {
  204. this.cherryWin = 0;
  205. this.isBigBonusBgmPlay = false;
  206. this.winLine = new List<int>();
  207. this.fixedWinSymbol = -1;
  208. this.stopCount = 0;
  209. this.chanceCorrect = 0;
  210. this.fixedLine = -1;
  211. this.winSynbol = -1;
  212. this.isBlock = true;
  213. this.startButton.GetComponent<Image>().sprite = this.sprite[0];
  214. if (!this.isChanceMode)
  215. {
  216. for (int i = 0; i < 3; i++)
  217. {
  218. base.StartCoroutine(this.LightLamp(this.slotLight[i], false, this.lightingTime));
  219. }
  220. for (int j = 0; j < 10; j++)
  221. {
  222. base.StartCoroutine(this.LightLamp(this.customMaidLamp[j], false, this.lightingTime));
  223. }
  224. this.normalCount++;
  225. }
  226. else
  227. {
  228. this.chanceModeCount++;
  229. }
  230. for (int k = 0; k < 3; k++)
  231. {
  232. base.StartCoroutine(this.LightLamp(this.sevenLamp[k], false, this.lightingTime));
  233. Vector4 value = new Vector4(0f, 0f, 0f, 0f);
  234. this.reelLights[k].GetComponent<Renderer>().material.SetVector("_Mask1", value);
  235. this.reelLights[k].GetComponent<Renderer>().material.SetVector("_Mask2", value);
  236. this.reelLights[k].GetComponent<Renderer>().material.SetVector("_Mask3", value);
  237. this.idReach[k] = 0;
  238. }
  239. for (int l = 0; l < 5; l++)
  240. {
  241. base.StartCoroutine(this.LightLamp(this.hitLight[l], false, this.lightingTime));
  242. }
  243. for (int m = 0; m < 8; m++)
  244. {
  245. base.StartCoroutine(this.LightLamp(this.bigbonus[m], false, this.lightingTime));
  246. }
  247. base.StartCoroutine(this.LightLamp(this.heartLamp, false, this.lightingTime));
  248. base.StartCoroutine(this.LightLamp(this.ballLamp, false, this.lightingTime));
  249. base.StartCoroutine(this.LightLamp(this.topLamp, false, this.lightingTime));
  250. this.reachFlg = false;
  251. this.reachSymbolList = new List<int>();
  252. this.idList = new List<int>();
  253. this.reelNoList = new List<int>();
  254. this.reachLine = new List<int>();
  255. if (SlotManager.reelArray != null)
  256. {
  257. this.state = 1;
  258. }
  259. }
  260. else if (this.state == 2)
  261. {
  262. base.StartCoroutine(this.AutoBet());
  263. }
  264. else if (this.state == 4)
  265. {
  266. base.StartCoroutine(this.AutoLeverOn());
  267. }
  268. else if (this.state == 7)
  269. {
  270. this.AllReelsStopWait();
  271. }
  272. else if (this.state == 6)
  273. {
  274. this.isBlock = false;
  275. }
  276. else if (this.state == 8)
  277. {
  278. this.AllReelsStopWait();
  279. }
  280. else if (this.state == 9)
  281. {
  282. this.AllReelsStopWait();
  283. }
  284. else if (this.state == 10)
  285. {
  286. this.WinCheck();
  287. }
  288. else if (this.state == 11)
  289. {
  290. this.Win();
  291. }
  292. else if (this.state == 13)
  293. {
  294. this.ChanceModeCheck();
  295. }
  296. else if (this.state == 14)
  297. {
  298. base.StartCoroutine(this.BigBonus());
  299. }
  300. }
  301. public void ChanceModeCheck()
  302. {
  303. if (!this.isChanceMode)
  304. {
  305. if (UnityEngine.Random.Range(0, 100) < 1 + this.chanceCorrect)
  306. {
  307. this.StartChanceMode();
  308. }
  309. }
  310. else if (this.chanceModeCount >= 15)
  311. {
  312. this.EndChanceMode();
  313. }
  314. this.state = 0;
  315. SlotUImgr.Instance.UpdateUI();
  316. }
  317. public void StartChanceMode()
  318. {
  319. GameMain.Instance.SoundMgr.PlaySe("casino_SE011.ogg", false);
  320. this.isChanceMode = true;
  321. this.normalCount = 0;
  322. this.chanceModeCount = 0;
  323. base.StartCoroutine(this.ChenceModeFade(1.5f));
  324. }
  325. public void EndChanceMode()
  326. {
  327. this.isChanceMode = false;
  328. this.normalCount = 0;
  329. this.chanceModeCount = 0;
  330. Material[] materials = this.slotMachine.GetComponent<Renderer>().materials;
  331. foreach (Material material in materials)
  332. {
  333. Debug.Log("mat = " + material.name);
  334. if (material.name == "Slot_Panel (Instance)")
  335. {
  336. Debug.Log("mat.texture = " + material.mainTexture);
  337. material.mainTexture = this.tex[3];
  338. this.nowTexId = 0;
  339. }
  340. }
  341. }
  342. public IEnumerator ChenceModeFade(float time)
  343. {
  344. SlotUImgr.Instance.SetUIActive(false);
  345. float endTime = Time.time + time;
  346. this.fadeMask.SetActive(true);
  347. GameMain.Instance.MainCamera.FadeOut(time, false, null, false, Color.white);
  348. while (GameMain.Instance.MainCamera.IsFadeProc())
  349. {
  350. yield return null;
  351. }
  352. Material[] mats = this.slotMachine.GetComponent<Renderer>().materials;
  353. foreach (Material material in mats)
  354. {
  355. Debug.Log("mat = " + material.name);
  356. if (material.name == "Slot_Panel (Instance)")
  357. {
  358. Debug.Log("mat.texture = " + material.mainTexture);
  359. int num = UnityEngine.Random.Range(0, 3);
  360. material.mainTexture = this.tex[num];
  361. this.nowTexId = num + 1;
  362. }
  363. }
  364. for (int j = 0; j < 10; j++)
  365. {
  366. base.StartCoroutine(this.LightLamp(this.customMaidLamp[j], true, this.lightingTime));
  367. }
  368. GameMain.Instance.MainCamera.FadeIn(time, false, null, false, true, Color.white);
  369. while (GameMain.Instance.MainCamera.IsFadeProc())
  370. {
  371. yield return null;
  372. }
  373. SlotUImgr.Instance.SetUIActive(true);
  374. this.fadeMask.SetActive(false);
  375. yield return null;
  376. yield break;
  377. }
  378. public void AllReelsStopWait()
  379. {
  380. int num = 0;
  381. int num2 = -1;
  382. int num3 = -1;
  383. for (int i = 0; i < 3; i++)
  384. {
  385. if (this.reels[i].GetComponent<Reel>().state == 5)
  386. {
  387. num++;
  388. num3 = i;
  389. }
  390. if (!this.buttonFlg[i])
  391. {
  392. num2 = i;
  393. }
  394. }
  395. if (num == 0 && this.fixedBar)
  396. {
  397. this.fixedWinSymbol = 1;
  398. this.fixedLine = 1;
  399. this.fixedBar = false;
  400. }
  401. if (this.state == 7)
  402. {
  403. if (num == 1)
  404. {
  405. this.stopIdArray[0] = num3;
  406. this.FirstStopCheck(num3);
  407. this.stopCount = 1;
  408. this.isBlock = false;
  409. }
  410. }
  411. else if (this.state == 8 && num == 2 && num2 != -1)
  412. {
  413. this.stopCount = 2;
  414. this.stopIdArray[1] = 3 - (num2 + this.stopIdArray[0]);
  415. this.stopIdArray[2] = num2;
  416. this.CherryStopCheck(this.stopIdArray[1]);
  417. this.ReachCheck(num2);
  418. this.isBlock = false;
  419. }
  420. if (num == 3)
  421. {
  422. this.stopCount = 3;
  423. this.CherryStopCheck(this.stopIdArray[2]);
  424. this.state = 10;
  425. SlotUImgr.Instance.UpdateUI();
  426. }
  427. }
  428. public IEnumerator AutoBet()
  429. {
  430. this.state = 3;
  431. GameMain.Instance.CharacterMgr.status.casinoCoin -= 300L;
  432. yield return new WaitForSeconds(0.4f);
  433. GameMain.Instance.SoundMgr.PlaySe("casino_SE005.ogg", false);
  434. base.StartCoroutine(this.LightLamp(this.slotLight[0], true, 0.1f));
  435. base.StartCoroutine(this.LightLamp(this.hitLight[0], true, 0.1f));
  436. this.credit -= 100L;
  437. this.CreditUpdate();
  438. yield return new WaitForSeconds(0.1f);
  439. GameMain.Instance.SoundMgr.PlaySe("casino_SE005.ogg", false);
  440. base.StartCoroutine(this.LightLamp(this.slotLight[1], true, 0.1f));
  441. base.StartCoroutine(this.LightLamp(this.hitLight[1], true, 0.1f));
  442. base.StartCoroutine(this.LightLamp(this.hitLight[2], true, 0.1f));
  443. this.credit -= 100L;
  444. this.CreditUpdate();
  445. yield return new WaitForSeconds(0.1f);
  446. GameMain.Instance.SoundMgr.PlaySe("casino_SE005.ogg", false);
  447. base.StartCoroutine(this.LightLamp(this.slotLight[2], true, 0.1f));
  448. base.StartCoroutine(this.LightLamp(this.hitLight[3], true, 0.1f));
  449. base.StartCoroutine(this.LightLamp(this.hitLight[4], true, 0.1f));
  450. this.credit -= 100L;
  451. this.CreditUpdate();
  452. SlotUImgr.Instance.UpdateUI();
  453. yield return new WaitForSeconds(0.1f);
  454. this.state = 4;
  455. yield break;
  456. }
  457. public IEnumerator AutoLeverOn()
  458. {
  459. this.state = 5;
  460. float time = 0f;
  461. float limitTime = 0.25f;
  462. Quaternion from = Quaternion.Euler(-90f, 90f, 0f);
  463. Quaternion to = Quaternion.Euler(-50f, 90f, 0f);
  464. while (time < limitTime)
  465. {
  466. if (time < limitTime)
  467. {
  468. time += Time.deltaTime;
  469. if (time < limitTime / 2f)
  470. {
  471. this.lever.transform.rotation = Quaternion.Slerp(from, to, time * 8f);
  472. }
  473. else
  474. {
  475. this.lever.transform.rotation = Quaternion.Slerp(to, from, time * 8f - 1f);
  476. }
  477. }
  478. yield return null;
  479. }
  480. yield return new WaitForSeconds(0f);
  481. GameMain.Instance.SoundMgr.PlaySe("casino_SE006.ogg", false);
  482. for (int i = 0; i < 3; i++)
  483. {
  484. this.reels[i].GetComponent<Reel>().ChangeState(1);
  485. base.StartCoroutine(this.LightLamp(this.buttons[i].transform.GetChild(0).gameObject, true, this.lightingTime));
  486. this.buttonFlg[i] = false;
  487. this.StopButtons[i].interactable = true;
  488. }
  489. this.state = 6;
  490. SlotUImgr.Instance.UpdateUI();
  491. yield break;
  492. }
  493. private void FirstStopCheck(int id)
  494. {
  495. int[] array = new int[]
  496. {
  497. this.reels[id].GetComponent<Reel>().reelNo + 1,
  498. this.reels[id].GetComponent<Reel>().reelNo,
  499. this.reels[id].GetComponent<Reel>().reelNo - 1
  500. };
  501. for (int i = 0; i < 3; i++)
  502. {
  503. if (array[i] > 21)
  504. {
  505. array[i] -= 21;
  506. }
  507. if (array[i] < 1)
  508. {
  509. array[i] += 21;
  510. }
  511. }
  512. int[] array2 = new int[]
  513. {
  514. SlotManager.reelArray[id, 21 - array[0]],
  515. SlotManager.reelArray[id, 21 - array[1]],
  516. SlotManager.reelArray[id, 21 - array[2]]
  517. };
  518. this.CheckFirstStopReel(array2);
  519. for (int j = 0; j < 3; j++)
  520. {
  521. if (array2[j] == 0)
  522. {
  523. Debug.Log("7!");
  524. if (this.isChanceMode)
  525. {
  526. base.StartCoroutine(this.LightLamp(this.sevenLamp[id], true, this.lightingTime));
  527. }
  528. }
  529. else if (array2[j] == 6 && id == 0)
  530. {
  531. this.SymbolLight(id, array[j]);
  532. Debug.Log("Cherry!");
  533. }
  534. }
  535. this.state = 8;
  536. }
  537. private void CherryStopCheck(int id)
  538. {
  539. int[] array = new int[]
  540. {
  541. this.reels[id].GetComponent<Reel>().reelNo + 1,
  542. this.reels[id].GetComponent<Reel>().reelNo,
  543. this.reels[id].GetComponent<Reel>().reelNo - 1
  544. };
  545. for (int i = 0; i < 3; i++)
  546. {
  547. if (array[i] > 21)
  548. {
  549. array[i] -= 21;
  550. }
  551. if (array[i] < 1)
  552. {
  553. array[i] += 21;
  554. }
  555. }
  556. int[] array2 = new int[]
  557. {
  558. SlotManager.reelArray[id, 21 - array[0]],
  559. SlotManager.reelArray[id, 21 - array[1]],
  560. SlotManager.reelArray[id, 21 - array[2]]
  561. };
  562. for (int j = 0; j < 3; j++)
  563. {
  564. if (array2[j] == 6 && id == 0)
  565. {
  566. this.SymbolLight(id, array[j]);
  567. Debug.Log("Cherry!");
  568. }
  569. }
  570. }
  571. private void WinCherryCheck()
  572. {
  573. int[] array = new int[]
  574. {
  575. this.reels[0].GetComponent<Reel>().reelNo,
  576. this.reels[1].GetComponent<Reel>().reelNo
  577. };
  578. int[] array2 = new int[]
  579. {
  580. this.reels[0].GetComponent<Reel>().reelNo + 1,
  581. this.reels[1].GetComponent<Reel>().reelNo + 1
  582. };
  583. int[] array3 = new int[]
  584. {
  585. this.reels[0].GetComponent<Reel>().reelNo - 1,
  586. this.reels[1].GetComponent<Reel>().reelNo - 1
  587. };
  588. for (int i = 0; i < 2; i++)
  589. {
  590. if (array2[i] > 21)
  591. {
  592. array2[i] -= 21;
  593. }
  594. if (array3[i] < 1)
  595. {
  596. array3[i] += 21;
  597. }
  598. }
  599. if (SlotManager.reelArray[0, 21 - array2[0]] == 6)
  600. {
  601. Debug.Log("1列目上にチェリーが揃いました。");
  602. this.state = 11;
  603. this.cherryWin = 2;
  604. this.winLine.Add(2);
  605. this.winLine.Add(4);
  606. this.SymbolLight(0, array2[0]);
  607. }
  608. if (SlotManager.reelArray[0, 21 - array[0]] == 6)
  609. {
  610. Debug.Log("1列目真ん中にチェリーが揃いました。");
  611. this.state = 11;
  612. this.cherryWin = 1;
  613. this.winLine.Add(1);
  614. this.SymbolLight(0, array[0]);
  615. }
  616. if (SlotManager.reelArray[0, 21 - array3[0]] == 6)
  617. {
  618. Debug.Log("1列目下にチェリーが揃いました。");
  619. this.state = 11;
  620. this.cherryWin = 2;
  621. this.winLine.Add(3);
  622. this.winLine.Add(5);
  623. this.SymbolLight(0, array3[0]);
  624. }
  625. if (SlotManager.reelArray[0, 21 - array2[0]] == 6 && SlotManager.reelArray[1, 21 - array2[1]] == 6)
  626. {
  627. Debug.Log("上列にチェリーが揃いました。");
  628. this.state = 11;
  629. this.cherryWin = 3;
  630. this.winLine.Add(2);
  631. this.SymbolLight(0, array2[0]);
  632. this.SymbolLight(1, array2[1]);
  633. }
  634. if (SlotManager.reelArray[0, 21 - array[0]] == 6 && SlotManager.reelArray[1, 21 - array[1]] == 6)
  635. {
  636. Debug.Log("中央列にチェリーが揃いました。");
  637. this.state = 11;
  638. this.winLine.Add(1);
  639. this.cherryWin = 4;
  640. this.SymbolLight(0, array[0]);
  641. this.SymbolLight(1, array[1]);
  642. }
  643. if (SlotManager.reelArray[0, 21 - array3[0]] == 6 && SlotManager.reelArray[1, 21 - array3[1]] == 6)
  644. {
  645. Debug.Log("下列にチェリーが揃いました。");
  646. this.state = 11;
  647. this.cherryWin = 3;
  648. this.winLine.Add(3);
  649. this.SymbolLight(0, array3[0]);
  650. this.SymbolLight(1, array3[1]);
  651. }
  652. if (SlotManager.reelArray[0, 21 - array2[0]] == 6 && SlotManager.reelArray[1, 21 - array[1]] == 6)
  653. {
  654. Debug.Log("\列にチェリーが揃いました。");
  655. this.state = 11;
  656. this.cherryWin = 5;
  657. this.SymbolLight(0, array2[0]);
  658. this.SymbolLight(1, array[1]);
  659. }
  660. if (SlotManager.reelArray[0, 21 - array3[0]] == 6 && SlotManager.reelArray[1, 21 - array[1]] == 6)
  661. {
  662. Debug.Log("/列にチェリーが揃いました。");
  663. this.state = 11;
  664. this.cherryWin = 5;
  665. this.SymbolLight(0, array3[0]);
  666. this.SymbolLight(1, array[1]);
  667. }
  668. }
  669. private void CheckFirstStopReel(int[] symbols)
  670. {
  671. int num = 0;
  672. int[] array = new int[3];
  673. for (int i = 0; i < 3; i++)
  674. {
  675. if (!this.isChanceMode)
  676. {
  677. switch (symbols[i])
  678. {
  679. case 0:
  680. num += this.normalDividend[symbols[i]];
  681. array[i] = this.normalDividend[symbols[i]];
  682. break;
  683. case 1:
  684. num += this.normalDividend[symbols[i]];
  685. array[i] = this.normalDividend[symbols[i]];
  686. break;
  687. case 2:
  688. num += this.normalDividend[symbols[i]];
  689. array[i] = this.normalDividend[symbols[i]];
  690. break;
  691. case 3:
  692. num += this.normalDividend[symbols[i]];
  693. array[i] = this.normalDividend[symbols[i]];
  694. break;
  695. case 4:
  696. num += this.normalDividend[symbols[i]];
  697. array[i] = this.normalDividend[symbols[i]];
  698. break;
  699. case 5:
  700. num += this.normalDividend[symbols[i]];
  701. array[i] = this.normalDividend[symbols[i]];
  702. break;
  703. case 6:
  704. num += this.normalDividend[symbols[i]];
  705. array[i] = this.normalDividend[symbols[i]];
  706. break;
  707. }
  708. }
  709. else
  710. {
  711. switch (symbols[i])
  712. {
  713. case 0:
  714. num += this.chanceDividend[symbols[i]];
  715. array[i] = this.chanceDividend[symbols[i]];
  716. break;
  717. case 1:
  718. num += this.chanceDividend[symbols[i]];
  719. array[i] = this.chanceDividend[symbols[i]];
  720. break;
  721. case 2:
  722. num += this.chanceDividend[symbols[i]];
  723. array[i] = this.chanceDividend[symbols[i]];
  724. break;
  725. case 3:
  726. num += this.chanceDividend[symbols[i]];
  727. array[i] = this.chanceDividend[symbols[i]];
  728. break;
  729. case 4:
  730. num += this.chanceDividend[symbols[i]];
  731. array[i] = this.chanceDividend[symbols[i]];
  732. break;
  733. case 5:
  734. num += this.chanceDividend[symbols[i]];
  735. array[i] = this.chanceDividend[symbols[i]];
  736. break;
  737. case 6:
  738. num += this.chanceDividend[symbols[i]];
  739. array[i] = this.chanceDividend[symbols[i]];
  740. break;
  741. }
  742. }
  743. }
  744. Debug.Log(string.Concat(new string[]
  745. {
  746. "確率:",
  747. array[0].ToString(),
  748. ", ",
  749. array[1].ToString(),
  750. ", ",
  751. array[2].ToString()
  752. }));
  753. Debug.Log("probability = " + num);
  754. UnityEngine.Random.Range(0, 100);
  755. int num2;
  756. if (this.isChanceMode)
  757. {
  758. num2 = UnityEngine.Random.Range(0, this.chanceMaxProb);
  759. }
  760. else
  761. {
  762. num2 = UnityEngine.Random.Range(0, this.normalMaxProb);
  763. }
  764. Debug.Log("rand = " + num2);
  765. if (num > num2)
  766. {
  767. for (int j = 0; j < 3; j++)
  768. {
  769. if (array[j] > num2)
  770. {
  771. if (!this.fixedBar)
  772. {
  773. Debug.Log("<color=red>" + symbols[j] + "が確定しました</color>");
  774. this.fixedWinSymbol = symbols[j];
  775. this.fixedLine = j;
  776. }
  777. else
  778. {
  779. Debug.Log("<color=red>Bar半確定</color>");
  780. }
  781. break;
  782. }
  783. num2 -= array[j];
  784. }
  785. }
  786. else
  787. {
  788. Debug.Log("<color=blue>外れ</color>");
  789. }
  790. }
  791. private void ReachCheck(int id)
  792. {
  793. this.state = 9;
  794. this.reachSymbolList = new List<int>();
  795. this.idList = new List<int>();
  796. this.reelNoList = new List<int>();
  797. int[] array = new int[]
  798. {
  799. this.reels[0].GetComponent<Reel>().reelNo,
  800. this.reels[1].GetComponent<Reel>().reelNo,
  801. this.reels[2].GetComponent<Reel>().reelNo
  802. };
  803. int[] array2 = new int[]
  804. {
  805. this.reels[0].GetComponent<Reel>().reelNo + 1,
  806. this.reels[1].GetComponent<Reel>().reelNo + 1,
  807. this.reels[2].GetComponent<Reel>().reelNo + 1
  808. };
  809. int[] array3 = new int[]
  810. {
  811. this.reels[0].GetComponent<Reel>().reelNo - 1,
  812. this.reels[1].GetComponent<Reel>().reelNo - 1,
  813. this.reels[2].GetComponent<Reel>().reelNo - 1
  814. };
  815. for (int i = 0; i < 3; i++)
  816. {
  817. if (array2[i] > 21)
  818. {
  819. array2[i] -= 21;
  820. }
  821. if (array3[i] < 1)
  822. {
  823. array3[i] += 21;
  824. }
  825. if (array[i] < 1)
  826. {
  827. array[i] += 21;
  828. }
  829. }
  830. int[] array4 = new int[]
  831. {
  832. SlotManager.reelArray[0, 21 - array2[0]],
  833. SlotManager.reelArray[1, 21 - array2[1]],
  834. SlotManager.reelArray[2, 21 - array2[2]]
  835. };
  836. int[] array5 = new int[]
  837. {
  838. SlotManager.reelArray[0, 21 - array[0]],
  839. SlotManager.reelArray[1, 21 - array[1]],
  840. SlotManager.reelArray[2, 21 - array[2]]
  841. };
  842. int[] array6 = new int[]
  843. {
  844. SlotManager.reelArray[0, 21 - array3[0]],
  845. SlotManager.reelArray[1, 21 - array3[1]],
  846. SlotManager.reelArray[2, 21 - array3[2]]
  847. };
  848. for (int j = 0; j < 3; j++)
  849. {
  850. if (id == j)
  851. {
  852. array5[j] = -1;
  853. array4[j] = -1;
  854. array6[j] = -1;
  855. }
  856. }
  857. if (array5[0] == array5[1] || array5[0] == array5[2] || array5[1] == array5[2])
  858. {
  859. Debug.Log("1:リーチです");
  860. this.reachFlg = true;
  861. if (array5[0] != -1)
  862. {
  863. this.reachSymbolList.Add(array5[0]);
  864. }
  865. else
  866. {
  867. this.reachSymbolList.Add(array5[1]);
  868. }
  869. for (int k = 0; k < 3; k++)
  870. {
  871. if (array5[k] != -1)
  872. {
  873. this.idList.Add(k);
  874. this.reelNoList.Add(array[k]);
  875. }
  876. }
  877. this.reachLine.Add(1);
  878. }
  879. if (array4[0] == array4[1] || array4[0] == array4[2] || array4[1] == array4[2])
  880. {
  881. this.reachFlg = true;
  882. if (array4[0] != -1)
  883. {
  884. this.reachSymbolList.Add(array4[0]);
  885. }
  886. else
  887. {
  888. this.reachSymbolList.Add(array4[1]);
  889. }
  890. for (int l = 0; l < 3; l++)
  891. {
  892. if (array4[l] != -1)
  893. {
  894. this.idList.Add(l);
  895. this.reelNoList.Add(array2[l]);
  896. }
  897. }
  898. this.reachLine.Add(2);
  899. }
  900. if (array6[0] == array6[1] || array6[0] == array6[2] || array6[1] == array6[2])
  901. {
  902. Debug.Log("3:リーチです");
  903. this.reachFlg = true;
  904. if (array6[0] != -1)
  905. {
  906. this.reachSymbolList.Add(array6[0]);
  907. }
  908. else
  909. {
  910. this.reachSymbolList.Add(array6[1]);
  911. }
  912. for (int m = 0; m < 3; m++)
  913. {
  914. if (array6[m] != -1)
  915. {
  916. this.idList.Add(m);
  917. this.reelNoList.Add(array3[m]);
  918. }
  919. }
  920. this.reachLine.Add(3);
  921. }
  922. if (array4[0] == array5[1] || array5[1] == array6[2] || array4[0] == array6[2])
  923. {
  924. Debug.Log("4:リーチです");
  925. this.reachFlg = true;
  926. if (array4[0] != -1)
  927. {
  928. this.reachSymbolList.Add(array4[0]);
  929. }
  930. else
  931. {
  932. this.reachSymbolList.Add(array5[1]);
  933. }
  934. if (array4[0] == -1)
  935. {
  936. this.idList.Add(1);
  937. this.reelNoList.Add(array[1]);
  938. this.idList.Add(2);
  939. this.reelNoList.Add(array3[2]);
  940. }
  941. if (array5[1] == -1)
  942. {
  943. this.idList.Add(0);
  944. this.reelNoList.Add(array2[0]);
  945. this.idList.Add(2);
  946. this.reelNoList.Add(array3[2]);
  947. }
  948. if (array6[2] == -1)
  949. {
  950. this.idList.Add(0);
  951. this.reelNoList.Add(array2[0]);
  952. this.idList.Add(1);
  953. this.reelNoList.Add(array[1]);
  954. }
  955. this.reachLine.Add(4);
  956. }
  957. if (array6[0] == array5[1] || array5[1] == array4[2] || array6[0] == array4[2])
  958. {
  959. Debug.Log("5:リーチです");
  960. this.reachFlg = true;
  961. if (array6[0] != -1)
  962. {
  963. this.reachSymbolList.Add(array6[0]);
  964. }
  965. else
  966. {
  967. this.reachSymbolList.Add(array5[1]);
  968. }
  969. if (array6[0] == -1)
  970. {
  971. this.idList.Add(1);
  972. this.reelNoList.Add(array[1]);
  973. this.idList.Add(2);
  974. this.reelNoList.Add(array2[2]);
  975. }
  976. if (array5[1] == -1)
  977. {
  978. this.idList.Add(0);
  979. this.reelNoList.Add(array3[0]);
  980. this.idList.Add(2);
  981. this.reelNoList.Add(array2[2]);
  982. }
  983. if (array4[2] == -1)
  984. {
  985. this.idList.Add(0);
  986. this.reelNoList.Add(array3[0]);
  987. this.idList.Add(1);
  988. this.reelNoList.Add(array[1]);
  989. }
  990. this.reachLine.Add(5);
  991. }
  992. foreach (int num in this.reachSymbolList)
  993. {
  994. }
  995. int num2 = 0;
  996. List<int> list = new List<int>();
  997. foreach (int id2 in this.idList)
  998. {
  999. this.SymbolLight(id2, this.reelNoList[num2]);
  1000. num2++;
  1001. }
  1002. foreach (int num3 in this.reachLine)
  1003. {
  1004. }
  1005. if (this.reachFlg)
  1006. {
  1007. GameMain.Instance.SoundMgr.PlaySe("casino_SE008.ogg", false);
  1008. base.StartCoroutine(this.LightLamp(this.ballLamp, true, this.lightingTime));
  1009. base.StartCoroutine(this.LightLamp(this.topLamp, true, this.lightingTime));
  1010. if (this.isChanceMode)
  1011. {
  1012. using (List<int>.Enumerator enumerator4 = this.reachSymbolList.GetEnumerator())
  1013. {
  1014. while (enumerator4.MoveNext())
  1015. {
  1016. if (enumerator4.Current == 0)
  1017. {
  1018. Debug.Log("seven reach!");
  1019. base.StartCoroutine(this.LightLamp(this.sevenLamp[this.stopIdArray[1]], true, this.lightingTime));
  1020. string f_strFileName = null;
  1021. switch (this.nowTexId)
  1022. {
  1023. case 1:
  1024. f_strFileName = "H0_09451.ogg";
  1025. break;
  1026. case 2:
  1027. f_strFileName = "H1_09950.ogg";
  1028. break;
  1029. case 3:
  1030. f_strFileName = "H2_10068.ogg";
  1031. break;
  1032. default:
  1033. Debug.LogError("該当するボイスがありません。");
  1034. break;
  1035. }
  1036. GameMain.Instance.SoundMgr.PlaySe(f_strFileName, false);
  1037. }
  1038. }
  1039. }
  1040. }
  1041. }
  1042. }
  1043. private void SymbolLight(int id, int reelNo)
  1044. {
  1045. float y = this.reelLights[id].GetComponent<Renderer>().sharedMaterial.GetTextureOffset("_MainTex").y;
  1046. Vector4 value;
  1047. if (reelNo > 9)
  1048. {
  1049. value = new Vector4(0f, 0.04761905f * (float)reelNo, 0f, 0.04761905f * (float)(reelNo - 1));
  1050. }
  1051. else
  1052. {
  1053. value = new Vector4(0f, 0.04761905f * (float)(reelNo + 21), 0f, 0.04761905f * (float)(reelNo + 20));
  1054. }
  1055. if (reelNo == 9)
  1056. {
  1057. if (y < 0.1f)
  1058. {
  1059. value = new Vector4(0f, Mathf.Abs(1f - 0.04761905f * (float)(reelNo + 21)), 0f, Mathf.Abs(1f - 0.04761905f * (float)(reelNo + 20)));
  1060. }
  1061. else
  1062. {
  1063. value = new Vector4(0f, 0.04761905f * (float)(reelNo + 21), 0f, 0.04761905f * (float)(reelNo + 20));
  1064. }
  1065. }
  1066. else if (reelNo == 8)
  1067. {
  1068. if ((double)y > 0.9)
  1069. {
  1070. value = new Vector4(0f, 0.04761905f * (float)reelNo + 1f, 0f, 0.04761905f * (float)(reelNo - 1) + 1f);
  1071. }
  1072. else
  1073. {
  1074. value = new Vector4(0f, 0.04761905f * (float)reelNo, 0f, 0.04761905f * (float)(reelNo - 1));
  1075. }
  1076. }
  1077. if (this.idReach[id] == 0)
  1078. {
  1079. this.reelLights[id].GetComponent<Renderer>().material.SetVector("_Mask1", value);
  1080. }
  1081. else if (this.idReach[id] == 1)
  1082. {
  1083. this.reelLights[id].GetComponent<Renderer>().material.SetVector("_Mask2", value);
  1084. }
  1085. else
  1086. {
  1087. this.reelLights[id].GetComponent<Renderer>().material.SetVector("_Mask3", value);
  1088. }
  1089. this.idReach[id]++;
  1090. if (this.idReach[id] > 2)
  1091. {
  1092. this.idReach[id] = 0;
  1093. }
  1094. }
  1095. private void WinCheck()
  1096. {
  1097. this.state = 13;
  1098. int[] array = new int[]
  1099. {
  1100. this.reels[0].GetComponent<Reel>().reelNo,
  1101. this.reels[1].GetComponent<Reel>().reelNo,
  1102. this.reels[2].GetComponent<Reel>().reelNo
  1103. };
  1104. int[] array2 = new int[]
  1105. {
  1106. this.reels[0].GetComponent<Reel>().reelNo + 1,
  1107. this.reels[1].GetComponent<Reel>().reelNo + 1,
  1108. this.reels[2].GetComponent<Reel>().reelNo + 1
  1109. };
  1110. int[] array3 = new int[]
  1111. {
  1112. this.reels[0].GetComponent<Reel>().reelNo - 1,
  1113. this.reels[1].GetComponent<Reel>().reelNo - 1,
  1114. this.reels[2].GetComponent<Reel>().reelNo - 1
  1115. };
  1116. for (int i = 0; i < 3; i++)
  1117. {
  1118. if (array2[i] > 21)
  1119. {
  1120. array2[i] -= 21;
  1121. }
  1122. if (array3[i] < 1)
  1123. {
  1124. array3[i] += 21;
  1125. }
  1126. }
  1127. for (int j = 0; j < 3; j++)
  1128. {
  1129. Vector4 value = new Vector4(0f, 0f, 0f, 0f);
  1130. this.reelLights[j].GetComponent<Renderer>().material.SetVector("_Mask1", value);
  1131. this.reelLights[j].GetComponent<Renderer>().material.SetVector("_Mask2", value);
  1132. this.reelLights[j].GetComponent<Renderer>().material.SetVector("_Mask3", value);
  1133. }
  1134. if (SlotManager.reelArray[0, 21 - array[0]] == SlotManager.reelArray[1, 21 - array[1]] && SlotManager.reelArray[0, 21 - array[0]] == SlotManager.reelArray[2, 21 - array[2]])
  1135. {
  1136. Debug.Log("1LINE目に" + SlotManager.reelArray[0, 21 - array[0]] + "が揃いました。");
  1137. this.state = 11;
  1138. this.winLine.Add(1);
  1139. this.winSynbol = SlotManager.reelArray[0, 21 - array[0]];
  1140. this.SymbolLight(0, array[0]);
  1141. this.SymbolLight(1, array[1]);
  1142. this.SymbolLight(2, array[2]);
  1143. }
  1144. if (SlotManager.reelArray[0, 21 - array2[0]] == SlotManager.reelArray[1, 21 - array2[1]] && SlotManager.reelArray[0, 21 - array2[0]] == SlotManager.reelArray[2, 21 - array2[2]])
  1145. {
  1146. Debug.Log("2LINE目上段に" + SlotManager.reelArray[0, 21 - array2[0]] + "が揃いました。");
  1147. this.state = 11;
  1148. this.winLine.Add(2);
  1149. this.winSynbol = SlotManager.reelArray[0, 21 - array2[0]];
  1150. this.SymbolLight(0, array2[0]);
  1151. this.SymbolLight(1, array2[1]);
  1152. this.SymbolLight(2, array2[2]);
  1153. }
  1154. if (SlotManager.reelArray[0, 21 - array3[0]] == SlotManager.reelArray[1, 21 - array3[1]] && SlotManager.reelArray[0, 21 - array3[0]] == SlotManager.reelArray[2, 21 - array3[2]])
  1155. {
  1156. Debug.Log("2LINE目下段に" + SlotManager.reelArray[0, 21 - array3[0]] + "が揃いました。");
  1157. this.state = 11;
  1158. this.winLine.Add(3);
  1159. this.winSynbol = SlotManager.reelArray[0, 21 - array3[0]];
  1160. this.SymbolLight(0, array3[0]);
  1161. this.SymbolLight(1, array3[1]);
  1162. this.SymbolLight(2, array3[2]);
  1163. }
  1164. if (SlotManager.reelArray[0, 21 - array2[0]] == SlotManager.reelArray[1, 21 - array[1]] && SlotManager.reelArray[0, 21 - array2[0]] == SlotManager.reelArray[2, 21 - array3[2]])
  1165. {
  1166. Debug.Log("上→下に" + SlotManager.reelArray[0, 21 - array2[0]] + "が揃いました。");
  1167. this.state = 11;
  1168. this.winLine.Add(4);
  1169. this.winSynbol = SlotManager.reelArray[0, 21 - array2[0]];
  1170. this.SymbolLight(0, array2[0]);
  1171. this.SymbolLight(1, array[1]);
  1172. this.SymbolLight(2, array3[2]);
  1173. }
  1174. if (SlotManager.reelArray[0, 21 - array3[0]] == SlotManager.reelArray[1, 21 - array[1]] && SlotManager.reelArray[0, 21 - array3[0]] == SlotManager.reelArray[2, 21 - array2[2]])
  1175. {
  1176. Debug.Log("下→上に" + SlotManager.reelArray[0, 21 - array3[0]] + "が揃いました。");
  1177. this.state = 11;
  1178. this.winLine.Add(5);
  1179. this.winSynbol = SlotManager.reelArray[0, 21 - array3[0]];
  1180. this.SymbolLight(0, array3[0]);
  1181. this.SymbolLight(1, array[1]);
  1182. this.SymbolLight(2, array2[2]);
  1183. }
  1184. this.WinCherryCheck();
  1185. if (this.state == 11 && this.winSynbol == 0)
  1186. {
  1187. this.state = 14;
  1188. }
  1189. }
  1190. private void Win()
  1191. {
  1192. this.state = 12;
  1193. base.StartCoroutine(this.Payout());
  1194. for (int i = 0; i < 3; i++)
  1195. {
  1196. base.StartCoroutine(this.BlinkLamp(this.slotLight[i], 0.5f, 0f));
  1197. }
  1198. base.StartCoroutine(this.BlinkLamp(this.topLamp, 0.1f, 0f));
  1199. base.StartCoroutine(this.BlinkLamp(this.ballLamp, 0.1f, 0f));
  1200. for (int j = 0; j < 5; j++)
  1201. {
  1202. base.StartCoroutine(this.LightLamp(this.hitLight[j], false, this.lightingTime));
  1203. }
  1204. foreach (int num in this.winLine)
  1205. {
  1206. base.StartCoroutine(this.LightLamp(this.hitLight[num - 1], true, this.lightingTime));
  1207. }
  1208. base.StartCoroutine(this.BlinkLamp(this.winMark, 0.1f, 0f));
  1209. }
  1210. private IEnumerator BigBonus()
  1211. {
  1212. this.state = 15;
  1213. GameMain.Instance.SoundMgr.PlaySe("casino_SE009.ogg", false);
  1214. this.isBigBonusBgmPlay = true;
  1215. this.isPayoutRunning = true;
  1216. base.StartCoroutine(this.BlinkBigBonusLamp());
  1217. base.StartCoroutine(this.LightLamp(this.sevenLamp[this.stopIdArray[2]], true, this.lightingTime));
  1218. base.StartCoroutine(this.BlinkLamp(this.heartLamp, 0.1f, 0f));
  1219. for (int i = 0; i < 3; i++)
  1220. {
  1221. base.StartCoroutine(this.BlinkLamp(this.slotLight[i], 0.5f, 0f));
  1222. }
  1223. base.StartCoroutine(this.BlinkLamp(this.topLamp, 0.1f, 0f));
  1224. base.StartCoroutine(this.BlinkLamp(this.ballLamp, 0.1f, 0f));
  1225. base.StartCoroutine(this.BlinkLamp(this.winMark, 0.1f, 0f));
  1226. for (int j = 0; j < 5; j++)
  1227. {
  1228. base.StartCoroutine(this.LightLamp(this.hitLight[j], true, this.lightingTime));
  1229. }
  1230. yield return new WaitForSeconds(6f);
  1231. string str = null;
  1232. switch (this.nowTexId)
  1233. {
  1234. case 1:
  1235. str = "H0_09452.ogg";
  1236. break;
  1237. case 2:
  1238. str = "H1_09951.ogg";
  1239. break;
  1240. case 3:
  1241. str = "H2_10069.ogg";
  1242. break;
  1243. default:
  1244. Debug.LogError("該当するボイスがありません。");
  1245. break;
  1246. }
  1247. GameMain.Instance.SoundMgr.PlaySe(str, false);
  1248. yield return new WaitForSeconds(6.5f);
  1249. this.isBigBonusBgmPlay = false;
  1250. base.StartCoroutine(this.Payout());
  1251. yield return null;
  1252. yield break;
  1253. }
  1254. private IEnumerator BlinkBigBonusLamp()
  1255. {
  1256. float waitTime = 0.5f;
  1257. for (int j = 0; j < 8; j++)
  1258. {
  1259. base.StartCoroutine(this.LightLamp(this.bigbonus[j], true, 0.1f));
  1260. }
  1261. for (int i = 0; i < 8; i++)
  1262. {
  1263. base.StartCoroutine(this.BlinkLamp(this.bigbonus[i], 0.5f, 1.5f));
  1264. yield return new WaitForSeconds(waitTime);
  1265. }
  1266. yield return null;
  1267. yield break;
  1268. }
  1269. private IEnumerator Payout()
  1270. {
  1271. int payCredit = 0;
  1272. int totalpay = 0;
  1273. this.isPayoutRunning = true;
  1274. if (this.cherryWin != 0)
  1275. {
  1276. if (!this.isChanceMode)
  1277. {
  1278. switch (this.cherryWin)
  1279. {
  1280. case 1:
  1281. this.fixedBar = true;
  1282. payCredit = this.payDividend[6];
  1283. break;
  1284. case 2:
  1285. payCredit = this.payDividend[6] * 2;
  1286. break;
  1287. case 3:
  1288. this.chanceCorrect = 19;
  1289. payCredit = this.payDividend[6] * 2;
  1290. break;
  1291. case 4:
  1292. this.fixedBar = true;
  1293. payCredit = this.payDividend[6] * 2;
  1294. break;
  1295. case 5:
  1296. payCredit = this.payDividend[6] * 3;
  1297. break;
  1298. }
  1299. }
  1300. else
  1301. {
  1302. switch (this.cherryWin)
  1303. {
  1304. case 1:
  1305. payCredit = this.payDividend[6];
  1306. break;
  1307. case 2:
  1308. payCredit = this.payDividend[6] * 2;
  1309. break;
  1310. case 3:
  1311. payCredit = this.payDividend[6];
  1312. break;
  1313. case 4:
  1314. payCredit = this.payDividend[6] * 2;
  1315. break;
  1316. case 5:
  1317. payCredit = this.payDividend[6] * 3;
  1318. break;
  1319. }
  1320. }
  1321. this.PayoutUpdate(payCredit);
  1322. yield return new WaitForSeconds(1f);
  1323. GameMain.Instance.CharacterMgr.status.casinoCoin += (long)payCredit;
  1324. totalpay += payCredit;
  1325. while (payCredit > 0)
  1326. {
  1327. GameMain.Instance.SoundMgr.PlaySe("casino_SE010.ogg", true);
  1328. payCredit -= 100;
  1329. this.PayoutUpdate(payCredit);
  1330. this.credit += 100L;
  1331. this.CreditUpdate();
  1332. yield return new WaitForSeconds((float)this.msCount / 1000f);
  1333. }
  1334. SlotUImgr.Instance.UpdateUI();
  1335. GameMain.Instance.SoundMgr.StopSe();
  1336. }
  1337. if (this.winSynbol != -1)
  1338. {
  1339. yield return new WaitForSeconds(0.5f);
  1340. switch (this.winSynbol)
  1341. {
  1342. case 1:
  1343. this.chanceCorrect = 99;
  1344. break;
  1345. }
  1346. payCredit = this.payDividend[this.winSynbol];
  1347. this.PayoutUpdate(payCredit);
  1348. yield return new WaitForSeconds(1f);
  1349. GameMain.Instance.CharacterMgr.status.casinoCoin += (long)payCredit;
  1350. totalpay += payCredit;
  1351. while (payCredit > 0)
  1352. {
  1353. GameMain.Instance.SoundMgr.PlaySe("casino_SE010.ogg", true);
  1354. payCredit -= 100;
  1355. this.PayoutUpdate(payCredit);
  1356. this.credit += 100L;
  1357. this.CreditUpdate();
  1358. yield return new WaitForSeconds((float)this.msCount / 1000f);
  1359. }
  1360. CasinoDataMgr.Instance.AddTotalCoin(totalpay);
  1361. SlotUImgr.Instance.UpdateUI();
  1362. GameMain.Instance.SoundMgr.StopSe();
  1363. yield return new WaitForSeconds(0.5f);
  1364. }
  1365. this.isPayoutRunning = false;
  1366. if (this.winSynbol == 0)
  1367. {
  1368. this.EndChanceMode();
  1369. this.chanceCorrect = -1;
  1370. }
  1371. this.state = 13;
  1372. yield break;
  1373. }
  1374. private void CreditUpdate()
  1375. {
  1376. long[] array = new long[6];
  1377. long num = this.credit;
  1378. for (int i = 0; i < 6; i++)
  1379. {
  1380. array[i] = num % 10L;
  1381. num /= 10L;
  1382. }
  1383. for (int j = 0; j < 6; j++)
  1384. {
  1385. Vector2 value = new Vector2(0f, (float)(-(float)array[j]) / 10f);
  1386. this.creditNumber[j].GetComponent<Renderer>().sharedMaterial.SetTextureOffset("_MainTex", value);
  1387. }
  1388. }
  1389. private void PayoutUpdate(int payout)
  1390. {
  1391. int[] array = new int[6];
  1392. int num = payout;
  1393. for (int i = 0; i < 6; i++)
  1394. {
  1395. array[i] = num % 10;
  1396. num /= 10;
  1397. }
  1398. for (int j = 0; j < 6; j++)
  1399. {
  1400. Vector2 value = new Vector2(0f, (float)(-(float)array[j]) / 10f);
  1401. this.payoutNumber[j].GetComponent<Renderer>().sharedMaterial.SetTextureOffset("_MainTex", value);
  1402. }
  1403. }
  1404. private IEnumerator BlinkLamp(GameObject obj, float waitTime, float waitTime2 = 0f)
  1405. {
  1406. if (waitTime2 == 0f)
  1407. {
  1408. waitTime2 = waitTime;
  1409. }
  1410. while (this.isPayoutRunning)
  1411. {
  1412. base.StartCoroutine(this.LightLamp(obj, true, this.lightingTime));
  1413. yield return new WaitForSeconds(waitTime2);
  1414. base.StartCoroutine(this.LightLamp(obj, false, this.lightingTime));
  1415. yield return new WaitForSeconds(waitTime);
  1416. }
  1417. yield break;
  1418. }
  1419. public IEnumerator LightLamp(GameObject obj, bool flg, float time)
  1420. {
  1421. float startTime = Time.time;
  1422. float alpha = 0.5f / time;
  1423. if (!flg)
  1424. {
  1425. if (!obj.activeSelf)
  1426. {
  1427. yield break;
  1428. }
  1429. }
  1430. obj.SetActive(true);
  1431. while (time > Time.time - startTime)
  1432. {
  1433. float setAlpha = alpha * (Time.time - startTime);
  1434. if (flg)
  1435. {
  1436. Color value = new Color(0.5f, 0.5f, 0.5f, setAlpha);
  1437. obj.GetComponent<Renderer>().material.SetColor("_TintColor", value);
  1438. }
  1439. else
  1440. {
  1441. Color value2 = new Color(0.5f, 0.5f, 0.5f, 0.5f - setAlpha);
  1442. obj.GetComponent<Renderer>().material.SetColor("_TintColor", value2);
  1443. }
  1444. yield return null;
  1445. }
  1446. if (!flg)
  1447. {
  1448. Color value3 = new Color(0.5f, 0.5f, 0.5f, 0f);
  1449. obj.GetComponent<Renderer>().material.SetColor("_TintColor", value3);
  1450. obj.SetActive(false);
  1451. }
  1452. else
  1453. {
  1454. Color value4 = new Color(0.5f, 0.5f, 0.5f, 0.5f);
  1455. obj.GetComponent<Renderer>().material.SetColor("_TintColor", value4);
  1456. }
  1457. yield break;
  1458. }
  1459. [HideInInspector]
  1460. public List<int> reachSymbolList = new List<int>();
  1461. [HideInInspector]
  1462. public List<int> idList = new List<int>();
  1463. [HideInInspector]
  1464. public List<int> reelNoList = new List<int>();
  1465. [HideInInspector]
  1466. public List<int> reachLine = new List<int>();
  1467. [HideInInspector]
  1468. public int[] normalDividend = new int[8];
  1469. [HideInInspector]
  1470. public int[] chanceDividend = new int[8];
  1471. [HideInInspector]
  1472. public int[] payDividend = new int[8];
  1473. [HideInInspector]
  1474. public int normalMaxProb;
  1475. [HideInInspector]
  1476. public int chanceMaxProb;
  1477. [HideInInspector]
  1478. private List<int> winLine;
  1479. [HideInInspector]
  1480. public bool[] buttonFlg = new bool[3];
  1481. [HideInInspector]
  1482. public int[] stopIdArray = new int[3];
  1483. [HideInInspector]
  1484. public int[] idReach = new int[3];
  1485. [HideInInspector]
  1486. public bool reachFlg;
  1487. [HideInInspector]
  1488. private int winSynbol = -1;
  1489. [HideInInspector]
  1490. private bool isPayoutRunning;
  1491. public List<Button> StopButtons = new List<Button>();
  1492. [SerializeField]
  1493. [Header("クレジット")]
  1494. private long m_Mycredit;
  1495. [SerializeField]
  1496. [Header("クレジット移動にかかる時間")]
  1497. public int msCount;
  1498. [HideInInspector]
  1499. public bool isChanceMode;
  1500. [HideInInspector]
  1501. public float lightingTime = 0.1f;
  1502. [HideInInspector]
  1503. private bool isBigBonusBgmPlay;
  1504. [HideInInspector]
  1505. public int stopCount;
  1506. [HideInInspector]
  1507. public int fixedWinSymbol;
  1508. [SerializeField]
  1509. [Header("当選(半)確定絵柄")]
  1510. private string dispSymbol;
  1511. [SerializeField]
  1512. [Header("現在のステート")]
  1513. private string dispState;
  1514. [SerializeField]
  1515. [Header("当選確定ライン")]
  1516. public int fixedLine;
  1517. [HideInInspector]
  1518. public bool isBlock;
  1519. [HideInInspector]
  1520. public int cherryWin;
  1521. [SerializeField]
  1522. [Header("通常モードの回転回数")]
  1523. public int normalCount;
  1524. [SerializeField]
  1525. [Header("チャンスモードの回転回数")]
  1526. public int chanceModeCount;
  1527. [SerializeField]
  1528. [Header("チャンスモードに入る追加確率(0~99%)")]
  1529. [Range(0f, 99f)]
  1530. public int chanceCorrect;
  1531. [SerializeField]
  1532. [Header("バー半確定モードか否か")]
  1533. public bool fixedBar;
  1534. private int nowTexId;
  1535. public static int[,] reelArray = new int[,]
  1536. {
  1537. {
  1538. 3,
  1539. 0,
  1540. 4,
  1541. 5,
  1542. 4,
  1543. 5,
  1544. 1,
  1545. 6,
  1546. 5,
  1547. 4,
  1548. 5,
  1549. 0,
  1550. 2,
  1551. 5,
  1552. 4,
  1553. 5,
  1554. 6,
  1555. 1,
  1556. 5,
  1557. 4,
  1558. 5
  1559. },
  1560. {
  1561. 4,
  1562. 0,
  1563. 5,
  1564. 6,
  1565. 4,
  1566. 3,
  1567. 5,
  1568. 6,
  1569. 4,
  1570. 1,
  1571. 5,
  1572. 6,
  1573. 2,
  1574. 4,
  1575. 0,
  1576. 5,
  1577. 6,
  1578. 4,
  1579. 3,
  1580. 5,
  1581. 6
  1582. },
  1583. {
  1584. 5,
  1585. 0,
  1586. 1,
  1587. 3,
  1588. 4,
  1589. 5,
  1590. 2,
  1591. 3,
  1592. 4,
  1593. 5,
  1594. 2,
  1595. 3,
  1596. 4,
  1597. 5,
  1598. 2,
  1599. 3,
  1600. 4,
  1601. 5,
  1602. 2,
  1603. 3,
  1604. 4
  1605. }
  1606. };
  1607. [HideInInspector]
  1608. public int state;
  1609. public const int STATE_WAIT = 0;
  1610. public const int STATE_START_WAIT = 1;
  1611. public const int STATE_BET = 2;
  1612. public const int STATE_BET_WAIT = 3;
  1613. public const int STATE_LEVER_ON = 4;
  1614. public const int STATE_LEVER_ON_WAIT = 5;
  1615. public const int STATE_PLAY = 6;
  1616. public const int STATE_PLAY_WAIT = 7;
  1617. public const int STATE_FIRST_STOP = 8;
  1618. public const int STATE_REACH = 9;
  1619. public const int STATE_STOP = 10;
  1620. public const int STATE_STOP_WAIT = 11;
  1621. public const int STATE_WIN = 12;
  1622. public const int STATE_CHANCE_CHECK = 13;
  1623. public const int STATE_BIG_BONUS = 14;
  1624. public const int STATE_BIG_BONUS_WAIT = 15;
  1625. private GameObject slotMachine;
  1626. private GameObject lever;
  1627. private GameObject ballLamp;
  1628. private GameObject topLamp;
  1629. private GameObject winMark;
  1630. private GameObject heartLamp;
  1631. private GameObject startButton;
  1632. private GameObject fadeMask;
  1633. private GameObject[] reels = new GameObject[3];
  1634. private GameObject[] reelLights = new GameObject[3];
  1635. private GameObject[] buttons = new GameObject[3];
  1636. private GameObject[] slotLight = new GameObject[3];
  1637. private GameObject[] hitLight = new GameObject[5];
  1638. private GameObject[] payoutNumber = new GameObject[6];
  1639. private GameObject[] creditNumber = new GameObject[6];
  1640. private GameObject[] customMaidLamp = new GameObject[10];
  1641. private GameObject[] sevenLamp = new GameObject[3];
  1642. private GameObject[] bigbonus = new GameObject[8];
  1643. private Texture[] tex = new Texture[4];
  1644. private Sprite[] sprite = new Sprite[2];
  1645. }