Пример #1
0
    public void ChuPai(HandCardItem item, bool isMoNi)
    {
        item.setLayer("ZhuoPai");
        _RecyleHandCardList.Add(item);
        PlayChuPaiAnimation(isMoNi);

        AudioManager.GetInstance().PlayHandCardAudio(item.getId());
    }
Пример #2
0
    IEnumerator _HuPai(HuPushInfo info, Action cb)
    {
        bool       myself = isMyself();
        bool       zimo   = info.iszimo;
        int        layer  = myself ? LayerMask.NameToLayer("Self") : LayerMask.NameToLayer("ZhuoPai");
        List <int> holds  = info.holds;

        holds.Sort((a, b) => a - b);

        if (!myself)
        {
            for (int i = 0; i < _handCardList.Count && i < holds.Count; i++)
            {
                HandCardItem item = _handCardList [i];

                int          id   = holds [i];
                GameObject   obj  = ResourcesMgr.GetInstance().LoadMJ(id);
                HandCardItem card = new HandCardItem(id, obj);
                obj.layer = layer;
                obj.tag   = tagValue;
                obj.transform.SetParent(_HandCardPlace);

                obj.transform.localRotation = item.getObj().transform.localRotation;
                obj.transform.localPosition = item.getObj().transform.localPosition;

                _handCardList [i] = card;
                item.destroy();
            }

            foreach (HandCardItem item in _handCardList)
            {
                item.setLayer("ZhuoPai");
            }
        }

        if (_MoHand != null)
        {
            _MoHand.destroy();
        }

        if (true)
        {
            int        id  = info.hupai;
            GameObject obj = ResourcesMgr.GetInstance().LoadMJ(id);
            _MoHand   = new HandCardItem(id, obj);
            obj.layer = layer;
            obj.tag   = tagValue;
            obj.transform.SetParent(_MoHandPos);
            obj.transform.rotation = _MoHandPos.rotation;
            obj.transform.position = _MoHandPos.TransformPoint(0.0731f * offSetX, 0, 0);
        }

        _MoHand.setInteractable(false, false);

        bool anim   = false;
        bool replay = ReplayMgr.GetInstance().isReplay();

        if (!myself && !replay)
        {
            _MoHandPos.transform.Translate(0, 0, 0.04f);
            _MoHandPos.transform.Rotate(-90, 0, 0);
            anim = true;
        }

        if (anim)
        {
            Transform  huHandSpawn = this.transform.parent.Find("HandSpawn");
            GameObject huHand      = ResourcesMgr.mInstance.InstantiateGameObjectWithType("HupaiHand", ResourceType.Hand);
            huHand.transform.rotation = huHandSpawn.rotation;
            huHand.transform.position = huHandSpawn.position;
            huHand.GetComponent <DHM_HandAnimationCtr> ().huPaiEvent += HuPaiEventHandle;
        }

        if (!zimo)
        {
            DHM_RecyleHandCardManager.playHu();
        }
        else
        {
            Transform trans = _MoHand.getObj().transform;

            if (!myself)
            {
                GameObject ob = Instantiate(Resources.Load("Prefab/Meishu/fx_hu"), trans) as GameObject;
                Transform  ts = ob.transform;
                ts.localPosition = new Vector3(0, 0.24f, 0.13f);
            }
        }

        _MoHand.setHu();
        yield return(new WaitForSeconds(1.0f));

/*
 *              if (huPaiSpawn == null)
 *          huPaiSpawn = this.transform.parent.Find("HuPaiSpwan");
 *
 *      GameObject effectObj = Instantiate(_huEffect);
 *      effectObj.SetActive(true);
 *      effectObj.transform.position = huPaiSpawn.position;
 *
 *              GameObject huCard = ResourcesMgr.GetInstance ().LoadMJ (id);
 *      huCard.transform.rotation = huPaiSpawn.rotation;
 *      huCard.transform.position = huPaiSpawn.position;
 *      huCard.transform.SetParent(huPaiSpawn);
 */

        AudioManager.GetInstance().PlayEffectAudio("hu");
        MainViewMgr mm = MainViewMgr.GetInstance();

        if (zimo)
        {
            mm.showAction(seatindex, "zimo");
        }
        else
        {
            mm.showAction(seatindex, "hu");
            if (info.target >= 0)
            {
                mm.showAction(info.target, "dianpao");
            }
        }

        yield return(new WaitForSeconds(4.0f));

        cb();
    }