private void LoadObjects() { LogSys.Log(LOG_TYPE.DEBUG, "Scene {0} start Running.", m_SceneResId); m_GameTime.Start(); m_SceneContext.StartTime = m_GameTime.StartTime; for (int campId = (int)CampIdEnum.Friendly; campId <= (int)CampIdEnum.Red; ++campId) { int key = this.SceneResId * 10 + campId; List <TableConfig.LevelMonster> monsters; if (TableConfig.LevelMonsterProvider.Instance.TryGetValue(key, out monsters)) { for (int i = 0; i < monsters.Count; ++i) { TableConfig.LevelMonster monster = monsters[i]; if (null != monster) { TableConfig.Actor actor = TableConfig.ActorProvider.Instance.GetActor(monster.actorID); if (null != actor) { int unitId = campId * 10000 + i; EntityInfo npc = EntityManager.AddEntity(unitId, campId, actor, (int)AiStateLogicId.Entity_General); if (null != npc) { npc.IsPassive = monster.passive; npc.LevelMonsterData = monster; npc.SetLevel(monster.level); npc.GetMovementStateInfo().SetPosition2D(monster.x, monster.y); npc.GetMovementStateInfo().SetFaceDir(Geometry.DegreeToRadian(monster.dir)); } } } } } } ServerStorySystem.ThreadInitMask(); m_StorySystem.ClearStoryInstancePool(); m_StorySystem.PreloadSceneStories(); m_StorySystem.StartStory("local_main"); m_StorySystem.StartStory("story_main"); }
internal void ReloadObjects() { if (m_PreparedReloadMonsterCount > 0) { for (int i = 0; i < m_PreparedReloadMonsterCount; ++i) { TableConfig.LevelMonster monster = m_PreparedReloadMonsters[i]; if (null != monster) { int campId = monster.camp; TableConfig.Actor actor = TableConfig.ActorProvider.Instance.GetActor(monster.actorID); if (null != actor) { int unitId = campId * 10000 + i; EntityInfo npc = EntityManager.AddEntity(unitId, campId, actor, (int)AiStateLogicId.Entity_General); if (null != npc) { npc.IsPassive = monster.passive; npc.LevelMonsterData = monster; npc.SetLevel(monster.level); npc.GetMovementStateInfo().SetPosition2D(monster.x, monster.y); npc.GetMovementStateInfo().SetFaceDir(monster.dir); Msg_RC_CreateNpc msg = DataSyncUtility.BuildCreateNpcMessage(npc); NotifyAllUser(RoomMessageDefine.Msg_RC_CreateNpc, msg); Msg_RC_SyncProperty msg2 = DataSyncUtility.BuildSyncPropertyMessage(npc); NotifyAllUser(RoomMessageDefine.Msg_RC_SyncProperty, msg2); } } } } m_PreparedReloadMonsterCount = 0; } while (m_ReloadMonstersQueue.Count > 0 && m_PreparedReloadMonsterCount < c_MaxReloadMonsterNum) { m_PreparedReloadMonsters[m_PreparedReloadMonsterCount++] = m_ReloadMonstersQueue.Dequeue(); } }