Exemple #1
0
    /// <summary>
    /// 全局UI事件处理器
    /// </summary>
    /// <param name="eventType"></param>
    /// <param name="data"></param>
    public void GlobalEventHandler(int eventType, object data)
    {
        switch (eventType)
        {
        case (int)Client.GameEventID.SYSTEM_LOADSCENECOMPELETE:
        {
            Client.stLoadSceneComplete loadScene = (Client.stLoadSceneComplete)data;
            if (loadScene.nMapID == 159)
            {
                DataManager.Manager <UIPanelManager>().ShowPanel(PanelID.CampFightingPanel);
            }
        }
        break;

        case (int)Client.GameEventID.ENTITYSYSTEM_LEVELUP:
        {
            CaculateCampSectionIndex();
        }
        break;

        case (int)Client.GameEventID.ENTITYSYSTEM_CREATEENTITY:
        {
            //             if (isEnterScene == false)
            //             {
            //                 return;
            //             }

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

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

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

            int npcBaseId = npc.GetProp((int)Client.EntityProp.BaseID);
            //采集物
            table.NpcDataBase npctable = GameTableManager.Instance.GetTableItem <table.NpcDataBase>((uint)npcBaseId);
            if (npctable != null && npctable.dwType == (uint)GameCmd.enumNpcType.NPC_TYPE_COLLECT_PLANT)        //采集物
            {
                GameCmd.eCamp camp = (GameCmd.eCamp)npc.GetProp((int)Client.CreatureProp.Camp);
                if (m_CampCombatResultInfo != null && m_CampCombatResultInfo.m_MyCampCombatInfo.camp != camp)
                {
                    CampNpcOnTrigger callback = new CampNpcOnTrigger();
                    npc.SetCallback(callback);
                }
            }
        }
        break;
        }
    }
Exemple #2
0
    public void OnEvent(int nEventId, object param)
    {
        if (nEventId == (int)Client.GameEventID.ENTITYSYSTEM_CREATEENTITY)
        {
            Client.stCreateEntity createEntity = (Client.stCreateEntity)param;
            Client.IEntitySystem  es           = Client.ClientGlobal.Instance().GetEntitySystem();
            if (es == null)
            {
                Engine.Utility.Log.Error("严重错误:EntitySystem is null!");
                return;
            }

            Client.IEntity en = es.FindEntity(createEntity.uid);
            if (en != null && en is Client.INPC)
            {
                List <QuestTraceInfo> traceTask;
                DataManager.Manager <TaskDataManager>().GetAllQuestTraceInfo(out traceTask);
                int         index;
                Client.INPC npc = en as Client.INPC;
                if (IsNeedSetTip(npc, ref traceTask, out index))
                {
                    SetNpcTipsByTraceInfo(traceTask[index]);
                }
            }
        }
        else if (nEventId == (int)Client.GameEventID.ENTITYSYSTEM_REMOVEENTITY)
        {
            Client.stRemoveEntity removeEntiy = (Client.stRemoveEntity)param;
            Client.IEntitySystem  es          = Client.ClientGlobal.Instance().GetEntitySystem();
            if (es == null)
            {
                Engine.Utility.Log.Error("严重错误:EntitySystem is null!");
                return;
            }

            Client.IEntity en = es.FindEntity(removeEntiy.uid);
            if (en != null && en is Client.INPC)
            {
                Client.INPC npc = en as Client.INPC;
                DeleteEffectByNpc(npc);
            }
        }
        else if (nEventId == (int)Client.GameEventID.TASK_ACCEPT)
        {
            uint taskId = (uint)param;
            SetNpcTipsByTaskID(taskId, true);
        }
        else if (nEventId == (int)Client.GameEventID.TASK_DELETE)
        {
            uint taskId = (uint)param;
            DeleteEffectByTaskID(taskId);
        }
        else if (nEventId == (int)Client.GameEventID.TASK_DONE)
        {
            Client.stTaskDone td = (Client.stTaskDone)param;
            DeleteEffectByTaskID(td.taskid);
        }
        else if (nEventId == (int)Client.GameEventID.TASK_CANSUBMIT)
        {
            Client.stTaskCanSubmit tcs = (Client.stTaskCanSubmit)param;
            SetNpcTipsByTaskID(tcs.taskid, false);
        }
        else if (nEventId == (int)Client.GameEventID.SYSTEM_GAME_READY)
        {
            RefreshAllNpcTips();
        }
        else if (nEventId == (int)Client.GameEventID.TASK_CANACCEPT)
        {
            uint taskId = (uint)param;
            SetNpcTipsByTaskID(taskId, false);
        }
    }