| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- 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()
- {
- if (GlobalData.pkMatchType != PKMatchType.OnlinePK) {
- GameMgr.ins.addLockerForGamePause(this);
- }
- this.Click();
- }
- void OnDestroy()
- {
- createLock = false;
- if (GlobalData.pkMatchType != PKMatchType.OnlinePK) {
- if (GameMgr.ins) GameMgr.ins.removeLockerForGamePause(this);
- }
- }
- public void Click() {
- int[] rule = null;
- if (GameMgr.gameType == 1) {
- rule = rule1;
- } else if (GameMgr.gameType == 2 || GameMgr.gameType == 9) {
- rule = rule2;
- }
- if (ruleLookIndex >= rule.Length) {
- Destroy(this.gameObject);
- GameMgr.ins.FinishGameRuleGuide();
- } else {
- this.transform.Find("BG/Panel/Content").GetComponent<TextAutoLanguage>().SetText(rule[ruleLookIndex]);
- ruleLookIndex++;
- }
- }
- }
|