Esempio n. 1
0
    public void Execute(stSendGoodNessDataUserCmd cmd)
    {
        IEntitySystem es = ClientGlobal.Instance().GetEntitySystem();

        if (es == null)
        {
            Engine.Utility.Log.Error("严重错误:EntitySystem is null!");
            return;
        }

        IEntity en = es.FindPlayer(cmd.userid);

        if (en != null)
        {
            //// 时间(分钟) 大于0表示恶,否则表示善  暂时没用
            en.SetProp((int)PlayerProp.GoodNess, (int)cmd.goodstate);//GameCmd.enumGoodNess.GoodNess_Badman:
            stPropUpdate prop = new stPropUpdate();
            prop.uid        = en.GetUID();
            prop.nPropIndex = (int)PlayerProp.GoodNess;
            prop.oldValue   = en.GetProp((int)PlayerProp.GoodNess);
            prop.newValue   = (int)cmd.goodstate;
            Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_PROPUPDATE, prop);
        }
        else
        {
            Engine.Utility.Log.Error("找不到player :{0}", cmd.userid);
        }
    }
Esempio n. 2
0
    public void Execute(stSetPKModePropertyUserCmd_CS cmd)
    {
        IEntitySystem es = ClientGlobal.Instance().GetEntitySystem();

        if (es == null)
        {
            Engine.Utility.Log.Error("严重错误:EntitySystem is null!");
            return;
        }

        IEntity en = es.FindPlayer(cmd.userid);

        if (en != null)
        {
            en.SetProp((int)PlayerProp.PkMode, (int)cmd.pkmode);
            stPropUpdate prop = new stPropUpdate();
            prop.uid        = en.GetUID();
            prop.nPropIndex = (int)PlayerProp.PkMode;
            prop.oldValue   = en.GetProp((int)PlayerProp.PkMode);
            prop.newValue   = (int)cmd.pkmode;
            Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_PROPUPDATE, prop);
            //切换模式后刷新一下场景内的的血条
            RoleStateBarManager.RefreshAllRoleBarHeadStatus(HeadStatusType.Hp);
        }
        else
        {
            Engine.Utility.Log.Error("找不到player :{0}", cmd.userid);
        }
    }
Esempio n. 3
0
    public void Execute(stSetPKValuePropertyUserCmd_S cmd)
    {
        IEntitySystem es = ClientGlobal.Instance().GetEntitySystem();

        if (es == null)
        {
            Engine.Utility.Log.Error("严重错误:EntitySystem is null!");
            return;
        }

        IEntity en = es.FindPlayer(cmd.userid);

        if (en != null)
        {
            en.SetProp((int)PlayerProp.PKValue, (int)cmd.pkvalue);
            stPropUpdate prop = new stPropUpdate();
            prop.uid        = en.GetUID();
            prop.nPropIndex = (int)PlayerProp.PKValue;
            prop.oldValue   = en.GetProp((int)PlayerProp.PKValue);
            prop.newValue   = (int)cmd.pkvalue;
            Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_PROPUPDATE, prop);
        }
        else
        {
            Engine.Utility.Log.Error("找不到player :{0}", cmd.userid);
        }
    }
Esempio n. 4
0
    public void OnPetLevelUP(stLevelUpPetUserCmd_S cmd)
    {
        IPet pet = GetPetByThisID(cmd.id);

        if (pet != null)
        {
            pet.SetProp((int)CreatureProp.Level, cmd.lv);
            pet.SetProp((int)PetProp.LevelExp, cmd.exp);
            pet.SetProp((int)PetProp.MaxPoint, cmd.max_point);
            UpdatePetProp();
            string txt = DataManager.Manager <TextManager>().GetLocalFormatText(LocalTextType.Talk_System_zhanhunshengji, GetPetName(pet), cmd.lv);
            ChatDataManager.SendToChatSystem(txt);
            INPC npc = GetNpcByPetID(cmd.id);
            if (npc != null)
            {
                npc.SetProp((int)CreatureProp.Level, cmd.lv);
                stPropUpdate prop = new stPropUpdate();
                prop.uid        = npc.GetUID();
                prop.nPropIndex = (int)CreatureProp.Level;
                prop.newValue   = (int)cmd.lv;

                Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_PROPUPDATE, prop);
            }
        }
    }
Esempio n. 5
0
    void DoDie()
    {
        Engine.Utility.Log.Info("主角死亡............");
        //客户端自己设置血量为0
        Client.IEntity en = ClientGlobal.Instance().MainPlayer;
        if (en == null)
        {
            return;
        }
        stPropUpdate prop = new stPropUpdate();

        prop.uid        = en.GetUID();
        prop.nPropIndex = (int)CreatureProp.Hp;
        prop.oldValue   = en.GetProp((int)CreatureProp.Hp);
        prop.newValue   = 0;
        en.SetProp((int)CreatureProp.Hp, prop.newValue);

        Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.ENTITYSYSTEM_HPUPDATE, prop);
        //清空选中目标
        ClientGlobal.Instance().GetControllerSystem().GetActiveCtrl().UpdateTarget(null);

        if (Client.ClientGlobal.Instance().MainPlayer.IsDead())
        {
            if (DataManager.Manager <NvWaManager>().EnterNvWa == false)//女娲无复活弹框
            {
                float waitTime = 1f;
                DataManager.Manager <UIPanelManager>().ShowPanel(PanelID.ReLivePanel, data: waitTime);
            }
        }
    }
Esempio n. 6
0
    public void Excute(GameCmd.stSetSPDataUserCmd_S cmd)
    {
        Client.IEntity en = EntitySystem.EntityHelper.GetEntity(GameCmd.SceneEntryType.SceneEntry_Player, cmd.id);
        if (en == null)
        {
            return;
        }

        stPropUpdate prop = new stPropUpdate();

        prop.uid        = en.GetUID();
        prop.nPropIndex = (int)CreatureProp.Mp;
        prop.oldValue   = en.GetProp((int)CreatureProp.Mp);
        prop.newValue   = (int)cmd.sp;

        en.SetProp((int)CreatureProp.Mp, (int)cmd.sp);

        Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_MPUPDATE, prop);

        prop.uid        = en.GetUID();
        prop.nPropIndex = (int)CreatureProp.MaxMp;
        prop.oldValue   = en.GetProp((int)CreatureProp.MaxMp);
        prop.newValue   = (int)cmd.maxsp;

        en.SetProp((int)CreatureProp.MaxMp, (int)cmd.maxsp);

        Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_MPUPDATE, prop);
    }
Esempio n. 7
0
    private void UpdateProprty(object param)
    {
        stPropUpdate prop = (stPropUpdate)param;

        //更新目标血条
        if (prop.nPropIndex == (int)CreatureProp.Hp)
        {
            Client.IEntity target = ClientGlobal.Instance().GetControllerSystem().GetActiveCtrl().GetCurTarget();
            if (target != null && target.GetUID() == prop.uid)
            {
                Client.IEntity entity = ClientGlobal.Instance().GetEntitySystem().FindEntity(prop.uid);
                UpdateTargetHp(entity);
                return;
            }
        }
        //更新自己信息
        if (!ClientGlobal.Instance().IsMainPlayer(prop.uid))
        {
            return;
        }
        if (prop.nPropIndex == (int)CreatureProp.Hp || prop.nPropIndex == (int)CreatureProp.MaxHp)
        {
            Client.IEntity entity = ClientGlobal.Instance().GetEntitySystem().FindEntity(prop.uid);
            if (entity != null)
            {
                SetRoleHp(entity);
            }
        }
        if (prop.nPropIndex == (int)CreatureProp.Mp || prop.nPropIndex == (int)CreatureProp.MaxMp)
        {
            Client.IEntity entity = ClientGlobal.Instance().GetEntitySystem().FindEntity(prop.uid);
            if (entity != null)
            {
                SetRoleMp(entity);
            }
        }
        else if (prop.nPropIndex == (int)PlayerProp.Exp)
        {
            Client.IEntity entity = ClientGlobal.Instance().GetEntitySystem().FindEntity(prop.uid);
            if (entity != null)
            {
                SetRoleExp(entity);
            }
        }
        else if (prop.nPropIndex == (int)PlayerProp.PkMode)
        {
            SetRolePkModel(ClientGlobal.Instance().MainPlayer);
        }
        else if (prop.nPropIndex == (int)CreatureProp.Level)
        {
            int level = MainPlayerHelper.GetPlayerLevel();
            m_label_Level.text        = level.ToString();
            m_label_mainroleName.text = UserData.CurrentRole.name;
        }
    }
Esempio n. 8
0
 void OnEvent(int eventID, object param)
 {
     if (eventID == (int)Client.GameEventID.ENTITYSYSTEM_HPUPDATE)
     {
         stPropUpdate prop = (stPropUpdate)param;
         if (prop.nPropIndex != (int)CreatureProp.Hp)
         {
             return;
         }
         SetHP(prop.uid);
     }
 }
Esempio n. 9
0
    public void Execute(GameCmd.stLevelUpMagicUserCmd_S cmd)
    {
        Client.IEntity en = EntitySystem.EntityHelper.GetEntity(GameCmd.SceneEntryType.SceneEntry_Player, cmd.dwUserTempID);
        if (en == null)
        {
            return;
        }

        stPropUpdate prop = new stPropUpdate();

        prop.uid        = en.GetUID();
        prop.nPropIndex = (int)CreatureProp.Level;
        prop.oldValue   = en.GetProp((int)CreatureProp.Level);
        prop.newValue   = (int)cmd.dwLevel;

        stEntityLevelUp levelup = new stEntityLevelUp();

        levelup.uid        = en.GetUID();
        levelup.nLastLevel = en.GetProp((int)CreatureProp.Level);
        levelup.nLevel     = (int)cmd.dwLevel;

        en.SetProp((int)CreatureProp.Level, (int)cmd.dwLevel);
        Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_PROPUPDATE, prop);

        // 等级提升
        if (levelup.nLevel > levelup.nLastLevel)
        {
            Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_LEVELUP, levelup);

            //IEntity mainPlayer = EntitySystem.EntityHelper.GetEntity(MainPlayerHelper.GetPlayerUID());


            if (ClientGlobal.Instance().IsMainPlayer(en))
            {
                //主角实体加特效

                EntitySystem.EntityHelper.AddEffect(en, 9001);
                //统计
                DataManager.Manager <LoginDataManager>().UserUpLevel(levelup.nLevel);
            }
        }


        // 飘字提示 升级成功
        //         if(ClientGlobal.Instance().IsMainPlayer(en))
        //         {
        //             string strTips = string.Format("角色等级提升");
        //             TipsManager.Instance.ShowTips(strTips);
        //         }
    }
Esempio n. 10
0
    void OnEvent(int eventID, object param)
    {
        long userID = MainPlayerHelper.GetPlayerUID();
        int  level  = MainPlayerHelper.GetPlayerLevel();

        if (level > maxPushLevel)
        {
            return;
        }
        if (eventID == (int)GameEventID.LOGINSUCESSANDRECEIVEALLINFO)
        {
            pushQueue.Clear();
            InitPushList();
            PopPushPanel();
        }
        else if (eventID == (int)GameEventID.ENTITYSYSTEM_PROPUPDATE)
        {
            stPropUpdate prop = (stPropUpdate)param;
            if (prop.uid == userID)
            {
                if (prop.nPropIndex == (int)CreatureProp.Level)
                {
                    pushQueue.Clear();

                    InitPushList();
                    PopPushPanel();
                }
            }
        }
        else if (eventID == (int)GameEventID.PUSH_ADDITEM)
        {
            if (param is BaseItem)
            {
                BaseItem bi = (BaseItem)param;

                InitPushList(bi);
                PopPushPanel();
            }
        }
        else if (eventID == (int)GameEventID.REFRESHACHIEVEMENTPUSH)
        {
            pushQueue.Clear();
            StructAchievePushItem();
            InitPushList();
            PopPushPanel();
        }
    }
Esempio n. 11
0
    public void Excute(GameCmd.stSetHpSpDataUserCmd_CS cmd)
    {
        Client.IEntity en = ClientGlobal.Instance().MainPlayer;
        if (en == null)
        {
            return;
        }

        stPropUpdate prop = new stPropUpdate();

        prop.uid        = en.GetUID();
        prop.nPropIndex = (int)CreatureProp.Mp;
        prop.oldValue   = en.GetProp((int)CreatureProp.Mp);
        prop.newValue   = (int)cmd.sp;

        en.SetProp((int)CreatureProp.Mp, (int)cmd.sp);

        Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_MPUPDATE, prop);

        if (en.GetProp((int)CreatureProp.MaxMp) != (int)cmd.maxsp)
        {
            prop.nPropIndex = (int)CreatureProp.MaxMp;
            prop.oldValue   = en.GetProp((int)CreatureProp.MaxMp);
            prop.newValue   = (int)cmd.maxsp;

            en.SetProp((int)CreatureProp.MaxMp, (int)cmd.maxsp);

            Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_MPUPDATE, prop);
        }

        prop.nPropIndex = (int)CreatureProp.Hp;
        prop.oldValue   = en.GetProp((int)CreatureProp.Hp);
        prop.newValue   = (int)cmd.hp;

        en.SetProp((int)CreatureProp.Hp, (int)cmd.hp);

        Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_HPUPDATE, prop);

        if (en.GetProp((int)CreatureProp.MaxHp) != (int)cmd.maxhp)
        {
            prop.nPropIndex = (int)CreatureProp.MaxHp;
            prop.oldValue   = en.GetProp((int)CreatureProp.MaxHp);
            prop.newValue   = (int)cmd.maxhp;
            en.SetProp((int)CreatureProp.MaxHp, (int)cmd.maxsp);
            Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_HPUPDATE, prop);
        }
    }
Esempio n. 12
0
    void OnEvent(int eventID, object param)
    {
        switch ((Client.GameEventID)eventID)
        {
        case GameEventID.ENTITYSYSTEM_PROPUPDATE:
        {
            stPropUpdate prop = (stPropUpdate)param;
            if (prop.uid != MainPlayerHelper.GetPlayerUID())
            {
                return;
            }
            if (prop.nPropIndex != (int)CreatureProp.Level)
            {
                return;
            }

            DispatchRedPoingMsg();
            AutoSetSkill();
            int needLevel = GameTableManager.Instance.GetGlobalConfig <int>("ChangeStateLevel");
            int level     = GetPlayerLevel();

            if (level >= needLevel)
            {
                // CurState = SkillSettingState.StateOne;
                SetCurStateSkillList();
                DataManager.Manager <UIPanelManager>().SendMsg(PanelID.MainPanel, UIMsgID.eSkillBtnRefresh, null);
            }
        }
        break;

        case GameEventID.SYSTEM_GAME_READY:
        case GameEventID.HEARTSKILLGODDATA:
        {
            DispatchRedPoingMsg();
        }
        break;

        case GameEventID.SKILL_SHOWPETSKILL:
        {
            stShowPetSkill st = (stShowPetSkill)param;
            m_bShowPetSkill = st.bShow;
            DataManager.Manager <UIPanelManager>().SendMsg(PanelID.MainPanel, UIMsgID.eSkillShowPetSkill, null);
        }
        break;
        }
    }
Esempio n. 13
0
 /// <summary>
 /// 属性变更
 /// </summary>
 /// <param name="prop"></param>
 private void OnPropUpdate(ref stPropUpdate prop)
 {
     Client.IEntity entity = ClientGlobal.Instance().GetEntitySystem().FindEntity(prop.uid);
     if (prop.nPropIndex == (int)CreatureProp.Hp || prop.nPropIndex == (int)CreatureProp.MaxHp)
     {
         UpdateHeadStaus(prop.uid, HeadStatusType.Hp);
     }
     else if (prop.nPropIndex == (int)PlayerProp.GoodNess ||
              prop.nPropIndex == (int)CreatureProp.Camp)
     {
         UpdateHeadStaus(prop.uid, HeadStatusType.Name);
         if (prop.nPropIndex == (int)Client.CreatureProp.Camp)
         {
             UpdateHeadStaus(prop.uid, HeadStatusType.CampMask);
         }
     }
 }
Esempio n. 14
0
 private void OnPropUpdate(ref stPropUpdate prop)
 {
     Client.IEntity entity = ClientGlobal.Instance().GetEntitySystem().FindEntity(prop.uid);
     if (prop.nPropIndex == (int)CreatureProp.Hp || prop.nPropIndex == (int)CreatureProp.MaxHp)
     {
         if (entity != null)
         {
             RoleStateBar bar = GetRoleBarByUID(prop.uid);
             if (bar != null)
             {
                 HeadTipData data = new HeadTipData(entity, HeadTipType.Hp, m_bHpSliderVisible);
                 bar.UpdateWidget(data);
             }
         }
     }
     else if (prop.nPropIndex == (int)PlayerProp.GoodNess || prop.nPropIndex == (int)CreatureProp.Camp)
     {
         OnChangeName(prop.uid);
     }
 }
Esempio n. 15
0
    void SetEntityCurHP(IEntity entity, uint curHp)
    {//除去伤害包之外的类型
        stPropUpdate prop = new stPropUpdate();

        prop.uid        = entity.GetUID();
        prop.nPropIndex = (int)CreatureProp.Hp;
        prop.oldValue   = entity.GetProp((int)CreatureProp.Hp);
        prop.newValue   = (int)curHp;
        float maxhp = (float)entity.GetProp((int)CreatureProp.MaxHp);

        if (curHp < 0)
        {
            curHp = (uint)Mathf.CeilToInt(maxhp * 0.1f);
        }
        entity.SetProp((int)CreatureProp.Hp, (int)curHp);
        if (curHp == 0)
        {
            //  Engine.Utility.Log.LogGroup("ZDY", "cmd.curhp----------------" + curHp);
        }

        Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_HPUPDATE, prop);
    }
Esempio n. 16
0
    public void Execute(GameCmd.stRobotLevelUpMagicUserCmd_S cmd)
    {
        Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem();
        if (es == null)
        {
            return;
        }
        Client.IRobot robot = es.FindRobot(cmd.npc_id);
        if (robot == null)
        {
            return;
        }
        uint             baseID     = (uint)robot.GetProp((int)Client.EntityProp.BaseID);
        uint             job        = (uint)robot.GetProp((int)Client.RobotProp.Job);
        uint             level      = (uint)robot.GetProp((int)Client.CreatureProp.Level);
        string           name       = robot.GetName();
        EntityCreateData createData = RoleUtil.BuildRobotEntityData(cmd.npc_id, baseID, job, level, name);

        stPropUpdate lvprop = new stPropUpdate();
        stPropUpdate prop   = new stPropUpdate();

        prop.uid   = robot.GetUID();
        lvprop.uid = robot.GetUID();

        prop.nPropIndex   = (int)CreatureProp.Hp;
        lvprop.nPropIndex = (int)CreatureProp.Level;

        prop.oldValue   = robot.GetProp((int)CreatureProp.Hp);
        lvprop.oldValue = robot.GetProp((int)CreatureProp.Level);

        robot.UpdateProp(createData);

        prop.newValue   = robot.GetProp((int)CreatureProp.Hp);
        lvprop.newValue = robot.GetProp((int)CreatureProp.Level);

        Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_HPUPDATE, prop);
        Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_PROPUPDATE, lvprop);
    }
Esempio n. 17
0
    public void Excute(GameCmd.stSetHPDataUserCmd_S cmd)
    {//只有npc用 角色用stHPChangeDataUserCmd_S
        Client.IEntity en = EntitySystem.EntityHelper.GetEntity((GameCmd.SceneEntryType)cmd.type, cmd.id);
        if (en == null)
        {
            return;
        }

        stPropUpdate prop = new stPropUpdate();

        prop.uid        = en.GetUID();
        prop.nPropIndex = (int)CreatureProp.Hp;
        prop.oldValue   = en.GetProp((int)CreatureProp.Hp);
        prop.newValue   = (int)cmd.curhp;

        en.SetProp((int)CreatureProp.Hp, (int)cmd.curhp);
        if (cmd.curhp == 0)
        {
            Engine.Utility.Log.LogGroup("ZDY", "cmd.curhp----------------" + cmd.curhp);
        }

        Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_HPUPDATE, prop);
    }
Esempio n. 18
0
    public void Excute(stObtainExpPropertyUserCmd_S cmd)
    {
        Client.IEntity en = ClientGlobal.Instance().MainPlayer;
        if (en == null)
        {
            return;
        }
        stPropUpdate prop = new stPropUpdate();

        prop.uid        = en.GetUID();
        prop.nPropIndex = (int)PlayerProp.Exp;
        prop.oldValue   = en.GetProp((int)PlayerProp.Exp);
        prop.newValue   = (int)cmd.dwUserExp;

        en.SetProp((int)PlayerProp.Exp, (int)cmd.dwUserExp);

        if (cmd.dwExp > 0)  //增加的经验
        {
            TipsManager.Instance.ShowTips("获得经验X" + cmd.dwExp);
        }

        Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_PROPUPDATE, prop);
    }
Esempio n. 19
0
    /// <summary>
    /// 事件处理
    /// </summary>
    /// <param name="nEventID"></param>
    /// <param name="param"></param>
    public void GlobalEventHandler(int eventID, object param)
    {
        switch (eventID)
        {
        case (int)Client.GameEventID.ENTITYSYSTEM_CHANGE:
        {
            if (null != param && param is Client.stPlayerChange)
            {
                Client.stPlayerChange change = (Client.stPlayerChange)param;
                IEntity entity = RoleStateBarManager.GetEntityByUserID <IPlayer>(change.uid);
                if (null == entity)
                {
                    entity = RoleStateBarManager.GetEntityByUserID <INPC>(change.uid);
                }

                if (null != entity)
                {
                    LateUpdateChangePos(entity.GetUID());
                }
            }
        }
        break;

        case (int)Client.GameEventID.ENTITYSYSTEM_UNRIDE:
        {
            if (null != param && param is stEntityUnRide)
            {
                stEntityUnRide unride = (stEntityUnRide)param;
                LateUpdateChangePos(unride.uid);
            }
        }
        break;

        case (int)Client.GameEventID.ENTITYSYSTEM_RIDE:
        {
            if (null != param && param is stEntityRide)
            {
                stEntityRide ride = (stEntityRide)param;
                LateUpdateChangePos(ride.uid);
            }
        }
        break;

        case (int)Client.GameEventID.ENTITYSYSTEM_ENTITYBEGINMOVE:
        {
            if (null != param && param is stEntityBeginMove)
            {
                stEntityBeginMove move = (stEntityBeginMove)param;
                OnEntityMoving(move.uid);
            }
        }
        break;

        case (int)Client.GameEventID.ENTITYSYSTEM_ENTITYMOVE:
        {
            if (null != param && param is stEntityMove)
            {
                stEntityMove move = (stEntityMove)param;
                OnEntityMoving(move.uid);
            }
        }
        break;

        case (int)Client.GameEventID.ENTITYSYSTEM_ENTITYSTOPMOVE:
        {
            if (null != param && param is stEntityStopMove)
            {
                stEntityStopMove move = (stEntityStopMove)param;
                OnEntityMoving(move.uid);
            }
        }
        break;

        case (int)Client.GameEventID.ENTITYSYSTEM_CREATEENTITY:
        {
            //实体创建
            Client.stCreateEntity ce = (Client.stCreateEntity)param;
            OnCretateEntity(ce);
        }
        break;

        case (int)Client.GameEventID.ENTITYSYSTEM_REMOVEENTITY:
        {
            //实体删除
            Client.stRemoveEntity removeEntiy = (Client.stRemoveEntity)param;
            RemoveRoleBar(removeEntiy.uid);
        }
        break;

        case (int)Client.GameEventID.ENTITYSYSTEM_PROPUPDATE:
        {
            //实体属性变更
            stPropUpdate prop = (stPropUpdate)param;
            OnPropUpdate(ref prop);
        }
        break;

        case (int)Client.GameEventID.ENTITYSYSTEM_HPUPDATE:
        {
            //实体属性变更
            stPropUpdate prop = (stPropUpdate)param;
            OnPropUpdate(ref prop);
        }
        break;

        case (int)Client.GameEventID.ENTITYSYSTEM_CHANGENAME:
        {
            //实体名称改变
            stEntityChangename e = (stEntityChangename)param;
            UpdateHeadStaus(e.uid, HeadStatusType.Name);
        }
        break;

        case (int)Client.GameEventID.ENTITYSYSTEM_SETHIDE:
        {
            //实体名称改变
            stEntityHide st = (stEntityHide)param;
            //UpdateHeadStaus(e.uid, HeadStatusType.Name);
            OnSetEntityHide(ref st);
        }
        break;

        case (int)Client.GameEventID.TITLE_WEAR:
        {
            Client.stTitleWear data   = (Client.stTitleWear)param;
            IPlayer            player = RoleStateBarManager.GetEntityByUserID <IPlayer>(data.uid);
            if (null != player)
            {
                //佩戴称号
                UpdateHeadStaus(player.GetUID(), HeadStatusType.Title);
            }
        }
        break;

        case (int)Client.GameEventID.SKILLGUIDE_PROGRESSSTART:
        {
            //引导技能开始
        }
        break;

        case (int)Client.GameEventID.SKILLGUIDE_PROGRESSBREAK:
        {
            //引导技能中断
        }
        break;

        case (int)Client.GameEventID.SKILLGUIDE_PROGRESSEND:
        {
            //引导技能结束
        }
        break;

        case (int)Client.GameEventID.CLANQUIT:
        case (int)Client.GameEventID.CLANJOIN:
        case (int)Client.GameEventID.CLANREFRESHID:
        case (int)Client.GameEventID.CITYWARWINERCLANID:
        case (int)Client.GameEventID.CLANDeclareInfoAdd:
        case (int)Client.GameEventID.CLANDeclareInfoRemove:
        {
            //氏族状态改变
            OnRefreshAllClan();
        }
        break;

        case (int)Client.GameEventID.CITYWARTOTEMCLANNAMECHANGE:
        {
            long uid = EntitySystem.EntityHelper.MakeUID(EntityType.EntityType_NPC, (uint)param);
            UpdateHeadStaus(uid, HeadStatusType.Clan);
        }
        break;

        case (int)Client.GameEventID.SYSTEM_GAME_READY:
        {
            OnRefresAllHp();
        }
        break;

        case (int)Client.GameEventID.CAMERA_MOVE_END:
        {
            UpdateAllPos();
        }
        break;

        case (int)Client.GameEventID.RFRESHENTITYHEADSTATUS:
        {
            HeadStatusType status = (HeadStatusType)param;
            RefreshAllHeadStatus(status);
        }
        break;

        //npc头顶任务状态
        case (int)Client.GameEventID.TASK_ACCEPT:
        {
            uint taskId = (uint)param;
            OnUpdateNpcTaskStatus(taskId, Client.GameEventID.TASK_ACCEPT);
        }
        break;

        case (int)Client.GameEventID.TASK_DELETE:
        {
            uint taskId = (uint)param;
            OnUpdateNpcTaskStatus(taskId, Client.GameEventID.TASK_DELETE);
        }
        break;

        case (int)Client.GameEventID.TASK_DONE:
        {
            Client.stTaskDone td = (Client.stTaskDone)param;
            OnUpdateNpcTaskStatus(td.taskid, Client.GameEventID.TASK_DONE);
        }
        break;

        case (int)Client.GameEventID.TASK_CANSUBMIT:
        {
            Client.stTaskCanSubmit tcs = (Client.stTaskCanSubmit)param;
            OnUpdateNpcTaskStatus(tcs.taskid, Client.GameEventID.TASK_CANSUBMIT);
        }
        break;

        case (int)Client.GameEventID.TASK_CANACCEPT:
        {
            uint taskId = (uint)param;
            OnUpdateNpcTaskStatus(taskId, Client.GameEventID.TASK_CANACCEPT);
        }
        break;
        }
    }
Esempio n. 20
0
 /// <summary>
 /// 事件处理
 /// </summary>
 /// <param name="nEventID"></param>
 /// <param name="param"></param>
 public void GlobalEventHandler(int eventID, object param)
 {
     if (eventID == (int)Client.GameEventID.ENTITYSYSTEM_NPCHEADSTATUSCHANGED)
     {
         if (null != param && param is Client.INPC)
         {
             UpdateNpcHeadMask((Client.INPC)param);
         }
     }
     else if (eventID == (int)Client.GameEventID.ENTITYSYSTEM_CREATEENTITY)
     {
         Client.stCreateEntity ce = (Client.stCreateEntity)param;
         OnCretateEntity(ref ce);
     }
     else if (eventID == (int)Client.GameEventID.ENTITYSYSTEM_REMOVEENTITY)
     {
         Client.stRemoveEntity removeEntiy = (Client.stRemoveEntity)param;
         RemoveBar(removeEntiy);
     }
     else if (eventID == (int)Client.GameEventID.ENTITYSYSTEM_PROPUPDATE)
     {
         stPropUpdate prop = (stPropUpdate)param;
         OnPropUpdate(ref prop);
     }
     else if (eventID == (int)Client.GameEventID.ENTITYSYSTEM_HPUPDATE)
     {
         stPropUpdate prop = (stPropUpdate)param;
         OnPropUpdate(ref prop);
     }
     else if (eventID == (int)Client.GameEventID.ENTITYSYSTEM_CHANGENAME)
     {
         stEntityChangename e = (stEntityChangename)param;
         OnChangeName(e.uid);
     }
     else if (eventID == (int)(int)Client.GameEventID.ENTITYSYSTEM_SETHIDE)
     {
         stEntityHide st = (stEntityHide)param;
         OnSetEntityHide(ref st);
         return;
     }
     else if (eventID == (int)(int)Client.GameEventID.TITLE_WEAR)//佩戴称号
     {
         Client.stTitleWear data = (Client.stTitleWear)param;
         OnTitleWear(data.uid);
     }
     else if (eventID == (int)GameEventID.SKILLGUIDE_PROGRESSSTART)
     {
         Client.stUninterruptMagic uninterrupt = (Client.stUninterruptMagic)param;
         OnStartCollectSlider(ref uninterrupt);
     }
     else if (eventID == (int)GameEventID.SKILLGUIDE_PROGRESSBREAK)
     {
         if (param != null)
         {
             stGuildBreak guildbreak = (stGuildBreak)param;
             if (ShowCollectTip(guildbreak.action))
             {
                 long         uid = EntitySystem.EntityHelper.MakeUID(EntityType.EntityType_Player, guildbreak.uid);
                 RoleStateBar bar = GetRoleBarByUID(uid);
                 if (bar != null)
                 {
                     bar.SetWidgetState(HeadTipType.Collect, false);
                 }
             }
         }
     }
     else if (eventID == (int)GameEventID.SKILLGUIDE_PROGRESSEND)
     {
         if (param != null)
         {
             stGuildEnd guildEnd = (stGuildEnd)param;
             if (ShowCollectTip(guildEnd.action))
             {
                 long         uid = EntitySystem.EntityHelper.MakeUID(EntityType.EntityType_Player, guildEnd.uid);
                 RoleStateBar bar = GetRoleBarByUID(uid);
                 if (bar != null)
                 {
                     bar.SetWidgetState(HeadTipType.Collect, false);
                 }
             }
         }
     }
     else if (eventID == (int)Client.GameEventID.CLANQUIT || eventID == (int)Client.GameEventID.CLANJOIN ||
              eventID == (int)Client.GameEventID.CLANREFRESHID || eventID == (int)Client.GameEventID.CITYWARWINERCLANID ||
              eventID == (int)Client.GameEventID.CLANDeclareInfoAdd || eventID == (int)Client.GameEventID.CLANDeclareInfoRemove)
     {
         OnRefreshAllClanTitile();
     }
     else if (eventID == (int)Client.GameEventID.CITYWARTOTEMCLANNAMECHANGE)
     {
         long         uid = EntitySystem.EntityHelper.MakeUID(EntityType.EntityType_NPC, (uint)param);
         RoleStateBar bar = GetRoleBarByUID(uid);
         if (bar != null)
         {
             Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem();
             if (es == null)
             {
                 return;
             }
             RefreshClanName(es.FindEntity(uid), bar);
         }
     }
     else if (eventID == (int)Client.GameEventID.SYSTEM_GAME_READY)
     {
         OnRefreshAllHpSlider();
     }
 }
Esempio n. 21
0
    void OnEvent(int eventID, object param)
    {
        if (eventID == (int)GameEventID.ENTITYSYSTEM_PROPUPDATE)
        {
            stPropUpdate prop = (stPropUpdate)param;
            if (prop.uid == MainPlayerHelper.GetPlayerUID())
            {
                int  lv   = MainPlayerHelper.GetPlayerLevel();
                uint type = (uint)ActivityType.GrowthFund;
                if (m_dic_Activity.ContainsKey(type))
                {
                    List <ActivityData> lst = m_dic_Activity[type];
                    for (int i = 0; i < lst.Count; i++)
                    {
                        ActivityData data = lst[i];
                        if (OverIDList.Contains(data.id))
                        {
                            data.state = ActivityState.Got;
                            continue;
                        }
                        if (dailyGiftList.Contains(data.id))
                        {
                            data.state = ActivityState.Got;
                            continue;
                        }

                        data.process = (uint)lv;
                        data.state   = (lv >= data.total && isBuy) ? ActivityState.CanGet : ActivityState.None;
                    }
                    if (type != (uint)ActivityType.DailyGift)
                    {
                        lst.Sort();
                    }
                }
            }
        }
        else if (eventID == (int)GameEventID.SYSTEM_GAME_READY)
        {
            if (lstActivityTabData != null)
            {
                for (int i = 0; i < lstActivityTabData.Count; i++)
                {
                    uint schedule = lstActivityTabData[i].scheduleID;
                    uint type     = lstActivityTabData[i].type;
                    if (schedule != 0)
                    {
                        if (m_dic_Activity.ContainsKey(type))
                        {
                            if (!DataManager.Manager <DailyManager>().InSchedule(schedule))
                            {
                                m_dic_Activity.Remove(type);
                                if (m_lstType.Contains((ActivityType)type))
                                {
                                    m_lstType.Remove((ActivityType)type);
                                }
                                if (m_dicTabData.ContainsKey(type))
                                {
                                    m_dicTabData.Remove(type);
                                }
                            }
                        }
                    }
                }
            }
        }
    }
Esempio n. 22
0
    void OnEvent(int eventID, object param)
    {
        if (eventID == (int)Client.GameEventID.SKILLSYSTEM_SHOWDAMAGE)
        {
            stShowDemage st      = (stShowDemage)param;
            bool         IsMyNpc = false;//是否是其他人的宠物或者召唤物
            if ((GameCmd.SceneEntryType)st.attacktype != GameCmd.SceneEntryType.SceneEntry_Player)
            {
                IEntity attacker = EntitySystem.EntityHelper.GetEntity((GameCmd.SceneEntryType)st.attacktype, st.attackID);
                if (attacker != null)
                {
                    INPC npc = attacker as INPC;
                    if (npc != null)
                    {
                        if (npc.IsMainPlayerSlave())
                        {
                            IsMyNpc = true;
                        }
                    }
                }
            }

            uint skillid = st.skillid;
            List <GameCmd.stMultiAttackDownMagicUserCmd_S.stDefender> defenerList = st.defenerList;
            if (IsMyNpc || st.attackID == MainPlayerHelper.GetPlayerID())
            {
                //如果攻击者是自己或者自己的宠物 飘血

                for (int i = 0; i < defenerList.Count; i++)
                {
                    var        info = defenerList[i];
                    EntityType type = EntitySystem.EntityHelper.GetEntityEtype(info.byDefencerType);
                    if (info.dwDamage == 0 && info.byDamType == (uint)GameCmd.AttackType.ATTACK_TYPE_FO)
                    {
                        continue;
                    }
                    ShowDamage(info.dwDamage, info.byDamType, info.dwDefencerID, type, info.dwDefencerHP, skillid, st.attackID);
                }
            }
            else
            {
                for (int i = 0; i < defenerList.Count; i++)
                {
                    var info = defenerList[i];
                    //如果受击者是自己或者自己的宠物 飘血
                    if (info.dwDamage == 0 && info.byDamType == (uint)GameCmd.AttackType.ATTACK_TYPE_FO)
                    {
                        continue;
                    }
                    if (info.dwDefencerID != MainPlayerHelper.GetPlayerID())
                    {
                        IEntity en = EntitySystem.EntityHelper.GetEntity(info.byDefencerType, info.dwDefencerID);
                        if (en != null)
                        {
                            INPC npc = en as INPC;
                            if (npc != null)
                            {
                                if (npc.IsTrap())
                                {
                                    return;
                                }
                                if (npc.IsMainPlayerSlave())
                                {//防御者是自己的宠物
                                    EntityType type = EntitySystem.EntityHelper.GetEntityEtype(info.byDefencerType);
                                    ShowDamage(info.dwDamage, info.byDamType, info.dwDefencerID, type, info.dwDefencerHP, skillid, st.attackID);
                                }
                            }
                            else
                            {
                                //怪打人 血量同步 先不同步
                                //IPlayer otherPlayer = en as IPlayer;
                                //if(otherPlayer != null)
                                //{
                                //    SetEntityCurHP(en, info.dwDefencerHP);
                                //}
                            }
                        }
                    }
                    else
                    {//防御者是自己
                        EntityType type = EntitySystem.EntityHelper.GetEntityEtype(info.byDefencerType);
                        ShowDamage(info.dwDamage, info.byDamType, info.dwDefencerID, type, info.dwDefencerHP, skillid, st.attackID);
                    }
                }
            }
        }
        else if (eventID == (int)Client.GameEventID.SKILLSYSTEM_SHOWBUFFDAMAGE)
        {
            stBuffDamage st = (stBuffDamage)param;

            ShowBuffDamage(st);
        }
        else if (eventID == (int)Client.GameEventID.ENTITYSYSTEM_PROPUPDATE)
        {
            stPropUpdate prop = (stPropUpdate)param;
            if (MainPlayerHelper.GetPlayerUID() != prop.uid)
            {
                return;
            }
            if (prop.nPropIndex == (int)PlayerProp.Exp)
            {
                int exp = prop.newValue - prop.oldValue;
                if (exp < 0)
                {
                    return;
                }

                ShowExp(exp);
            }
        }
        else if (eventID == (int)Client.GameEventID.ENTITYSYSTEM_LEAVEMAP)
        {
            OnLowMemoryWarning();
        }
        else if (eventID == (int)GameEventID.APPLICATION_LOWMEMORY)
        {
            OnLowMemoryWarning();
        }
    }