コード例 #1
0
    public static void setAllPokerWeiXuanZe()
    {
        // 优先使用热更新的代码
        if (ILRuntimeUtil.getInstance().checkDllClassHasFunc("PokerScript_hotfix", "setAllPokerWeiXuanZe"))
        {
            ILRuntimeUtil.getInstance().getAppDomain().Invoke("HotFix_Project.PokerScript_hotfix", "setAllPokerWeiXuanZe", null, null);
            return;
        }

        // 升级
        for (int i = 0; i < GameData.getInstance().m_myPokerObjList.Count; i++)
        {
            PokerScript pokerScript = GameData.getInstance().m_myPokerObjList[i].GetComponent <PokerScript>();

            pokerScript.setIsSelect(false);
            pokerScript.setIsJump(false);
        }

        // 斗地主
        for (int i = 0; i < DDZ_GameData.getInstance().m_myPokerObjList.Count; i++)
        {
            PokerScript pokerScript = DDZ_GameData.getInstance().m_myPokerObjList[i].GetComponent <PokerScript>();

            pokerScript.setIsSelect(false);
            pokerScript.setIsJump(false);
        }
    }
コード例 #2
0
    public void OnPointerUp(PointerEventData eventData)
    {
        // 优先使用热更新的代码
        if (ILRuntimeUtil.getInstance().checkDllClassHasFunc("PokerScript_hotfix", "OnPointerUp"))
        {
            ILRuntimeUtil.getInstance().getAppDomain().Invoke("HotFix_Project.PokerScript_hotfix", "OnPointerUp", null, eventData);
            return;
        }

        if (m_canTouch)
        {
            // 升级
            for (int i = 0; i < GameData.getInstance().m_myPokerObjList.Count; i++)
            {
                PokerScript pokerScript = GameData.getInstance().m_myPokerObjList[i].GetComponent <PokerScript>();

                pokerScript.setIsJump(pokerScript.getIsSelect());
            }

            // 斗地主
            for (int i = 0; i < DDZ_GameData.getInstance().m_myPokerObjList.Count; i++)
            {
                PokerScript pokerScript = DDZ_GameData.getInstance().m_myPokerObjList[i].GetComponent <PokerScript>();

                pokerScript.setIsJump(pokerScript.getIsSelect());
            }
        }
    }
コード例 #3
0
    public void setData(List <TLJCommon.PokerInfo> dipaiList)
    {
        // 优先使用热更新的代码
        if (ILRuntimeUtil.getInstance().checkDllClassHasFunc("ShowDiPokerScript_hotfix", "setData"))
        {
            ILRuntimeUtil.getInstance().getAppDomain().Invoke("HotFix_Project.ShowDiPokerScript_hotfix", "setData", null, dipaiList);
            return;
        }

        List <GameObject> objList = new List <GameObject>();

        for (int i = 0; i < dipaiList.Count; i++)
        {
            GameObject poker = PokerScript.createPoker();
            poker.transform.SetParent(gameObject.transform);
            poker.transform.localScale = new Vector3(1, 1, 1);

            poker.GetComponent <PokerScript>().initPoker(dipaiList[i].m_num, (int)dipaiList[i].m_pokerType);
            poker.GetComponent <PokerScript>().m_canTouch = false;

            objList.Add(poker);
        }

        initPokerPos(objList);
    }
コード例 #4
0
    public void OnPointerDown(PointerEventData eventData)
    {
        // 优先使用热更新的代码
        if (ILRuntimeUtil.getInstance().checkDllClassHasFunc("ShiFangPokerScript_hotfix", "OnPointerDown"))
        {
            ILRuntimeUtil.getInstance().getAppDomain().Invoke("HotFix_Project.ShiFangPokerScript_hotfix", "OnPointerDown", null, eventData);
            return;
        }

        PokerScript.setAllPokerWeiXuanZe();
    }
コード例 #5
0
    // Start is called before the first frame update
    void Start()
    {
        List <string> deck = PokerScript.GenerateDeck();

        pokerScript = FindObjectOfType <PokerScript>();

        int i = 0;

        foreach (string card in deck)
        {
            if (this.name == card)
            {
                cardFace = pokerScript.cardFaces[i];
                break;
            }
            i++;
        }
        spriteRenderer = GetComponent <spriteRenderer>();
        roundSection   = GetComponent <RoundSection>();
    }
コード例 #6
0
    // 请求出牌
    public void reqOutPoker()
    {
        // 优先使用热更新的代码
        if (ILRuntimeUtil.getInstance().checkDllClassHasFunc(m_hotfix_class, "reqOutPoker"))
        {
            ILRuntimeUtil.getInstance().getAppDomain().Invoke(m_hotfix_path, "reqOutPoker", null, null);
            return;
        }

        JsonData data = new JsonData();

        data["tag"]        = DDZ_GameData.getInstance().m_tag;
        data["uid"]        = UserData.uid;
        data["playAction"] = (int)TLJCommon.Consts.DDZ_PlayAction.PlayAction_PlayerOutPoker;

        bool hasOutPoker = false;
        List <TLJCommon.PokerInfo> myOutPokerList = new List <TLJCommon.PokerInfo>();

        // 自己出的牌
        {
            JsonData jarray = new JsonData();
            for (int i = 0; i < DDZ_GameData.getInstance().m_myPokerObjList.Count; i++)
            {
                PokerScript pokerScript = DDZ_GameData.getInstance().m_myPokerObjList[i].GetComponent <PokerScript>();
                if (pokerScript.getIsJump())
                {
                    hasOutPoker = true;

                    JsonData jd = new JsonData();
                    jd["num"]       = pokerScript.getPokerNum();
                    jd["pokerType"] = pokerScript.getPokerType();
                    jarray.Add(jd);

                    myOutPokerList.Add(new TLJCommon.PokerInfo(pokerScript.getPokerNum(), (TLJCommon.Consts.PokerType)pokerScript.getPokerType()));
                }
            }

            data["hasOutPoker"] = hasOutPoker;

            if (hasOutPoker)
            {
                data["pokerList"] = jarray;
            }
        }

        // 检测出牌合理性
        {
            List <TLJCommon.PokerInfo> m_maxPlayerOutPokerList = DDZ_GameData.getInstance().m_maxPlayerOutPokerList;
            LandlordsCardsHelper.SetWeight(myOutPokerList);
            LandlordsCardsHelper.SetWeight(m_maxPlayerOutPokerList);

            if (myOutPokerList.Count != 0)
            {
                CardsType type;
                if (LandlordsCardsHelper.GetCardsType(myOutPokerList.ToArray(), out type))
                {
                    if (!DDZ_GameData.getInstance().m_isFreeOutPoker)
                    {
                        CardsType lastType;
                        if (LandlordsCardsHelper.GetCardsType(m_maxPlayerOutPokerList.ToArray(), out lastType))
                        {
                            List <PokerInfo[]> pokerInfoses = LandlordsCardsHelper.GetPrompt(myOutPokerList, m_maxPlayerOutPokerList, lastType);
                            if (pokerInfoses.Count == 0)
                            {
                                ToastScript.createToast("出牌不符合规则");
                                return;
                            }
                        }
                        else
                        {
                            ToastScript.createToast("上一家出牌不符合规则");
                            return;
                        }
                    }
                }
                else
                {
                    ToastScript.createToast("自己出牌不符合规则");
                    return;
                }
            }
            else
            {
                if (DDZ_GameData.getInstance().m_isFreeOutPoker)
                {
                    ToastScript.createToast("请选择您出的牌");
                    return;
                }
                else
                {
                    // 不要
                }
            }
        }

        PlayServiceSocket.s_instance.sendMessage(data.ToJson());

        // 所有牌设为未选中
        PokerScript.setAllPokerWeiXuanZe();
    }