Esempio n. 1
0
    void OnGUI()
    {
        GUILayout.BeginHorizontal();
        #region 麻将抽发测试  已完成 2016/12/28
        GUILayout.BeginVertical();
        if (GUILayout.Button("发牌顺序:R-F-L-H"))
        {
            GameAct.CardDirection(1);
        }

        if (GUILayout.Button("发牌顺序:H-R-F-L"))
        {
            GameAct.CardDirection(0);
        }

        if (GUILayout.Button("断开连接"))
        {
            GameAct.BreakAllLink();
        }

        if (GUILayout.Button("洗牌"))
        {
            StartCoroutine(GetTest(CardTest.group));
        }

        if (GUILayout.Button("掷色子"))
        {
            StartCoroutine(GetTest(CardTest.diceRoll));
        }

        if (GUILayout.Button("移除色子"))
        {
            StartCoroutine(GetTest(CardTest.displayDice));
        }

        if (GUILayout.Button("清空"))
        {
            GameAct.Reset();
        }
        GUILayout.EndVertical();
        #endregion

        #region 玩家牌测试 所有玩家测试完成 2016/12/28
        GUILayout.BeginVertical();
        if (GUILayout.Button("发牌"))
        {
            MahjongPrefab tran = new MahjongPrefab();
            if (GameAct.hostUser.handCard.IsNotFull)
            {
                tran = GameAct.group_H.GetMahjongCard(6);
            }
            if (tran.transform != null)
            {
                StartCoroutine(GetTest(CardTest.handCard, tran));
            }
        }

        if (GUILayout.Button("获取手牌"))
        {
            StartCoroutine(GetTest(CardTest.getCard));
        }

        if (GUILayout.Button("从最后获取手牌"))
        {
            MahjongPrefab tran = new MahjongPrefab();
            if (GameAct.hostUser.handCard.IsNotFull)
            {
                tran = GameAct.group_H.GetMahjongCard(5, 0);
            }
            if (tran.transform != null)
            {
                StartCoroutine(GetTest(CardTest.getCard, tran));
            }
            //mGameClientAction.GetCard(mGameClientAction.hostUser, tran);
        }

        if (GUILayout.Button("加入手牌"))
        {
            StartCoroutine(GetTest(CardTest.insertCard));
        }

        if (GUILayout.Button("打出第一张牌"))
        {
            MahjongPrefab tran = GameAct.hostUser.handCard.GetMahjongCard();
            StartCoroutine(GetTest(CardTest.outCard, tran));
        }

        if (GUILayout.Button("打出最后一张牌"))
        {
            MahjongPrefab tran = GameAct.hostUser.handCard.GetMahjongCard(0, 0);
            StartCoroutine(GetTest(CardTest.outCard, tran));
        }

        if (GUILayout.Button("明杠"))
        {
            //左边第2个开始 杠四个
            MahjongPrefab tran1 = GameAct.hostUser.handCard.GetMahjongCard(2, 0, false);
            MahjongPrefab tran2 = GameAct.hostUser.handCard.GetMahjongCard(2, 0, false);
            MahjongPrefab tran3 = GameAct.hostUser.handCard.GetMahjongCard(2, 0, false);
            MahjongPrefab tran4 = GameAct.hostUser.handCard.GetMahjongCard(2, 0, false);
            StartCoroutine(GameAct.AddGang(GameAct.hostUser, CardActType.MingGang, tran1, tran2, tran3, tran4, () => {
                GameAct.hostUser.handCard.ReSort();
            }));
        }

        if (GUILayout.Button("补杠"))
        {
            //左边第2个开始 杠四个
            MahjongPrefab tran1 = GameAct.hostUser.handCard.GetMahjongCard(2, 0, false);
            StartCoroutine(GameAct.InsertToAddGangCard(GameAct.hostUser, index, tran1));
        }

        if (GUILayout.Button("resort"))
        {
        }

        if (GUILayout.Button("暗杠"))
        {
            //左边第2个开始 杠四个
            MahjongPrefab tran1 = GameAct.hostUser.handCard.GetMahjongCard(2, 0, false);
            MahjongPrefab tran2 = GameAct.hostUser.handCard.GetMahjongCard(2, 0, false);
            MahjongPrefab tran3 = GameAct.hostUser.handCard.GetMahjongCard(2, 0, false);
            MahjongPrefab tran4 = GameAct.hostUser.handCard.GetMahjongCard(2, 0, false);
            StartCoroutine(GameAct.AddGang(GameAct.hostUser, CardActType.AnGang, tran1, tran2, tran3, tran4, () => {
                GameAct.hostUser.handCard.ReSort();
            }));
        }

        if (GUILayout.Button("碰"))
        {
            //出牌最后一个
            MahjongPrefab tran1 = GameAct.hostUser.outCardPoint.GetMahjongCard();
            //左边第1个开始  碰两个
            MahjongPrefab tran2 = GameAct.hostUser.handCard.GetMahjongCard(1, 0, false);
            MahjongPrefab tran3 = GameAct.hostUser.handCard.GetMahjongCard(1, 0, false);
            StartCoroutine(GameAct.AddPengChi(GameAct.hostUser, CardActType.Peng, tran1, tran2, tran3, () =>
            {
                GameAct.hostUser.handCard.ReSort();
            }));
        }

        if (GUILayout.Button("吃"))
        {
            //出牌最后一个
            MahjongPrefab tran1 = GameAct.hostUser.outCardPoint.GetMahjongCard();
            //左边第1个开始  手牌两个
            MahjongPrefab tran2 = GameAct.hostUser.handCard.GetMahjongCard(1, 0, false);
            MahjongPrefab tran3 = GameAct.hostUser.handCard.GetMahjongCard(1, 0, false);
            StartCoroutine(GameAct.AddPengChi(GameAct.hostUser, CardActType.Chi, tran1, tran2, tran3, () =>
            {
                GameAct.hostUser.handCard.ReSort();
            }));
        }

        if (GUILayout.Button("重排出牌区域"))
        {
            GameAct.hostUser.outCardPoint.ReSort();
        }

        if (GUILayout.Button("胡"))
        {
            StartCoroutine(GameAct.TurnOverCard(GameAct.hostUser));
        }

        if (GUILayout.Button("功能牌"))
        {
            MahjongPrefab tran = GameAct.hostUser.handCard.GetMahjongCard();
            StartCoroutine(GetTest(CardTest.spacialCard, tran));
        }

        GUILayout.EndVertical();
        GUILayout.BeginVertical();
        if (GUILayout.Button("洗牌"))
        {
            test = processorModel.RandCardData();
            string s = "[ ";
            foreach (byte item in test)
            {
                s += item + " : ";
            }
            s += " ]";
            Debug.Log(s);
        }
        if (GUILayout.Button("排序"))
        {
            processorModel.SelectSort(ref test);
            string s = "[ ";
            foreach (byte item in test)
            {
                s += item + " : ";
            }
            s += " ]";
            Debug.Log(s);
        }
        if (GUILayout.Button("插入"))
        {
            byte item = 10;
            Debug.Log(item);
            int index = processorModel.GetInsert(ref test, item);
            Debug.Log(index);
            string s = "[ ";
            foreach (byte it in test)
            {
                s += it + " : ";
            }
            s += " ]";
            Debug.Log(s);
        }
        GUILayout.EndVertical();
        #endregion
        GUILayout.EndHorizontal();
    }
Esempio n. 2
0
    void OnGUI()
    {
        if (vReady && GUILayout.Button("准备"))
        {
            vReady = false;
            gameAct.Reset();
            control.EndStatusFlag(ID, UserAction.ready);
        }
        if (vPass && GUILayout.Button("过"))
        {
            vPass    = false;
            vHu      = false;
            vPeng    = false;
            vGang    = false;
            vChi     = false;
            vJiaGang = false;
            control.EndStatusFlag(currentUserID, UserAction.pass_flag);
        }
        if (vHu && GUILayout.Button("胡"))
        {
            vHu   = false;
            vPass = false;
            control.EndStatusFlag(currentUserID, UserAction.hu_flag);
        }
        if (vPeng && GUILayout.Button("碰"))
        {
            vPeng   = false;
            vPass   = false;
            exebuff = pengBuffer;
            control.EndStatusFlag(currentUserID, UserAction.peng_card_flag, exebuff);
        }
        if (vGang && GUILayout.Button("杠"))
        {
            vGang   = false;
            vPass   = false;
            exebuff = gangBuffer[0];
            control.EndStatusFlag(currentUserID, UserAction.gang_flag, exebuff);
        }
        if (vChi && GUILayout.Button("吃"))
        {
            vChi    = false;
            vPass   = false;
            exebuff = chiBuffer[0];
            control.EndStatusFlag(currentUserID, UserAction.chi_card_flag, exebuff);
        }
        if (vJiaGang && GUILayout.Button("加杠"))
        {
            vJiaGang = false;
            vPass    = false;
            exebuff  = gangBuffer[0];
            control.EndStatusFlag(currentUserID, UserAction.add_gang, exebuff);
        }

        /*
         * if(GUILayout.Button("开始"))
         * {
         *  game.OnStart();
         * }
         * if(globalOperateFlag)
         * {
         *
         *  if(GUILayout.Button("获取手牌"))
         *  {
         *      AutoOutCard();
         *  }
         * }
         * if(GUILayout.Button("摇色子"))
         * {
         *  game.OnSiceTwo();
         * }
         * if(GUILayout.Button("发牌"))
         * {
         *  game.OnSendCard();
         * }
         * if(GUILayout.Button("胡"))
         * {
         *  game.OnUserAction(0, 0, UserAction.hu);
         * }
         */
    }