示例#1
0
        /// <summary>
        /// 模拟本地动作
        /// </summary>
        private IEnumerator ClientPlayAct(int actCard, int userId, PlayerActType act)
        {
            var pushPlayerActS2C = new PushPlayerActS2C();

            pushPlayerActS2C.actCard = actCard;
            pushPlayerActS2C.userId  = userId;
            pushPlayerActS2C.act     = act;
            NetMgr.Instance.OnClientReceiveBuff(MsgNoS2C.PUSH_PLAYER_ACT.GetHashCode(), 0, pushPlayerActS2C);
            yield return(new WaitForSeconds(1));

            curSit = GlobalData.GetNextSit(curSit, 1);

            if (act == PlayerActType.PUT_CARD)
            {
                int getCard    = getRangeCard(false);
                var getCardS2C = new PushPlayerActS2C();
                getCardS2C.actCard = getCard;
                getCardS2C.userId  = battleProxy.playerSitInfoDic[curSit].userId;
                getCardS2C.act     = PlayerActType.GET_CARD;
                NetMgr.Instance.OnClientReceiveBuff(MsgNoS2C.PUSH_PLAYER_ACT.GetHashCode(), 0, getCardS2C);
                yield return(new WaitForSeconds(1));

                GameMgr.Instance.StartCoroutine(ClientPlayerTip());
            }
            else
            {
                yield return(new WaitForSeconds(1));

                GameMgr.Instance.StartCoroutine(ClientPlayerTip());
            }
        }
示例#2
0
    /// <summary>
    /// 播放玩家操作提示
    /// </summary>
    /// <param name="playerAct"></param>
    private void PlayAct(PlayerActType playerAct)
    {
        var selfInfoVO      = battleProxy.playerIdInfoDic[playerInfoProxy.userID];
        var actPlayerInfoVO = battleProxy.playerIdInfoDic[battleProxy.GetPlayerActS2C().userId];
        var actIndex        = (actPlayerInfoVO.sit - selfInfoVO.sit + GlobalData.SIT_NUM) % GlobalData.SIT_NUM;

        if (actIndex != 0)
        {
            View.headItemList[actIndex].GetComponent <HeadItem>().PlayAct(playerAct);
        }
        if (actIndex == 0)
        {
            View.operateView.HidenPlayActTip();
            View.headItemList[actIndex].GetComponent <HeadItem>().BaoIcon(playerAct);
        }
        else if (playerAct != PlayerActType.PASS && !battleProxy.huTypes.Contains(playerAct))
        {
            View.operateView.HidenPlayActTip();
        }
        if (playerAct == PlayerActType.CHI_HU || playerAct == PlayerActType.QIANG_AN_GANG_HU ||
            playerAct == PlayerActType.QIANG_PENG_GANG_HU || playerAct == PlayerActType.QIANG_ZHI_GANG_HU ||
            playerAct == PlayerActType.SELF_HU)
        {
            for (int i = 0; i < 4; i++)
            {
                View.headItemList[i].GetComponent <HeadItem>().baoImg.gameObject.SetActive(false);
            }
        }
    }
示例#3
0
    /// <summary>
    /// 播放玩家操作提示
    /// </summary>
    /// <param name="playerAct"></param>
    private void PlayAct(PlayerActType playerAct)
    {
        //View.masterView.ShowPlayActTip();
        //var selfInfoVO = battleProxy.playerIdInfoDic[playerInfoProxy.UserInfo.UserID];
        //var actPlayerInfoVO = battleProxy.playerIdInfoDic[battleProxy.playerActS2C.userId];
        //var actIndex = (actPlayerInfoVO.sit - selfInfoVO.sit + GlobalData.SIT_NUM) % GlobalData.SIT_NUM;
        //if (actIndex != 0)
        //{
        //    View.headItemList[actIndex].GetComponent<HeadItem>().PlayAct(playerAct);
        //}
        //View.headItemList[0].GetComponent<HeadItem>().HidenPlayActTip();

        var selfInfoVO      = battleProxy.playerIdInfoDic[playerInfoProxy.UserInfo.UserID];
        var actPlayerInfoVO = battleProxy.playerIdInfoDic[battleProxy.playerActS2C.userId];
        var actIndex        = (actPlayerInfoVO.sit - selfInfoVO.sit + GlobalData.SIT_NUM) % GlobalData.SIT_NUM;

        if (actIndex != 0)
        {
            View.headItemList[actIndex].GetComponent <HeadItem>().PlayAct(playerAct);
        }
        if (actIndex == 0)
        {
            View.headItemList[0].GetComponent <HeadItem>().HidenPlayActTip();
        }
        else if (playerAct != PlayerActType.PASS && !battleProxy.huTypes.Contains(playerAct))
        {
            View.headItemList[0].GetComponent <HeadItem>().HidenPlayActTip();
        }
    }
示例#4
0
    /// <summary>
    /// 点击直杠按钮
    /// </summary>
    private void onZhiGangClick(PlayerActType act, int card)
    {
        var actC2S = new ZhiGangC2S();

        actC2S.mahjongCode = card;
        NetMgr.Instance.SendBuff(SocketType.BATTLE, MsgNoC2S.ZHIGANG_C2S.GetHashCode(), 0, actC2S);
    }
示例#5
0
 /// <summary>
 /// 点击胡按钮
 /// </summary>
 private void onHuClick(PlayerActType act, int card)
 {
     if (act == PlayerActType.SELF_HU)
     {
         var actC2S = new ZiMoHuC2S();
         NetMgr.Instance.SendBuff(SocketType.BATTLE, MsgNoC2S.C2S_ROOM_ZI_MO_HU.GetHashCode(), 0, actC2S);
     }
     else if (act == PlayerActType.QIANG_AN_GANG_HU)
     {
         var actC2S = new QiangAnGangHuC2S();
         NetMgr.Instance.SendBuff(SocketType.BATTLE, MsgNoC2S.C2S_ROOM_QIANG_AN_GANG_HU.GetHashCode(), 0, actC2S);
     }
     else if (act == PlayerActType.QIANG_PENG_GANG_HU)
     {
         var actC2S = new QiangPengGangHuC2S();
         NetMgr.Instance.SendBuff(SocketType.BATTLE, MsgNoC2S.C2S_ROOM_QIANG_PENG_GANG_HU.GetHashCode(), 0, actC2S);
     }
     else if (act == PlayerActType.QIANG_ZHI_GANG_HU)
     {
         var actC2S = new QiangZhiGangHuC2S();
         NetMgr.Instance.SendBuff(SocketType.BATTLE, MsgNoC2S.C2S_ROOM_QIANG_ZHI_GANG_HU.GetHashCode(), 0, actC2S);
     }
     else if (act == PlayerActType.CHI_HU)
     {
         var actC2S = new ChiHuC2S();
         NetMgr.Instance.SendBuff(SocketType.BATTLE, MsgNoC2S.C2S_ROOM_CHI_HU.GetHashCode(), 0, actC2S);
     }
 }
示例#6
0
    /// <summary>
    /// 点击吃按钮
    /// </summary>
    /// <param name="act"></param>
    /// <param name="cards"></param>
    private void onChiClick(PlayerActType act, List <int> cards, int btnIndex)
    {
        var actC2S = new ChiC2S();

        for (int i = 0; i < cards.Count; i++)
        {
            actC2S.mahjongCodes.Add(cards[i]);
        }
        var card = battleProxy.GetPlayerActTipS2C().actCards[btnIndex];

        actC2S.mahjongCodes.Add(card);//将自己吃的牌放进数组
        actC2S.forbitCards.Add(card);
        if (cards[0] == card + 1)
        {
            if (Array.IndexOf(GlobalData.CardValues, card + 3) != -1)
            {
                actC2S.forbitCards.Add(card + 3);
            }
        }
        else if (cards[0] == card - 2)
        {
            if (Array.IndexOf(GlobalData.CardValues, card - 3) != -1)
            {
                actC2S.forbitCards.Add(card - 3);
            }
        }
        NetMgr.Instance.SendBuff(SocketType.BATTLE, MsgNoC2S.C2S_ROOM_CHI.GetHashCode(), 0, actC2S);
    }
示例#7
0
    /// <summary>
    /// 点击碰按钮
    /// </summary>
    private void onPengClick(PlayerActType act, int card)
    {
        var actC2S = new PengC2S();

        actC2S.mahjongCode = card;
        NetMgr.Instance.SendBuff(SocketType.BATTLE, MsgNoC2S.C2S_ROOM_PENG.GetHashCode(), 0, actC2S);
    }
示例#8
0
    /// <summary>
    /// 播放玩家动作
    /// </summary>
    /// <param name="act"></param>
    public void PlayAct(PlayerActType act)
    {
        GameObject effectPerfab = null;

        switch (act)
        {
        case PlayerActType.COMMON_AN_GANG:
        case PlayerActType.BACK_AN_GANG:
        case PlayerActType.COMMON_PENG_GANG:
        case PlayerActType.BACK_PENG_GANG:
        case PlayerActType.ZHI_GANG:
            effectPerfab = Resources.Load <GameObject>("Effect/GangEffect/GangEffect");
            break;

        case PlayerActType.PENG:
            effectPerfab = Resources.Load <GameObject>("Effect/PengEffect/PengEffect");
            break;

        case PlayerActType.CHI:
            effectPerfab = Resources.Load <GameObject>("Effect/ChiEffect/ChiEffect");
            break;

        case PlayerActType.BAO_TING:
            effectPerfab = Resources.Load <GameObject>("Effect/91Effect/EffectBaoTing");
            BaoIcon(act);
            break;

        case PlayerActType.BAO_DIAO:
            effectPerfab = Resources.Load <GameObject>("Effect/91Effect/EffectBaoDiao");
            BaoIcon(act);
            break;

        case PlayerActType.BAO_JIA:
            effectPerfab = Resources.Load <GameObject>("Effect/91Effect/EffectBaoJia");
            BaoIcon(act);
            break;

        case PlayerActType.CHENG_DIAO:
            effectPerfab = Resources.Load <GameObject>("Effect/91Effect/EffectChenDiao");
            BaoIcon(act);
            break;
        }
        if (effectPerfab != null)
        {
            actEffect = Instantiate(effectPerfab);
            var perPosition = actEffect.GetComponent <RectTransform>().localPosition;
            actEffect.GetComponent <RectTransform>().SetParent(baoEffect);                    //GetComponent<RectTransform>()
            actEffect.GetComponent <RectTransform>().localPosition = baoEffect.localPosition; //perPosition;
            actEffect.GetComponent <RectTransform>().localScale    = Vector3.one;
            actEffect.GetComponent <Animator>().enabled            = true;
            Timer.Instance.AddDeltaTimer(0.5f, 1, 2.5f, RemoveActEffect);
        }
    }
示例#9
0
    /// <summary>
    /// 操作单张牌
    /// </summary>
    /// <param name="act"></param>
    /// <param name="card"></param>
    private void OperateSingle(PlayerActType act, int card, int btnIndex)
    {
        switch (act)
        {
        case PlayerActType.ZHI_GANG:
            onZhiGangClick(act, card);
            break;

        case PlayerActType.BACK_AN_GANG:
        case PlayerActType.COMMON_AN_GANG:
            onAnGangClick(act, card);
            break;

        case PlayerActType.BACK_PENG_GANG:
        case PlayerActType.COMMON_PENG_GANG:
            onPengGangClick(act, card);
            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:
            onHuClick(act, card);
            break;

        case PlayerActType.PASS:
            onPassClick();
            break;

        case PlayerActType.PENG:
            onPengClick(act, card);
            break;

        case PlayerActType.BAO_TING:
            onBaoTingClick();
            break;

        case PlayerActType.BAO_JIA:
            onBaoJiaClick();
            break;

        case PlayerActType.BAO_DIAO:
            onBaoDiaoClick();
            break;
            //case PlayerActType.CHENG_DIAO:
            //    onChenDiaoClick();
            //    break;
        }
        //ClearOperateCardBtns();
    }
示例#10
0
 /// <summary>
 /// 点击碰杠按钮
 /// </summary>
 private void onPengGangClick(PlayerActType act, int card)
 {
     if (act == PlayerActType.COMMON_PENG_GANG)
     {
         var actC2S = new CommonPengGangC2S();
         actC2S.mahjongCode = card;
         NetMgr.Instance.SendBuff(SocketType.BATTLE, MsgNoC2S.C2S_ROOM_COMMON_PENG_GANG.GetHashCode(), 0, actC2S);
     }
     else if (act == PlayerActType.BACK_PENG_GANG)
     {
         var actC2S = new BackPengGangC2S();
         actC2S.mahjongCode = card;
         NetMgr.Instance.SendBuff(SocketType.BATTLE, MsgNoC2S.C2S_ROOM_BACK_PENG_GANG.GetHashCode(), 0, actC2S);
     }
 }
示例#11
0
    /// <summary>
    /// 点击碰按钮
    /// </summary>
    private void onPengClick(PlayerActType act, int card)
    {
        var actC2S = new PengC2S();

        actC2S.mahjongCode = card;
        NetMgr.Instance.SendBuff(SocketType.BATTLE, MsgNoC2S.PENG_C2S.GetHashCode(), 0, actC2S);
        for (int i = 0; i < actionBtns.Count; i++)
        {
            Debug.Log("childCount = " + actionBtns[i].gameObject.transform.childCount);
            for (int j = 0; j < actionBtns[i].gameObject.transform.childCount; j++)
            {
                Destroy(actionBtns[i].gameObject.transform.GetChild(j).gameObject);
            }
        }
    }
示例#12
0
 /// <summary>
 /// 点击暗杠按钮
 /// </summary>
 private void onAnGangClick(PlayerActType act, int card)
 {
     if (act == PlayerActType.COMMON_AN_GANG)
     {
         var actC2S = new CommonAnGangC2S();
         actC2S.mahjongCode = card;
         NetMgr.Instance.SendBuff(SocketType.BATTLE, MsgNoC2S.COMMONANGANG_C2S.GetHashCode(), 0, actC2S);
     }
     else if (act == PlayerActType.BACK_AN_GANG)
     {
         var actC2S = new BackAnGangC2S();
         actC2S.mahjongCode = card;
         NetMgr.Instance.SendBuff(SocketType.BATTLE, MsgNoC2S.BACKANGANG_C2S.GetHashCode(), 0, actC2S);
     }
 }
示例#13
0
 /// <summary>
 /// 显示报听,报夹,报吊,抻吊Ico
 /// </summary>
 /// <param name="act"></param>
 public void BaoIcon(PlayerActType act)
 {
     if (act == PlayerActType.BAO_TING)
     {
         baoImg.gameObject.SetActive(true);
         baoImg.sprite = Resources.Load <Sprite>("Textures/91city_chipenggang/tingIco");
     }
     if (act == PlayerActType.BAO_JIA)
     {
         baoImg.gameObject.SetActive(true);
         baoImg.sprite = Resources.Load <Sprite>("Textures/91city_chipenggang/jiaIco");
     }
     if (act == PlayerActType.BAO_DIAO || act == PlayerActType.CHENG_DIAO)
     {
         Debug.Log("PlayerActType is" + act);
         baoImg.gameObject.SetActive(true);
         baoImg.sprite = Resources.Load <Sprite>("Textures/91city_chipenggang/diaoIco");
     }
 }
示例#14
0
 /// <summary>
 /// 点击胡按钮
 /// </summary>
 private void onHuClick(PlayerActType act, int card)
 {
     //Debug.Log("onHuClick ********************************");
     if (act == PlayerActType.SELF_HU)
     {
         var actC2S = new ZiMoHuC2S();
         NetMgr.Instance.SendBuff(SocketType.BATTLE, MsgNoC2S.ZIMOHU_C2S.GetHashCode(), 0, actC2S);
     }
     else if (act == PlayerActType.QIANG_AN_GANG_HU)
     {
         var actC2S = new QiangAnGangHuC2S();
         NetMgr.Instance.SendBuff(SocketType.BATTLE, MsgNoC2S.QIANGANGANGHU_C2S.GetHashCode(), 0, actC2S);
     }
     else if (act == PlayerActType.QIANG_PENG_GANG_HU)
     {
         var actC2S = new QiangPengGangHuC2S();
         NetMgr.Instance.SendBuff(SocketType.BATTLE, MsgNoC2S.QIANGPENGGANGHU_C2S.GetHashCode(), 0, actC2S);
     }
     else if (act == PlayerActType.QIANG_ZHI_GANG_HU)
     {
         var actC2S = new QiangZhiGangHuC2S();
         NetMgr.Instance.SendBuff(SocketType.BATTLE, MsgNoC2S.QIANGZHIGANGHU_C2S.GetHashCode(), 0, actC2S);
     }
     else if (act == PlayerActType.CHI_HU)
     {
         var actC2S = new ChiHuC2S();
         NetMgr.Instance.SendBuff(SocketType.BATTLE, MsgNoC2S.CHIHU_C2S.GetHashCode(), 0, actC2S);
     }
     for (int i = 0; i < actionBtns.Count; i++)
     {
         actionBtns[i].gameObject.SetActive(false);
     }
     for (int i = 0; i < actionBtns.Count; i++)
     {
         Debug.Log("childCount = " + actionBtns[i].gameObject.transform.childCount);
         for (int j = 0; j < actionBtns[i].gameObject.transform.childCount; j++)
         {
             Destroy(actionBtns[i].gameObject.transform.GetChild(j).gameObject);
         }
     }
 }
示例#15
0
    /// <summary>
    /// 播放玩家动作
    /// </summary>
    /// <param name="act"></param>
    public void PlayAct(PlayerActType act)
    {
        GameObject effectPerfab = null;

        switch (act)
        {
        case PlayerActType.COMMON_AN_GANG:
        case PlayerActType.BACK_AN_GANG:
        case PlayerActType.COMMON_PENG_GANG:
        case PlayerActType.BACK_PENG_GANG:
        case PlayerActType.ZHI_GANG:
            effectPerfab = Resources.Load <GameObject>("Effect/GangEffect/GangEffect");
            break;

        case PlayerActType.PENG:
            effectPerfab = Resources.Load <GameObject>("Effect/PengEffect/PengEffect");
            break;

        case PlayerActType.CHI:
            effectPerfab = Resources.Load <GameObject>("Effect/ChiEffect/ChiEffect");
            break;
        }
        if (effectPerfab != null)
        {
            actEffect = Instantiate(effectPerfab);
            var perPosition = actEffect.GetComponent <RectTransform>().localPosition;
            actEffect.GetComponent <RectTransform>().SetParent(GetComponent <RectTransform>());
            actEffect.GetComponent <RectTransform>().localPosition = Vector3.zero;
            if (actEffect.name == "ChiEffect(Clone)")
            {
                actEffect.GetComponent <RectTransform>().localScale = new Vector3(0.4f, 0.4f, 0.4f);
            }
            else
            {
                actEffect.GetComponent <RectTransform>().localScale = Vector3.one;
            }

            actEffect.GetComponent <Animator>().enabled = true;
            Timer.Instance.AddTimer(0.5f, 1, 2.5f, RemoveActEffect);
        }
    }
示例#16
0
 /// <summary>
 /// 点击碰杠按钮
 /// </summary>
 private void onPengGangClick(PlayerActType act, int card)
 {
     if (act == PlayerActType.COMMON_PENG_GANG)
     {
         var actC2S = new CommonPengGangC2S();
         actC2S.mahjongCode = card;
         NetMgr.Instance.SendBuff(SocketType.BATTLE, MsgNoC2S.COMMONPENGGANG_C2S.GetHashCode(), 0, actC2S);
     }
     else if (act == PlayerActType.BACK_PENG_GANG)
     {
         var actC2S = new BackPengGangC2S();
         actC2S.mahjongCode = card;
         NetMgr.Instance.SendBuff(SocketType.BATTLE, MsgNoC2S.BACKPENGGANG_C2S.GetHashCode(), 0, actC2S);
     }
     for (int i = 0; i < actionBtns.Count; i++)
     {
         for (int j = 0; j < actionBtns[i].gameObject.transform.childCount; j++)
         {
             Destroy(actionBtns[i].gameObject.transform.GetChild(j).gameObject);
         }
     }
 }
示例#17
0
    /// <summary>
    /// 点击吃按钮
    /// </summary>
    /// <param name="act"></param>
    /// <param name="cards"></param>
    private void onChiClick(PlayerActType act, List <int> cards, int btnIndex)
    {
        var actC2S = new ChiC2S();

        for (int i = 0; i < cards.Count; i++)
        {
            actC2S.mahjongCodes.Add(cards[i]);
        }
        var card = battleProxy.playerActTipS2C.actCards[btnIndex];

        actC2S.mahjongCodes.Add(card);//将自己吃的牌放进数组
        actC2S.forbitCards.Add(card);
        if (cards[0] == card + 1)
        {
            if (Array.IndexOf(GlobalData.CardValues, card + 3) != -1)
            {
                actC2S.forbitCards.Add(card + 3);
            }
        }
        else if (cards[0] == card - 2)
        {
            if (Array.IndexOf(GlobalData.CardValues, card - 3) != -1)
            {
                actC2S.forbitCards.Add(card - 3);
            }
        }
        NetMgr.Instance.SendBuff(SocketType.BATTLE, MsgNoC2S.CHI_C2S.GetHashCode(), 0, actC2S);
        cards.Clear();
        for (int i = 0; i < actionBtns.Count; i++)
        {
            Debug.Log("childCount = " + actionBtns[i].gameObject.transform.childCount);
            for (int j = 0; j < actionBtns[i].gameObject.transform.childCount; j++)
            {
                Destroy(actionBtns[i].gameObject.transform.GetChild(j).gameObject);
            }
        }
    }
示例#18
0
    /// <summary>
    /// 操作单张牌
    /// </summary>
    /// <param name="act"></param>
    /// <param name="card"></param>
    private void OperateSingle(PlayerActType act, int card, int btnIndex)
    {
        switch (act)
        {
        case PlayerActType.ZHI_GANG:
            onZhiGangClick(act, card);
            break;

        case PlayerActType.BACK_AN_GANG:
        case PlayerActType.COMMON_AN_GANG:
            onAnGangClick(act, card);
            break;

        case PlayerActType.BACK_PENG_GANG:
        case PlayerActType.COMMON_PENG_GANG:
            onPengGangClick(act, card);
            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:
            onHuClick(act, card);
            break;

        case PlayerActType.PASS:
            onPassClick();
            break;

        case PlayerActType.PENG:
            onPengClick(act, card);
            break;
        }
        ClearOperateCardBtns();
    }
示例#19
0
    /// <summary>
    /// 显示玩家操作提示
    /// </summary>
    public void ShowPlayActTip()
    {
        //ClearOperateCardBtns();
        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.playerActTipS2C.acts.Count; i++)
        {
            PlayerActType actType     = battleProxy.playerActTipS2C.acts[i];
            OperateType   operateType = OperateType.PASS;
            if (actType == PlayerActType.PUT_CARD)
            {
                continue;
            }
            if (actType == PlayerActType.PUT_FLOWER_CARD)
            {
                //PutFlowerCard();
                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.PASS:
                operateType = OperateType.PASS;
                break;

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

            case PlayerActType.CHI:
                operateType  = OperateType.CHI;
                chiSelectArr = BattleAreaUtil.GetCanChiArr(battleProxy.playerActTipS2C.actCards[i]);
                break;
                //case PlayerActType.PUT_FLOWER_CARD:
                //    //发送打花牌消息
                //    operateType = OperateType.FLOWER;
                //    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.playerActTipS2C.actCards[i]);
            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);
            switch (operates[i])
            {
            case OperateType.GANG:
                actionBtns[i].gameObject.SetActive(true);

                actionBtns[i].gameObject.GetComponent <Image>().sprite = Resources.Load <Sprite>("Textures/ActionGang");
                break;

            case OperateType.HU:
                actionBtns[i].gameObject.SetActive(true);

                actionBtns[i].gameObject.GetComponent <Image>().sprite = Resources.Load <Sprite>("Textures/ActionHu");
                break;

            case OperateType.PASS:
                actionBtns[i].gameObject.SetActive(true);

                actionBtns[i].gameObject.GetComponent <Image>().sprite = Resources.Load <Sprite>("Textures/ActionGuo");
                break;

            case OperateType.PENG:
                actionBtns[i].gameObject.SetActive(true);

                actionBtns[i].gameObject.GetComponent <Image>().sprite = Resources.Load <Sprite>("Textures/ActionPeng");
                break;

            case OperateType.CHI:
                actionBtns[i].gameObject.SetActive(true);

                actionBtns[i].gameObject.GetComponent <Image>().sprite = Resources.Load <Sprite>("Textures/ActionChi");
                break;
            }
            Animator animator = actionBtns[i].gameObject.GetComponent <Animator>();
            actionBtns[i].gameObject.GetComponent <Animator>().Play("ShowActBtn" + (i + 1), 0, 0);
        }
    }
示例#20
0
 public ActPowerVO(PlayerActType pAct, int pActCard, float pPower)
 {
     act     = pAct;
     actCard = pActCard;
     power   = pPower;
 }
示例#21
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;
        }
    }