using System; using System.Collections.Generic; using UnityEngine; public class Reel : MonoBehaviour { private void Awake() { this.state = 0; this.childList = base.transform.gameObject.GetComponentsInChildren(); this.sManager = GameObject.Find("SlotManager").GetComponent(); this.childList[0].GetComponent().sharedMaterial.SetTextureOffset("_MainTex", new Vector2(0f, 0f)); this.childList[1].GetComponent().sharedMaterial.SetTextureOffset("_MainTex", new Vector2(0f, 0f)); this.startTime = 0f; this.keepTime = 0f; this.isSlide = false; this.time = 0f; this.slipStopNo = 0; this.slipNoToOffset = 0f; this.dontStopPlace = new List(); this.dontStopSymbol = new List(); } private void Update() { if (this.state == 2 || this.isSlide) { this.time = Time.time - this.startTime + this.keepTime; this.scroll = Mathf.Repeat(this.time * this.speed, 1f); this.offset = new Vector2(0f, this.scroll); this.childList[0].GetComponent().sharedMaterial.SetTextureOffset("_MainTex", this.offset); this.childList[1].GetComponent().sharedMaterial.SetTextureOffset("_MainTex", this.offset); } this.StateCheck(); } private void StateCheck() { if (this.state == 1) { this.speed = 1.2f; this.state = 2; this.startTime = Time.time; } if (this.state == 3) { int num = (int)(this.scroll / 0.04761905f + this.slip); float num2 = (float)num / 21f; this.reelNo = num + 9; if (this.reelNo > 21) { this.reelNo -= 21; } this.symbolNo = SlotManager.reelArray[this.id, 21 - this.reelNo]; if (this.sManager.fixedWinSymbol == -1 && this.sManager.reachFlg) { int num3 = 0; using (List.Enumerator enumerator = this.sManager.reachLine.GetEnumerator()) { while (enumerator.MoveNext()) { switch (enumerator.Current) { case 1: this.dontStopPlace.Add(0); this.dontStopSymbol.Add(this.sManager.reachSymbolList[num3]); break; case 2: this.dontStopPlace.Add(-1); this.dontStopSymbol.Add(this.sManager.reachSymbolList[num3]); break; case 3: this.dontStopPlace.Add(1); this.dontStopSymbol.Add(this.sManager.reachSymbolList[num3]); break; case 4: this.dontStopPlace.Add(this.id - 1); this.dontStopSymbol.Add(this.sManager.reachSymbolList[num3]); break; case 5: this.dontStopPlace.Add(1 - this.id); this.dontStopSymbol.Add(this.sManager.reachSymbolList[num3]); break; } num3++; } } } this.state = 4; } if (this.state == 4) { if (this.symbolNo == 6 && this.id == 0 && !this.isSlide && !this.sManager.isChanceMode && this.sManager.normalCount <= 20) { this.slip = 3f; } int num4 = 0; foreach (int num5 in this.dontStopSymbol) { if (num5 != 3) { for (;;) { int num6 = (int)(this.scroll / 0.04761905f + this.slip); float num7 = (float)num6 / 21f; int num8 = num6 + 9 - this.dontStopPlace[num4]; if (num8 > 21) { num8 -= 21; } else if (num8 <= 0) { num8 += 21; } if (num5 != SlotManager.reelArray[this.id, 21 - num8] || this.sManager.fixedWinSymbol != -1) { break; } this.slip += 1f; } } num4++; } if (!this.isSlide) { this.slipStopNo = (int)(this.scroll / 0.04761905f + this.slip); this.slipNoToOffset = (float)this.slipStopNo / 21f; if (this.sManager.fixedWinSymbol != -1) { for (int i = 0; i < 12; i++) { this.slipStopNo = (int)(this.scroll / 0.04761905f + (float)i + 1f); this.slipNoToOffset = (float)this.slipStopNo / 21f; this.reelNo = this.slipStopNo + 9 - (this.sManager.fixedLine - 1); if (this.reelNo > 21) { this.reelNo -= 21; } if (SlotManager.reelArray[this.id, 21 - this.reelNo] == this.sManager.fixedWinSymbol) { break; } } } this.isSlide = true; } if (this.isSlide) { this.slipNoToOffset = (float)this.slipStopNo / 21f; if (this.slipNoToOffset >= 1f) { this.slipNoToOffset -= 1f; } if (this.scroll >= this.slipNoToOffset) { this.offset = new Vector2(0f, this.slipNoToOffset); this.childList[0].GetComponent().sharedMaterial.SetTextureOffset("_MainTex", this.offset); this.childList[1].GetComponent().sharedMaterial.SetTextureOffset("_MainTex", this.offset); if (this.sManager.fixedLine != -1) { this.reelNo = this.slipStopNo + 9; } else { this.reelNo = this.slipStopNo + 9; } if (this.reelNo > 21) { this.reelNo -= 21; } this.symbolNo = SlotManager.reelArray[this.id, 21 - this.reelNo]; this.isSlide = false; } } if (!this.isSlide) { this.speed = 0f; this.slip = 1f; this.keepTime = this.time; this.state = 0; this.slipStopNo = 0; this.slipNoToOffset = 0f; this.dontStopPlace = new List(); this.dontStopSymbol = new List(); } } if (this.state == 0) { this.state = 5; } } public void ChangeState(int newState) { this.state = newState; } public const int STATE_STOP = 0; public const int STATE_PUSH_START = 1; public const int STATE_START = 2; public const int STATE_PUSH_STOP = 3; public const int STATE_STOP_WAIT = 4; public const int STATE_WAIT = 5; public int state; public int id; public int reelNo; public float slip = 1f; private int symbolNo; private float time; private float keepTime; private float startTime; [Range(0f, 10f)] public float speed = 10f; public int spriteCount = 2; private Vector3 spriteSize; private Vector3 stopPosition; public ReelScroll[] childList; private float scroll; private Vector2 offset; private SlotManager sManager; private bool isSlide; private int slipStopNo; private float slipNoToOffset; private List dontStopSymbol; private List dontStopPlace; }