public void RemoveScene(int sceneId) { if (Scenes.ContainsKey(sceneId)) { Scenes.Remove(sceneId); } }
/// <summary> /// 指定した名前でシーンを追加する /// </summary> /// <param name="sceneName">シーンの名前</param> /// <param name="sceneInstance">対応するシーンのインスタンス</param> public static void AddScene(SceneName sceneName, IScene sceneInstance) { if (!Scenes.ContainsKey(sceneName)) { Scenes.Add(sceneName, sceneInstance); } }
/// <summary> /// 通过字符串,设置某个场景为活动场景 /// </summary> public static void SetActiveScene(string str) { if (Scenes.ContainsKey(str)) { ActiveScene = Scenes[str]; } }
private void RegisterGameSpecificPrefabs(Scene scene, LoadSceneMode mode) { if (Scenes.ContainsKey(scene.name)) { return; } Scenes.Add(scene.name, scene); var rgx = new Regex(@"(\(\d+\))$"); var objs = Resources.FindObjectsOfTypeAll <GameObject>() .Where( x => !rgx.IsMatch(x.name) && x.scene.name == null // prefabs don't get a reference to the scene ); // so that's how you identify them foreach (var o in objs) { if (GttodAssets.Instance.HasAsset(o.name)) { continue; } Log.Info($"Registering prefab: {o.name}"); GttodAssets.Instance.AddAsset(o); } if (PreviousCount != GttodAssets.Instance.TotalAssets) { GttodAssets.Instance.OnAssetsInitialized(scene); Log.Debug($"Discovered and registered {GttodAssets.Instance.TotalAssets} new prefabs from scene '{scene.name}'."); } PreviousCount = GttodAssets.Instance.TotalAssets; }
public void AddScene(string sceneName, GameScene scene) { if (!Scenes.ContainsKey(sceneName)) { Scenes.Add(sceneName, scene); } }
public GameScene GetScene(string sceneName) { if (Scenes.ContainsKey(sceneName)) { return(Scenes[sceneName]); } return(null); }
private void ShowPortAllocationsCommand(List <string> args, Common.CmdIO.TTY io, UUID limitedToScene) { var sb = new StringBuilder("TCP Ports:\n----------------------------------------------\n"); foreach (KeyValuePair <int, string> kvp in KnownTcpPorts) { sb.AppendFormat("{0}:\n- Port: {1}\n", kvp.Value, kvp.Key); } if (m_RegionStorage != null) { sb.Append("\nUDP Ports:\n----------------------------------------------\n"); foreach (RegionInfo region in m_RegionStorage.GetAllRegions()) { string status = Scenes.ContainsKey(region.ID) ? "online" : "offline"; sb.AppendFormat("Region \"{0}\" ({1})\n- Port: {2}\n- Status: ({3})\n", region.Name, region.ID, region.ServerPort, status); } } io.Write(sb.ToString()); }
private void LoadCurrentScene() { if (!(StaticControls.GetControlByName("SceneBox") is PictureBox sceneBox)) { throw new ApplicationException("Static control is missing"); } var sceneIndex = this.GetStateForCurrentStage(); if (!Scenes.ContainsKey(sceneIndex)) { throw new ApplicationException($"Scene index {sceneIndex} is invalid for scene {Name}"); } var currentScene = Scenes[sceneIndex]; currentScene.Load(); var image = currentScene.Data; sceneBox.Image = image; // TODO: Index should come from Player data's sceneStateDictionary }
/// <summary> /// Change the Scene in the SceneManager. /// </summary> /// <param name="sceneKey">Key of the scene</param> public void Change(string sceneKey) { if (this.IsLoading) { if (Scenes.ContainsKey(sceneKey)) { Scene scene; if (this.Scenes.TryGetValue(sceneKey, out scene)) { IsLoading = true; foreach (Shot shot in this.ShotManager.Shots) { shot.UnloadContent(); } this.ShotManager.Shots.Clear(); OnLoadStarted(scene.ShotTypes.Count, scene.IsHeavyLoad); List <Shot> shots = scene.GetShots(); this.Current = scene; Task.Factory.StartNew(() => Parallel.ForEach <Shot>(shots, shot => LoadAsync(shot))); } else { throw new DirectorEngineException(typeof(SceneManager).FullName, Pulsar.Resources.Exceptions.Director.SceneValueNotDefine); } } else { throw new DirectorEngineException(typeof(SceneManager).FullName, Pulsar.Resources.Exceptions.Director.SceneKeyNotDefine); } } else { throw new DirectorEngineException(typeof(SceneManager).FullName, Pulsar.Resources.Exceptions.Director.SceneManagerLoading); } }