Beispiel #1
0
    //发起行为,出牌碰、吃、杠等
    public void CreateAction(MjActionType type, MaJangModel mjm = null, MaJangModel otherMjm = null)
    {
        UserMjAction uma = new UserMjAction();

        uma.type = (int)type;
        if (type != MjActionType.Guo)
        {
            if (type == MjActionType.AGang)
            {
                uma.mj = sameMj[0].mj;
            }
            else
            {
                uma.mj = mjm.mj;
            }
        }
        if (otherMjm)
        {
            uma.mjOther = otherMjm.mj;
        }
        if (statu == 1)
        {
            uma.isTing = true;
        }
        if (type == MjActionType.OutMj)
        {
            OutMj(mjm);
        }
        SocketClient.Instance.AddSendMessageQueue(new C2GMessage()
        {
            msgid        = MessageId.C2G_UserMjAction,
            UserMjAction = uma
        });
        isTurn = false;
    }
Beispiel #2
0
 public void Gang(List <Mj> mjs = null, MjActionType mat = MjActionType.DGang)
 {
     isGang = true;
     if (mjs == null)
     {
         if (sameMj.Count > 4)
         {
             EnableGangPanel();
         }
         else
         {
             List <MaJangModel> temp = new List <MaJangModel>();
             int targetNum           = 0;
             for (int i = 0; i < handMjList.Count; i++)
             {
                 if (handMjList[i].mjNo == sameMj[0].mjNo)
                 {
                     targetNum++;
                     temp.Add(handMjList[i]);
                 }
             }
             if (targetNum == 4)
             {
                 LightMj(temp, true);
                 CreateAction(MjActionType.AGang, temp[0]);
             }
             else if (targetNum == 3)
             {
                 CreateAction(MjActionType.DGang, temp[0]);
             }
             else if (targetNum == 1)
             {
                 LightMj(temp[0]);
                 CreateAction(MjActionType.BGang, sameMj[0]);
             }
             PlaySound(sex == 0 ? AudioManager.AudioSoundType.boygang : AudioManager.AudioSoundType.girlgang);
         }
     }
     else
     {
         if (mat.Equals(MjActionType.BGang))
         {
             LightMj(GetLightMj(mjs)[0]);
         }
         else
         {
             LightMj(GetLightMj(mjs), mat == MjActionType.AGang);
         }
         ActionAnimation(MjActionType.AGang);
         PlaySound(sex == 0 ? AudioManager.AudioSoundType.boygang : AudioManager.AudioSoundType.girlgang);
     }
 }
Beispiel #3
0
    //行为回调,部分行为受到回调后才会继续执行
    public void ExecuteAction(UserActionResp uar)
    {
        MjActionType type = (MjActionType)uar.type;

        switch (type)
        {
        case MjActionType.Peng:
            if (sameMj.Count > 3)
            {
                sameMj.RemoveAt(0);
            }
            LightMj(sameMj);
            isTurn = true;
            break;

        case MjActionType.DGang:
            LightMj(sameMj);
            break;

        case MjActionType.Chi:
            LightMj(chiMj);
            isTurn = true;
            break;

        case MjActionType.ChiTing:
            LightMj(chiTingMj, false, false);
            SetTingMj(uar.mj);
            Ting();
            isTurn = true;
            break;

        case MjActionType.DingTing:
        case MjActionType.PengTing:
            if (sameMj.Count > 3)
            {
                sameMj.RemoveAt(0);
            }
            LightMj(sameMj, false, false);
            SetTingMj(uar.mj);
            Ting();
            isTurn = true;
            break;
        }
        ActionAnimation(type);
    }
Beispiel #4
0
    //行为动画
    void ActionAnimation(MjActionType mat)
    {
        bool isActivity = true;

        actionAnimation.isDisappear = true;
        Image image = actionAnimation.GetComponent <Image>();

        switch (mat)
        {
        case MjActionType.Peng:
        case MjActionType.Chi:
        case MjActionType.Ting:
        case MjActionType.ChiTing:
        case MjActionType.DingTing:
        case MjActionType.PengTing:
            //case MjActionType.Hu:
            //case MjActionType.ZiMo:
            image.sprite = BundleManager.Instance.GetSprite("majiang_pic_" + mat.ToString().ToLower(), MaJangPage.Instance.GetSpriteAB());
            break;

        case MjActionType.DGang:
        case MjActionType.AGang:
        case MjActionType.BGang:
            image.sprite = BundleManager.Instance.GetSprite("majiang_pic_gang", MaJangPage.Instance.GetSpriteAB());
            break;

        default:
            isActivity = false;
            break;
        }
        if (isActivity)
        {
            image.SetNativeSize();
            actionAnimation.gameObject.SetActive(true);
        }
    }