using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using wf; public class SlotManager : MonoBehaviour { public long credit { get { return this.m_Mycredit; } set { this.m_Mycredit = wf.Math.RoundMinMax(value, 0L, 999999L); } } private void Start() { SceneCasinoSlot component = GameObject.Find("_SceneCasinoSlot_").GetComponent(); this.slotMachine = component.slotMachine; this.lever = component.lever; this.ballLamp = component.ballLamp; this.topLamp = component.topLamp; this.winMark = component.winMark; this.heartLamp = component.heartLamp; this.startButton = component.startButton; this.fadeMask = component.fadeMask; this.reels = component.reels; this.reelLights = component.reelLights; this.buttons = component.buttons; this.slotLight = component.slotLight; this.hitLight = component.hitLight; this.payoutNumber = component.payoutNumber; this.creditNumber = component.creditNumber; this.customMaidLamp = component.customMaidLamp; this.sevenLamp = component.sevenLamp; this.bigbonus = component.bigbonus; this.tex = component.tex; this.sprite = component.sprite; this.dispState = "初期状態"; this.dispSymbol = "確定絵柄なし"; for (int i = 0; i < 3; i++) { this.buttonFlg[i] = true; this.StopButtons[i].interactable = false; base.StartCoroutine(this.LightLamp(this.buttons[i].transform.GetChild(0).gameObject, false, this.lightingTime)); this.stopIdArray[i] = -1; this.idReach[i] = 0; } this.GetCsv(); ExChangeUI instance = ExChangeUI.Instance; instance.FadeOutStartAction = (Action)Delegate.Combine(instance.FadeOutStartAction, new Action(delegate() { this.credit = GameMain.Instance.CharacterMgr.status.casinoCoin; this.CreditUpdate(); })); this.Init(); } private void Init() { this.isChanceMode = false; this.reachFlg = false; this.cherryWin = 0; this.normalCount = 0; this.chanceModeCount = 0; this.chanceCorrect = 0; this.credit = GameMain.Instance.CharacterMgr.status.casinoCoin; this.CreditUpdate(); this.stopCount = 0; this.PayoutUpdate(0); this.state = 0; this.fixedWinSymbol = -1; this.fixedLine = -1; this.fixedBar = false; this.isBlock = true; this.reachSymbolList = new List(); this.idList = new List(); this.reelNoList = new List(); this.reachLine = new List(); this.fadeMask.SetActive(false); Material[] materials = this.slotMachine.GetComponent().materials; foreach (Material material in materials) { Debug.Log("mat = " + material.name); if (material.name == "Slot_Panel (Instance)") { Debug.Log("mat.texture = " + material.mainTexture); material.mainTexture = this.tex[3]; } } } private void GetCsv() { CsvImporter component = GameObject.Find("SlotManager").GetComponent(); this.msCount = component.GetCsvDataMs("casino_slot_byou.nei"); component.GetCsvData("casino_slot_haitou.nei"); this.normalMaxProb = component.GetCsvDataParse(0); this.chanceMaxProb = component.GetCsvDataParse(1); this.payDividend = component.GetCsvDataParseList(0); this.normalDividend = component.GetCsvDataParseList(1); this.chanceDividend = component.GetCsvDataParseList(2); } private void Update() { this.StateCheck(); this._UpdateDispDescription(); } public void _UpdateDispDescription() { int num = this.fixedWinSymbol; switch (num + 1) { case 0: this.dispSymbol = "確定絵柄なし"; break; case 1: this.dispSymbol = "スリーセブン"; break; case 2: this.dispSymbol = "BAR"; break; case 3: this.dispSymbol = "ピエロ"; break; case 4: this.dispSymbol = "ベル"; break; case 5: this.dispSymbol = "サイ"; break; case 6: this.dispSymbol = "マスカット"; break; case 7: this.dispSymbol = "チェリー"; break; } switch (this.state) { case 0: this.dispState = "初期状態"; break; case 1: this.dispState = "開始待機"; break; case 2: this.dispState = "ベット開始"; break; case 3: this.dispState = "ベット中"; break; case 4: this.dispState = "レバーオン開始"; break; case 5: this.dispState = "レバーオン中"; break; case 6: this.dispState = "プレイ開始"; break; case 7: this.dispState = "プレイ中"; break; case 8: this.dispState = "1個目停止"; break; case 9: if (this.reachFlg) { this.dispState = "リーチ"; } else { this.dispState = "2個目停止"; } break; case 10: this.dispState = "全部停止"; break; case 11: this.dispState = "停止後の処理"; break; case 12: this.dispState = "当選時の処理"; break; case 13: this.dispState = "チャンスモード判定"; break; case 14: this.dispState = "BIGBONUS当選"; break; case 15: this.dispState = "BIGBONUS処理"; break; } } public void StateCheck() { if (this.state == 0) { this.cherryWin = 0; this.isBigBonusBgmPlay = false; this.winLine = new List(); this.fixedWinSymbol = -1; this.stopCount = 0; this.chanceCorrect = 0; this.fixedLine = -1; this.winSynbol = -1; this.isBlock = true; this.startButton.GetComponent().sprite = this.sprite[0]; if (!this.isChanceMode) { for (int i = 0; i < 3; i++) { base.StartCoroutine(this.LightLamp(this.slotLight[i], false, this.lightingTime)); } for (int j = 0; j < 10; j++) { base.StartCoroutine(this.LightLamp(this.customMaidLamp[j], false, this.lightingTime)); } this.normalCount++; } else { this.chanceModeCount++; } for (int k = 0; k < 3; k++) { base.StartCoroutine(this.LightLamp(this.sevenLamp[k], false, this.lightingTime)); Vector4 value = new Vector4(0f, 0f, 0f, 0f); this.reelLights[k].GetComponent().material.SetVector("_Mask1", value); this.reelLights[k].GetComponent().material.SetVector("_Mask2", value); this.reelLights[k].GetComponent().material.SetVector("_Mask3", value); this.idReach[k] = 0; } for (int l = 0; l < 5; l++) { base.StartCoroutine(this.LightLamp(this.hitLight[l], false, this.lightingTime)); } for (int m = 0; m < 8; m++) { base.StartCoroutine(this.LightLamp(this.bigbonus[m], false, this.lightingTime)); } base.StartCoroutine(this.LightLamp(this.heartLamp, false, this.lightingTime)); base.StartCoroutine(this.LightLamp(this.ballLamp, false, this.lightingTime)); base.StartCoroutine(this.LightLamp(this.topLamp, false, this.lightingTime)); this.reachFlg = false; this.reachSymbolList = new List(); this.idList = new List(); this.reelNoList = new List(); this.reachLine = new List(); if (SlotManager.reelArray != null) { this.state = 1; } } else if (this.state == 2) { base.StartCoroutine(this.AutoBet()); } else if (this.state == 4) { base.StartCoroutine(this.AutoLeverOn()); } else if (this.state == 7) { this.AllReelsStopWait(); } else if (this.state == 6) { this.isBlock = false; } else if (this.state == 8) { this.AllReelsStopWait(); } else if (this.state == 9) { this.AllReelsStopWait(); } else if (this.state == 10) { this.WinCheck(); } else if (this.state == 11) { this.Win(); } else if (this.state == 13) { this.ChanceModeCheck(); } else if (this.state == 14) { base.StartCoroutine(this.BigBonus()); } } public void ChanceModeCheck() { if (!this.isChanceMode) { if (UnityEngine.Random.Range(0, 100) < 1 + this.chanceCorrect) { this.StartChanceMode(); } } else if (this.chanceModeCount >= 15) { this.EndChanceMode(); } this.state = 0; SlotUImgr.Instance.UpdateUI(); } public void StartChanceMode() { GameMain.Instance.SoundMgr.PlaySe("casino_SE011.ogg", false); this.isChanceMode = true; this.normalCount = 0; this.chanceModeCount = 0; base.StartCoroutine(this.ChenceModeFade(1.5f)); } public void EndChanceMode() { this.isChanceMode = false; this.normalCount = 0; this.chanceModeCount = 0; Material[] materials = this.slotMachine.GetComponent().materials; foreach (Material material in materials) { Debug.Log("mat = " + material.name); if (material.name == "Slot_Panel (Instance)") { Debug.Log("mat.texture = " + material.mainTexture); material.mainTexture = this.tex[3]; this.nowTexId = 0; } } } public IEnumerator ChenceModeFade(float time) { SlotUImgr.Instance.SetUIActive(false); float endTime = Time.time + time; this.fadeMask.SetActive(true); GameMain.Instance.MainCamera.FadeOut(time, false, null, false, Color.white); while (GameMain.Instance.MainCamera.IsFadeProc()) { yield return null; } Material[] mats = this.slotMachine.GetComponent().materials; foreach (Material material in mats) { Debug.Log("mat = " + material.name); if (material.name == "Slot_Panel (Instance)") { Debug.Log("mat.texture = " + material.mainTexture); int num = UnityEngine.Random.Range(0, 3); material.mainTexture = this.tex[num]; this.nowTexId = num + 1; } } for (int j = 0; j < 10; j++) { base.StartCoroutine(this.LightLamp(this.customMaidLamp[j], true, this.lightingTime)); } GameMain.Instance.MainCamera.FadeIn(time, false, null, false, true, Color.white); while (GameMain.Instance.MainCamera.IsFadeProc()) { yield return null; } SlotUImgr.Instance.SetUIActive(true); this.fadeMask.SetActive(false); yield return null; yield break; } public void AllReelsStopWait() { int num = 0; int num2 = -1; int num3 = -1; for (int i = 0; i < 3; i++) { if (this.reels[i].GetComponent().state == 5) { num++; num3 = i; } if (!this.buttonFlg[i]) { num2 = i; } } if (num == 0 && this.fixedBar) { this.fixedWinSymbol = 1; this.fixedLine = 1; this.fixedBar = false; } if (this.state == 7) { if (num == 1) { this.stopIdArray[0] = num3; this.FirstStopCheck(num3); this.stopCount = 1; this.isBlock = false; } } else if (this.state == 8 && num == 2 && num2 != -1) { this.stopCount = 2; this.stopIdArray[1] = 3 - (num2 + this.stopIdArray[0]); this.stopIdArray[2] = num2; this.CherryStopCheck(this.stopIdArray[1]); this.ReachCheck(num2); this.isBlock = false; } if (num == 3) { this.stopCount = 3; this.CherryStopCheck(this.stopIdArray[2]); this.state = 10; SlotUImgr.Instance.UpdateUI(); } } public IEnumerator AutoBet() { this.state = 3; GameMain.Instance.CharacterMgr.status.casinoCoin -= 300L; yield return new WaitForSeconds(0.4f); GameMain.Instance.SoundMgr.PlaySe("casino_SE005.ogg", false); base.StartCoroutine(this.LightLamp(this.slotLight[0], true, 0.1f)); base.StartCoroutine(this.LightLamp(this.hitLight[0], true, 0.1f)); this.credit -= 100L; this.CreditUpdate(); yield return new WaitForSeconds(0.1f); GameMain.Instance.SoundMgr.PlaySe("casino_SE005.ogg", false); base.StartCoroutine(this.LightLamp(this.slotLight[1], true, 0.1f)); base.StartCoroutine(this.LightLamp(this.hitLight[1], true, 0.1f)); base.StartCoroutine(this.LightLamp(this.hitLight[2], true, 0.1f)); this.credit -= 100L; this.CreditUpdate(); yield return new WaitForSeconds(0.1f); GameMain.Instance.SoundMgr.PlaySe("casino_SE005.ogg", false); base.StartCoroutine(this.LightLamp(this.slotLight[2], true, 0.1f)); base.StartCoroutine(this.LightLamp(this.hitLight[3], true, 0.1f)); base.StartCoroutine(this.LightLamp(this.hitLight[4], true, 0.1f)); this.credit -= 100L; this.CreditUpdate(); SlotUImgr.Instance.UpdateUI(); yield return new WaitForSeconds(0.1f); this.state = 4; yield break; } public IEnumerator AutoLeverOn() { this.state = 5; float time = 0f; float limitTime = 0.25f; Quaternion from = Quaternion.Euler(-90f, 90f, 0f); Quaternion to = Quaternion.Euler(-50f, 90f, 0f); while (time < limitTime) { if (time < limitTime) { time += Time.deltaTime; if (time < limitTime / 2f) { this.lever.transform.rotation = Quaternion.Slerp(from, to, time * 8f); } else { this.lever.transform.rotation = Quaternion.Slerp(to, from, time * 8f - 1f); } } yield return null; } yield return new WaitForSeconds(0f); GameMain.Instance.SoundMgr.PlaySe("casino_SE006.ogg", false); for (int i = 0; i < 3; i++) { this.reels[i].GetComponent().ChangeState(1); base.StartCoroutine(this.LightLamp(this.buttons[i].transform.GetChild(0).gameObject, true, this.lightingTime)); this.buttonFlg[i] = false; this.StopButtons[i].interactable = true; } this.state = 6; SlotUImgr.Instance.UpdateUI(); yield break; } private void FirstStopCheck(int id) { int[] array = new int[] { this.reels[id].GetComponent().reelNo + 1, this.reels[id].GetComponent().reelNo, this.reels[id].GetComponent().reelNo - 1 }; for (int i = 0; i < 3; i++) { if (array[i] > 21) { array[i] -= 21; } if (array[i] < 1) { array[i] += 21; } } int[] array2 = new int[] { SlotManager.reelArray[id, 21 - array[0]], SlotManager.reelArray[id, 21 - array[1]], SlotManager.reelArray[id, 21 - array[2]] }; this.CheckFirstStopReel(array2); for (int j = 0; j < 3; j++) { if (array2[j] == 0) { Debug.Log("7!"); if (this.isChanceMode) { base.StartCoroutine(this.LightLamp(this.sevenLamp[id], true, this.lightingTime)); } } else if (array2[j] == 6 && id == 0) { this.SymbolLight(id, array[j]); Debug.Log("Cherry!"); } } this.state = 8; } private void CherryStopCheck(int id) { int[] array = new int[] { this.reels[id].GetComponent().reelNo + 1, this.reels[id].GetComponent().reelNo, this.reels[id].GetComponent().reelNo - 1 }; for (int i = 0; i < 3; i++) { if (array[i] > 21) { array[i] -= 21; } if (array[i] < 1) { array[i] += 21; } } int[] array2 = new int[] { SlotManager.reelArray[id, 21 - array[0]], SlotManager.reelArray[id, 21 - array[1]], SlotManager.reelArray[id, 21 - array[2]] }; for (int j = 0; j < 3; j++) { if (array2[j] == 6 && id == 0) { this.SymbolLight(id, array[j]); Debug.Log("Cherry!"); } } } private void WinCherryCheck() { int[] array = new int[] { this.reels[0].GetComponent().reelNo, this.reels[1].GetComponent().reelNo }; int[] array2 = new int[] { this.reels[0].GetComponent().reelNo + 1, this.reels[1].GetComponent().reelNo + 1 }; int[] array3 = new int[] { this.reels[0].GetComponent().reelNo - 1, this.reels[1].GetComponent().reelNo - 1 }; for (int i = 0; i < 2; i++) { if (array2[i] > 21) { array2[i] -= 21; } if (array3[i] < 1) { array3[i] += 21; } } if (SlotManager.reelArray[0, 21 - array2[0]] == 6) { Debug.Log("1列目上にチェリーが揃いました。"); this.state = 11; this.cherryWin = 2; this.winLine.Add(2); this.winLine.Add(4); this.SymbolLight(0, array2[0]); } if (SlotManager.reelArray[0, 21 - array[0]] == 6) { Debug.Log("1列目真ん中にチェリーが揃いました。"); this.state = 11; this.cherryWin = 1; this.winLine.Add(1); this.SymbolLight(0, array[0]); } if (SlotManager.reelArray[0, 21 - array3[0]] == 6) { Debug.Log("1列目下にチェリーが揃いました。"); this.state = 11; this.cherryWin = 2; this.winLine.Add(3); this.winLine.Add(5); this.SymbolLight(0, array3[0]); } if (SlotManager.reelArray[0, 21 - array2[0]] == 6 && SlotManager.reelArray[1, 21 - array2[1]] == 6) { Debug.Log("上列にチェリーが揃いました。"); this.state = 11; this.cherryWin = 3; this.winLine.Add(2); this.SymbolLight(0, array2[0]); this.SymbolLight(1, array2[1]); } if (SlotManager.reelArray[0, 21 - array[0]] == 6 && SlotManager.reelArray[1, 21 - array[1]] == 6) { Debug.Log("中央列にチェリーが揃いました。"); this.state = 11; this.winLine.Add(1); this.cherryWin = 4; this.SymbolLight(0, array[0]); this.SymbolLight(1, array[1]); } if (SlotManager.reelArray[0, 21 - array3[0]] == 6 && SlotManager.reelArray[1, 21 - array3[1]] == 6) { Debug.Log("下列にチェリーが揃いました。"); this.state = 11; this.cherryWin = 3; this.winLine.Add(3); this.SymbolLight(0, array3[0]); this.SymbolLight(1, array3[1]); } if (SlotManager.reelArray[0, 21 - array2[0]] == 6 && SlotManager.reelArray[1, 21 - array[1]] == 6) { Debug.Log("\列にチェリーが揃いました。"); this.state = 11; this.cherryWin = 5; this.SymbolLight(0, array2[0]); this.SymbolLight(1, array[1]); } if (SlotManager.reelArray[0, 21 - array3[0]] == 6 && SlotManager.reelArray[1, 21 - array[1]] == 6) { Debug.Log("/列にチェリーが揃いました。"); this.state = 11; this.cherryWin = 5; this.SymbolLight(0, array3[0]); this.SymbolLight(1, array[1]); } } private void CheckFirstStopReel(int[] symbols) { int num = 0; int[] array = new int[3]; for (int i = 0; i < 3; i++) { if (!this.isChanceMode) { switch (symbols[i]) { case 0: num += this.normalDividend[symbols[i]]; array[i] = this.normalDividend[symbols[i]]; break; case 1: num += this.normalDividend[symbols[i]]; array[i] = this.normalDividend[symbols[i]]; break; case 2: num += this.normalDividend[symbols[i]]; array[i] = this.normalDividend[symbols[i]]; break; case 3: num += this.normalDividend[symbols[i]]; array[i] = this.normalDividend[symbols[i]]; break; case 4: num += this.normalDividend[symbols[i]]; array[i] = this.normalDividend[symbols[i]]; break; case 5: num += this.normalDividend[symbols[i]]; array[i] = this.normalDividend[symbols[i]]; break; case 6: num += this.normalDividend[symbols[i]]; array[i] = this.normalDividend[symbols[i]]; break; } } else { switch (symbols[i]) { case 0: num += this.chanceDividend[symbols[i]]; array[i] = this.chanceDividend[symbols[i]]; break; case 1: num += this.chanceDividend[symbols[i]]; array[i] = this.chanceDividend[symbols[i]]; break; case 2: num += this.chanceDividend[symbols[i]]; array[i] = this.chanceDividend[symbols[i]]; break; case 3: num += this.chanceDividend[symbols[i]]; array[i] = this.chanceDividend[symbols[i]]; break; case 4: num += this.chanceDividend[symbols[i]]; array[i] = this.chanceDividend[symbols[i]]; break; case 5: num += this.chanceDividend[symbols[i]]; array[i] = this.chanceDividend[symbols[i]]; break; case 6: num += this.chanceDividend[symbols[i]]; array[i] = this.chanceDividend[symbols[i]]; break; } } } Debug.Log(string.Concat(new string[] { "確率:", array[0].ToString(), ", ", array[1].ToString(), ", ", array[2].ToString() })); Debug.Log("probability = " + num); UnityEngine.Random.Range(0, 100); int num2; if (this.isChanceMode) { num2 = UnityEngine.Random.Range(0, this.chanceMaxProb); } else { num2 = UnityEngine.Random.Range(0, this.normalMaxProb); } Debug.Log("rand = " + num2); if (num > num2) { for (int j = 0; j < 3; j++) { if (array[j] > num2) { if (!this.fixedBar) { Debug.Log("" + symbols[j] + "が確定しました"); this.fixedWinSymbol = symbols[j]; this.fixedLine = j; } else { Debug.Log("Bar半確定"); } break; } num2 -= array[j]; } } else { Debug.Log("外れ"); } } private void ReachCheck(int id) { this.state = 9; this.reachSymbolList = new List(); this.idList = new List(); this.reelNoList = new List(); int[] array = new int[] { this.reels[0].GetComponent().reelNo, this.reels[1].GetComponent().reelNo, this.reels[2].GetComponent().reelNo }; int[] array2 = new int[] { this.reels[0].GetComponent().reelNo + 1, this.reels[1].GetComponent().reelNo + 1, this.reels[2].GetComponent().reelNo + 1 }; int[] array3 = new int[] { this.reels[0].GetComponent().reelNo - 1, this.reels[1].GetComponent().reelNo - 1, this.reels[2].GetComponent().reelNo - 1 }; for (int i = 0; i < 3; i++) { if (array2[i] > 21) { array2[i] -= 21; } if (array3[i] < 1) { array3[i] += 21; } if (array[i] < 1) { array[i] += 21; } } int[] array4 = new int[] { SlotManager.reelArray[0, 21 - array2[0]], SlotManager.reelArray[1, 21 - array2[1]], SlotManager.reelArray[2, 21 - array2[2]] }; int[] array5 = new int[] { SlotManager.reelArray[0, 21 - array[0]], SlotManager.reelArray[1, 21 - array[1]], SlotManager.reelArray[2, 21 - array[2]] }; int[] array6 = new int[] { SlotManager.reelArray[0, 21 - array3[0]], SlotManager.reelArray[1, 21 - array3[1]], SlotManager.reelArray[2, 21 - array3[2]] }; for (int j = 0; j < 3; j++) { if (id == j) { array5[j] = -1; array4[j] = -1; array6[j] = -1; } } if (array5[0] == array5[1] || array5[0] == array5[2] || array5[1] == array5[2]) { Debug.Log("1:リーチです"); this.reachFlg = true; if (array5[0] != -1) { this.reachSymbolList.Add(array5[0]); } else { this.reachSymbolList.Add(array5[1]); } for (int k = 0; k < 3; k++) { if (array5[k] != -1) { this.idList.Add(k); this.reelNoList.Add(array[k]); } } this.reachLine.Add(1); } if (array4[0] == array4[1] || array4[0] == array4[2] || array4[1] == array4[2]) { this.reachFlg = true; if (array4[0] != -1) { this.reachSymbolList.Add(array4[0]); } else { this.reachSymbolList.Add(array4[1]); } for (int l = 0; l < 3; l++) { if (array4[l] != -1) { this.idList.Add(l); this.reelNoList.Add(array2[l]); } } this.reachLine.Add(2); } if (array6[0] == array6[1] || array6[0] == array6[2] || array6[1] == array6[2]) { Debug.Log("3:リーチです"); this.reachFlg = true; if (array6[0] != -1) { this.reachSymbolList.Add(array6[0]); } else { this.reachSymbolList.Add(array6[1]); } for (int m = 0; m < 3; m++) { if (array6[m] != -1) { this.idList.Add(m); this.reelNoList.Add(array3[m]); } } this.reachLine.Add(3); } if (array4[0] == array5[1] || array5[1] == array6[2] || array4[0] == array6[2]) { Debug.Log("4:リーチです"); this.reachFlg = true; if (array4[0] != -1) { this.reachSymbolList.Add(array4[0]); } else { this.reachSymbolList.Add(array5[1]); } if (array4[0] == -1) { this.idList.Add(1); this.reelNoList.Add(array[1]); this.idList.Add(2); this.reelNoList.Add(array3[2]); } if (array5[1] == -1) { this.idList.Add(0); this.reelNoList.Add(array2[0]); this.idList.Add(2); this.reelNoList.Add(array3[2]); } if (array6[2] == -1) { this.idList.Add(0); this.reelNoList.Add(array2[0]); this.idList.Add(1); this.reelNoList.Add(array[1]); } this.reachLine.Add(4); } if (array6[0] == array5[1] || array5[1] == array4[2] || array6[0] == array4[2]) { Debug.Log("5:リーチです"); this.reachFlg = true; if (array6[0] != -1) { this.reachSymbolList.Add(array6[0]); } else { this.reachSymbolList.Add(array5[1]); } if (array6[0] == -1) { this.idList.Add(1); this.reelNoList.Add(array[1]); this.idList.Add(2); this.reelNoList.Add(array2[2]); } if (array5[1] == -1) { this.idList.Add(0); this.reelNoList.Add(array3[0]); this.idList.Add(2); this.reelNoList.Add(array2[2]); } if (array4[2] == -1) { this.idList.Add(0); this.reelNoList.Add(array3[0]); this.idList.Add(1); this.reelNoList.Add(array[1]); } this.reachLine.Add(5); } foreach (int num in this.reachSymbolList) { } int num2 = 0; List list = new List(); foreach (int id2 in this.idList) { this.SymbolLight(id2, this.reelNoList[num2]); num2++; } foreach (int num3 in this.reachLine) { } if (this.reachFlg) { GameMain.Instance.SoundMgr.PlaySe("casino_SE008.ogg", false); base.StartCoroutine(this.LightLamp(this.ballLamp, true, this.lightingTime)); base.StartCoroutine(this.LightLamp(this.topLamp, true, this.lightingTime)); if (this.isChanceMode) { using (List.Enumerator enumerator4 = this.reachSymbolList.GetEnumerator()) { while (enumerator4.MoveNext()) { if (enumerator4.Current == 0) { Debug.Log("seven reach!"); base.StartCoroutine(this.LightLamp(this.sevenLamp[this.stopIdArray[1]], true, this.lightingTime)); string f_strFileName = null; switch (this.nowTexId) { case 1: f_strFileName = "H0_09451.ogg"; break; case 2: f_strFileName = "H1_09950.ogg"; break; case 3: f_strFileName = "H2_10068.ogg"; break; default: Debug.LogError("該当するボイスがありません。"); break; } GameMain.Instance.SoundMgr.PlaySe(f_strFileName, false); } } } } } } private void SymbolLight(int id, int reelNo) { float y = this.reelLights[id].GetComponent().sharedMaterial.GetTextureOffset("_MainTex").y; Vector4 value; if (reelNo > 9) { value = new Vector4(0f, 0.04761905f * (float)reelNo, 0f, 0.04761905f * (float)(reelNo - 1)); } else { value = new Vector4(0f, 0.04761905f * (float)(reelNo + 21), 0f, 0.04761905f * (float)(reelNo + 20)); } if (reelNo == 9) { if (y < 0.1f) { value = new Vector4(0f, Mathf.Abs(1f - 0.04761905f * (float)(reelNo + 21)), 0f, Mathf.Abs(1f - 0.04761905f * (float)(reelNo + 20))); } else { value = new Vector4(0f, 0.04761905f * (float)(reelNo + 21), 0f, 0.04761905f * (float)(reelNo + 20)); } } else if (reelNo == 8) { if ((double)y > 0.9) { value = new Vector4(0f, 0.04761905f * (float)reelNo + 1f, 0f, 0.04761905f * (float)(reelNo - 1) + 1f); } else { value = new Vector4(0f, 0.04761905f * (float)reelNo, 0f, 0.04761905f * (float)(reelNo - 1)); } } if (this.idReach[id] == 0) { this.reelLights[id].GetComponent().material.SetVector("_Mask1", value); } else if (this.idReach[id] == 1) { this.reelLights[id].GetComponent().material.SetVector("_Mask2", value); } else { this.reelLights[id].GetComponent().material.SetVector("_Mask3", value); } this.idReach[id]++; if (this.idReach[id] > 2) { this.idReach[id] = 0; } } private void WinCheck() { this.state = 13; int[] array = new int[] { this.reels[0].GetComponent().reelNo, this.reels[1].GetComponent().reelNo, this.reels[2].GetComponent().reelNo }; int[] array2 = new int[] { this.reels[0].GetComponent().reelNo + 1, this.reels[1].GetComponent().reelNo + 1, this.reels[2].GetComponent().reelNo + 1 }; int[] array3 = new int[] { this.reels[0].GetComponent().reelNo - 1, this.reels[1].GetComponent().reelNo - 1, this.reels[2].GetComponent().reelNo - 1 }; for (int i = 0; i < 3; i++) { if (array2[i] > 21) { array2[i] -= 21; } if (array3[i] < 1) { array3[i] += 21; } } for (int j = 0; j < 3; j++) { Vector4 value = new Vector4(0f, 0f, 0f, 0f); this.reelLights[j].GetComponent().material.SetVector("_Mask1", value); this.reelLights[j].GetComponent().material.SetVector("_Mask2", value); this.reelLights[j].GetComponent().material.SetVector("_Mask3", value); } 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]]) { Debug.Log("1LINE目に" + SlotManager.reelArray[0, 21 - array[0]] + "が揃いました。"); this.state = 11; this.winLine.Add(1); this.winSynbol = SlotManager.reelArray[0, 21 - array[0]]; this.SymbolLight(0, array[0]); this.SymbolLight(1, array[1]); this.SymbolLight(2, array[2]); } 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]]) { Debug.Log("2LINE目上段に" + SlotManager.reelArray[0, 21 - array2[0]] + "が揃いました。"); this.state = 11; this.winLine.Add(2); this.winSynbol = SlotManager.reelArray[0, 21 - array2[0]]; this.SymbolLight(0, array2[0]); this.SymbolLight(1, array2[1]); this.SymbolLight(2, array2[2]); } 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]]) { Debug.Log("2LINE目下段に" + SlotManager.reelArray[0, 21 - array3[0]] + "が揃いました。"); this.state = 11; this.winLine.Add(3); this.winSynbol = SlotManager.reelArray[0, 21 - array3[0]]; this.SymbolLight(0, array3[0]); this.SymbolLight(1, array3[1]); this.SymbolLight(2, array3[2]); } 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]]) { Debug.Log("上→下に" + SlotManager.reelArray[0, 21 - array2[0]] + "が揃いました。"); this.state = 11; this.winLine.Add(4); this.winSynbol = SlotManager.reelArray[0, 21 - array2[0]]; this.SymbolLight(0, array2[0]); this.SymbolLight(1, array[1]); this.SymbolLight(2, array3[2]); } 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]]) { Debug.Log("下→上に" + SlotManager.reelArray[0, 21 - array3[0]] + "が揃いました。"); this.state = 11; this.winLine.Add(5); this.winSynbol = SlotManager.reelArray[0, 21 - array3[0]]; this.SymbolLight(0, array3[0]); this.SymbolLight(1, array[1]); this.SymbolLight(2, array2[2]); } this.WinCherryCheck(); if (this.state == 11 && this.winSynbol == 0) { this.state = 14; } } private void Win() { this.state = 12; base.StartCoroutine(this.Payout()); for (int i = 0; i < 3; i++) { base.StartCoroutine(this.BlinkLamp(this.slotLight[i], 0.5f, 0f)); } base.StartCoroutine(this.BlinkLamp(this.topLamp, 0.1f, 0f)); base.StartCoroutine(this.BlinkLamp(this.ballLamp, 0.1f, 0f)); for (int j = 0; j < 5; j++) { base.StartCoroutine(this.LightLamp(this.hitLight[j], false, this.lightingTime)); } foreach (int num in this.winLine) { base.StartCoroutine(this.LightLamp(this.hitLight[num - 1], true, this.lightingTime)); } base.StartCoroutine(this.BlinkLamp(this.winMark, 0.1f, 0f)); } private IEnumerator BigBonus() { this.state = 15; GameMain.Instance.SoundMgr.PlaySe("casino_SE009.ogg", false); this.isBigBonusBgmPlay = true; this.isPayoutRunning = true; base.StartCoroutine(this.BlinkBigBonusLamp()); base.StartCoroutine(this.LightLamp(this.sevenLamp[this.stopIdArray[2]], true, this.lightingTime)); base.StartCoroutine(this.BlinkLamp(this.heartLamp, 0.1f, 0f)); for (int i = 0; i < 3; i++) { base.StartCoroutine(this.BlinkLamp(this.slotLight[i], 0.5f, 0f)); } base.StartCoroutine(this.BlinkLamp(this.topLamp, 0.1f, 0f)); base.StartCoroutine(this.BlinkLamp(this.ballLamp, 0.1f, 0f)); base.StartCoroutine(this.BlinkLamp(this.winMark, 0.1f, 0f)); for (int j = 0; j < 5; j++) { base.StartCoroutine(this.LightLamp(this.hitLight[j], true, this.lightingTime)); } yield return new WaitForSeconds(6f); string str = null; switch (this.nowTexId) { case 1: str = "H0_09452.ogg"; break; case 2: str = "H1_09951.ogg"; break; case 3: str = "H2_10069.ogg"; break; default: Debug.LogError("該当するボイスがありません。"); break; } GameMain.Instance.SoundMgr.PlaySe(str, false); yield return new WaitForSeconds(6.5f); this.isBigBonusBgmPlay = false; base.StartCoroutine(this.Payout()); yield return null; yield break; } private IEnumerator BlinkBigBonusLamp() { float waitTime = 0.5f; for (int j = 0; j < 8; j++) { base.StartCoroutine(this.LightLamp(this.bigbonus[j], true, 0.1f)); } for (int i = 0; i < 8; i++) { base.StartCoroutine(this.BlinkLamp(this.bigbonus[i], 0.5f, 1.5f)); yield return new WaitForSeconds(waitTime); } yield return null; yield break; } private IEnumerator Payout() { int payCredit = 0; int totalpay = 0; this.isPayoutRunning = true; if (this.cherryWin != 0) { if (!this.isChanceMode) { switch (this.cherryWin) { case 1: this.fixedBar = true; payCredit = this.payDividend[6]; break; case 2: payCredit = this.payDividend[6] * 2; break; case 3: this.chanceCorrect = 19; payCredit = this.payDividend[6] * 2; break; case 4: this.fixedBar = true; payCredit = this.payDividend[6] * 2; break; case 5: payCredit = this.payDividend[6] * 3; break; } } else { switch (this.cherryWin) { case 1: payCredit = this.payDividend[6]; break; case 2: payCredit = this.payDividend[6] * 2; break; case 3: payCredit = this.payDividend[6]; break; case 4: payCredit = this.payDividend[6] * 2; break; case 5: payCredit = this.payDividend[6] * 3; break; } } this.PayoutUpdate(payCredit); yield return new WaitForSeconds(1f); GameMain.Instance.CharacterMgr.status.casinoCoin += (long)payCredit; totalpay += payCredit; while (payCredit > 0) { GameMain.Instance.SoundMgr.PlaySe("casino_SE010.ogg", true); payCredit -= 100; this.PayoutUpdate(payCredit); this.credit += 100L; this.CreditUpdate(); yield return new WaitForSeconds((float)this.msCount / 1000f); } SlotUImgr.Instance.UpdateUI(); GameMain.Instance.SoundMgr.StopSe(); } if (this.winSynbol != -1) { yield return new WaitForSeconds(0.5f); switch (this.winSynbol) { case 1: this.chanceCorrect = 99; break; } payCredit = this.payDividend[this.winSynbol]; this.PayoutUpdate(payCredit); yield return new WaitForSeconds(1f); GameMain.Instance.CharacterMgr.status.casinoCoin += (long)payCredit; totalpay += payCredit; while (payCredit > 0) { GameMain.Instance.SoundMgr.PlaySe("casino_SE010.ogg", true); payCredit -= 100; this.PayoutUpdate(payCredit); this.credit += 100L; this.CreditUpdate(); yield return new WaitForSeconds((float)this.msCount / 1000f); } CasinoDataMgr.Instance.AddTotalCoin(totalpay); SlotUImgr.Instance.UpdateUI(); GameMain.Instance.SoundMgr.StopSe(); yield return new WaitForSeconds(0.5f); } this.isPayoutRunning = false; if (this.winSynbol == 0) { this.EndChanceMode(); this.chanceCorrect = -1; } this.state = 13; yield break; } private void CreditUpdate() { long[] array = new long[6]; long num = this.credit; for (int i = 0; i < 6; i++) { array[i] = num % 10L; num /= 10L; } for (int j = 0; j < 6; j++) { Vector2 value = new Vector2(0f, (float)(-(float)array[j]) / 10f); this.creditNumber[j].GetComponent().sharedMaterial.SetTextureOffset("_MainTex", value); } } private void PayoutUpdate(int payout) { int[] array = new int[6]; int num = payout; for (int i = 0; i < 6; i++) { array[i] = num % 10; num /= 10; } for (int j = 0; j < 6; j++) { Vector2 value = new Vector2(0f, (float)(-(float)array[j]) / 10f); this.payoutNumber[j].GetComponent().sharedMaterial.SetTextureOffset("_MainTex", value); } } private IEnumerator BlinkLamp(GameObject obj, float waitTime, float waitTime2 = 0f) { if (waitTime2 == 0f) { waitTime2 = waitTime; } while (this.isPayoutRunning) { base.StartCoroutine(this.LightLamp(obj, true, this.lightingTime)); yield return new WaitForSeconds(waitTime2); base.StartCoroutine(this.LightLamp(obj, false, this.lightingTime)); yield return new WaitForSeconds(waitTime); } yield break; } public IEnumerator LightLamp(GameObject obj, bool flg, float time) { float startTime = Time.time; float alpha = 0.5f / time; if (!flg) { if (!obj.activeSelf) { yield break; } } obj.SetActive(true); while (time > Time.time - startTime) { float setAlpha = alpha * (Time.time - startTime); if (flg) { Color value = new Color(0.5f, 0.5f, 0.5f, setAlpha); obj.GetComponent().material.SetColor("_TintColor", value); } else { Color value2 = new Color(0.5f, 0.5f, 0.5f, 0.5f - setAlpha); obj.GetComponent().material.SetColor("_TintColor", value2); } yield return null; } if (!flg) { Color value3 = new Color(0.5f, 0.5f, 0.5f, 0f); obj.GetComponent().material.SetColor("_TintColor", value3); obj.SetActive(false); } else { Color value4 = new Color(0.5f, 0.5f, 0.5f, 0.5f); obj.GetComponent().material.SetColor("_TintColor", value4); } yield break; } [HideInInspector] public List reachSymbolList = new List(); [HideInInspector] public List idList = new List(); [HideInInspector] public List reelNoList = new List(); [HideInInspector] public List reachLine = new List(); [HideInInspector] public int[] normalDividend = new int[8]; [HideInInspector] public int[] chanceDividend = new int[8]; [HideInInspector] public int[] payDividend = new int[8]; [HideInInspector] public int normalMaxProb; [HideInInspector] public int chanceMaxProb; [HideInInspector] private List winLine; [HideInInspector] public bool[] buttonFlg = new bool[3]; [HideInInspector] public int[] stopIdArray = new int[3]; [HideInInspector] public int[] idReach = new int[3]; [HideInInspector] public bool reachFlg; [HideInInspector] private int winSynbol = -1; [HideInInspector] private bool isPayoutRunning; public List