Пример #1
0
    /// <summary>
    /// 关闭按钮点击
    /// </summary>
    public void OnCloseClick()
    {
        OptRequest req = new OptRequest();

        req.ins = eMJInstructionsType.EXITROOM;
        Global.Inst.GetController <MJGameController>().SendInstructions(req, null);
    }
Пример #2
0
    public void OnClickBtn(GameObject obj)
    {
        string name = obj.name;;

        switch (int.Parse(name.Split('_')[1]))
        {
        case 1:
            CurFixedcolorType = eFixedType.WAN;
            break;

        case 2:
            CurFixedcolorType = eFixedType.TIAO;
            break;

        case 3:
            CurFixedcolorType = eFixedType.TONG;
            break;
        }
        for (int i = 0; i < mToggleList.Count; i++)
        {
            if (obj.name == mToggleList[i].name)
            {
                mCircle[i].SetActive(true);
            }
            else
            {
                mCircle[i].SetActive(false);
            }
        }
        OptRequest req = new OptRequest();

        req.ins  = eMJInstructionsType.FIXEDCOLOR;
        req.type = (int)CurFixedcolorType;
        Global.Inst.GetController <MJGameController>().SendOptRequest(req, () => { button.gameObject.SetActive(false); });
    }
Пример #3
0
    /// <summary>
    /// 取消托管点击
    /// </summary>
    public void OnCancelTrustClick()
    {
        OptRequest req = new OptRequest();

        req.ins  = eMJInstructionsType.TG;
        req.type = eMJTrusteeshipType.cancelTrust.GetHashCode();//取消托管
        Global.Inst.GetController <MJGameController>().SendInstructions(req, null);
    }
Пример #4
0
    public void OnClickBtn()

    {
        OptRequest req = new OptRequest();

        req.ins   = eMJInstructionsType.YAOPAI;
        req.cards = new System.Collections.Generic.List <int>();
        req.cards.Add(int.Parse(mInput.value));
        Global.Inst.GetController <MJGameController>().SendOptRequest(req, null, false);
    }
Пример #5
0
    public void OnSelfClick()
    {
        //if (mCallback != null)
        //   mCallback(mOpt, mCard);


        OptRequest req = new OptRequest();

        req.ins   = eMJInstructionsType.GANG;
        req.cards = new List <int>();
        req.cards.Add(cardNum);
        Global.Inst.GetController <MJGameController>().SendInstructions(req, null);
    }
Пример #6
0
    /// <summary>
    /// 打牌
    /// </summary>
    public void SendOutCard(List <CanHuStruct> canHuList = null)
    {
        if (!MJGameModel.Inst.mIsTing && MJGameModel.Inst.mStartGameData.roomInfo.roomState == eRoomState.START) //不是在报叫
        {
            OptRequest data = new OptRequest();
            data.ins   = eMJInstructionsType.HIT;
            data.cards = new List <int>();
            data.cards.Add(mNum);
            MJGameController mGameCtr = Global.Inst.GetController <MJGameController>();
            #region 判断点击的牌是否符合要求   符合要求发送消息   出牌   不符合设置为没选中


            if (MJGameModel.Inst.isHu)
            {
                int curCard = MJGameModel.Inst.allPlayersCardsInfoStruct[MJGameModel.Inst.mMySeatId].currCard;
                if (curCard > 0 && mNum == curCard)
                {
                }
                else
                {
                    SetCardUnSelect();
                    return;
                }
            }

            if (MJGameModel.Inst.isHasFixeCard)
            {
                if (MJGameModel.Inst.eFixe[0] == 0 || mNum > MJGameModel.Inst.eFixe[0] && mNum < MJGameModel.Inst.eFixe[1])
                {
                }
                else
                {
                    SetCardUnSelect();
                    return;
                }
            }
            if (!MJGameModel.Inst.isMyHit)
            {
                SetCardUnSelect();
                return;
            }
            #endregion
            MJGameModel.Inst.isMyHit = false;
            Debug.Log("出牌");
            mGameCtr.SendOptRequest(data, () =>
            {
            }, false);
            MJGameModel.Inst.hasCanHuListCards = null;
        }
    }
Пример #7
0
    /// <summary>
    /// 特殊操作点击返回
    /// </summary>
    /// <param name="opt"></param>
    /// <param name="cards"></param>
    public void OnSpeciaInsItemCall(OptItemStruct opt, MJliangcard cards)
    {
        ResetUI();
        OptRequest req = new OptRequest();

        if (opt.ins == eMJInstructionsType.GANG)
        {
            req.ins    = eMJInstructionsType.GANG;
            cards.card = new List <int>();
        }
        //else if (opt.ins == eMJInstructionsType.chi)
        //    opt.type = cards.type;
        opt.cards = cards.card;
        req.cards.Add(cards.card[0]);
        Global.Inst.GetController <MJGameController>().SendInstructions(req, null);
    }
Пример #8
0
    public void OnItemClick()
    {
        //操作

        if (mOpt.ins == eMJInstructionsType.GANG)
        {
            if (mOpt.cards.Count > 1)
            {
                //mPlayer.ShowInstructions(null);//关闭选项界面
                mPlayer.SetSpeciaInstructions(mOpt);
                return;
            }
        }

        /*
         * else if (mOpt.ins == eMJInstructionsType.chi)
         * {
         *  List<MJliangcard> list = mPlayer.GetChiCards();
         *  if (list.Count > 1)
         *  {
         *      mPlayer.ShowInstructions(null);//关闭选项界面
         *      mPlayer.SetSpeciaInstructions(mOpt);
         *      return;
         *  }
         * }
         */
        if (mPlayer != null)
        {
            mPlayer.ShowInstructions(null);
        }

        OptRequest req = new OptRequest();

        req.ins   = mOptIndex;
        req.cards = new List <int>();
        if (mOpt.cards != null)
        {
            req.cards.Add(mOpt.cards[0]);
        }
        Global.Inst.GetController <MJGameController>().SendInstructions(req, () =>
        {
            if (mPlayer != null)
            {
                mPlayer.ShowInstructions(null);
            }
        });
    }
Пример #9
0
    /// <summary>
    /// 确认按钮事件
    /// </summary>
    public void OnSureButtonClick()
    {
        for (int i = 0; i < mToggleList.Count; i++)
        {
            if (int.Parse(mToggleList[i].name.Split('_')[1]) == (int)CurFixedcolorType)
            {
                mToggleList[i].gameObject.SetActive(true);
            }
            else
            {
                mToggleList[i].gameObject.SetActive(false);
            }
        }
        OptRequest req = new OptRequest();

        req.ins  = eMJInstructionsType.FIXEDCOLOR;
        req.type = (int)CurFixedcolorType;
        Global.Inst.GetController <MJGameController>().SendOptRequest(req, () => { button.gameObject.SetActive(false); });
    }
Пример #10
0
 /// <summary>
 /// 操作指令
 /// </summary>
 /// <param name="info"></param>
 public void SendInstructions(OptRequest info, CallBack call)
 {
     NetProcess.SendRequest <OptRequest>(info, MJProtoMap.Cmd_SendDealIns, (msg) =>
     {
         CommonRecieveProto data = msg.Read <CommonRecieveProto>();
         if (data.code == 1)
         {
             Debug.Log("操作指令");
             if (call != null)
             {
                 call();
             }
         }
         else if (data.code > 0)
         {
             GameUtils.ShowErrorTips(data.code);
         }
     }, false);
 }
Пример #11
0
 /// <summary>
 /// 发送 操作的指令请求
 /// </summary>
 /// <param name="data"></param>
 public void SendOptRequest(OptRequest req, System.Action finish = null, bool show = true)
 {
     NetProcess.SendRequest <OptRequest>(req, MJProtoMap.Cmd_SendDealIns, (msg) =>
     {
         CommonRecieveProto data = msg.Read <CommonRecieveProto>();
         if (data.code == 107)//金币不足,返回俱乐部界面
         {
             GameUtils.ShowErrorTips(data.code);
             Global.Inst.GetController <MJGameController>().BackToClub();
         }
     }, show);
     if (finish != null)
     {
         finish();
     }
     if (req.ins == eMJInstructionsType.HIT && mGameUI.mSelfPlayer != null)
     {
         mGameUI.mSelfPlayer.ShowInstructions(null);
     }
 }
Пример #12
0
    public void OnSureBtnClick()
    {
        if (MJGameModel.Inst.mCurSlectCardList.Count != 3)
        {
            Global.Inst.GetController <CommonTipsController>().ShowTips("选择的牌不符合要求");
            return;
        }
        SQDebug.Log("确定换3张-->发送消息");
        OptRequest req = new OptRequest();

        req.ins = eMJInstructionsType.CHANGETHREE;
        List <int> newIntList = new List <int>();

        foreach (var item in MJGameModel.Inst.mCurSlectCardList)
        {
            //Destroy(item.gameObject);
            item.gameObject.SetActive(false);
            newIntList.Add(item.mNum);
        }
        req.cards = newIntList;
        Global.Inst.GetController <MJGameController>().SendOptRequest(req);
    }
Пример #13
0
    /// <summary>
    /// 继续
    /// </summary>
    public void OnContinueClick()
    {
        MJGameController mMJctr = Global.Inst.GetController <MJGameController>();

        MJGameModel.Inst.ResetData();
        if (mInfo == null)//解散过后
        {
            mMJctr.ConnectedToHallServer(null);
        }
        else
        {
            MJGameSettlementFinalInfo info = MJGameModel.Inst.mFinalSettlementInfo;
            if (info != null)
            {
                if (info != null)
                {
                    mMJctr.mGameUI.ServerSettlementFinal(info);
                    CloseWidget <MJGameSettlementView>();
                    //gameObject.SetActive(false);
                    return;
                }
                else
                {
                    Global.Inst.GetController <MJGameController>().ConnectedToHallServer(null);
                }
            }
            else
            {
                //准备
                mMJctr.mGameUI.SetSelfPreShow(false);
                OptRequest req = new OptRequest();
                req.ins = eMJInstructionsType.READY;
                Global.Inst.GetController <MJGameController>().SendOptRequest(req);
                Close();
            }
        }
    }