Пример #1
0
 internal void ReloadObjects()
 {
     if (null != m_MapData)
     {
         //刷新场景逻辑
         foreach (SceneLogicConfig cfg in m_MapData.m_SceneLogicMgr.GetData().Values)
         {
             SceneLogicInfo sli = m_SceneLogicInfoMgr.GetSceneLogicInfoByConfigId(cfg.GetId());
             if (null == sli)
             {
                 m_SceneLogicInfoMgr.AddSceneLogicInfo(cfg);
             }
         }
         //刷新npc
         foreach (Data_Unit unit in m_MapData.m_UnitMgr.GetData().Values)
         {
             if (unit.m_IsEnable)
             {
                 NpcInfo npc = m_NpcMgr.GetNpcInfoByUnitId(unit.GetId());
                 if (null == npc)
                 {
                     m_NpcMgr.AddNpc(unit);
                 }
             }
         }
     }
 }
Пример #2
0
 private void RecycleSceneLogicInfo(SceneLogicInfo logicInfo)
 {
     if (null != logicInfo && m_UnusedSceneLogicInfos.Count < m_SceneLogicInfoPoolSize)
     {
         logicInfo.Reset();
         m_UnusedSceneLogicInfos.Enqueue(logicInfo);
     }
 }
        internal void OnSceneLogicSendStoryMessage(SceneLogicInfo info, string msgId, object[] args)
        {
            Scene scene = info.SceneContext.CustomData as Scene;

            if (null != scene)
            {
                scene.StorySystem.SendMessage(msgId, args);
            }
        }
Пример #4
0
        public SceneLogicInfo AddSceneLogicInfo(int id, SceneLogicConfig cfg)
        {
            SceneLogicInfo info = NewSceneLogicInfo(id);

            info.SceneContext     = m_SceneContext;
            info.SceneLogicConfig = cfg;
            m_SceneLogicInfos.Add(info.GetId(), info);
            return(info);
        }
Пример #5
0
        public SceneLogicInfo DelayAddSceneLogicInfo(int id, SceneLogicConfig cfg)
        {
            SceneLogicInfo info = NewSceneLogicInfo(id);

            info.SceneContext     = m_SceneContext;
            info.SceneLogicConfig = cfg;
            m_DelayAdd.Add(info);
            return(info);
        }
Пример #6
0
        public SceneLogicInfo DelayAddSceneLogicInfo(int logicId)
        {
            SceneLogicInfo info = NewSceneLogicInfo();

            info.SceneContext               = m_SceneContext;
            info.SceneLogicConfig           = new SceneLogicConfig();
            info.SceneLogicConfig.m_LogicId = logicId;
            m_DelayAdd.Add(info);
            return(info);
        }
Пример #7
0
        public SceneLogicInfo AddSceneLogicInfo(int logicId)
        {
            SceneLogicInfo info = NewSceneLogicInfo();

            info.SceneContext               = m_SceneContext;
            info.SceneLogicConfig           = new SceneLogicConfig();
            info.SceneLogicConfig.m_LogicId = logicId;
            m_SceneLogicInfos.Add(info.GetId(), info);
            return(info);
        }
Пример #8
0
        public void RemoveSceneLogicInfo(int id)
        {
            SceneLogicInfo info = GetSceneLogicInfo(id);

            if (null != info)
            {
                m_SceneLogicInfos.Remove(id);
                info.SceneContext = null;
                RecycleSceneLogicInfo(info);
            }
        }
Пример #9
0
        public SceneLogicInfo AddSceneLogicInfo(int id, int logicId)
        {
            SceneLogicInfo info = NewSceneLogicInfo(id);

            info.SceneContext               = m_SceneContext;
            info.SceneLogicConfig           = new SceneLogicConfig();
            info.SceneLogicConfig.m_LogicId = logicId;
            if (m_SceneLogicInfos.Contains(id))
            {
                SceneLogicInfo oldInfo = GetSceneLogicInfo(id);
                LogSystem.Error("AddSceneLogicInfo error, Id={0} was exist, LogicId={1}, NewLogicId={2}", id, oldInfo.LogicId, logicId);
            }
            m_SceneLogicInfos.Add(info.GetId(), info);
            return(info);
        }
Пример #10
0
        public SceneLogicInfo GetSceneLogicInfoByConfigId(int id)
        {
            SceneLogicInfo ret = null;

            for (LinkedListNode <SceneLogicInfo> linkNode = m_SceneLogicInfos.FirstValue; null != linkNode; linkNode = linkNode.Next)
            {
                SceneLogicInfo info = linkNode.Value;
                if (info.ConfigId == id)
                {
                    ret = info;
                    break;
                }
            }
            return(ret);
        }
Пример #11
0
        private SceneLogicInfo NewSceneLogicInfo(int id)
        {
            SceneLogicInfo info = null;

            if (m_UnusedSceneLogicInfos.Count > 0)
            {
                info = m_UnusedSceneLogicInfos.Dequeue();
                info.Reset();
                info.InitId(id);
            }
            else
            {
                info = new SceneLogicInfo(id);
            }
            return(info);
        }
Пример #12
0
 public NpcInfo Boss(SceneLogicInfo info)
 {
     return(info.NpcManager.GetNpcInfo(BossId));
 }
Пример #13
0
 public NpcInfo ExplodeNpc(SceneLogicInfo info)
 {
     return(info.NpcManager.GetNpcInfo(npc_id_));
 }
Пример #14
0
 public NpcInfo Lair(SceneLogicInfo info)
 {
     return(info.NpcManager.GetNpcInfo(LairId));
 }