123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- using System.Collections.Generic;
- using UnityEditor;
- using UnityEngine;
- namespace ET
- {
- public enum ActInfoType
- {
- LightPole = 1,//明
- BackPole = 2,//回 //
- DarkPole = 3,//暗 // 手上3 外面1
- Peng = 4,//碰
- Chi = 5//吃
- }
- public class GameUtil : Singleton<GameUtil>
- {
- private Scene scene;
- private List<GameObject> cardCloneItem = new List<GameObject>() { null,null};
- public int curRequestCardVal = -1;
- public int curCardVal = -1;
- public Vector2 myHandCardSize = new Vector2(89,135);
- public Vector2 myShowCard = new Vector2(69,90);
- public void SetSceneComponent(Scene scene)
- {
- this.scene = scene;
- }
- public Scene GetSceneComponent()
- {
- return this.scene;
- }
- public void SetCardCloneItem(GameObject item,int index)
- {
- this.cardCloneItem[index] = item;
- }
- public GameObject GetCardCloneItem(int index)
- {
- return this.cardCloneItem[index];
- }
- public bool CheckIsSequence(List<int> cards)
- {
- if (cards == null || cards.Count < 3)
- {
- return false;
- }
- cards.Sort();
- int first = cards[0];
- for (int i = 1;i < cards.Count;i++)
- {
- if (first + 1 != cards[i])
- {
- return false;
- }
- first = cards[i];
- }
- return true;
- }
- //type == 0 碰
- //type == 1 gang
- public bool CheckIsSame(List<int> cards,int type)
- {
- int count = type == 0? 3 : 4;
- if (cards == null || cards.Count < count)
- {
- return false;
- }
- cards.Sort();
- int first = cards[0];
- for (int i = 1; i < cards.Count; i++)
- {
- if (first != cards[i])
- {
- return false;
- }
- }
- return true;
- }
- public GameObject InitializeObj(GameObject obj)
- {
- return UnityEngine.Object.Instantiate(obj);
- }
- }
- }
|