Example #1
0
 /// <summary>
 /// 出牌
 /// </summary>
 private void PutCard()
 {
     if (!_data.isOnline)
     {
         NetMgr.Instance.ShowDisconnectAlert();
         return;
     }
     //出牌
     if (selectCard != null && battleProxy.isSelfAction && battleProxy.GetPlayerActTipS2C() != null && battleProxy.GetPlayerActTipS2C().acts.Contains(PlayerActType.PUT_CARD))
     {
         var cardValue = BattleAreaUtil.GetMeshCardValue(selectCard);
         if (battleProxy.GetPlayerActTipS2C().forbitCards.IndexOf(cardValue) != -1)
         {
             PopMsg.Instance.ShowMsg("吃牌后当前牌不能出牌");
             return;
         }
         PlayAMahjongC2S actC2S = new PlayAMahjongC2S();
         actC2S.mahjongCode = cardValue;
         NetMgr.Instance.SendBuff(SocketType.BATTLE, MsgNoC2S.C2S_ROOM_PLAY_A_MAHJONG.GetHashCode(), 0, actC2S, true);
         battleProxy.isSelfAction = false;
         selectCardInstance       = selectCard.GetInstanceID();
         selectCard = null;
     }
     isTouchMove = false;
 }
Example #2
0
 /// <summary>
 /// AI出牌
 /// </summary>
 public void AIPutCard()
 {
     if (!GlobalData.isDebugModel || !battleProxy.isSelfAction || battleProxy.isReport)
     {
         return;
     }
     if (battleProxy.GetPlayerActTipS2C().acts.Contains(PlayerActType.PASS))
     {
         SpecialCardHandler();
     }
     else if (battleProxy.GetPlayerActTipS2C().acts.Contains(PlayerActType.PUT_CARD))
     {
         PutCardHandler();
     }
 }
Example #3
0
    /// <summary>
    /// 初始化界面显示
    /// </summary>
    private void InitView()
    {
        UpdateAllHeadItem();//false
        View.roomIdTxt.text = RoomInfo.RoomId;
        if (battleProxy.isStart)
        {
            if (battleProxy.GetPlayerActTipS2C() != null)
            {
                ShowPlayActTip();
            }
            UpdateTingIcon();

            if (battleProxy.innings == 8)
            {
                View.roundTxt.text = string.Format("{0}/{1}", battleProxy.curInnings, battleProxy.innings);
            }
            else
            {
                View.roundTxt.text = "一锅";
            }
            for (int i = 0; i < battleProxy.playType.Count; i++)
            {
                if (battleProxy.playType[i] == 44)
                {
                    View.ruleText.text = string.Format("【三家炮】");
                }
                if (battleProxy.playType[i] == 45)
                {
                    View.ruleText.text = string.Format("【一家炮】");
                }
                if (battleProxy.playType[i] == 46)
                {
                    View.ruleText1.text = string.Format("【蛋带翻】");
                }
                if (battleProxy.playType[i] == 47)
                {
                    View.ruleText1.text = string.Format("【蛋不翻】");
                }
                if (battleProxy.playType[i] == 48)
                {
                    View.ruleText2.text = string.Format("【长跑3】");
                }
                if (battleProxy.playType[i] == 49)
                {
                    View.ruleText2.text = string.Format("【长跑5】");
                }
                if (battleProxy.playType[i] == 50)
                {
                    View.ruleText2.text = string.Format("【长跑10】");
                }
            }
        }
        if (battleProxy.isStart && GlobalData.ShowSendCardAnimation)
        {
            SendNotification(NotificationConstant.MEDI_BATTLE_PLAYROTATE);
            //SendNotification(NotificationConstant.MEDI_BATTLEVIEW_UPDATEALLHEAD);
            SendNotification(NotificationConstant.MEDI_BATTLE_SENDCARD);
        }

        //View.readyBtn.gameObject.SetActive(!battleProxy.playerIdInfoDic[playerInfoProxy.userID].isReady);
        UpdateRoomInfo();
        if (battleProxy.isReport)
        {
            ShowReportView();
        }
        UpdateInviteBtn();
        if (battleProxy.hasDisloveApply)
        {
            if (battleProxy.agreeIds.IndexOf(playerInfoProxy.userID) == -1 && battleProxy.refuseIds.IndexOf(playerInfoProxy.userID) == -1)
            {
                UIManager.Instance.ShowUI(UIViewID.DISLOVE_APPLY_VIEW);
            }
            else
            {
                UIManager.Instance.ShowUI(UIViewID.DISLOVE_STATISTICS_VIEW);
            }
        }
        if (battleProxy.isStart)
        {
        }
    }
Example #4
0
    /// <summary>
    /// 显示玩家操作提示
    /// </summary>
    public void ShowPlayActTip()
    {
        operates        = new List <OperateType>();
        operateCards    = new Dictionary <OperateType, List <int> >();
        operateActs     = new Dictionary <OperateType, List <PlayerActType> >();
        operateCardBtns = new List <GameObject>();
        for (int i = 0; i < battleProxy.GetPlayerActTipS2C().acts.Count; i++)
        {
            PlayerActType actType     = battleProxy.GetPlayerActTipS2C().acts[i];
            OperateType   operateType = OperateType.PASS;
            if (actType == PlayerActType.PUT_CARD)
            {
                continue;
            }
            switch (actType)
            {
            case PlayerActType.ZHI_GANG:
            case PlayerActType.BACK_AN_GANG:
            case PlayerActType.COMMON_AN_GANG:
            case PlayerActType.BACK_PENG_GANG:
            case PlayerActType.COMMON_PENG_GANG:
                operateType = OperateType.GANG;
                break;

            case PlayerActType.SELF_HU:
            case PlayerActType.QIANG_ZHI_GANG_HU:
            case PlayerActType.QIANG_PENG_GANG_HU:
            case PlayerActType.QIANG_AN_GANG_HU:
            case PlayerActType.CHI_HU:
                operateType = OperateType.HU;
                break;

            case PlayerActType.PENG:
                operateType = OperateType.PENG;
                break;

            case PlayerActType.CHI:
                operateType  = OperateType.CHI;
                chiSelectArr = BattleAreaUtil.GetCanChiArr(battleProxy.GetPlayerActTipS2C().actCards[i]);
                break;

            case PlayerActType.BAO_TING:
                operateType = OperateType.BAOTING;
                break;

            case PlayerActType.BAO_DIAO:
                operateType = OperateType.BAODIAO;
                break;

            case PlayerActType.CHENG_DIAO:
                operateType       = OperateType.CHENDIAO;
                chenDiaoSelectArr = battleProxy.GetPlayerActTipS2C().chenDiaoCards;
                break;

            case PlayerActType.BAO_JIA:
                operateType = OperateType.BAOJIA;
                break;

            case PlayerActType.PASS:
                operateType = OperateType.PASS;
                break;
            }
            if (operates.IndexOf(operateType) == -1)
            {
                operates.Add(operateType);
                operateCards.Add(operateType, new List <int>());
                operateActs.Add(operateType, new List <PlayerActType>());
            }
            operateCards[operateType].Add(battleProxy.GetPlayerActTipS2C().actCards[i]);
            operateActs[operateType].Add(actType);
            //if (operateType == OperateType.CHENDIAO)
            //{
            //    battleProxy.GetPlayerActTipS2C().chenDiaoCards.ForEach(o=> { operateCards[operateType].Add(o); });
            //    operateActs[operateType].Add(actType);
            //}
        }
        for (int i = 0; i < actionBtns.Count; i++)
        {
            if (i >= operateActs.Count)
            {
                actionBtnContainers[i].gameObject.SetActive(false);
                continue;
            }
            actionBtnContainers[i].gameObject.SetActive(true);
            foreach (Transform item in actionBtns[i].gameObject.transform)
            {
                Destroy(item.gameObject);
            }
            switch (operates[i])
            {
            case OperateType.GANG:
                actionBtns[i].gameObject.GetComponent <Image>().sprite = Resources.Load <Sprite>("Textures/91city_chipenggang/ActionGang");
                break;

            case OperateType.HU:
                actionBtns[i].gameObject.GetComponent <Image>().sprite = Resources.Load <Sprite>("Textures/91city_chipenggang/ActionHu");
                break;

            case OperateType.PASS:
                actionBtns[i].gameObject.GetComponent <Image>().sprite = Resources.Load <Sprite>("Textures/91city_chipenggang/ActionGuo");
                break;

            case OperateType.PENG:
                actionBtns[i].gameObject.GetComponent <Image>().sprite = Resources.Load <Sprite>("Textures/91city_chipenggang/ActionPeng");
                break;

            case OperateType.CHI:
                actionBtns[i].gameObject.GetComponent <Image>().sprite = Resources.Load <Sprite>("Textures/91city_chipenggang/ActionChi");
                break;

            case OperateType.BAOTING:
                actionBtns[i].gameObject.GetComponent <Image>().sprite = Resources.Load <Sprite>("Textures/91city_chipenggang/ActionBaoTing");
                break;

            case OperateType.BAODIAO:
                actionBtns[i].gameObject.GetComponent <Image>().sprite = Resources.Load <Sprite>("Textures/91city_chipenggang/ActionBaoDiao");
                break;

            case OperateType.BAOJIA:
                actionBtns[i].gameObject.GetComponent <Image>().sprite = Resources.Load <Sprite>("Textures/91city_chipenggang/ActionBaoJia");
                break;

            case OperateType.CHENDIAO:
                actionBtns[i].gameObject.GetComponent <Image>().sprite = Resources.Load <Sprite>("Textures/91city_chipenggang/ActionChenDiao");
                break;
            }
            actionBtns[i].gameObject.GetComponent <Animator>().Play("ShowActBtn" + (i + 1), 0, 0);
        }
        for (int i = 0; i < operateActs.Count; i++)
        {
            var perPosition = actionBtnContainers[i].localPosition;
            perPosition = new Vector3(503.3f - 163.8f * (operateActs.Count - i - 1), perPosition.y, perPosition.z);
            actionBtnContainers[i].localPosition = perPosition;
        }
    }
Example #5
0
    /// <summary>
    /// 显示玩家操作提示
    /// </summary>
    public void ShowPlayActTip()
    {
        gameObject.GetComponent <Animator>().Stop();
        var             selfInfoVO  = battleProxy.playerIdInfoDic[playerInfoProxy.userID];
        PlayerInfoVOS2C tipPlayerVO = null;

        if (battleProxy.GetPlayerActTipS2C() == null && battleProxy.GetPlayerActS2C() == null)
        {
            return;
        }
        if (battleProxy.curGuide == GuideType.ACT_TIP)
        {
            tipPlayerVO = battleProxy.playerIdInfoDic[battleProxy.GetPlayerActTipS2C().optUserId];
            bool isPengGang = false;
            foreach (PlayerActType item in battleProxy.hidenActTypes)
            {
                if (battleProxy.GetPlayerActTipS2C().acts.Contains(item))
                {
                    isPengGang = true;
                    break;
                }
            }
            if (isPengGang && battleProxy.playerIdInfoDic.ContainsKey(battleProxy.GetPlayerActTipS2C().targetUserId))
            {
                tipPlayerVO = battleProxy.playerIdInfoDic[battleProxy.GetPlayerActTipS2C().targetUserId];
                //var nextSitId = GlobalData.GetNextSit(tipPlayerVO.sit, 1);
                //tipPlayerVO = battleProxy.playerSitInfoDic[nextSitId];
            }
        }
        else if (battleProxy.curGuide == GuideType.ACT)
        {
            tipPlayerVO = battleProxy.playerIdInfoDic[battleProxy.GetPlayerActS2C().userId];
            if (battleProxy.GetPlayerActS2C().act == PlayerActType.PASS)
            {
                return;
            }
        }
        if (tipPlayerVO == null)
        {
            return;
        }
        var sitIndex = (tipPlayerVO.sit - selfInfoVO.sit + GlobalData.SIT_NUM) % GlobalData.SIT_NUM;

        arrowContainer.localEulerAngles = new Vector3(0, 0, 180 + sitIndex * 90);
        arrowIcon.color  = Color.white;
        masterIcon.color = new Color(1, 1, 1, 0);
        remainTimeId     = Timer.Instance.AddDeltaTimer(1, 0, 1, UpdateTipRemain);
        remainTimeTxt.gameObject.SetActive(true);
        UpdateTipRemain();
    }