示例#1
0
 /// <summary>
 /// 设置家园实体状态通过实体id
 /// </summary>
 /// <param name="landIndex">实体id</param>
 /// <param name="state">状态</param>
 /// <param name="indexID">homeland.xlsx 模型配置表里对应的索引id</param>
 void SetHomeEntityState(long uid, int state, uint indexID)
 {
     if (entityStateDic.ContainsKey(uid))
     {
         HomeEntityInfo info = entityStateDic[uid];
         info.state          = state;
         entityStateDic[uid] = info;
         IEntitySystem es = ClientGlobal.Instance().GetEntitySystem();
         if (es != null)
         {
             IEntity en = es.FindEntity(uid);
             if (en != null)
             {
                 HomeLandViewDatabase db = GameTableManager.Instance.GetTableItem <HomeLandViewDatabase>((uint)indexID, state);
                 if (db != null)
                 {
                     ResourceDataBase rdb = GameTableManager.Instance.GetTableItem <ResourceDataBase>(db.dwModelID);
                     if (rdb != null)
                     {
                         ChangePart cp = new ChangePart();
                         cp.strPartName = "main";
                         cp.strResName  = rdb.strPath;
                         en.SendMessage(EntityMessage.EntityCommand_ChangePart, cp);
                     }
                 }
             }
         }
     }
     else
     {
         Log.Error("not cotain uid " + uid.ToString());
     }
 }
示例#2
0
    public void OnAnsTeamCopy(stAnsTeamCopyUserCmd_CS cmd)
    {
        if (m_dicTeammateStatus.ContainsKey(cmd.charid))
        {
            m_dicTeammateStatus[cmd.charid] = cmd.ans;
        }
        else
        {
            m_dicTeammateStatus.Add(cmd.charid, cmd.ans);
        }

        if (!cmd.ans)
        {
            IEntitySystem es = ClientGlobal.Instance().GetEntitySystem();
            if (es != null)
            {
                IPlayer player = es.FindEntity <IPlayer>(cmd.charid);
                if (player != null)
                {
                    TipsManager.Instance.ShowLocalFormatTips(LocalTextType.Copy_Commond_xweitongyijinrufuben, player.GetName());
                }
            }
            return;
        }

        DispatchValueUpdateEvent(new ValueUpdateEventArgs(CopyDispatchEvent.RefreshStatus.ToString(), null, null));
        TeamDataManager teamData = DataManager.Manager <TeamDataManager>();

        if (teamData.MainPlayerIsLeader())
        {
            List <TeamMemberInfo> memList = teamData.TeamMemberList;
            bool bAllagree = true;
            foreach (var meminfo in memList)
            {
                if (m_dicTeammateStatus.ContainsKey(meminfo.id))
                {
                    bAllagree = m_dicTeammateStatus[meminfo.id];
                    if (!bAllagree)
                    {
                        break;
                    }
                }
                else
                {
                    bAllagree = false;
                    break;
                }
            }
            if (bAllagree)
            {
                //stRequestEnterCopyUserCmd_C copyCmd = new stRequestEnterCopyUserCmd_C();
                //copyCmd.copy_base_id = EnterCopyID;
                //NetService.Instance.Send(copyCmd);

                DataManager.Manager <ComBatCopyDataManager>().ReqEnterCopy(EnterCopyID);
            }
        }
    }
示例#3
0
    IEntity GetEntity(long uid)
    {
        IEntitySystem es = ClientGlobal.Instance().GetEntitySystem();

        if (es != null)
        {
            return(es.FindEntity(uid));
        }
        return(null);
    }
示例#4
0
    public static T GetEntityByUserID <T>(uint userId) where T : IEntity
    {
        IEntitySystem es = ClientGlobal.Instance().GetEntitySystem();

        if (es != null)
        {
            return(es.FindEntity <T>(userId));
        }
        return(default(T));
    }
示例#5
0
    /// <summary>
    /// 为采集物添加特效
    /// </summary>
    /// <param name="npcEntity">npc</param>
    void AddEntityEffect(Client.stCreateEntity npcEntity)
    {
        QuestDataBase questDb = GameTableManager.Instance.GetTableItem <QuestDataBase>(DoingTaskID);

        if (questDb == null)
        {
            return;
        }

        if (questDb.dwSubType != (uint)TaskSubType.Collection)
        {
            return;
        }

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

        if (es == null)
        {
            return;
        }

        IEntity npc = es.FindEntity(npcEntity.uid);

        if (npc == null)
        {
            return;
        }

        //List<QuestTraceInfo> traceTask;
        //GetAllQuestTraceInfo(out traceTask, null);
        //if (traceTask == null)
        //{
        //    return;
        //}

        ////正在采集为   要加特效
        //QuestTraceInfo questTraceInfo = traceTask.Find((data) => { return data.taskId == DoingTaskID && data.taskSubType == TaskSubType.Collection; });

        //if (questTraceInfo == null)
        //{
        //    RemoveCollectNpcEffectAndCleanDataByNpcId(npc.GetID());
        //    return;
        //}

        uint npcBaseId = (uint)npc.GetProp((int)EntityProp.BaseID);

        if (questDb.collect_npc != npcBaseId)
        {
            RemoveCollectNpcEffectAndCleanDataByNpcId(npc.GetID());
            return;
        }

        AddCollectNpcEffect(npc.GetID(), 9002);
        AddCollectNpcEffect(npc.GetID(), 9003);
    }
示例#6
0
    void DoGameEvent(int eventID, object param)
    {
        if (eventID == (int)GameEventID.SYSTEM_LOADSCENECOMPELETE)
        {
            Client.stLoadSceneComplete pa = (Client.stLoadSceneComplete)param;
            int homeID = GameTableManager.Instance.GetGlobalConfig <int>("HomeSceneID");
            if (pa.nMapID == homeID)
            {
                IPlayer player = ClientGlobal.Instance().MainPlayer;
                if (player != null)
                {
                    //stRequestAllHomeUserCmd_C cmd = new stRequestAllHomeUserCmd_C();
                    //cmd.char_id = player.GetID();
                    //NetService.Instance.Send(cmd);
                    ReqAllUserHomeData(player.GetID());

                    ReqHomeTradePrice();
                }
            }
        }
        else if (eventID == (int)GameEventID.PLAYER_LOGIN_SUCCESS)
        {
        }
        else if (eventID == (int)GameEventID.HOMELAND_CLICKENTITY)
        {
            stClickEntity ce = (stClickEntity)param;
            IEntitySystem es = ClientGlobal.Instance().GetEntitySystem();
            if (es != null)
            {
                IEntity et = es.FindEntity(ce.uid);
                if (et != null)
                {
                    if (IsMyHome()) //只有自己家园才可以点击实体
                    {
                        if (et.GetEntityType() == EntityType.EntityType_Plant || et.GetEntityType() == EntityType.EntityType_Soil)
                        {//农场点击响应
                            OnClickPlantEntity(et);
                        }
                        else if (et.GetEntityType() == EntityType.EntityType_Animal)
                        {
                            OnClickAnimalEntity(et);
                        }
                        else if (et.GetEntityType() == EntityType.EntityType_Tree)
                        {
                            OnClickTreeEntity(et);
                        }
                        else if (et.GetEntityType() == EntityType.EntityType_Minerals)
                        {
                            OnClickMineEntity(et);
                        }
                    }
                }
            }
        }
    }
示例#7
0
    void DoGameEvent(int eventID, object param)
    {
        if (eventID == (int)GameEventID.ENTITYSYSTEM_CREATEENTITY)
        {
            if (m_bEnterCityWar == false)
            {
                return;
            }

            Client.stCreateEntity npcEntity = (Client.stCreateEntity)param;

            IEntitySystem es = ClientGlobal.Instance().GetEntitySystem();
            if (es == null)
            {
                return;
            }

            IEntity npc = es.FindEntity(npcEntity.uid);
            if (npc == null)
            {
                return;
            }

            int npcBaseId = npc.GetProp((int)EntityProp.BaseID);

            // 1、设置城战图腾氏族ID
            CityWarTotem cityWarTotem = m_lstCityWarTotem.Find((d) => { return(d.npcBaseId == npcBaseId); });
            if (cityWarTotem != null)
            {
                //npc.SetProp((int)Client.CreatureProp.ClanId, (int)cityWarTotem.clanId);

                uint clanId     = cityWarTotem.clanId;
                int  clanIdLow  = (int)(clanId & 0x0000ffff);
                int  clanIdHigh = (int)(clanId >> 16);
                npc.SetProp((int)Client.CreatureProp.ClanIdLow, clanIdLow);
                npc.SetProp((int)Client.CreatureProp.ClanIdHigh, clanIdHigh);
            }

            // 2、采集物
            table.NpcDataBase npctable = GameTableManager.Instance.GetTableItem <table.NpcDataBase>((uint)npcBaseId);
            if (npctable != null && npctable.dwType == (uint)GameCmd.enumNpcType.NPC_TYPE_COLLECT_PLANT)//采集物
            {
                CampNpcOnTrigger callback = new CampNpcOnTrigger();
                npc.SetCallback(callback);
            }

            // 城战打印
            //UnityEngine.Debug.LogError("------npctable.dwID = " + npcBaseId);
            //List<CityWarTotem> list = DataManager.Manager<CityWarManager>().CityWarTotemList;
            //for (int i = 0; i < list.Count; i++)
            //{
            //    UnityEngine.Debug.LogError(">>>>>>totemNpcId = " + list[i].totemNpcId + " clanId = " + list[i].clanId);
            //}
        }
    }
示例#8
0
        public static IEntity GetMaster(int masterID)
        {
            IEntitySystem es = EntitySystem.m_ClientGlobal.GetEntitySystem();

            if (es != null)
            {
                IPlayer p = es.FindEntity <IPlayer>((uint)masterID);
                return(p);
            }
            return(null);
        }
示例#9
0
    public void RemoveEntity(long uid)
    {
        IEntitySystem es = ClientGlobal.Instance().GetEntitySystem();

        if (es == null)
        {
            return;
        }
        IEntity en = es.FindEntity(uid);

        RemoveEntity(en);
    }
示例#10
0
    void OnSuitEvent(int nEventID, object param)
    {
        if (nEventID == (int)GameEventID.PLAYER_LOGIN_SUCCESS)
        {
            //             stOpSuitPropertyUserCmd_C cmd = new stOpSuitPropertyUserCmd_C();
            //             cmd.type = SuitOPType.SuitOPType_Login;
            //             NetService.Instance.Send(cmd);
        }
        else if (nEventID == (int)GameEventID.LOGINSUCESSANDRECEIVEALLINFO)
        {
            InitShowDic();
            stOpSuitPropertyUserCmd_C cmd = new stOpSuitPropertyUserCmd_C();
            cmd.type = SuitOPType.SuitOPType_Login;
            NetService.Instance.Send(cmd);
        }
        else if (nEventID == (int)GameEventID.SKILLSYSTEM_CHANGEMODEL)
        {
            stSkillChangeModel st = (stSkillChangeModel)param;
            IEntitySystem      es = ClientGlobal.Instance().GetEntitySystem();
            if (es == null)
            {
                return;
            }
            IPlayer player = es.FindEntity <IPlayer>(st.userID);
            if (player == null)
            {
                return;
            }
            uint suitID = 0;
            if (!IsPlayerEquipCloth(player, out suitID))
            {
                ChangeEquip ce = new ChangeEquip();
                ce.nSuitID    = (int)suitID;
                ce.pos        = Client.EquipPos.EquipPos_Body;
                ce.nStateType = player.GetProp((int)PlayerProp.SkillStatus);
                if (this != null)
                {//EntityCommand_PlayAni
                    PlayAni anim_param = new PlayAni();
                    anim_param.strAcionName = EntityAction.Stand;
                    anim_param.fSpeed       = 1;
                    anim_param.nStartFrame  = 0;

                    player.SendMessage(EntityMessage.EntityCommand_PlayAni, anim_param);
                    player.SendMessage(EntityMessage.EntityCommand_ChangeEquip, ce);
                }
            }
        }
    }
示例#11
0
        public static IEntity GetEntity(long uid)
        {
            if (EntitySystem.m_ClientGlobal == null)
            {
                return(null);
            }

            IEntitySystem es = EntitySystem.m_ClientGlobal.GetEntitySystem();

            if (es == null)
            {
                return(null);
            }

            return(es.FindEntity(uid));
        }
示例#12
0
    /// <summary>
    /// 移除采集物特效(当npc移除时同时移除特效)
    /// </summary>
    /// <param name="removeEntity"></param>
    void RemoveEntityEffect(Client.stRemoveEntity removeEntity)
    {
        IEntitySystem es = ClientGlobal.Instance().GetEntitySystem();

        if (es == null)
        {
            return;
        }

        IEntity npc = es.FindEntity(removeEntity.uid);

        if (npc == null)
        {
            return;
        }

        RemoveCollectNpcEffectAndCleanDataByNpcId(npc.GetID());
    }
示例#13
0
    //采集
    void UpdateFBPickBtn(object param)
    {
        if (DataManager.Manager <ComBatCopyDataManager>().IsEnterCopy)
        {
            if (param == null)
            {
                return;
            }

            stCampCollectNpc npc = (stCampCollectNpc)param;

            //npc在傍边
            bool          isNpcExist = false;
            IEntitySystem es         = ClientGlobal.Instance().GetEntitySystem();
            if (es != null)
            {
                if (null != es.FindEntity(npc.npcid))
                {
                    isNpcExist = true;
                }
            }


            if (npc.enter && isNpcExist)
            {
                m_btn_FBPickBtn.gameObject.SetActive(true);
                m_lCloseNpcid = npc.npcid;
            }
            else
            {
                m_lCloseNpcid = 0;
                m_btn_FBPickBtn.gameObject.SetActive(false);
            }
        }
        else
        {
            m_btn_FBPickBtn.gameObject.SetActive(false);
        }
    }
示例#14
0
    public void RebackWeaponSuit()
    {
        IEntitySystem es = ClientGlobal.Instance().GetEntitySystem();

        if (es != null)
        {
            IEntity en = es.FindEntity(MainPlayerHelper.GetPlayerUID());
            if (en == null)
            {
                return;
            }
            IPlayer player = en as IPlayer;
            if (player == null)
            {
                return;
            }
            //if (CurWeaponSuitID != 0)
            {
                SendChangeBody(2, CurWeaponSuitID, player);
                SendChangeRenderObj(CurWeaponSuitID, 2, player.GetID());
            }
        }
    }
示例#15
0
        public bool Conform(INPC en)
        {
            int error = 0;

            if (!CommonCondition.IsNpcCanAttackByTable(en))
            {
                return(false);
            }
            if (en.IsPet() || en.IsSummon())
            {
                int           masterID = en.GetProp((int)NPCProp.Masterid);
                IEntitySystem es       = EntitySystem.m_ClientGlobal.GetEntitySystem();
                if (es != null)
                {
                    IPlayer p = es.FindEntity <IPlayer>((uint)masterID);
                    if (p != null)
                    {
                        if (EntitySystem.m_ClientGlobal.MainPlayer.GetUID() == p.GetUID())
                        {
                            return(false);
                        }
                    }
                }
            }
            if (m_skillPart != null && m_skillPart.CheckCanAttackTarget(en, out error) == false)
            {
                return(false);
            }

            float fDis = Vector3.Distance(m_centerpos, en.GetPos());

            if (fDis > m_rang)
            {
                return(false);
            }
            return(true);
        }
示例#16
0
    public void Execuete(GameCmd.stReturnObjectPosMagicUserCmd_S cmd)
    {
        //冲锋应该是goto  瞬移应该是enumMoveType_Immediate  此处待后台修改 前台先山寨一下
        if (cmd.byMoveType == stReturnObjectPosMagicUserCmd_S.enumMoveType.enumMoveType_GoTo || cmd.byMoveType == stReturnObjectPosMagicUserCmd_S.enumMoveType.enumMoveType_Immediate)
        {
            IEntitySystem es = ClientGlobal.Instance().GetEntitySystem();
            if (es == null)
            {
                Engine.Utility.Log.Error("GetEntitySystem failed!");
                return;
            }

            stEntryPosition userPos = cmd.userpos;
            if (userPos != null)
            {
                IEntity player = es.FindEntity <IPlayer>(userPos.dwTempID);
                if (player != null)
                {
                    //MapVector2 mapPos = MapVector2.FromCoordinate(userPos.x, userPos.y);
                    Vector3    pos       = new Vector3(userPos.cur_pos.x * 0.01f, 0, -userPos.cur_pos.y * 0.01f); // 服务器到客户端坐标转换
                    ISkillPart skillPart = SkillHelper.GetSkillPart(userPos.dwTempID, EntityType.EntityType_Player);

                    if (skillPart != null)
                    {
                        if (skillPart.IsFastMove())
                        {
                            Move move = new Move();
                            move.m_target      = pos;
                            move.m_ignoreStand = true;
                            player.SendMessage(EntityMessage.EntityCommand_MoveTo, (object)move);
                        }
                        else
                        {
                            //不是在释放快速移动技能 立刻设置位置 否则延迟设置

                            player.SendMessage(EntityMessage.EntityCommand_SetPos, (object)pos);
                            //Vector3 rot = GameUtil.S2CDirection(userPos.byDir);
                            //player.SendMessage(EntityMessage.EntityCommand_SetRotate, (object)rot);
                        }
                        IEntity skillTarget = skillPart.GetSkillTarget();
                        if (skillTarget != null && skillTarget.GetUID() != player.GetUID())
                        {
                            SkillDatabase db = skillPart.GetCurSkillDataBase();
                            if (db != null)
                            {
                                if (db.targetType == (int)SkillTargetType.TargetForwardPoint)
                                {
                                    return;
                                }
                            }
                            player.SendMessage(EntityMessage.EntityCommand_LookTarget, skillTarget.GetPos());
                        }
                    }
                }
            }

            if (cmd.npcpos != null)
            {
                INPC npc = es.FindEntity <INPC>(cmd.npcpos.dwTempID);
                if (npc != null)
                {
                    //MapVector2 mapPos = MapVector2.FromCoordinate(cmd.npcpos.x, cmd.npcpos.y);
                    Vector3    pos       = new Vector3(cmd.npcpos.cur_pos.x * 0.01f, 0, -cmd.npcpos.cur_pos.y * 0.01f); // 服务器到客户端坐标转换
                    ISkillPart skillPart = SkillHelper.GetSkillPart(cmd.npcpos.dwTempID, EntityType.EntityType_NPC);

                    if (skillPart != null)
                    {  //不是在释放快速移动技能 立刻设置位置 否则延迟设置
                        npc.SendMessage(EntityMessage.EntityCommand_StopMove, (object)pos);
                    }
                }
            }

            EventEngine.Instance().DispatchEvent((int)GameEventID.CAMERA_MOVE_END);
        }
    }
示例#17
0
文件: NPC.cs 项目: zuojiashun/src
        //-------------------------------------------------------------------------------------------------------
        public override bool CreateEntityView(EntityCreateData data)
        {
            m_Data = data;

            base.CreateEntityView(data);
            if (GetEntityType() != EntityType.EntityType_NPC)
            {
                Engine.Utility.Log.Error("NPC:CreateEntityView failed:{0}", GetName());
                return(false);
            }

            int     nID      = GetProp((int)EntityProp.BaseID);
            int     suitID   = GetProp((int)NPCProp.SuitID);
            int     masterID = GetProp((int)NPCProp.Masterid);
            int     type     = GetProp((int)NPCProp.MasterType);
            IEntity en       = EntityHelper.GetEntity((GameCmd.SceneEntryType)type, (uint)masterID);

            if (en != null)
            {
                if (EntityHelper.IsMainPlayer(en))
                {
                    m_isMySlave = true;
                }
            }
            string strResName = "";

            if (nID == 0)
            {
                // 则使用默认数据
                // strResName = data.strName;
            }
            else
            {
                var table_data = GameTableManager.Instance.GetTableItem <table.NpcDataBase>((uint)nID);
                if (table_data == null)
                {
                    Engine.Utility.Log.Error("不存在这个NPC: " + nID);
                    return(false);
                }
                m_bCanSelect = table_data.dwCanBeSelect == 1;
                if (m_Data.ViewList == null)
                {
                    uint modelID = table_data.dwModelSet;
                    if (suitID != 0)
                    {
                        table.SuitDataBase sdb = GameTableManager.Instance.GetTableItem <table.SuitDataBase>((uint)suitID, 1);
                        if (sdb != null)
                        {
                            if (sdb.resid != 0)
                            {
                                modelID = sdb.resid;
                            }
                        }
                    }
                    table.ResourceDataBase resDB = GameTableManager.Instance.GetTableItem <table.ResourceDataBase>(modelID);
                    if (resDB == null)
                    {
                        Engine.Utility.Log.Error("NPC:找不到NPC模型资源路径配置{0}", modelID);
                        return(false);
                    }
                    strResName = resDB.strPath;
                }
                else
                {
                    for (int i = 0; i < data.ViewList.Length; ++i)
                    {
                        if (data.ViewList[i] == null)
                        {
                            continue;
                        }

                        if (data.ViewList[i].nPos == (int)EquipPos.EquipPos_Body)
                        {
                            //if(data.ViewList[i].)
                            var suit_data = GameTableManager.Instance.GetTableItem <table.SuitDataBase>((uint)data.ViewList[i].value);
                            if (suit_data != null)
                            {
                                table.ResourceDataBase db = GameTableManager.Instance.GetTableItem <table.ResourceDataBase>(suit_data.resid);
                                if (db == null)
                                {
                                    Debug.LogError("ResourceDataBase is null bodypahtid is " + suit_data.resid + "  请检查resource 表格");
                                    return(false);
                                }
                                //string bodyPath = db.strPath;
                                //if (data.ViewList[i] != null)
                                //{
                                //    strResName = data.ViewList[i].value == 0 ? bodyPath : EntityHelper.GetModelPath((uint)data.ViewList[i].value, (Cmd.enmCharSex)GetProp((int)PlayerProp.Sex));
                                //}
                                strResName = db.strPath;
                            }
                            else
                            {
                                strResName = "";
                            }
                        }
                    }
                }

                // 技能形态
                m_Data.eSkillState = (SkillSettingState)GetProp((int)NPCProp.SkillStatus);

                if ((int)GameCmd.ArenaNpcType.ArenaNpcType_Player == GetProp((int)NPCProp.ArenaNpcType))
                {
                    SetName(m_Data.strName);
                }
                else
                {
                    if (string.IsNullOrEmpty(data.strName))
                    {
                        SetName(table_data.strName);
                    }
                    else
                    {
                        SetName(data.strName);
                    }
                }
                if (IsSummon())
                {
                    IEntitySystem es = EntitySystem.m_ClientGlobal.GetEntitySystem();
                    if (es != null)
                    {
                        IPlayer player = es.FindEntity <IPlayer>((uint)masterID);
                        if (player != null)
                        {
                            string playerName = player.GetName();
                            string summonName = GetName();
                            string tempName   = playerName + "的" + summonName;
                            SetName(tempName);
                        }
                    }
                }
            }

            // TODO: 根据配置表读取数据
            //if ( !m_EntityView.Create( ref strResName , OnCreateRenderObj ) )
            //{
            //    Engine.Utility.Log.Error( "CreateEntityView failed:{0}" , strResName );
            //}

            string strPath, strFileName, strExt, strFileNameNoExt;

            Engine.Utility.StringUtility.ParseFileName(ref strResName, out strPath, out strFileName, out strFileNameNoExt, out strExt);
            m_strObjName = strFileNameNoExt;

            // 功能NPC立即创建
            if (!IsMonster() && !IsPet() && !IsSummon())
            {
                m_Data.bImmediate = true;
            }

            if (m_Data.bImmediate)
            {
                // 立即创建
                if (!m_EntityView.Create(ref strResName, OnCreateRenderObj, false))
                {
                    Engine.Utility.Log.Error("CreateEntityView failed:{0}", strResName);
                }
            }
            else
            {
                EntityViewCreator.Instance.AddView(GetUID(), m_EntityView, ref strResName, OnCreateRenderObj);
            }


            return(false);
        }
示例#18
0
    void EventCallBack(int nEventID, object param)
    {
        if (nEventID == (int)GameEventID.ENTITYSYSTEM_PROPUPDATE)
        {
            Client.stPropUpdate prop = (Client.stPropUpdate)param;
            //传过来的是Long型参数ID  强制转换不知道会不会有问题
            IEntitySystem es = ClientGlobal.Instance().GetEntitySystem();
            if (es == null)
            {
                Engine.Utility.Log.Error("严重错误:EntitySystem is null!");
                return;
            }
            Client.IEntity entity = es.FindEntity(prop.uid);
            if (entity != null)
            {
                if (entity.GetEntityType() != EntityType.EntityType_Player)
                {
                    return;
                }
                if (m_currShowUID == entity.GetID())
                {
                    ShowByPlayer(entity as Client.IPlayer);
                }
            }
        }
        else if (nEventID == (int)GameEventID.TITLE_WEAR)
        {
            Client.stTitleWear data = (Client.stTitleWear)param;
            if (Client.ClientGlobal.Instance().IsMainPlayer(data.uid))
            {
                SetWearTitleItem(data.titleId);

                RefreshTitleGrids(data.titleId);
            }
        }
        else if (nEventID == (int)GameEventID.TITLE_ACTIVATE)
        {
            uint titleId = (uint)param;
            SetActivateTitleItem(titleId);
            RefreshTitleGrids(titleId);
        }
        else if (nEventID == (int)GameEventID.TITLE_TIMEOUT)
        {
            uint titleId = (uint)param;
            RefreshTitleGrids(titleId);
        }
        else if (nEventID == (int)GameEventID.TITLE_NEWTITLE)
        {
            uint titleId = (uint)param;
            CreateTopTabs();
            RefreshTitleGrids(titleId);
        }
        else if (nEventID == (int)GameEventID.TITLE_DELETE)
        {
            uint titleId = (uint)param;
            CreateTopTabs();
            if (m_lstTitleData.Exists((data) => { return(data == titleId ? true : false); }))
            {
                RefreshTitleGrids(titleId);
                //InitTitleGridListUI();
            }
        }
        else if (nEventID == (int)GameEventID.TITLE_USETIMES)
        {
            uint titleId = (uint)param;
            //刷新界面使用次数
            UpdateUseTimes(titleId);
            //刷新左侧的grid  (次数为0,取消佩戴激活)
            RefreshTitleGrids(titleId);
        }
    }
示例#19
0
        void OnEvent(int nEventID, object param)
        {
            if (m_ClientGlobal == null)
            {
                return;
            }

            IEntitySystem es = m_ClientGlobal.GetEntitySystem();

            if (es == null)
            {
                return;
            }

            GameEventID evt = (GameEventID)nEventID;
            long        uid = 0;

            switch (evt)
            {
            case GameEventID.ENTITYSYSTEM_ENTITYMOVE:
            {
                stEntityMove move = (stEntityMove)param;
                uid = move.uid;
                break;
            }

            case GameEventID.ENTITYSYSTEM_ENTITYSTOPMOVE:
            {
                stEntityStopMove move = (stEntityStopMove)param;
                uid = move.uid;
                break;
            }

            case GameEventID.SYSTEM_GAME_READY:
            {
                PreLoadAllResource();
                break;
            }

            default:
            {
                break;
            }
            }

            IEntity en = es.FindEntity(uid);

            if (en != null && en.GetEntityType() == EntityType.EntityType_Player)
            {
                Vector3     pos  = en.GetPos();
                MapAreaType type = GetAreaTypeByPos(pos);
                if (m_eMapAreaType != type)
                {
                    stEntityChangeArea changeArea = new stEntityChangeArea();
                    changeArea.uid   = uid;
                    changeArea.eType = type;
                    m_eMapAreaType   = type;
                    Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_CHANGEAREA, changeArea);
                }
            }
        }
示例#20
0
    void UpdateTargetStatus(long npcid, uint teamid, uint ownerid, uint clanid, string ownerName)
    {
        IEntitySystem es = ClientGlobal.Instance().GetEntitySystem();

        if (es == null)
        {
            Engine.Utility.Log.Error("IEntitySystem is null--");
            return;
        }
        INPC npc = es.FindEntity(npcid) as INPC;

        if (npc == null)
        {
            Engine.Utility.Log.Error("npc is null--{0}", npcid);
            return;
        }

        if (m_nLastNpcId != 0 && m_nLastNpcId != npcid)
        {
            return;
        }
        bool showPackage = npc.IsBoss();

        m_toggle_packageState.gameObject.SetActive(showPackage);
        string text     = "";
        bool   belongMe = false;



        if (teamid != 0)
        {
            if (DataManager.Manager <TeamDataManager>().TeamId == teamid)
            {
                belongMe = true;
            }
            else
            {
                belongMe = false;
            }
            text = string.Format("{0}的队伍", ownerName);
        }
        else if (clanid != 0)
        {
            DataManager.Manager <ClanManger>().GetClanName(clanid, (namedata) =>
            {
                if (DataManager.Manager <ClanManger>().ClanId == clanid)
                {
                    belongMe = true;
                }
                else
                {
                    belongMe = false;
                }
                text = string.Format("{0}氏族", namedata.ClanName);
            });
        }
        else
        {
            belongMe = MainPlayerHelper.GetPlayerID() == ownerid;
            text     = ownerName;
        }
        //Engine.Utility.Log.Error("ownerid:" + ownerid
        //               + "---text:" + text
        //               + "---teamid:" + teamid
        //               + "---clanid:" + clanid);


        m_label_TeamLeaderName.text = text;
        m_toggle_packageState.value = belongMe;
    }
示例#21
0
    public void PrepareUseSkill(GameCmd.stPrepareUseSkillSkillUserCmd_S cmd)
    {
        EntityType type      = EntitySystem.EntityHelper.GetEntityEtype(cmd.usertype);
        ISkillPart skillPart = SkillHelper.GetSkillPart(cmd.userid, type);

        if (skillPart == null)
        {
            Engine.Utility.Log.Error("获取技能部件失败!" + cmd.userid + " type is " + Enum.GetName(typeof(EntityType), type));
            return;
        }
        if (cmd.level == 0)
        {
            cmd.level = 1;
        }
        SkillDatabase database = GameTableManager.Instance.GetTableItem <table.SkillDatabase>(cmd.skillid, (int)cmd.level);

        if (database == null)
        {
            Engine.Utility.Log.Error(" skill database is null skillid is " + cmd.skillid.ToString() + " level is " + cmd.level.ToString());
            return;
        }
        skillPart.OnPrepareUseSkill(cmd);


        if (type == EntityType.EntityType_Player)
        {
            uint time = (database.dwReadTime);
            if (time > 0)
            {
                TimerAxis.Instance().SetTimer(m_uReadSliderTimerID, time, this, 1);
            }
        }
        else if (type == EntityType.EntityType_NPC)
        {
            IEntitySystem es = ClientGlobal.Instance().GetEntitySystem();
            if (es == null)
            {
                Engine.Utility.Log.Error("GetEntitySystem failed!");
                return;
            }

            INPC npc = es.FindEntity <INPC>(cmd.userid);
            if (npc != null)
            {
                int masterID = npc.GetProp((int)NPCProp.Masterid);
                if (masterID == MainPlayerHelper.GetPlayerID())
                {
                    SkillDatabase db = GameTableManager.Instance.GetTableItem <SkillDatabase>((uint)cmd.skillid);
                    if (db != null)
                    {
                        if (db.petType == 1 || db.petType == 2)
                        {
                            Client.stSkillCDChange st = new Client.stSkillCDChange();
                            st.skillid = (uint)cmd.skillid;
                            st.cd      = -1;
                            Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.SKILLCD_BEGIN, st);
                            TipsManager.Instance.ShowTips(npc.GetName() + CommonData.GetLocalString("使用") + db.strName);
                        }
                    }
                }
            }
        }
    }