Exemplo n.º 1
0
    public void OnGUI()
    {
        if (GUI.Button(new Rect(0, 0, 150, 40), "FightTest"))
        {
            int      cnt   = Msgs.Count;
            AttackVO atkVo = null;
            for (int i = 0; i < cnt; i++)
            {
                EffectVO vo = Msgs[i];
                vo.Target.Pid = PlayerProxy.Instance.Info.pid;

                if (vo.HeroProp == HeroPropType.Damage || vo.HeroProp == HeroPropType.Hp || vo.HeroProp == HeroPropType.Shield)
                {
                    atkVo = PVPManager.Instance.On_AddMainOverEffect(vo);
                }
                else if (null != PVPManager.Instance)
                {
                    PVPManager.Instance.On_AddEffect(vo);
                }
            }

            if (null != PVPManager.Instance && !PVPManager.Instance.InPlayMainAnimation() && null != atkVo)
            {
                PVPManager.Instance.PlayMainAnimation(atkVo);
            }
        }

        GUI.Label(new Rect(100, 100, 400, 40), FightProxy.xxxxxx);
    }
Exemplo n.º 2
0
    public override void InjectVO(UnitVO input)
    {
        type = ComponentType.Movement;
        switch (input.type)
        {
        case UnitType.creature:
            CreatureVO vo = input as CreatureVO;
            data.position = vo.positon;
            data.forward  = vo.forward;
            data.speed    = vo.speed;
            data.movetype = vo.movetype;
            data.bodySize = vo.bodysize;
            data.type     = UnitType.creature;
            break;

        case UnitType.effect:
            EffectVO evo = input as EffectVO;
            data.position = evo.positon;
            data.forward  = evo.forward;
            data.speed    = evo.speed;
            data.movetype = evo.movetype;
            data.bodySize = evo.bodysize;
            data.type     = UnitType.effect;
            break;
        }
    }
Exemplo n.º 3
0
    private void OnRec_FightEffect(INotification noti)
    {
        if (null == m_Panel)
        {
            if (mOpenEffectList == null)
            {
                mOpenEffectList = new List <EffectVO>();
            }

            mOpenEffectList.Add(noti.Body as EffectVO);
            return;
        }

        EffectVO vo = noti.Body as EffectVO;

        DoEffect(vo);
    }
Exemplo n.º 4
0
    /// <summary>添加主动画过后执行效果</summary>
    /// <param name="vo"></param>
    public AttackVO On_AddMainOverEffect(EffectVO vo)
    {
        AttackVO atkvo = new AttackVO();

        atkvo.Pid       = vo.Source.Pid;
        atkvo.TargetPid = vo.Target.Pid;
        atkvo.From      = vo.Source.Target;
        atkvo.To        = vo.Target.Target;

        AttackVO dicvo;

        if (!AttackDIc.TryGetValue(atkvo.ID, out dicvo))
        {
            AttackDIc[atkvo.ID] = atkvo;
        }

        AttackDIc[atkvo.ID].Effects.Add(vo);

        return(AttackDIc[atkvo.ID]);
    }
Exemplo n.º 5
0
    /// <summary>添加执行效果</summary>
    /// <param name="vo"></param>
    public void On_AddEffect(EffectVO vo)
    {
        if (null == mEffects)
        {
            mEffects = new List <EffectVO>();
        }


        if (vo.Type == TargetType.Role && vo.RoleProp == RolePropType.ExtractCard)
        {
            CanDoMoveNextEffect = true;
            mMoveEffects.Add(vo);
        }
        else
        {
            mEffects.Add(vo);
        }

        On_DoNextEffect();
    }
Exemplo n.º 6
0
    /// <summary>卡牌产生的效果</summary>
    /// <param name="data"></param>
    public void OnRec_EffectMsg(object data)
    {
        EffectsMsg msg = data as EffectsMsg;

        List <EffectVO> vos   = new List <EffectVO>();
        int             cnt   = msg.effect.Count;
        AttackVO        atkVo = null;

        bool doeffect = false;

        for (int i = 0; i < cnt; i++)
        {
            EffectVO vo = new EffectVO();
            vo.Prase(msg.effect[i]);

            vos.Add(vo);

            if (vo.HeroProp == HeroPropType.Damage || vo.HeroProp == HeroPropType.Hp || vo.HeroProp == HeroPropType.Shield)
            {
                atkVo = PVPManager.Instance.On_AddMainOverEffect(vo);
            }
            else if (null != PVPManager.Instance)
            {
                doeffect = true;
                PVPManager.Instance.On_AddEffect(vo);
            }

            Debug.LogError("EffectMsg:" + msg.effect[i].target.type + " | Prop:" + msg.effect[i].prop + " | Value:" + msg.effect[i].value + " TargetIndex:" + msg.effect[i].target.index);
        }

        if (doeffect)
        {
            PVPManager.Instance.On_DoMoveNextEffect();
        }


        if (null != PVPManager.Instance && null != atkVo)
        {
            PVPManager.Instance.PlayMainAnimation(atkVo);
        }
    }
Exemplo n.º 7
0
    /// <summary>执行下一个移动</summary>
    public void On_DoMoveNextEffect(bool force = false)
    {
        if (force)
        {
            CanDoMoveNextEffect = true;
        }

        if (!CanDoMoveNextEffect)
        {
            return;
        }

        if (mMoveEffects.Count > 0)
        {
            EffectVO vo = mMoveEffects[0];

            mMoveEffects.RemoveAt(0);

            CanDoMoveNextEffect = false;
            Facade.Instance.SendNotification(NotificationID.Fight_Effect, vo);
        }
    }
Exemplo n.º 8
0
    private void DoEffect(EffectVO vo)
    {
        if (vo.Type == TargetType.Hero && vo.HeroProp == HeroPropType.Move)
        {
            //if (mInDoMove)
            //{
            //    DoMoveList.Add(vo);
            //    return;
            //}

            //mInDoMove = true;

            bool     isTeamA = vo.Target.Pid == PlayerProxy.Instance.Info.pid;
            CardRole target;
            CardRole trigger;
            Vector3  targetToPos  = Vector3.zero;
            Vector3  triggerToPos = Vector3.zero;

            if (Define.VSTest)
            {
                target  = PVPManager.Instance.GetCardRoleByDid(2);
                trigger = PVPManager.Instance.GetCardRoleByDid(3);
            }
            else
            {
                int tragetInd  = vo.Target.Target - 1;
                int triggerInd = vo.Source.Target - 1;

                target  = PVPManager.Instance.GetCardRoleByPos(isTeamA, vo.Target.Target);
                trigger = PVPManager.Instance.GetCardRoleByPos(isTeamA, vo.Source.Target);

                Debug.LogError("Move target:" + vo.Target.Target + " | trigger:" + vo.Source.Target);

                target.SlotIndex    = vo.Source.Target;
                target.SerData.pos  = vo.Source.Target;
                trigger.SlotIndex   = vo.Target.Target;
                trigger.SerData.pos = vo.Target.Target;

                targetToPos  = target.transform.position;
                triggerToPos = trigger.transform.position;
            }

            //bool targetMoveOver = false;
            //bool triggerMoveOver = false;

            target.transform.DOMove(triggerToPos, 1f).OnComplete(() =>
            {
                //targetMoveOver = true;

                //if(targetMoveOver && triggerMoveOver)
                //{
                //mInDoMove = false;

                //EffectVO tvo = DoMoveList[0];
                //DoMoveList.RemoveAt(0);

                PVPManager.Instance.On_DoNextEffect(true);
                //SendNotification(NotificationID.Fight_Effect, tvo);
                //}
            });

            trigger.transform.DOMove(targetToPos, 1f).OnComplete(() =>
            {
                //triggerMoveOver = true;

                //if (targetMoveOver && triggerMoveOver)
                //{
                //mInDoMove = false;

                //EffectVO tvo = DoMoveList[0];
                //DoMoveList.RemoveAt(0);

                //PVPManager.Instance.On_DoNextEffect(true);
                //SendNotification(NotificationID.Fight_Effect, tvo);
                //}
            });

            //PVPManager.Instance.On_DoNextEffect(true);
        }
        else if (vo.Type == TargetType.Hero)
        {
            UILabel lab = GameObject.Instantiate(m_Panel.addValue);
            lab.transform.SetParent(m_Panel.transform);
            lab.transform.localScale = Vector3.one;
            lab.gameObject.SetActive(true);


            if (null == vo.Target)
            {
                return;
            }

            bool isMe = vo.Target.Pid == PlayerProxy.Instance.Info.pid;

            CardRole cdRole = PVPManager.Instance.GetCardRoleByPos(isMe, vo.Target.Target);

            string sign = vo.Value > 0 ? "+" : "";
            if (vo.HeroProp == HeroPropType.Damage)      //受到伤害
            {
                cdRole.SerData.shield += vo.Value;
                if (cdRole.SerData.shield < 0)
                {
                    cdRole.SerData.hp     = cdRole.SerData.hp + cdRole.SerData.shield;
                    cdRole.SerData.shield = 0;
                }


                lab.text = string.Format("[FF0000]{0}{1}[-]", sign, vo.Value);

                SendNotification(NotificationID.FightRoleHp_Data, cdRole);
            }
            else if (vo.HeroProp == HeroPropType.Hp)     //加血
            {
                cdRole.SerData.hp += vo.Value;
                if (cdRole.SerData.hp > cdRole.SerData.maxHp)
                {
                    cdRole.SerData.hp = cdRole.SerData.maxHp;
                }
                if (cdRole.SerData.hp < 0)
                {
                    cdRole.SerData.hp = 0;
                }

                lab.text = string.Format("[00FF00]{0}{1}[-]", sign, vo.Value);

                SendNotification(NotificationID.FightRoleHp_Data, cdRole);
            }
            else if (vo.HeroProp == HeroPropType.Shield) //加护甲
            {
                cdRole.SerData.shield += vo.Value;
                if (cdRole.SerData.shield < 0)
                {
                    cdRole.SerData.shield = 0;
                }

                lab.text = string.Format("[0000FF]{0}{1}[-]", sign, vo.Value);

                SendNotification(NotificationID.FightRoleHp_Data, cdRole);
            }
            else if (vo.HeroProp == HeroPropType.MoveNum)
            {
                cdRole.SerData.moveNum = vo.Value;

                PVPManager.Instance.On_DoNextEffect(true);
                return;
            }
            else if (vo.HeroProp == HeroPropType.UseArcaneNum)
            {
                cdRole.SerData.useArcaneNum = vo.Value;

                PVPManager.Instance.On_DoNextEffect(true);
                return;
            }
            else if (vo.HeroProp == HeroPropType.Death)
            {
                cdRole.Die();

                SendNotification(NotificationID.FightRoleHp_Data, cdRole);
                PVPManager.Instance.On_DoNextEffect(true);
                return;
            }
            else
            {
                PVPManager.Instance.On_DoNextEffect(true);
                return;
            }

            if (cdRole == null)
            {
                return;
            }

            Vector3 screenPos = PVPManager.Instance.AvatarCamera.WorldToScreenPoint(cdRole.transform.position);
            screenPos.z = 0;

            Vector3 uiPos = Main.CameraUI.ScreenToWorldPoint(screenPos);
            uiPos.y += 0.4f;
            lab.transform.position = uiPos;

            Vector3 endPos = lab.transform.position;
            endPos.y += 0.5f;
            lab.transform.DOMove(endPos, 1f).OnComplete(delegate()
            {
                GameObject.DestroyObject(lab.gameObject);

                PVPManager.Instance.On_DoNextEffect(true);
            });
        }
        else
        {
            PVPManager.Instance.On_DoNextEffect(true);
        }
    }
Exemplo n.º 9
0
    private void DoEffect(EffectVO vo)
    {
        int cnt;
        FightPanel_CardItem cdItm;

        if (vo.Type == TargetType.Role)
        {
            if (vo.RoleProp == RolePropType.GameOver)
            {
                string warn = vo.Value == PlayerProxy.Instance.Info.pid ? "我方胜利" : "敌方胜利";
                m_Panel.overLab.text = warn;
                m_Panel.overLab.gameObject.SetActive(true);
            }

            //获取额外卡牌
            if (vo.RoleProp == RolePropType.ExtractCard && vo.CardItem != null)
            {
                if (vo.IsMe || Define.VSTest)
                {
                    FightPanel_CardItem cdItm0 = GetCardItem(vo.IsMe);
                    if (cdItm0 != null)
                    {
                        AddCard(cdItm0);

                        cdItm0.SerData = vo.CardItem;

                        Vector3 pos = cdItm0.transform.position.Clone();
                        pos.x = 1.3f;
                        cdItm0.transform.position = pos;

                        if (Define.NoAni)
                        {
                            cdItm0.transform.position = mTeamAInitPosition[cdItm0.NoShowIndex];
                            PVPManager.Instance.On_DoMoveNextEffect(true);
                        }
                        else
                        {
                            cdItm0.transform.DOMove(mTeamAInitPosition[cdItm0.NoShowIndex], 0.5f).OnComplete(() =>
                            {
                                PVPManager.Instance.On_DoMoveNextEffect(true);
                            });
                        }
                    }
                }
                else
                {
                    FightPanel_CardItem cdItm0 = GetCardItem(vo.IsMe);
                    if (cdItm0 != null)
                    {
                        cdItm0.SerData = vo.CardItem;
                        cdItm0.gameObject.SetActive(true);
                        cdItm0.transform.position = mTeamBInitPosition[cdItm0.NoShowIndex];
                    }

                    UpdateCardBPostion();
                    PVPManager.Instance.On_DoMoveNextEffect(true);
                }
            }
            else if (vo.IsMe && vo.RoleProp == RolePropType.CreateCard)
            {
                cdItm = mTeamCardsFreeQueque[0];

                AddCard(cdItm);

                Vector3 pos = cdItm.transform.position.Clone();
                pos.x = 1.2f;
                cdItm.transform.position = pos;

                UpdateCardAPostion();
                PVPManager.Instance.On_DoNextEffect(true);
            }
            else if (!vo.IsMe && vo.RoleProp == RolePropType.CreateCard)
            {
                cdItm = GetCardItem(vo.IsMe);

                if (cdItm != null)
                {
                    cdItm.SerData = vo.CardItem;
                    cdItm.gameObject.SetActive(true);

                    cdItm.transform.position = mTeamBInitPosition[cdItm.NoShowIndex];
                    UpdateCardBPostion();
                    PVPManager.Instance.On_DoNextEffect(true);
                }
            }
            else if (vo.IsMe && vo.RoleProp == RolePropType.RemoveCard)
            {
                cnt   = mTeamCards.Count;
                cdItm = GetCardItem(vo.IsMe, vo.Value);
                Debug.LogError("Remove MyCard:" + vo.Value);

                if (null != cdItm)
                {
                    RemoveCard(cdItm);

                    UpdateCardAPostion();
                    PVPManager.Instance.On_DoNextEffect(true);
                }
            }
            else if (!vo.IsMe && vo.RoleProp == RolePropType.RemoveCard)
            {
                cnt   = mTeamCards.Count;
                cdItm = GetCardItem(vo.IsMe, vo.Value);

                if (null != cdItm)
                {
                    cdItm.gameObject.SetActive(false);

                    UpdateCardBPostion();
                    PVPManager.Instance.On_DoNextEffect(true);
                }
            }
            else
            {
                PVPManager.Instance.On_DoNextEffect(true);
            }
        }
        else if (vo.Type == TargetType.Card)
        {
            if (vo.IsMe)
            {
                int ct = 0;
                ct = mTeamCards.Count;
                FightPanel_CardItem cdItm0 = GetCardItem(vo.IsMe, vo.Target.Target);

                if (null != cdItm0)
                {
                    if (vo.CardProp == CardPropType.Exp)
                    {
                        cdItm0.SerData.exp = vo.Value;

                        AddCard(cdItm0);

                        cdItm0.UpdateDisplay();

                        UpdateCardAPostion();
                        PVPManager.Instance.On_DoNextEffect(true);
                    }
                }
            }
            else
            {
                int ct = 0;
                ct = mTeamBCards.Count;

                FightPanel_CardItem cdItm1 = GetCardItem(vo.IsMe, vo.Target.Target);

                if (null != cdItm1)
                {
                    if (vo.CardProp == CardPropType.Exp)
                    {
                        cdItm1.SerData.exp = vo.Value;
                        cdItm1.gameObject.SetActive(true);
                        cdItm1.UpdateDisplay();

                        UpdateCardBPostion();
                        PVPManager.Instance.On_DoNextEffect(true);
                    }
                }
            }
        }
    }