예제 #1
0
 // 显示吃碰杠胡
 public void ShowCpgh(EnumCpgType behivor)
 {
     YxDebug.Log("------> MahjongPlayer.ShowCpgh() behivor = " + behivor);
     if (CpghBehavior == null)
     {
         return;
     }
     CpghBehavior.SetBehavior(behivor);
 }
예제 #2
0
        public virtual void OnGetXFGang(RequestData requeset)
        {
            EnumCpgType fengGangBehavior = EnumCpgType.MingGang;
            string      fengGangInfo     = GameTools.GetOperationVoice(UserInfo.Sex, ConstantData.VoiceGang, Random.Range(0, 2));

            GetToken();
            MahjongGroupData groupData = new MahjongGroupData(GroupType.FengGang);

            if (requeset.Cards.Length == 3)
            {
                if (ShowFengGangByNum)
                {
                    fengGangBehavior = EnumCpgType.ThreeFengGang;
                    fengGangInfo     = GameTools.GetOperationVoice(UserInfo.Sex, ConstantData.VoiceThreeFengGang, 0);
                }
                groupData.values = new int[3];
            }
            else
            {
                if (ShowFengGangByNum)
                {
                    fengGangBehavior = EnumCpgType.FourFengGang;
                    fengGangInfo     = GameTools.GetOperationVoice(UserInfo.Sex, ConstantData.VoiceFourFengGang, 0);
                }
            }
            Facade.Instance <MusicManager>().Play(fengGangInfo);
            CpghBehavior.SetBehavior(fengGangBehavior);
            foreach (int card in requeset.Cards)
            {
                if (card > 0)
                {
                    groupData.AddValue(card);
                }
            }

            List <MahjongItem> needItems = new List <MahjongItem>();

            needItems.AddRange(GetCardsFromHand(groupData.values.ToList(), IsOther));
            foreach (var item in needItems)
            {
                GameTools.DestroyUserContorl(item);
            }
            MahjongEnv.AddGroup(groupData, needItems, IsOther);
            GroupItems.Add(groupData);
            SortHandCard();
            RecheckLastGetIn();
        }
예제 #3
0
파일: CpghChar.cs 프로젝트: da1fanshu/yizhe
        public void SetBehavior(EnumCpgType type)
        {
            int index;

            switch (type)
            {
            case EnumCpgType.Chi:
                index = 0;
                break;

            case EnumCpgType.Peng:
                index = 3;
                break;

            case EnumCpgType.ZhuaGang:
            case EnumCpgType.PengGang:
            case EnumCpgType.MingGang:
            case EnumCpgType.AnGang:
            case EnumCpgType.CaiGang:
            case EnumCpgType.LaiZiGang:
                index = 1;
                break;

            case EnumCpgType.Hu:
                index = 2;
                break;

            case EnumCpgType.ZiMo:
                index = 4;
                break;

            case EnumCpgType.MoBao:
                index = 5;
                break;

            case EnumCpgType.PiaoHu:
                index = 6;
                break;

            case EnumCpgType.ChongBao:
                index = 7;
                break;

            case EnumCpgType.HuanBao:
                index = 8;
                break;

            case EnumCpgType.NiuBiHu:
                index = 9;
                break;

            case EnumCpgType.Ting:
                index = 10;
                break;

            case EnumCpgType.Xst:
                index = 11;
                break;

            case EnumCpgType.QiangGangHu:
                index = 12;
                break;

            case EnumCpgType.ThreeFengGang:
                index = 13;
                break;

            case EnumCpgType.FourFengGang:
                index = 14;
                break;

            case EnumCpgType.LiGang:
                index = 15;
                break;

            default:
                return;
            }
            if (_showCor != null)
            {
                StopCoroutine(_showCor);
            }
            if (ShowTweenAni)
            {
                if (index >= CpghObjs.Length || index <= -1)
                {
                    return;
                }
                var showObj = CpghObjs[index];
                if (showObj)
                {
                    _showCor = StartCoroutine(OnPlayTweenEffect(showObj, EffectShowTime));
                }
            }
            else
            {
                if (index >= cpgh.Length || index <= -1)
                {
                    return;
                }
                var effect = cpgh[index];
                if (effect)
                {
                    _showCor = StartCoroutine(OnPlayEffect(effect, EffectShowTime));
                }
            }
            if (gameObject.activeInHierarchy)
            {
                StartCoroutine(EffectPlay.WaitExcuteCalls());
            }
        }