| 123456789101112131415161718192021222324252627282930313233343536373839404142 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- public class GameRuleView : MonoBehaviour
- {
- public int[] rule1;
- public int[] rule2;
- int ruleLookIndex = 0;
- static bool createLock = false;
- public static void Create()
- {
- if (createLock || GameMgr.gameType == 0) return;
- createLock = true;
- GameObject.Instantiate(Resources.Load<GameObject>("Prefabs/Views/GameRuleView"));
- }
- void Start()
- {
- GameMgr.ins.addLockerForGamePause(this);
- this.Click();
- }
- void OnDestroy()
- {
- createLock = false;
- GameMgr.ins.removeLockerForGamePause(this);
- }
- public void Click() {
- int[] rule = (int[]) this.GetType().GetField("rule" + GameMgr.gameType).GetValue(this);
- if (ruleLookIndex >= rule.Length) {
- Destroy(this.gameObject);
- GameMgr.ins.FinishGameRuleGuide();
- } else {
- this.transform.Find("BG/Panel/Content").GetComponent<TextAutoLanguage>().SetText(rule[ruleLookIndex]);
- ruleLookIndex++;
- }
- }
- }
|