private void RemoveAdditiveScene(SceneProperty property, string sceneName) { if (LoadSubSceneDictionary.Keys.Contains(sceneName) == true) { GameObject go = LoadSubSceneDictionary [sceneName]; LoadSubSceneDictionary.Remove(sceneName); go.hideFlags = HideFlags.None; DestroyImmediate(go); } }
public override void OnInspectorGUI() { SceneProperty property = target as SceneProperty; AlwaysDestroy(property); EditorGUILayout.Space(); AddSubScene(property); if (Application.isPlaying == false && EditorApplication.isCompiling == false) { AdditiveScene(property); } }
public Move(GameObject player, CharacterProperty characterProperty, SceneProperty sceneProperty) { this.sceneProperty = sceneProperty; this.characterProperty = characterProperty; this.player = player; try { cc = player.transform.GetComponent <CharacterController>(); } catch { Debug.Log("未成功获取玩家控制器"); } }
private void AdditiveScene(SceneProperty property) { foreach (var subScene in property.listAddSubScene) { if (subScene.isVisible) { if (LoadSubSceneDictionary.Keys.Contains(subScene.sceneName) == false) { GameObject rootObject = LoadWithCollection(subScene.sceneName, subScene.sceneFullName); LoadSubSceneDictionary.Add(subScene.sceneName, rootObject); } } else { RemoveAdditiveScene(property, subScene.sceneName); } } }
void Awake() { Debug.Log("[Enviroment] Awake"); if (_Instance == null) _Instance = GetComponent<ConstantEnviroment>(); NetworkManager.Instance.Initialize(); PrefabInkBall = Resources.Load(InkBallName); PrefabSubInkBall = Resources.Load(InkSubBallName); PrefabInkScatter = Resources.Load(InkScatterName); PrefabPlayer = Resources.Load(PlayerName); WeaponTable = new WeaponTable(); Network = new NetworkProperty(); Group = new GroupProperty(); Scene = new SceneProperty(); #if STAGING Network = new StagingNetworkProperty(); #endif }
set => SetValue(SceneProperty, value);
/// <summary> /// 追加するサブシーン /// </summary> /// <param name="property">Property.</param> private void AddSubScene(SceneProperty property) { int currentSceneIndex = EditorApplication.currentScene.LastIndexOf("/"); string currentSceneName = EditorApplication.currentScene.Substring(currentSceneIndex + 1).Replace(".unity", ""); EditorGUILayout.LabelField("Add Sub Scene"); EditorGUILayout.BeginVertical("box"); EditorGUILayout.LabelField("SceneName", "isAdd, isVisible"); EditorGUILayout.BeginVertical("box"); foreach (var scene in EditorBuildSettings.scenes) { int lastIndex = scene.path.LastIndexOf("/"); string sceneName = scene.path.Substring(lastIndex + 1).Replace(".unity", ""); if (string.IsNullOrEmpty(sceneName) == true) { continue; } if (sceneName.Equals(currentSceneName) == true) { continue; } if (SceneManagerSettings.ListResidentSceneName.Contains(sceneName) == true) { continue; } EditorGUILayout.BeginHorizontal(); bool isContains = property.listAddSubScene.Any(x => x.sceneName == sceneName); if (EditorGUILayout.Toggle(sceneName, isContains) == true) { if (isContains == false) { property.listAddSubScene.Add(new SubSceneProperty(sceneName, true, scene.path)); } } else { SubSceneProperty subSceneProperty = property.listAddSubScene.FirstOrDefault(x => x.sceneName == sceneName); if (subSceneProperty != null) { property.listAddSubScene.Remove(subSceneProperty); RemoveAdditiveScene(property, sceneName); } } bool isVisible = false; if (isContains == true) { SubSceneProperty subSceneProperty = property.listAddSubScene.FirstOrDefault(x => x.sceneName == sceneName); if (subSceneProperty != null) { isVisible = subSceneProperty.isVisible; } } isVisible = EditorGUILayout.Toggle(isVisible); if (isContains == true) { SubSceneProperty subSceneProperty = property.listAddSubScene.FirstOrDefault(x => x.sceneName == sceneName); if (subSceneProperty != null) { subSceneProperty.isVisible = isVisible; } } EditorGUILayout.EndHorizontal(); } EditorGUILayout.EndVertical(); EditorGUILayout.EndVertical(); }
/// <summary> /// 遷移後の挙動 /// </summary> /// <param name="property">Property.</param> private void AlwaysDestroy(SceneProperty property) { property.isAlwaysDestroy = EditorGUILayout.Toggle("isAlwaysDestroy", property.isAlwaysDestroy); }
private void RemoveAdditiveScene(SceneProperty property, string sceneName) { if (LoadSubSceneDictionary.Keys.Contains (sceneName) == true) { GameObject go = LoadSubSceneDictionary [sceneName]; LoadSubSceneDictionary.Remove (sceneName); go.hideFlags = HideFlags.None; DestroyImmediate (go); } }
/// <summary> /// 遷移後の挙動 /// </summary> /// <param name="property">Property.</param> private void AlwaysDestroy(SceneProperty property) { property.isAlwaysDestroy = EditorGUILayout.Toggle ("isAlwaysDestroy", property.isAlwaysDestroy); }
/// <summary> /// 追加するサブシーン /// </summary> /// <param name="property">Property.</param> private void AddSubScene(SceneProperty property) { int currentSceneIndex = EditorApplication.currentScene.LastIndexOf ("/"); string currentSceneName = EditorApplication.currentScene.Substring (currentSceneIndex + 1).Replace (".unity", ""); EditorGUILayout.LabelField ("Add Sub Scene"); EditorGUILayout.BeginVertical ("box"); EditorGUILayout.LabelField ("SceneName", "isAdd, isVisible"); EditorGUILayout.BeginVertical ("box"); foreach (var scene in EditorBuildSettings.scenes) { int lastIndex = scene.path.LastIndexOf ("/"); string sceneName = scene.path.Substring (lastIndex + 1).Replace (".unity", ""); if (string.IsNullOrEmpty (sceneName) == true) continue; if (sceneName.Equals (currentSceneName) == true) continue; if (SceneManagerSettings.ListResidentSceneName.Contains (sceneName) == true) continue; EditorGUILayout.BeginHorizontal (); bool isContains = property.listAddSubScene.Any (x => x.sceneName == sceneName); if (EditorGUILayout.Toggle (sceneName, isContains) == true) { if (isContains == false) property.listAddSubScene.Add (new SubSceneProperty (sceneName, true, scene.path)); } else { SubSceneProperty subSceneProperty = property.listAddSubScene.FirstOrDefault (x => x.sceneName == sceneName); if (subSceneProperty != null) { property.listAddSubScene.Remove (subSceneProperty); RemoveAdditiveScene (property, sceneName); } } bool isVisible = false; if (isContains == true) { SubSceneProperty subSceneProperty = property.listAddSubScene.FirstOrDefault (x => x.sceneName == sceneName); if (subSceneProperty != null) isVisible = subSceneProperty.isVisible; } isVisible = EditorGUILayout.Toggle (isVisible); if (isContains == true) { SubSceneProperty subSceneProperty = property.listAddSubScene.FirstOrDefault (x => x.sceneName == sceneName); if (subSceneProperty != null) subSceneProperty.isVisible = isVisible; } EditorGUILayout.EndHorizontal (); } EditorGUILayout.EndVertical (); EditorGUILayout.EndVertical (); }
private void AdditiveScene(SceneProperty property) { foreach (var subScene in property.listAddSubScene) { if (subScene.isVisible) { if (LoadSubSceneDictionary.Keys.Contains (subScene.sceneName) == false) { GameObject rootObject = LoadWithCollection (subScene.sceneName, subScene.sceneFullName); LoadSubSceneDictionary.Add (subScene.sceneName, rootObject); } } else { RemoveAdditiveScene (property, subScene.sceneName); } } }
private void Awake() { sceneProperty = new MainSceneProperty(); SendScene(); }