Example #1
0
    public void Execute(GameCmd.stBatchRemoveUserMapScreenUserCmd_S cmd)
    {
        IEntitySystem es = ClientGlobal.Instance().GetEntitySystem();

        if (es == null)
        {
            Engine.Utility.Log.Error("严重错误:EntitySystem is null!");
            return;
        }
        for (int i = 0; i < cmd.id.Count; ++i)
        {
            EntityCreator.Instance().RemovePlayer(cmd.id[i]);

            IPlayer player = es.FindPlayer(cmd.id[i]);
            if (player != null)
            {
                if (!ClientGlobal.Instance().IsMainPlayer(player))
                {
                    Client.stRemoveEntity removeEntiy = new Client.stRemoveEntity();
                    removeEntiy.uid = player.GetUID();
                    Engine.Utility.Log.Info("remove :" + cmd.id[i]);
                    Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_REMOVEENTITY, removeEntiy);

                    es.RemoveEntity(player);
                }
            }
        }
    }
Example #2
0
    public void ShowPlantSceneUI()
    {
        gameObject.SetActive(true);
        uiCamera   = Util.UICameraObj.GetComponent <Camera>();
        mainCamera = Util.MainCameraObj.GetComponent <Camera>();
        es         = ClientGlobal.Instance().GetEntitySystem();
        if (es == null)
        {
            return;
        }

        foreach (var info in homeDM.EntityStateDic)
        {
            IEntity en = es.FindEntity(info.Key);
            if (en != null)
            {
                Vector3 enpos = en.GetPos();
                enpos.y = 0;
                enpos   = mainCamera.WorldToViewportPoint(enpos);
                enpos   = uiCamera.ViewportToWorldPoint(enpos);

                ShowFarmUI(info, enpos);
                ShowAnimalUI(info, enpos);
                ShowTreeUI(info, enpos);
            }
        }
    }
Example #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);
            }
        }
    }
Example #4
0
    public void Execute(GameCmd.stNpcMoveMoveUserCmd cmd)
    {
        IEntitySystem es = ClientGlobal.Instance().GetEntitySystem();

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

        MapVector2 mapPos = MapVector2.FromCoordinate(cmd.dst_x, cmd.dst_y);
        Vector3    pos    = new Vector3(mapPos.x, 0, -mapPos.y); // 服务器到客户端坐标转换
        IEntity    en     = null;

        en = es.FindNPC(cmd.dwNpcTempID);
        if (en == null)
        {
            //Engine.Utility.Log.Info("机器人 移动pos {0}", pos);
            en = es.FindRobot(cmd.dwNpcTempID);
        }
        if (en != null)
        {
            Engine.Utility.Log.LogGroup("XXF", "{0}Move to{1},{2}", en.GetName(), pos.x, pos.z);

            Move move = new Move();
            //move.m_dir = Global.S2CDirection(cmd.dir);
            move.strRunAct = EntityAction.Run; // 动作名需要统一处理
            move.m_target  = pos;
            move.m_speed   = en.GetProp((int)WorldObjProp.MoveSpeed) * EntityConst.MOVE_SPEED_RATE;
            // Log.Error( "npc pos is" + pos.ToString() );
            en.SendMessage(EntityMessage.EntityCommand_MoveTo, (object)move);
        }
    }
Example #5
0
    public void Excute(GameCmd.stBatchRemoveNpcMapScreenUserCmd_S cmd)
    {
        Profiler.BeginSample("stBatchRemoveNpcMapScreenUserCmd_S");
        IEntitySystem es = ClientGlobal.Instance().GetEntitySystem();

        if (es == null)
        {
            Engine.Utility.Log.Error("严重错误:EntitySystem is null!");
            return;
        }
        for (int i = 0; i < cmd.id.Count; ++i)
        {
            EntityCreator.Instance().RemoveNPC(cmd.id[i]);
            //  Engine.Utility.Log.LogGroup( "ZDY" , "stBatchRemoveNpcMapScreenUserCmd_S remove entity ----------------" + cmd.id[i] );
            IEntity npc = es.FindNPC(cmd.id[i]);
            if (npc == null)
            {
                npc = es.FindRobot(cmd.id[i]);
            }

            if (npc != null)
            {
                long uid = npc.GetUID();
                Client.stRemoveEntity removeEntiy = new Client.stRemoveEntity();
                removeEntiy.uid = uid;
                Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_REMOVEENTITY, removeEntiy);

                NpcAscription.Instance.OnRemoveBelongData(uid);
            }

            es.RemoveEntity(npc);
        }
        Profiler.EndSample();
    }
Example #6
0
    /// <summary>
    /// 通过玩家id获取所属的npc
    /// </summary>
    /// <param name="playerID"></param>
    /// <returns></returns>
    public void GetOwnNpcByPlayerID(uint playerID, ref List <INPC> lstNPC)
    {
        IEntitySystem es = ClientGlobal.Instance().GetEntitySystem();

        if (es == null)
        {
            return;
        }

        if (lstNPC == null)
        {
            return;
        }

        lstNPC.Clear();
        es.FindAllEntity <INPC>(ref m_npcList);
        for (int i = 0; i < m_npcList.Count; i++)
        {
            INPC npc = m_npcList[i];
            if (npc != null)
            {
                int masterID = npc.GetProp((int)NPCProp.Masterid);
                if (masterID == playerID)
                {
                    lstNPC.Add(npc);
                }
            }
        }
        m_npcList.Clear();
    }
Example #7
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);
                }
            }
        }
    }
Example #8
0
    private void ShowSkill()
    {
        RegisterGlobalEvent(true);

        SetSkillIcon();
        LearnSkillDataManager skillData = DataManager.Manager <LearnSkillDataManager>();

        if (skillData.CurState == SkillSettingState.StateTwo)
        {
            m_widget_SkillBtns.transform.DORotate(new Vector3(0, 0, 125), rotTime);
        }

        InitShortcutUIAndData();

        IControllerSystem cs = ClientGlobal.Instance().GetControllerSystem();

        if (cs == null)
        {
            Engine.Utility.Log.Error("ExecuteCmd: ControllerSystem is null");
            return;
        }

        //Client.ICombatRobot robot = cs.GetCombatRobot();
        //if (robot != null)
        //{
        //    m_btn_BtnAI.GetComponent<UIToggle>().value = robot.Status != CombatRobotStatus.STOP;
        //}
    }
Example #9
0
    void SkillEvent(int eventID, object param)
    {
        if (ClientGlobal.Instance().MainPlayer == null)
        {
            return;
        }
        long userUID = ClientGlobal.Instance().MainPlayer.GetUID();

        if (eventID == (int)GameEventID.ENTITYSYSTEM_ENTITYDEAD)
        {
            stEntityDead ed = (stEntityDead)param;
            if (ed.uid == userUID)
            {
                DeleteFightPet(0);
            }
            if (CurPet != null)
            {
                INPC npc = GetNpcByPetID(CurPet.GetID());
                if (npc != null)
                {
                    if (ed.uid == npc.GetUID())
                    {
                        DeleteFightPet(0);
                    }
                }
            }
        }
    }
Example #10
0
    void ChangePetBody(uint suitID, uint petID)
    {
        PetDataManager pm = DataManager.Manager <PetDataManager>();

        if (pm != null)
        {
            //if (pm.CurFightingPet != 0)
            {
                IEntitySystem es = ClientGlobal.Instance().GetEntitySystem();
                if (es != null)
                {
                    INPC npc = es.FindNPC(petID);
                    if (npc != null)
                    {
                        if (suitID != 0)
                        {
                            SuitDataBase sdb = GameTableManager.Instance.GetTableItem <SuitDataBase>(suitID, 1);
                            if (sdb != null)
                            {
                                Client.ChangeBody cb = new Client.ChangeBody();
                                cb.resId      = (int)sdb.resid;
                                cb.modleScale = sdb.sceneModleScale;
                                npc.SendMessage(EntityMessage.EntityCommand_Change, cb);
                            }
                        }
                        else
                        {
                            npc.SendMessage(EntityMessage.EntityCommand_Restore);
                        }
                    }
                }
            }
        }
    }
Example #11
0
    public void RebackWeaponSuitAndCleanData(uint uid)
    {
        IEntitySystem es = ClientGlobal.Instance().GetEntitySystem();

        if (es == null)
        {
            return;
        }

        IPlayer player = es.FindPlayer(uid);

        if (player == null)
        {
            return;
        }

        uint suitId;

        if (m_playerSuitDic.TryGetValue(player.GetID(), out suitId))
        {
            SendChangeBody(2, suitId, player);
            SendChangeRenderObj(suitId, 2, player.GetID());
            m_playerSuitDic.Remove(player.GetID());
            m_playerFishingDic.Remove(player.GetID());
        }
    }
Example #12
0
    public void OnSendNineSuitMsg(stSendSuitToNinePropertyUserCmd_S cmd)
    {
        uint          userID = cmd.userid;
        IEntitySystem es     = ClientGlobal.Instance().GetEntitySystem();

        if (es != null)
        {
            if (cmd.type == EquipSuitType.Magic_Pet_Type)
            {
                ChangePetBody(cmd.suitid, cmd.petid);
                SendChangeRenderObj(cmd.suitid, (int)cmd.type, userID);
            }
            else
            {
                IPlayer player = es.FindEntity <IPlayer>(userID);
                if (player == null)
                {
                    return;
                }

                //if(ClientGlobal.Instance().IsMainPlayer(player))
                //{
                //    return;
                //}

                if (player != null)
                {
                    SendChangeBody((int)cmd.type, cmd.suitid, player);
                    SendChangeRenderObj(cmd.suitid, (int)cmd.type, userID);
                }
            }
        }
    }
Example #13
0
    public void RunCD()
    {
        if (IsCDing)
        {
            Log.LogGroup("ZDY", "run cd and is cding ");
            return;
        }


        Client.IPlayer mainPlayer = ClientGlobal.Instance().MainPlayer;
        if (mainPlayer == null)
        {
            Log.Error("main player is null");
            return;
        }

        SkillCDInfo cdInfo = DataManager.Manager <SkillCDManager>().GetSkillCDBySkillId((uint)m_skillid);

        if (cdInfo != null)
        {
            IsCDing = true;
            SetBtnEnable(false);
            if (!TimerAxis.Instance().IsExist(m_uSkillUseTimeID, this))
            {
                //   Log.LogGroup("ZDY", "start cd " );
                TimerAxis.Instance().SetTimer(m_uSkillUseTimeID, 30, this);
            }
        }
        else
        {
            SetBtnEnable(true);
            //Log.LogGroup("ZDY", "run cd info is null " + m_skillid);
        }
    }
Example #14
0
    public void Execute(GameCmd.stUserStopMoveUserCmd_S cmd)
    {
        IEntitySystem es = ClientGlobal.Instance().GetEntitySystem();

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

        IPlayer player = es.FindPlayer(cmd.charid);

        if (player == null)
        {
            return;
        }

        if (ClientGlobal.Instance().IsMainPlayer(player))
        {
            return;
        }

        Vector3 pos = new Vector3(cmd.stop_pos_x * 0.01f, 0, -cmd.stop_pos_y * 0.01f);

        Engine.Utility.Log.LogGroup("ZDY", "stop move ==============================!");
        player.SendMessage(EntityMessage.EntityCommand_ForceStopMove, pos);
    }
Example #15
0
    void onClick_FBPickBtn_Btn(GameObject caster)
    {
        if (DataManager.Manager <SliderDataManager>().IsReadingSlider)
        {
            return;
        }
        IEntity npc = ClientGlobal.Instance().GetEntitySystem().FindEntity(m_lCloseNpcid);

        if (npc != null)
        {
            bool ride = DataManager.Manager <RideManager>().IsRide;
            if (ride)
            {
                ClientGlobal.Instance().netService.Send(new GameCmd.stDownRideUserCmd_C()
                {
                });
            }

            NetService.Instance.Send(new GameCmd.stClickNpcScriptUserCmd_C()
            {
                dwNpcTempID = npc.GetID(),
            });
        }
        else
        {
            m_btn_FBPickBtn.gameObject.SetActive(false);
        }
    }
Example #16
0
    public int SetDisplayData(uint uID)
    {
        IEntitySystem es = ClientGlobal.Instance().GetEntitySystem();

        table.NpcDataBase npctable = GameTableManager.Instance.GetTableItem <table.NpcDataBase>(uID);
        if (npctable == null)
        {
            return(0);
        }

        GameCmd.t_MapNpcDataPos npcdata = new GameCmd.t_MapNpcDataPos();
        npcdata.mapnpcdata         = new GameCmd.t_MapNpcData();
        npcdata.mapnpcdata.npcdata = new GameCmd.t_NpcData();

        npcdata.mapnpcdata.npcdata.dwBaseID = uID;

        npcdata.mapnpcdata.npcdata.dwTempID  = this.m_dwID;
        npcdata.mapnpcdata.npcdata.movespeed = 600;

        EntityCreateData data = RoleUtil.BuildCreateEntityData(EntityType.EntityType_NPC, npcdata, 0);

        IEntity npc = es.CreateEntity(EntityType.EntityType_NPC, data, true) as INPC;

        //ISkillPart skillPart = npc.GetPart(EntityPart.Skill) as ISkillPart;
        //skillPart.ReqNpcUseSkill(208);

        m_pEntity = npc;

        return(1);
    }
Example #17
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);
        }
    }
Example #18
0
    public override bool OnTogglePanel(int tabType, int pageid)
    {
        if (pageid == (int)PropPanelPageEnum.Page_Prop)
        {
            SetPanelMode(PropPanelMode.Prop, true);
            uint          showUID = ClientGlobal.Instance().MainPlayer.GetID();
            IEntitySystem es      = ClientGlobal.Instance().GetEntitySystem();
            if (es == null)
            {
                return(false);
            }
            IPlayer player = es.FindPlayer(showUID);
            if (player == null)
            {
                return(false);
            }
            m_currShowUID = showUID;
            ShowByPlayer(player);
            m_label_fight.gameObject.SetActive(true);
        }
        else if (pageid == (int)PropPanelPageEnum.Page_Title)
        {
            SetPanelMode(PropPanelMode.Title, true);
        }
        else if (pageid == (int)PropPanelPageEnum.Page_Fashion)
        {
            SetPanelMode(PropPanelMode.Fashion, true);
            m_label_fight.gameObject.SetActive(false);
        }

        // 页签红点提示
        UpdateRedPoint();
        return(base.OnTogglePanel(tabType, pageid));
    }
Example #19
0
        // 根据ID获取技能部件
        public static ISkillPart GetSkillPart(uint uid, EntityType type)
        {
            IEntitySystem es = ClientGlobal.Instance().GetEntitySystem();

            if (es == null)
            {
                Engine.Utility.Log.Error("GetEntitySystem failed!");
                return(null);
            }
            if (type == EntityType.EntityType_NPC)
            {
                IRobot robot = es.FindEntity <IRobot>(uid);
                if (robot != null)
                {
                    type = EntityType.EntityTYpe_Robot;
                }
            }
            long    id     = EntitySystem.EntityHelper.MakeUID(type, uid);
            IEntity player = es.FindEntity(id);

            if (player == null)
            {
                Engine.Utility.Log.Error("GetAttack failed!");
                return(null);
            }

            ISkillPart skillPart = player.GetPart(EntityPart.Skill) as ISkillPart;

            return(skillPart);
        }
Example #20
0
 public void Awake()
 {
     m_RoomSocket = ClientGlobal.GetInstance().GetRoomSocket();
     m_UserList   = ClientGlobal.GetInstance().GetUserList();
     m_Owner      = ClientGlobal.GetInstance().GetOwner();
     m_RoomSocket.AddSocketReadSink(this);
 }
Example #21
0
 void OnEventRemoveBuff(int eventID, stRemoveBuff param)
 {
     if (ClientGlobal.Instance().IsMainPlayer(param.uid))
     {
         for (int i = 0; i < mainRoleBuffList.Count; i++)
         {
             Client.stAddBuff st = (Client.stAddBuff)mainRoleBuffList[i];
             if (st.buffThisID == param.buffThisID)
             {
                 mainRoleBuffList.RemoveAt(i);
                 break;
             }
         }
         stShowBuffInfo info = new stShowBuffInfo();
         info.IsMainRole = true;
         DataManager.Manager <UIPanelManager>().SendMsg(PanelID.MainPanel, UIMsgID.stShowBuff, info);
     }
     else
     {
         for (int i = 0; i < targetBuffList.Count; i++)
         {
             Client.stAddBuff st = (Client.stAddBuff)targetBuffList[i];
             if (st.buffThisID == param.buffThisID && st.uid == param.uid)
             {
                 targetBuffList.RemoveAt(i);
                 break;
             }
         }
         stShowBuffInfo info = new stShowBuffInfo();
         info.IsMainRole = false;
         DataManager.Manager <UIPanelManager>().SendMsg(PanelID.MainPanel, UIMsgID.stShowBuff, info);
     }
 }
Example #22
0
    public void CancleBuffState(stCancelStateIcoListMagicUserCmd_S cmd)
    {
        BuffDataBase db = GameTableManager.Instance.GetTableItem <BuffDataBase>(cmd.wdState);

        if (db != null)
        {
            IEntitySystem es = ClientGlobal.Instance().GetEntitySystem();
            if (es == null)
            {
                Engine.Utility.Log.Error("GetEntitySystem failed!");
            }

            IEntity entity = EntitySystem.EntityHelper.GetEntity(cmd.byType, cmd.dwTempID);

            if (entity == null)
            {
                Engine.Utility.Log.Error("es.FindEntity  useid is !" + cmd.dwTempID.ToString());
            }
            else
            {
                Log.LogGroup("ZDY", "取消{0}身上的buff {1}===========", db.strName, entity.GetName());
            }
        }
        else
        {
            Log.Error("找不到buff ===========" + cmd.wdState);
        }
        IBuffPart bp = GetBuffPart((GameCmd.SceneEntryType)cmd.byType, cmd.dwTempID);

        if (bp != null)
        {
            bp.CancleBuffState(cmd);
        }
    }
Example #23
0
    public void Execute(GameCmd.stAddMapNpcAndPosMapScreenUserCmd_S cmd)
    {
        //AddNPC(cmd.data);
        Profiler.BeginSample("stAddMapNpcAndPosMapScreenUserCmd_S");
        EntityCreator.Instance().AddNPC(cmd.data, cmd.master_id);
        IEntitySystem es = ClientGlobal.Instance().GetEntitySystem();

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

        if (userUID == cmd.master_id && cmd.pet_id != 0)
        {
            DataManager.Manager <PetDataManager>().AddPetToNpc(cmd.pet_id, cmd.data.mapnpcdata.npcdata.dwTempID);
        }

        GameCmd.stNpcBelongListMapScreenUserCmd_S belongcmd = new GameCmd.stNpcBelongListMapScreenUserCmd_S();
        belongcmd.teamid = cmd.data.mapnpcdata.npcdata.owernteamid;
        belongcmd.userid = cmd.master_id;
        belongcmd.npcid  = cmd.data.mapnpcdata.npcdata.dwTempID;
        Execute(belongcmd);
        RoleStateBarManager.RefreshAllRoleBarHeadStatus(HeadStatusType.Hp);
        Profiler.EndSample();
    }
Example #24
0
    public List <uint> GetUnLockLevelList()
    {
        List <uint>          list       = new List <uint>();
        IPlayer              mainPlayer = ClientGlobal.Instance().MainPlayer;
        int                  job        = mainPlayer.GetProp((int)PlayerProp.Job);
        int                  level      = mainPlayer.GetProp((int)CreatureProp.Level);
        List <SkillDatabase> skillList  = GameTableManager.Instance.GetTableList <SkillDatabase>();

        skillList = skillList.FindAll(P => P.dwJob == job && !P.IsBasic && P.wdLevel == 1);
        foreach (var skill in skillList)
        {
            list.Add(skill.dwNeedLevel);
        }
        list.Sort((x1, x2) =>
        {
            if (x1 > x2)
            {
                return(1);
            }
            else if (x1 < x2)
            {
                return(-1);
            }
            else
            {
                return(0);
            }
        });
        return(list);
    }
Example #25
0
    private System.Collections.IEnumerator BuildEntityBarsCor()
    {
        yield return(0);

        IEntitySystem entitySystem = ClientGlobal.Instance().GetEntitySystem();

        if (null != entitySystem)
        {
            List <long> entityUids = entitySystem.GetEntityUids();

            if (null != entityUids)
            {
                UIRoleStateBar bar = null;
                int            successCreateCount = 0;
                int            modSeed            = (entityUids.Count % 30);
                modSeed = Mathf.Max(0, modSeed);
                for (int i = 0, max = entityUids.Count; i < max; i++)
                {
                    bar = AddRoleBar(entityUids[i]);
                    if (null != bar)
                    {
                        successCreateCount++;
                        if (modSeed != 0)
                        {
                            if (successCreateCount % modSeed == 0)
                            {
                                //等待下一帧
                                yield return(null);
                            }
                        }
                    }
                }
            }
        }
    }
Example #26
0
    public int GetPlayerLevel()
    {
        IPlayer mainPlayer = ClientGlobal.Instance().MainPlayer;
        int     level      = mainPlayer.GetProp((int)CreatureProp.Level);

        return(level);
    }
Example #27
0
    /// <summary>
    /// 移除npc身上特效
    /// </summary>
    /// <param name="npcId"></param>
    public bool RemoveCollectNpcEffectByNpcId(uint npcId)
    {
        List <int> linkIdList;

        if (m_dicCollectNpcEffectLinkId.TryGetValue(npcId, out linkIdList))
        {
            IEntitySystem es = ClientGlobal.Instance().GetEntitySystem();
            if (es == null)
            {
                return(false);
            }

            INPC npc = es.FindNPC(npcId);
            if (npc == null)
            {
                return(false);
            }

            for (int i = 0; i < linkIdList.Count; i++)
            {
                EntitySystem.EntityHelper.RemoveEffect(npc, linkIdList[i]);
            }
            return(true);
        }

        return(false);
    }
Example #28
0
    public int GetPlayerJob()
    {
        IPlayer mainPlayer = ClientGlobal.Instance().MainPlayer;
        int     level      = mainPlayer.GetProp((int)PlayerProp.Job);

        return(level);
    }
Example #29
0
    /// <summary>
    /// 发起挑战
    /// </summary>
    /// <param name="targetID"></param>
    /// <param name="name"></param>
    public void ReqChallengeInvite(uint targetID, string name, uint targetRank, bool onLine)
    {
        // 大v说了武斗场id不变151.
        if (!KHttpDown.Instance().SceneFileExists(151))
        {
            //打开下载界面
            DataManager.Manager <UIPanelManager>().ShowPanel(PanelID.DownloadPanel);
            return;
        }

        MainPlayStop();
        IPlayer mainPlayer = ClientGlobal.Instance().MainPlayer;
        stChallengeInviteArenaUserCmd_CS cmd = new stChallengeInviteArenaUserCmd_CS();

        cmd.offensive_id   = mainPlayer.GetID();
        cmd.offensive_name = mainPlayer.GetName();
        cmd.offender_rank  = m_rank;
        cmd.defensive_id   = targetID;
        cmd.defensive_name = name;
        cmd.defendser_rank = targetRank;
        NetService.Instance.Send(cmd);

        if (onLine)  //在线,会弹出等待框
        {
            WaitPanelShowData waitData = new WaitPanelShowData();
            waitData.type       = WaitPanelType.ArenaChallenge;
            waitData.cdTime     = ChallengeRejectTime;
            waitData.des        = "挑战邀请中,请稍后...";
            waitData.timeOutDel = delegate { DataManager.Manager <UIPanelManager>().HidePanel(PanelID.CommonWaitingPanel); };
            waitData.useBoxMask = false;

            DataManager.Manager <UIPanelManager>().ShowPanel(PanelID.CommonWaitingPanel, data: waitData);
        }
    }
Example #30
0
    public void Execute(stMainUserDataUserCmd_S cmd)
    {
        //MainRole.Instance.MainData = cmd.data;

        // TODO: 后面再来处理
        IEntitySystem es = ClientGlobal.Instance().GetEntitySystem();

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

        EntityCreateData data = new EntityCreateData();

        data.PropList = new EntityAttr[(int)PlayerProp.End - (int)EntityProp.Begin];
        data.ID       = cmd.data.dwUserID;
        RoleUtil.BuildPlayerPropList(cmd.data, ref data.PropList);
        IPlayer player = es.FindPlayer(cmd.data.dwUserID);

        if (player != null)
        {
            player.UpdateProp(data);
            DataManager.Manager <UIPanelManager>().SendMsg(PanelID.MainPanel, UIMsgID.eSetRoleProperty, player);
        }
    }