Example #1
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);
    }
Example #2
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);
            }
        }
    }
Example #3
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);
        }
    }
Example #4
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);
        //         }
    }
Example #5
0
    public void Excute(stUnTransfigurationScriptUserCmd_S cmd)
    {
        Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem();
        if (es == null)
        {
            return;
        }

        Client.IEntity player = es.FindPlayer(cmd.userid);
        if (player != null)
        {
            player.SetProp((int)Client.PlayerProp.TransModelResId, 0);
            player.SendMessage(Client.EntityMessage.EntityCommand_Restore, new Client.ChangeBody()
            {
                param      = cmd.taskid,
                callback   = null,
                modleScale = 1
            });
        }
    }
Example #6
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);
    }
Example #7
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);
    }