Beispiel #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;
        }
    }
Beispiel #2
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);
            //}
        }
    }
Beispiel #3
0
 void SetCampNpOnTrigger(GameCmd.eCamp mycamp)
 {
     Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem();
     if (es != null)
     {
         es.FindAllEntity <Client.INPC>(ref m_lstNpc);
         for (int i = 0; i < m_lstNpc.Count; i++)
         {
             Client.INPC   npc  = m_lstNpc[i];
             GameCmd.eCamp camp = (GameCmd.eCamp)npc.GetProp((int)Client.CreatureProp.Camp);
             if (mycamp != camp)
             {
                 CampNpcOnTrigger callback = new CampNpcOnTrigger();
                 npc.SetCallback(callback);
                 UnityEngine.Debug.Log("SetCallback : " + npc.GetName());
             }
         }
         m_lstNpc.Clear();
     }
 }