void Start()
 {
     tip = Instantiate(m_Tip);
     tip.SetActive(false);
     if (_handCardMgr == null)
     {
         _handCardMgr = GetComponentInChildren <DHM_HandCardManager>();
     }
     if (_recyleCardMgr == null)
     {
         _recyleCardMgr = GetComponentInChildren <DHM_RecyleHandCardManager>();
     }
     if (_pengGangMgr == null)
     {
         _pengGangMgr = GetComponentInChildren <PengGangManager>();
     }
     if (_handAnimationCtr == null)
     {
         _handAnimationCtr = GetComponentInChildren <DHM_HandAnimationCtr>();
     }
     if (_handCardMgr != null && _recyleCardMgr != null)
     {
         _handCardMgr.chuPaiEvent           += _recyleCardMgr.ChuPai;
         _recyleCardMgr.ChuPaiCallBackEvent += _handCardMgr.ChuPaiCallBackEventHandle;
     }
     //initHighLight();
 }
Exemple #2
0
    void Start()
    {
        switch (m_Player)
        {
        case DHM_HandCardManager.PlayerType.East:
            localindex = 0;
            break;

        case DHM_HandCardManager.PlayerType.South:
            localindex = 1;
            break;

        case DHM_HandCardManager.PlayerType.West:
            localindex = 2;
            break;

        case DHM_HandCardManager.PlayerType.North:
            localindex = 3;
            break;
        }

        seatindex = RoomMgr.GetInstance().getSeatIndexByLocal(localindex);

        _handCardMgr      = GetComponentInChildren <DHM_HandCardManager>();
        _recyleCardMgr    = GetComponentInChildren <DHM_RecyleHandCardManager>();
        _pengGangMgr      = GetComponentInChildren <PengGangManager>();
        _handAnimationCtr = GetComponentInChildren <DHM_HandAnimationCtr>();

        _handCardMgr.seatindex   = seatindex;
        _recyleCardMgr.seatindex = seatindex;
        _pengGangMgr.seatindex   = seatindex;

        _handCardMgr.chuPaiEvent           += _recyleCardMgr.ChuPai;
        _recyleCardMgr.ChuPaiCallBackEvent += _handCardMgr.ChuPaiCallBackEventHandle;

        if (RoomMgr.GetInstance().seatindex == seatindex)
        {
            SetLayer();
        }
    }
    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();
    }
Exemple #4
0
    public void onBtnChat()
    {
        //GameAlert.GetInstance().show("测试");

        //DHM_CardManager cm = PlayerManager.GetInstance ().getCardManager (0);

        DHM_CardManager cm = GameObject.Find("WestPlayer").GetComponent <DHM_CardManager> ();
        PengGangManager pg = cm._pengGangMgr;

        //cm._handCardMgr.unittest ();

        DHM_RecyleHandCardManager.playHu();
        //cm._handCardMgr ();
        //gseats[0].GetComponent<GameSeat>().showAction ("peng", 11);
        //gseats[1].GetComponent<GameSeat>().showAction ("chi", 11);
        //gseats[2].GetComponent<GameSeat>().showAction ("gang", 11);
        //gseats[3].GetComponent<GameSeat>().showAction ("qiao", 11);

        //InteractMgr.GetInstance().showQiaoHelp();

        /*
         * List<int> tings = new List<int>();
         *
         * tings.Add (22);
         * tings.Add (33);
         * tings.Add (44);
         *
         * InteractMgr.GetInstance ().showPrompt (tings);
         */

        //Transform tm = cm._handCardMgr._HandCardPlace.transform;

        /*
         * tm.Translate(0, 0.0225f, 0);
         * tm.Rotate(90, 0, 0);
         *
         * tm.Translate(0, 0.05f, 0.0225f);
         * tm.Rotate(-180, 0, 0);
         */
        //tm.Translate (0, 0, 0.05f);
        //tm.Rotate (-90, 0, 0);

        //GameManager.GetInstance ().SwitchTo (2);

        //pg.Peng(134);
        //pg.Peng (341);
        //pg.CreateWanGangCard (341);

        //pg.Peng (141);
        //cm._pengGangMgr.Chi (13);
        //
//		cm._pengGangMgr.Gang (312, false);
//		cm._pengGangMgr.Chi (33);
//		cm._pengGangMgr.Peng (327);

        //cm._pengGangMgr.Chi (11);
        //cm._pengGangMgr.Peng (327);

        //cm._handCardMgr.HuPai(21);

/*
 *              if (show) {
 *                      cm.ActiveChuPaiState (true);
 *              } else {
 *                      cm.HideChuPaiState ();
 *              }
 *
 *              show = !show;
 */
        //GameManager.GetInstance ().PlaySaiZi (0, new int[] { 1, 6 });

/*
 *              VoiceMgr vm = VoiceMgr.GetInstance ();
 *              if (!show) {
 *                      Debug.Log ("start record");
 *                      vm.startRecord ();
 *              } else {
 *                      Debug.Log ("stop record");
 *                      vm.stopRecord ();
 *              }
 *
 *              show = !show;
 */
//		transform.Find("Chat").gameObject.SetActive(true);
    }