示例#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);
    }
示例#2
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);
        //         }
    }
示例#3
0
    void SetRolePkModel(Client.IEntity entity)
    {
        if (entity == null)
        {
            return;
        }
        if (!ClientGlobal.Instance().IsMainPlayer(entity.GetUID()))
        {
            return;
        }


        if (m_lableBtnTop != null)
        {
            int model = entity.GetProp((int)PlayerProp.PkMode);
            if (model != 0)
            {
                m_lableBtnTop.text = GetPkModeDes(model);
            }
            else
            {
                m_lableBtnTop.text = GetPkModeDes(1);
            }
        }
    }
示例#4
0
    void OnEeventAddBuff(int eventID, Client.stAddBuff state)
    {
        BuffDataBase db = GameTableManager.Instance.GetTableItem <BuffDataBase>(state.buffid);

        if (db != null)
        {
            if (db.dwShield == 1)
            {//不显示的直接跳过
                return;
            }
        }
        if (ClientGlobal.Instance().IsMainPlayer(state.uid))
        {
            mainRoleBuffList.Insert(0, state);
            stShowBuffInfo info = new stShowBuffInfo();
            info.IsMainRole = true;
            DataManager.Manager <UIPanelManager>().SendMsg(PanelID.MainPanel, UIMsgID.stShowBuff, info);
        }
        else
        {
            Client.IEntity target = ClientGlobal.Instance().GetControllerSystem().GetActiveCtrl().GetCurTarget();
            if (target != null)
            {
                if (target.GetUID() == state.uid)
                {
                    targetBuffList.Insert(0, state);
                    stShowBuffInfo info = new stShowBuffInfo();
                    info.IsMainRole = false;
                    DataManager.Manager <UIPanelManager>().SendMsg(PanelID.MainPanel, UIMsgID.stShowBuff, info);
                }
            }
        }
    }
示例#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);
            }
        }
    }
示例#6
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;
        }
    }
示例#7
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);
        }
    }
示例#8
0
    void RefreshHpSlider(Client.IEntity entity, RoleStateBar bar)
    {
        if (entity == null)
        {
            Engine.Utility.Log.Error("RefreshHpSlider entity is null");
            return;
        }
        if (bar == null)
        {
            Engine.Utility.Log.Error("RefreshHpSlider bar is null");
            return;
        }
        bool        addHpSlider = IsNeedHpSlider(entity);
        HeadTipData data        = null;

        if (addHpSlider)
        {
            bool    visible = true;
            IPlayer player  = ClientGlobal.Instance().MainPlayer;
            if (player == null)
            {
                return;
            }
            if (entity.GetUID() == player.GetUID())
            {
                visible = true;
            }
            else
            {
                visible = m_bHpSliderVisible;
            }
            data = new HeadTipData(entity, HeadTipType.Hp, visible);
        }
        else
        {
            data = new HeadTipData(entity, HeadTipType.Hp, addHpSlider);
        }
        if (data != null)
        {
            bar.UpdateWidget(data);
        }
    }
示例#9
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);
    }
示例#10
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);
    }
示例#11
0
    //-----------------------------------------------------------------------------------------------
    private void OnStartCollectSlider(ref Client.stUninterruptMagic uninterrupt)
    {
        if (ShowCollectTip(uninterrupt.type))
        {
            Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem();

            if (es == null)
            {
                return;
            }

            Client.IEntity entity = es.FindEntity(uninterrupt.uid);
            if (entity != null && Client.ClientGlobal.Instance().IsMainPlayer(entity.GetUID()) == false)
            {
                RoleStateBar bar = GetRoleBarByUID(uninterrupt.uid);
                if (bar != null)
                {
                    HeadTipData data = new HeadTipData(entity, HeadTipType.Collect, true);
                    data.SetCollectType(uninterrupt.type);
                    bar.UpdateWidget(data);
                }
            }
        }
    }
示例#12
0
    void RefreshClanName(Client.IEntity entity, RoleStateBar bar)
    {
        if (entity == null)
        {
            Engine.Utility.Log.Error("AddClanName entity is null");
            return;
        }
        if (bar == null)
        {
            Engine.Utility.Log.Error("AddClanName bar is null");
            return;
        }

        EntityType entityType = entity.GetEntityType();

        if (entityType == EntityType.EntityType_Player)
        {
            uint clanIdLow  = (uint)entity.GetProp((int)CreatureProp.ClanIdLow);
            uint clanIdHigh = (uint)entity.GetProp((int)CreatureProp.ClanIdHigh);
            uint clanId     = (clanIdHigh << 16) | clanIdLow;

            //int clanId = entity.GetProp((int)Client.CreatureProp.ClanId);
            if (clanId != 0)
            {
                DataManager.Manager <ClanManger>().GetClanName((uint)clanId, (namedata) =>
                {
                    string winerCityName = string.Empty;
                    string name          = string.Empty;
                    if (DataManager.Manager <CityWarManager>().GetWinerOfCityWarCityName((uint)clanId, out winerCityName))
                    {
                        //name = namedata.ClanName + winerCityName;
                        name = string.Format("{0}【{1}】", winerCityName, namedata.ClanName);
                    }
                    else
                    {
                        //name = namedata.ClanName;
                        name = string.Format("【{0}】", namedata.ClanName);
                    }

                    bool visible = m_bPlayerClanNameVisible;
                    if (entity.GetUID() == Client.ClientGlobal.Instance().MainPlayer.GetUID())
                    {
                        visible = true;
                    }
                    HeadTipData data = new HeadTipData(entity, HeadTipType.Clan, visible);
                    data.value       = name;
                    bar.UpdateWidget(data);
                });
            }
            else
            {
                bar.SetWidgetState(HeadTipType.Clan, false);
            }
        }
        else if (entity.GetEntityType() == EntityType.EntityType_NPC)
        {
            CityWarTotem cityWarTotemInfo = null;
            if (DataManager.Manager <CityWarManager>().GetCityWarTotemClanName((uint)entity.GetProp((int)Client.EntityProp.BaseID), out cityWarTotemInfo))
            {
                HeadTipData data = new HeadTipData(entity, HeadTipType.Clan, m_bPlayerClanNameVisible);
                data.value = cityWarTotemInfo.clanName;
                bar.UpdateWidget(data);
            }
            else
            {
                bar.SetWidgetState(HeadTipType.Clan, false);
            }
        }
    }