예제 #1
0
    void onClick_Btnhead_Btn(GameObject caster)
    {
        BShowEnemyList = !BShowEnemyList;
        Client.IEntity entity = ClientGlobal.Instance().GetControllerSystem().GetActiveCtrl().GetCurTarget();
        if (entity != null)
        {
            if (entity.GetEntityType() == EntityType.EntityType_Player)
            {
                DataManager.Instance.Sender.RequestPlayerInfoForOprate(entity.GetID(), PlayerOpreatePanel.ViewType.Normal);
            }
            else if (entity.GetEntityType() == EntityType.EntityTYpe_Robot)
            {
                ShowRobotOpreate((uint)entity.GetID(), (uint)entity.GetProp((int)RobotProp.Job),
                                 (uint)entity.GetProp((int)CreatureProp.Level), entity.GetName(), (uint)entity.GetProp((int)RobotProp.Sex));
            }
            else
            {
            }
        }

        if (BShowEnemyList)
        {
            if (entity != null)
            {
                NetService.Instance.Send(new GameCmd.stEnmityDataUserCmd_CS()
                {
                    npcid = entity.GetID()
                });
            }
        }
        else
        {
            m_transHateList.gameObject.SetActive(false);
        }
    }
예제 #2
0
    void UpdateTargetHp(Client.IEntity entity)
    {
        if (entity == null)
        {
            return;
        }
        int   currHp = entity.GetProp((int)CreatureProp.Hp);
        float hp     = currHp / (float)entity.GetProp((int)CreatureProp.MaxHp);

        if (m_spriteTargetHp == null)
        {
            return;
        }
        m_spriteTargetHp.fillAmount = hp;

        if (m_labelHP != null)
        {
            if (entity.GetEntityType() == EntityType.EntityType_NPC)
            {
                Client.INPC npc = (Client.INPC)entity;
                if (npc.IsMonster())
                {
                    m_labelHP.alpha = 1f;
                    m_labelHP.gameObject.SetActive(true);
                    m_labelHP.text = currHp.ToString();
                    return;
                }
            }
            m_labelHP.alpha = 0f;
            m_labelHP.gameObject.SetActive(false);
        }
    }
예제 #3
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);
    }
예제 #4
0
    void SetRoleMp(Client.IEntity entity)
    {
        if (entity == null || m_slider_mpSpritebg == null)
        {
            return;
        }
        int   mp    = entity.GetProp((int)CreatureProp.Mp);
        float maxmp = (float)entity.GetProp((int)CreatureProp.MaxMp);

        m_slider_mpSpritebg.value = mp / maxmp;
        //   m_sprite_mpSprite.fillAmount =
    }
예제 #5
0
    void SetRoleHp(Client.IEntity entity)
    {
        if (entity == null || m_slider_hpSpritebg == null)
        {
            return;
        }
        int   hp    = entity.GetProp((int)CreatureProp.Hp);
        float maxhp = (float)entity.GetProp((int)CreatureProp.MaxHp);

        m_slider_hpSpritebg.value = hp / maxhp;
        // m_sprite_hpSprite.fillAmount =
    }
예제 #6
0
    void SetRoleExp(Client.IEntity entity)
    {
        if (entity == null || m_slider_expSprite_bg == null)
        {
            return;
        }
        //经验值exp显示
        table.UpgradeDataBase data = GameTableManager.Instance.GetTableItem <table.UpgradeDataBase>((uint)entity.GetProp((int)CreatureProp.Level));
        ulong maxExp = data.qwExp;

        m_label_Labelexp.text       = string.Format("经验{0}%", Mathf.Floor((entity.GetProp((int)PlayerProp.Exp) + 0.0f) / (int)maxExp * 100));
        m_slider_expSprite_bg.value = (entity.GetProp((int)PlayerProp.Exp) + 0.0f) / (int)maxExp;
    }
예제 #7
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);
        //         }
    }
예제 #8
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);
            }
        }
    }
예제 #9
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);
            }
        }
    }
예제 #10
0
 void SetRoleHpMpExpPkPower(Client.IEntity entity)
 {
     SetRoleHp(entity);
     SetRoleMp(entity);
     SetRoleExp(entity);
     SetRolePkModel(entity);
     if (m_label_lablePower != null)
     {
         m_label_lablePower.text = entity.GetProp((int)FightCreatureProp.Power).ToString();
     }
 }
예제 #11
0
    /// <summary>
    /// 获取NPC头顶标识数据
    /// </summary>
    /// <param name="entity"></param>
    /// <returns></returns>
    public static table.NpcHeadMaskDataBase GetNPCHeadMaskDB(Client.IEntity entity)
    {
        table.NpcHeadMaskDataBase db = null;
        if (null != entity
            //&& entity.GetEntityType() == EntityType.EntityType_NPC
            )
        {
            db = GetNPCHeadMaskDB((uint)entity.GetProp((int)Client.EntityProp.BaseID));
        }

        return(db);
    }
예제 #12
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);
        }
    }
예제 #13
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);
    }
예제 #14
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);
    }
예제 #15
0
 public static bool IsNeedHpSlider(Client.IEntity entity)
 {
     if (entity.GetEntityType() == EntityType.EntityType_NPC)
     {
         INPC npc = entity as INPC;
         //是可以攻击的NPC
         if (npc.IsCanAttackNPC())
         {
             Client.ISkillPart skillPart = MainPlayerHelper.GetMainPlayer().GetPart(EntityPart.Skill) as Client.ISkillPart;
             bool canAttack = true;
             if (skillPart != null)
             {
                 int skillerror = 0;
                 canAttack = skillPart.CheckCanAttackTarget(entity, out skillerror);
             }
             if (npc.IsPet())
             {
                 if (npc.IsMainPlayerSlave())
                 {
                     return(true);
                 }
                 else
                 {
                     if (canAttack)
                     {
                         return(true);
                     }
                 }
                 return(false);
             }
             else if (npc.IsSummon())
             {
                 if (npc.IsMainPlayerSlave())
                 {
                     return(true);
                 }
                 else
                 {
                     if (canAttack)
                     {
                         return(true);
                     }
                 }
                 return(false);
             }
             else if (npc.IsMonster())
             {
                 int hp    = entity.GetProp((int)CreatureProp.Hp);
                 int maxhp = entity.GetProp((int)CreatureProp.MaxHp);
                 return(hp < maxhp);
             }
         }
         else
         {
             table.NpcDataBase npcdb = GameTableManager.Instance.GetTableItem <table.NpcDataBase>((uint)entity.GetProp((int)Client.EntityProp.BaseID));
             if (npcdb != null)
             {
                 if (npcdb.dwType == (int)GameCmd.enumNpcType.NPC_TYPE_TRANSFER || npcdb.dwType == (int)GameCmd.enumNpcType.NPC_TYPE_COLLECT_PLANT ||
                     npcdb.dwType == (int)GameCmd.enumNpcType.NPC_TYPE_FUNCTION)
                 {
                     return(false);
                 }
             }
         }
     }
     return(true);
 }
예제 #16
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);
            }
        }
    }
예제 #17
0
    void OnEvent(int eventID, object param)
    {
        if (eventID == (int)Client.GameEventID.ENTITYSYSTEM_CREATEENTITY)
        {
            Client.stCreateEntity ce = (Client.stCreateEntity)param;
            Client.IEntitySystem  es = Client.ClientGlobal.Instance().GetEntitySystem();
            if (es == null)
            {
                return;
            }
            Client.IEntity en = es.FindEntity(ce.uid);
            if (en != null)
            {
                int rideId = en.GetProp((int)Client.PlayerProp.RideBaseId);
                if (rideId != 0)
                {
                    //if (Client.ClientGlobal.Instance().IsMainPlayer(en))
                    //{
                    //    UsingRide = (uint)rideId;
                    //}
                    bool isride = (bool)en.SendMessage(Client.EntityMessage.EntityCommond_IsRide, null);
                    if (!isride)
                    {
                        en.SendMessage(Client.EntityMessage.EntityCommond_Ride, rideId);
                    }
                    //                    Engine.Utility.Log.LogGroup("ZCX", "EntityCommond_Ride {0}",en.GetID());
                }

                //int transModelId = en.GetProp((int)Client.PlayerProp.TransModelResId);
                //if (transModelId != 0)
                //{
                //    en.SendMessage(Client.EntityMessage.EntityCommand_Change, new Client.ChangeBody() {  resId = transModelId});
                //}
            }
        }
        else if (eventID == (int)Client.GameEventID.ENTITYSYSTEM_RIDE)
        {
            Client.stEntityRide ride = (Client.stEntityRide)param;
            if (Client.ClientGlobal.Instance().IsMainPlayer(ride.uid))
            {
                if (UsingRideCallback != null)
                {
                    UsingRideCallback(UsingRideCallbackParam);
                    UsingRideCallback      = null;
                    UsingRideCallbackParam = null;
                }
            }
        }
        else if (eventID == (int)Client.GameEventID.ENTITYSYSTEM_UNRIDE)
        {
            Client.stEntityUnRide ride = (Client.stEntityUnRide)param;
            if (Client.ClientGlobal.Instance().IsMainPlayer(ride.uid))
            {
                if (UnRideCallback != null)
                {
                    UnRideCallback(UnRideCallbackParam);
                    UnRideCallback      = null;
                    UnRideCallbackParam = null;
                }
            }
        }
        else if (eventID == (int)Client.GameEventID.ENTITYSYSTEM_MAINPLAYERCREATE)
        {
            Client.IEntity mainPlayer = Client.ClientGlobal.Instance().MainPlayer;
            if (mainPlayer == null)
            {
                return;
            }
            //int rideId = mainPlayer.GetProp((int)Client.PlayerProp.RideBaseId);
            //if (rideId != 0)
            //{

            //    UsingRide = (uint)rideId;
            //    bool isride = (bool)mainPlayer.SendMessage(Client.EntityMessage.EntityCommond_IsRide, null);
            //    if (!isride)
            //    {
            //        mainPlayer.SendMessage(Client.EntityMessage.EntityCommond_Ride, rideId);
            //    }
            //}
        }
        else if (eventID == (int)Client.GameEventID.UIEVENT_UPDATEITEM)
        {
            List <string> tempIDList = GameTableManager.Instance.GetGlobalConfigKeyList("Knight_ExpItem");


            uint breakItemID = GameTableManager.Instance.GetGlobalConfig <uint>("KngithRankItem");

            ItemDefine.UpdateItemPassData data = (ItemDefine.UpdateItemPassData)param;
            if (data != null)
            {
                if (data.BaseId == breakItemID || tempIDList.Contains(data.BaseId.ToString()))
                {
                    DisPatchRideRedPoint();
                }
            }
        }
    }