Ejemplo n.º 1
0
        public void UpdateVO_ShowHeadTaskState(int m_state)
        {
            if (m_vCreature == null)
            {
                return;
            }

            CmdUIHead state = new CmdUIHead();

            state.type      = 13;
            state.taskstate = m_state;
            m_vCreature.PushCommand(state);
        }
Ejemplo n.º 2
0
        public void UpdateVO_ShowHead(bool bShow)
        {
            if (m_vCreature == null)
            {
                return;
            }

            CmdUIHead lv = new CmdUIHead();

            lv.type  = 5;
            lv.bShow = bShow;
            m_vCreature.PushCommand(lv);
        }
Ejemplo n.º 3
0
        public void UpdateVO_ShowFootHalo()
        {
            if (m_vCreature == null || m_footHaloEffectId == 0)
            {
                return;
            }

            CmdUIHead lv = new CmdUIHead();

            lv.type     = 14;
            lv.effectId = m_footHaloEffectId;
            m_vCreature.PushCommand(lv);
        }
Ejemplo n.º 4
0
        public void UpdateVO_ShowHeadName(string sName)
        {
            if (m_vCreature == null)
            {
                return;
            }

            CmdUIHead name = new CmdUIHead();

            name.type = 1;
            name.name = sName;
            m_vCreature.PushCommand(name);
        }
Ejemplo n.º 5
0
        public void UpdateVO_SetNameShowOnly(bool bShow)
        {
            if (m_vCreature == null)
            {
                return;
            }

            CmdUIHead name = new CmdUIHead();

            name.type  = 9;
            name.bShow = bShow;
            m_vCreature.PushCommand(name);
        }
Ejemplo n.º 6
0
        public void UpdateVO_ShowHeadCamp(bool bTeam)
        {
            if (m_vCreature == null)
            {
                return;
            }

            CmdUIHead hp = new CmdUIHead();

            hp.type  = 8;
            hp.bTeam = bTeam;
            m_vCreature.PushCommand(hp);
        }
Ejemplo n.º 7
0
        public void UpdateVO_ShowHeadLv()
        {
            if (m_vCreature == null)
            {
                return;
            }

            CmdUIHead lv = new CmdUIHead();

            lv.type = 2;
            lv.lv   = GetPropNum(eCreatureProp.Lv);
            m_vCreature.PushCommand(lv);
        }
Ejemplo n.º 8
0
        // 创建玩家身上的特效,非技能情况,比如升级,吃F爆点等等,不需要逻辑控制生命周期的
        // bindPos = SBindPont.eBindType
        public void UpdateVO_ShowEffect_One(CCreature cc, int effect, int bindPos)
        {
            if (cc == null || cc.m_vCreature == null)
            {
                return;
            }

            CmdUIHead cmd = new CmdUIHead();

            cmd.type          = 11;
            cmd.effectId      = effect;
            cmd.effectBindPos = bindPos;
            cc.m_vCreature.PushCommand(cmd);
        }
Ejemplo n.º 9
0
        public void UpdateVO_ShowHeadHp()
        {
            if (m_vCreature == null)
            {
                return;
            }

            // 通知头顶更新
            CmdUIHead hp = new CmdUIHead();

            hp.type  = 3;
            hp.curHp = GetPropNum(eCreatureProp.CurHp);
            hp.maxHp = GetPropNum(eCreatureProp.Hp);
            m_vCreature.PushCommand(hp);
        }
Ejemplo n.º 10
0
        public void UpdateVO_ShowRide(bool bUp, CCreature ride = null)
        {
            if (m_vCreature == null)
            {
                return;
            }

            CmdUIHead name = new CmdUIHead();

            name.type  = 12;
            name.bRide = bUp;
            if (ride != null)
            {
                name.rideObject = ride.GetVObject();
            }
            m_vCreature.PushCommand(name);
        }
Ejemplo n.º 11
0
        public void UpdateUI_ShowHpHUD(CCreature target, int hitVal, bool bCrit = false)
        {
            eHUDType type = eHUDType.NONE;

            if (hitVal < 0)
            {
                if (bCrit)
                {
                    type = eHUDType.FIGHT_CRIT;
                }
                else
                {
                    if (target.IsMaster())
                    {
                        type = eHUDType.FIGHT_SELFHARM;
                    }
                    else
                    {
                        type = eHUDType.FIGHT_HARM;
                    }
                }
            }
            else
            {
                type = eHUDType.FIGHT_ADDBLOOD;
            }

            HudModule hud = (HudModule)LayoutMgr.Inst.GetLogicModule(LogicModuleIndex.eLM_PanelHud);

            hud.SetVisible(true);
            hud.SetHUD(type, hitVal.ToString(), target);

            return;

            if (target.m_vCreature == null)
            {
                return;
            }
            CmdUIHead cmd = new CmdUIHead();

            cmd.type    = 4;
            cmd.hudType = type;
            cmd.hudText = hitVal.ToString();
            target.m_vCreature.PushCommand(cmd);
        }
Ejemplo n.º 12
0
        public void UpdateVO_HitAnima(CCreature cc, int animaId)
        {
            if (cc == null || cc.m_vCreature == null)
            {
                return;
            }

            CmdUIHead cmd = new CmdUIHead();

            cmd.type    = 10;
            cmd.animaId = animaId;
            cc.m_vCreature.PushCommand(cmd);

            //cc.UpdateVO_BuffState(eBuffState.Hit, true);
            //CFrameTimeMgr.Inst.RegisterEvent(200, () =>
            //{
            //    cc.UpdateVO_BuffState(eBuffState.Hit, false);
            //});
        }
Ejemplo n.º 13
0
        public void EnterFrame()
        {
            if (m_player.IsDie())
            {
                return;
            }

            m_curTime += FSPParam.clientFrameMsTime;
            if (m_curTime >= 40 * FSPParam.clientFrameMsTime)
            {
                if (m_tree != null)
                {
                    m_tree.OnUpdate();
                }

                // AI技能外部CD
                int curSkillInterval = m_tree.m_dataBase.GetData <int>((int)eAIParam.INT_SKILL_INTERVAL);
                if (curSkillInterval >= 0)
                {
                    curSkillInterval -= FSPParam.clientFrameMsTime;
                    m_tree.m_dataBase.SetData <int>((int)eAIParam.INT_SKILL_INTERVAL, curSkillInterval);
                }

                if (Client.Inst().m_bDebug)
                {
                    string state = GetCurState();
                    if (!string.IsNullOrEmpty(state))// 如果卡主,可以知道最后一个状态
                    {
                        // 状态显示
                        VObject mt = m_player.GetVObject();
                        if (mt == null)
                        {
                            return;
                        }
                        CmdUIHead cmd = new CmdUIHead();
                        cmd.type = 1;
                        cmd.name = m_player.GetUid() + ":" + state;
                        mt.PushCommand(cmd);
                    }
                }

                // 仇恨值
                m_curHatredTime += FSPParam.clientFrameMsTime;
                if (m_curHatredTime >= 30 * FSPParam.clientFrameMsTime)
                {
                    _UpdateHatredList();
                    //主角显示测试界面
                    if (m_player.IsMaster())
                    {
                        m_hatredList.Sort((x, y) =>
                        {
                            if (x.val == y.val)
                            {
                                return(0);
                            }
                            else if (x.val > y.val)
                            {
                                return(-1);
                            }
                            else
                            {
                                return(1);
                            }
                        });
                        //m_list.Init(m_hatredList.Count, (item, index) =>
                        //{
                        //    UIItem.SetText(item, "txt", m_hatredList[index].uid + " 仇恨值:" + m_hatredList[index].val);
                        //    UIItem.SetProgress(item, "pct", m_hatredList[index].val, 100);
                        //});
                    }
                    m_curHatredTime = 0;
                }
            }
        }
Ejemplo n.º 14
0
        public override void PushCommand(IFspCmdType cmd)
        {
            BattleEntity ent = GetEnt() as BattleEntity;

            //Debug.Log("切换:" + cmd.GetCmdType());
            switch (cmd.GetCmdType())
            {
                #region 常态
            case CmdFspEnum.eFspStopMove:

                m_state = cmd.GetCmdType();
                SetMove(false);
                //Debug.Log("设置停止");
                ((BattleEntity)GetEnt()).SetPriority(0);
                ResetState();
                break;

            case CmdFspEnum.eFspMove:
            case CmdFspEnum.eFspAutoMove:
                m_state = cmd.GetCmdType();
                SetMove(true);
                //Debug.Log("设置移动");
                ResetState();
                break;

            case CmdFspEnum.eUIHead:
                CmdUIHead head = cmd as CmdUIHead;
                switch (head.type)
                {
                case 1:
                    if (m_head != null)
                    {
                        m_head.SetName(head.name);
                    }
                    break;

                case 2:
                    if (m_head != null)
                    {
                        m_head.SetLevel(head.lv);
                    }
                    break;

                case 3:
                    if (m_head != null)
                    {
                        m_head.SetHp(head.curHp, head.maxHp);
                    }
                    break;

                case 4:
                    if (m_head != null)
                    {
                        m_head.SetHud(head.hudText, head.hudType);
                    }
                    break;

                case 5:
                    if (m_head != null)
                    {
                        m_head.SetHeadShow(head.bShow);
                    }
                    break;

                case 8:
                    if (m_head != null)
                    {
                        m_head.SetTeam(head.bTeam);
                    }
                    break;

                //case 9:
                //    if (m_head != null)
                //        m_head.ShowNameOnly(head.bShow);
                //    break;
                case 10:
                    // The state of dizziness does not play the hit action
                    //if (CheckState(eVObjectState.stun))
                    //    return;
                    ent.PlayAnima(head.animaId, () => {
                        ResetState();
                    });
                    break;

                case 11:
                    if (head.effectBindPos == (int)SBindPont.eBindType.CreatureHeadPos)
                    {
                        CEffectMgr.CreateByCreaturePos(head.effectId, ent, 2);
                    }
                    else if (head.effectBindPos == (int)SBindPont.eBindType.Muzzle)         // 枪口
                    {
                        CEffectMgr.Create(head.effectId, ((BattleEntity)GetEnt()).
                                          GetRightPoint());
                    }
                    else
                    {
                        CEffectMgr.Create(head.effectId, GetEnt(), SBindPont.GetBindPont(head.effectBindPos));
                    }
                    break;

                case 12:
                    if (head.bRide)
                    {
                        m_ride = true;
                        VObject obj = head.rideObject;
                        GetEnt().SetParent(((BattleEntity)obj.GetEnt()).GetBone("ride"));
                    }
                    else
                    {
                        m_ride = false;
                        GetEnt().ClearBind();
                        Quaternion dest = Quaternion.LookRotation(m_moveInfo.m_dir);
                        GetEnt().SetRot(dest);
                        GetEnt().SetScale(Vector3.one * m_baseInfo.m_scale);
                    }
                    break;

                //case 13:
                //    if (m_head != null)
                //        m_head.SetTaskState(head.taskstate);
                //    break;
                case 14:
                    ShowFootHalo(head.effectId);
                    break;
                }
                break;

            case CmdFspEnum.eLife:
                if (ent == null)
                {
                    return;
                }
                CmdLife life = cmd as CmdLife;
                m_bDead = !life.state;

                if (life.state)
                {
                    ent.SetPriority(0);
                    ent.PlayAnima(SMtCreatureAnima.ANIMA_RESET, () => {
                        ResetState();
                        // 复活说话
                        //PlaySpeak(eRoleSpeakCsv.revive);
                    });
                    // 播放复活特效
                    if (m_bMaster)
                    {
                        CEffectMgr.Create(21002, GetEnt().GetPos(), GetEnt().GetRotate());
                    }
                }
                else
                {
                    SetMove(false);
                    ent.PlayAnima(SMtCreatureAnima.ANIMA_DIE);
                    //SoundManager.Inst.PlaySound(m_baseInfo.m_dieSound, ent.GetPos());
                    CEffectMgr.Create(m_baseInfo.m_dieEffect, GetEnt(), SBindPont.ORIGIN);

                    // xingzuo sound
                    PlayerCsv     playerCsv = CsvManager.Inst.GetCsv <PlayerCsv>((int)eAllCSV.eAC_Player);
                    PlayerCsvData csvData   = playerCsv.GetData(m_baseInfo.csvId);
                    if (csvData != null)
                    {
                        int soundId = 0, pct = 0;
                        JoyStickModule.GetSpeak(csvData.dieSpeak, ref soundId, ref pct);
                        SoundManager.Inst.PlaySound(soundId, (e) =>
                        {
                            e.SetPos(m_moveInfo.m_pos);
                        });
                    }
                    // 死亡说话
                    //PlaySpeak(eRoleSpeakCsv.die);
                }
                break;

                #endregion
            case CmdFspEnum.eFspUpdateEquip:
                m_cmdUpdateEquip = cmd as CmdFspUpdateEquip;
                UpdateEquip();
                break;

                #region BUFF特效
            case CmdFspEnum.eBuff:                            // 特效挂点设置
                CmdFspBuff buff     = cmd as CmdFspBuff;
                int        effectId = buff.effectId;
                if (effectId == 0)
                {
                    return;
                }

                //Debug.Log(buff.effectId + " add:" + buff.bAdd + "   " + buff.bindType);
                if (m_dicBuff == null)
                {
                    m_dicBuff = new Dictionary <int, object>();
                }
                if (m_dicBuffCount == null)
                {
                    m_dicBuffCount = new Dictionary <int, int>();
                }
                if (buff.bAdd)
                {
                    if (!m_dicBuff.ContainsKey(effectId))
                    {
                        if (buff.bindType == (int)SBindPont.eBindType.LRHand)      // 左右手
                        {
                            List <int> hid = new List <int>();
                            int        l   = CEffectMgr.Create(effectId, m_ent, SBindPont.L_HAND);
                            int        r   = CEffectMgr.Create(effectId, m_ent, SBindPont.R_HAND);
                            hid.Add(l);
                            hid.Add(r);
                            m_dicBuff[effectId] = hid;

                            if (!IsVisible())
                            {
                                CEffectMgr.GetEffect(l).SetShow(false);
                                CEffectMgr.GetEffect(r).SetShow(false);
                            }
                        }
                        else if (buff.bindType == (int)SBindPont.eBindType.CreaturePos)
                        {
                            int hid = CEffectMgr.CreateByCreaturePos(effectId, m_ent, 1);
                            m_dicBuff[effectId] = hid;

                            if (!IsVisible())
                            {
                                CEffect c = CEffectMgr.GetEffect(hid);
                                if (c != null)
                                {
                                    c.SetShow(false);
                                }
                            }
                        }
                        else if (buff.bindType == (int)SBindPont.eBindType.CreatureHeadPos)
                        {
                            int hid = CEffectMgr.CreateByCreaturePos(effectId, m_ent, 2);
                            m_dicBuff[effectId] = hid;

                            if (!IsVisible())
                            {
                                CEffect c = CEffectMgr.GetEffect(hid);
                                if (c != null)
                                {
                                    c.SetShow(false);
                                }
                            }
                        }
                        else
                        {
                            int hid = CEffectMgr.Create(effectId, m_ent, SBindPont.GetBindPont(buff.bindType), null);
                            m_dicBuff[effectId] = hid;

                            if (!IsVisible())
                            {
                                CEffect c = CEffectMgr.GetEffect(hid);
                                if (c != null)
                                {
                                    c.SetShow(false);
                                }
                            }
                        }
                    }
                    if (!m_dicBuffCount.ContainsKey(effectId))
                    {
                        m_dicBuffCount[effectId] = 1;
                    }
                    else
                    {
                        m_dicBuffCount[effectId]++;
                    }
                }
                else
                {
                    if (m_dicBuffCount.ContainsKey(effectId))
                    {
                        m_dicBuffCount[effectId]--;
                        if (m_dicBuffCount[effectId] <= 0)
                        {
                            m_dicBuffCount.Remove(effectId);
                        }
                    }

                    if (m_dicBuff.ContainsKey(effectId) && !m_dicBuffCount.ContainsKey(effectId))       // 如果包含这个BUFF,并且计数=0,才销毁
                    {
                        if (buff.bindType == (int)SBindPont.eBindType.LRHand)
                        {
                            List <int> hid = (List <int>)m_dicBuff[effectId];
                            for (int i = 0; i < hid.Count; i++)
                            {
                                CEffectMgr.Destroy(hid[i]);
                            }
                        }
                        else
                        {
                            CEffectMgr.Destroy((int)m_dicBuff[effectId]);
                        }
                        m_dicBuff.Remove(effectId);
                    }
                }

                break;
                #endregion

                #region 状态表现
            case CmdFspEnum.eState:                          // 外观状态设置
                CmdFspState   state = cmd as CmdFspState;
                eVObjectState type  = state.type;
                //Debug.Log("状态 add:" + state.bAdd + "   " + (eVObjectState)type);
                if (state.bAdd)
                {
                    SetShowState(type, true);
                    switch (type)
                    {
                    case eVObjectState.WindBlowsUp:
                        ent.SetWindBlowsUp(true);
                        break;

                    case eVObjectState.GhostShadow:
                        ent.SetGhostShadow(true);
                        break;

                    case eVObjectState.AlphaToHide:           // 全透 all alpha need hide effect
                        ent.SetShader(eShaderType.eAlphaToHide, Color.white, 0.3f, false, () =>
                        {
                            ent.SetShow(false);
                        });
                        break;

                    case eVObjectState.AlphaToHalf:                // 半透
                        GetEnt().SetShow(true);
                        if (CheckState(eVObjectState.AlphaToHide)) // 半透,全透状态应该是互斥的
                        {
                            SetShowState(eVObjectState.AlphaToHide, false);
                            ent.SetShader(eShaderType.eAlphaToHalf, Color.white, 0.0f, false);
                        }
                        else
                        {
                            ent.SetShader(eShaderType.eAlphaToHalf, Color.white, 0.3f, false);
                        }
                        break;

                    case eVObjectState.Nihility:            // 虚无
                        //if (m_head != null)
                        //{
                        //    m_head.SetHeadAlpha(0.5f);
                        //}
                        //ent.SetShader(eShaderType.eNihility, new Color(1, 1, 1, 0.7f));
                        break;

                    case eVObjectState.God:            // 无敌
                        //ent.SetShader(eShaderType.eRim, Color.yellow);
                        break;

                    case eVObjectState.Hit:            // 受击
                        //ent.SetShader(eShaderType.eRim, new Color(0.8f, 0.8f, 0.8f, 1.0f));
                        break;

                    case eVObjectState.Silence:           // 被沉默
                        if (m_bMaster)
                        {
                            JoyStickModule js = (JoyStickModule)LayoutMgr.Inst.GetLogicModule(LogicModuleIndex.eLM_PanelJoyStick);
                            //js.SetLock(true);
                        }
                        break;

                    case eVObjectState.Show:
                        GetEnt().SetShow(true);
                        break;

                    case eVObjectState.stun:            // 晕眩
                        //((BattleEntity)GetEnt()).Play(false);
                        if (m_bMaster)
                        {
                            JoyStickModule js = (JoyStickModule)LayoutMgr.Inst.GetLogicModule(LogicModuleIndex.eLM_PanelJoyStick);
                            //js.SetLock(true);
                        }
                        break;

                    case eVObjectState.unmove:            // 禁锢

                        break;

                    case eVObjectState.sleep:            // 睡眠

                        if (m_bMaster)
                        {
                            JoyStickModule js = (JoyStickModule)LayoutMgr.Inst.GetLogicModule(LogicModuleIndex.eLM_PanelJoyStick);
                            //js.SetLock(true);
                        }
                        break;
                    }
                }
                else
                {
                    SetShowState(type, false);
                    switch (type)
                    {
                    case eVObjectState.WindBlowsUp:
                        ent.SetWindBlowsUp(false);
                        break;

                    case eVObjectState.GhostShadow:
                        ent.SetGhostShadow(false);
                        break;

                    case eVObjectState.AlphaToHide:           // 全透
                        ent.RemoveShader();
                        ent.SetShow(true);
                        break;

                    case eVObjectState.AlphaToHalf:         // 半透,暂时都只用了移除全透
                        if (m_head != null)
                        {
                            m_head.SetHeadAlpha(1.0f);
                        }
                        ent.RemoveShader();
                        break;

                    case eVObjectState.Nihility:
                    case eVObjectState.God:
                    case eVObjectState.Hit:
                        //if (m_head != null)
                        //{
                        //    m_head.SetHeadAlpha(1.0f);
                        //}
                        //ent.RemoveShader();
                        break;

                    case eVObjectState.Silence:           // 取消沉默
                        if (m_bMaster)
                        {
                            JoyStickModule js = (JoyStickModule)LayoutMgr.Inst.GetLogicModule(LogicModuleIndex.eLM_PanelJoyStick);
                            //js.SetLock(false);
                        }
                        break;

                    case eVObjectState.Show:
                        GetEnt().SetShow(false);
                        break;

                    case eVObjectState.stun:            // 晕眩
                        //((BattleEntity)GetEnt()).Play(true);
                        ResetState();
                        if (m_bMaster)
                        {
                            JoyStickModule js = (JoyStickModule)LayoutMgr.Inst.GetLogicModule(LogicModuleIndex.eLM_PanelJoyStick);
                            //js.SetLock(false);
                        }
                        break;

                    case eVObjectState.unmove:            // 禁锢
                        ResetState();
                        break;

                    case eVObjectState.sleep:            // 睡眠
                        ResetState();
                        if (m_bMaster)
                        {
                            JoyStickModule js = (JoyStickModule)LayoutMgr.Inst.GetLogicModule(LogicModuleIndex.eLM_PanelJoyStick);
                            //js.SetLock(false);
                        }
                        break;
                    }
                }
                break;
                #endregion

            case CmdFspEnum.eSkillAnimaPriority:       // 设置技能动作优先级
                CmdSkillAnimaPriority cmdPri = cmd as CmdSkillAnimaPriority;
                ((BattleEntity)GetEnt()).SetPriority(cmdPri.priority);
                break;
            }
        }