private void OnEnable() { //initialization this.levelHierarchyConfiguration = AssetFinder.SafeSingleAssetFind <LevelHierarchyConfiguration>("t:" + typeof(LevelHierarchyConfiguration).Name); this.levelZonesSceneConfiguration = AssetFinder.SafeSingleAssetFind <LevelZonesSceneConfiguration>("t:" + typeof(LevelZonesSceneConfiguration).Name); this.chunkZonesSceneConfiguration = AssetFinder.SafeSingleAssetFind <ChunkZonesSceneConfiguration>("t:" + typeof(ChunkZonesSceneConfiguration).Name); //END var root = this.rootVisualElement; var searchBar = new ToolbarSearchField(); searchBar.style.height = 15; searchBar.style.justifyContent = Justify.Center; searchBar.RegisterValueChangedCallback(this.OnSearchChange); searchBar.focusable = true; searchBar.Focus(); root.Add(searchBar); var scrollView = new ScrollView(ScrollViewMode.Vertical); root.Add(scrollView); var boundingBox = new Box(); scrollView.Add(boundingBox); //HEADER Layout_HeadderLine(boundingBox, VisualElementWithStyle(new Label("Scene path"), HeaderLabelStyle()), VisualElementWithStyle(new Label("Scene ref"), HeaderLabelStyle())); //CONTENT this.DoDisplayLevels(boundingBox); }
public bool GetValue() { if (EditorPersistantBoolDatabase == null) { EditorPersistantBoolDatabase = AssetFinder.SafeSingleAssetFind <EditorPersistantBoolDatabase>("t:" + typeof(EditorPersistantBoolDatabase)); } return(EditorPersistantBoolDatabase.Get(key)); }
public void Refresh() { var fields = this.gameConfiguration.GetType().GetFields(); foreach (var field in fields) { field.SetValue(this.gameConfiguration, AssetFinder.SafeSingleAssetFind <UnityEngine.Object>("t:" + field.FieldType.Name)); } EditorUtility.SetDirty(this.gameConfiguration); }
public void OnGUI() { this.editorProfile = (T)EditorGUILayout.ObjectField(this.editorProfile, typeof(T), false); if (this.editorProfile == null) { this.editorProfile = AssetFinder.SafeSingleAssetFind <T>("t:" + typeof(T).Name); } if (this.editorProfile != null) { EditorGUILayout.BeginHorizontal(); if (GUILayout.Button(new GUIContent("R", "Reset creation wzard."), EditorStyles.miniButtonLeft, GUILayout.Width(20))) { this.editorProfile.ResetEditor(); } if (GUILayout.Button(new GUIContent(".", "Collapse all."), EditorStyles.miniButtonMid, GUILayout.Width(20))) { this.editorProfile.ColapseAll(); } if (GUILayout.Button(new GUIContent("*", "Create all."), EditorStyles.miniButtonMid, GUILayout.Width(20))) { this.editorProfile.CreateAll(); } EditorGUILayout.EndHorizontal(); editorProfile.WizardScrollPosition = EditorGUILayout.BeginScrollView(editorProfile.WizardScrollPosition); this.OnWizardGUI(); if (GUILayout.Button("GENERATE")) { if (this.editorProfile.ContainsError()) { if (EditorUtility.DisplayDialog("Proceed generation ?", "There are errors. Do you want to proceed generation ?", "YES", "NO")) { DoGeneration(); } } else if (this.editorProfile.ContainsWarn()) { if (EditorUtility.DisplayDialog("Proceed generation ?", "There are warnings. Do you want to proceed generation ?", "YES", "NO")) { DoGeneration(); } } else { DoGeneration(); } } this.DoGenereatedObject(); EditorGUILayout.EndScrollView(); } }
public static void ConvertToToon() { foreach (var selectedObject in Selection.objects) { if (selectedObject is Material selectedMaterial) { selectedMaterial.shader = Shader.Find("Unlit/ToonShader"); selectedMaterial.SetColor("_BaseColor", Color.white); selectedMaterial.SetTexture("_DiffuseRamp", AssetFinder.SafeSingleAssetFind <Texture2D>("ToonRamp")); } } }
public static GameCreationWizard InitWithSelected(string key) { var window = EditorWindow.GetWindow <GameCreationWizard>(); window.Show(); if (window.playerActionCreationWizardEditorProfile == null) { window.playerActionCreationWizardEditorProfile = AssetFinder.SafeSingleAssetFind <GameCreationWizardEditorProfile>("t:" + typeof(GameCreationWizardEditorProfile).ToString()); if (window.playerActionCreationWizardEditorProfile != null) { window.playerActionCreationWizardEditorProfile.Init(() => { window.Repaint(); }); window.playerActionCreationWizardEditorProfile.SetSelectedKey(key); } } return(window); }
private void OnGUI() { this.playerActionCreationWizardEditorProfile = EditorGUILayout.ObjectField(this.playerActionCreationWizardEditorProfile, typeof(GameCreationWizardEditorProfile), false) as GameCreationWizardEditorProfile; if (this.playerActionCreationWizardEditorProfile == null) { this.playerActionCreationWizardEditorProfile = AssetFinder.SafeSingleAssetFind <GameCreationWizardEditorProfile>("t:" + typeof(GameCreationWizardEditorProfile).ToString()); } if (this.playerActionCreationWizardEditorProfile != null) { this.playerActionCreationWizardEditorProfile.GUITick(() => { Repaint(); }); ICreationWizardEditor selectedTab = this.playerActionCreationWizardEditorProfile.GetSelectedConf(); if (selectedTab != null) { selectedTab.OnGUI(); } } }
private void SceneLoadWithoutDuplicate(string sceneToLoadName) { var sceneNB = EditorSceneManager.sceneCount; bool load = true; for (var i = 0; i < sceneNB; i++) { if (EditorSceneManager.GetSceneAt(i).name == sceneToLoadName) { load = false; } } if (load) { var scene = AssetFinder.SafeSingleAssetFind <SceneAsset>(sceneToLoadName + " t:Scene"); EditorSceneManager.OpenScene(AssetDatabase.GetAssetPath(scene), OpenSceneMode.Additive); } }
public void SetValue(bool value) { if (EditorPersistantBoolDatabase == null) { EditorPersistantBoolDatabase = AssetFinder.SafeSingleAssetFind <EditorPersistantBoolDatabase>("t:" + typeof(EditorPersistantBoolDatabase)); EditorApplication.wantsToQuit += () => { EditorPersistantBoolDatabase.Clear(); return(true); }; } if ((!this.Value && value) || (this.Value && !value)) { EditorPersistantBoolDatabase.Persist(key, value); } this.Value = value; }
private void OnGUI() { GameConfigurationRefresherProfile = (GameConfigurationRefresherProfile)EditorGUILayout.ObjectField(GameConfigurationRefresherProfile, typeof(GameConfigurationRefresherProfile), false); if (GameConfigurationRefresherProfile == null) { GameConfigurationRefresherProfile = AssetFinder.SafeSingleAssetFind <GameConfigurationRefresherProfile>("t:" + typeof(GameConfigurationRefresherProfile).Name); } if (GameConfigurationRefresherProfile != null) { EditorGUILayout.Separator(); EditorGUILayout.LabelField("Found game configurations : "); if (foundGameConfigurations.Count == 0) { var childGameConfigurationTypes = TypeHelper.GetAllTypeAssignableFrom(typeof(GameConfiguration)); if (childGameConfigurationTypes != null) { foreach (var gameConfigurationType in childGameConfigurationTypes) { foundGameConfigurations.Add(new SingleGameConfiguration((GameConfiguration)AssetFinder.SafeSingleAssetFind <UnityEngine.Object>("t:" + gameConfigurationType.Name), GameConfigurationRefresherProfile)); } } } if (GUILayout.Button("REFRESH ALL")) { foreach (var gameConfiguration in foundGameConfigurations) { gameConfiguration.Refresh(); } } foreach (var gameConfiguration in foundGameConfigurations) { EditorGUILayout.BeginVertical(); gameConfiguration.OnGui(); EditorGUILayout.EndVertical(); EditorGUILayout.Separator(); } } }
public static void InitProperties(ref CommonGameConfigurations CommonGameConfigurations) { #region Puzzle Common Prefabs AssetFinder.SafeSingleAssetFind(ref CommonGameConfigurations.PuzzleLevelCommonPrefabs.GameManagerPersistanceInstance, "_GameManagers_Persistance_Instanciater"); AssetFinder.SafeSingleAssetFind(ref CommonGameConfigurations.PuzzleLevelCommonPrefabs.CorePuzzleSceneElements, "CorePuzzleSceneElements"); AssetFinder.SafeSingleAssetFind(ref CommonGameConfigurations.PuzzleLevelCommonPrefabs.BasePuzzleLevelDynamics, "BasePuzzleLevelDynamics"); AssetFinder.SafeSingleAssetFind(ref CommonGameConfigurations.PuzzleLevelCommonPrefabs.BaseLevelChunkPrefab, "BaseLevelprefab"); #endregion //TODO configuration initialization if (CommonGameConfigurations.Configurations.Count == 0) { foreach (var configurationType in TypeHelper.GetAllGameConfigurationTypes()) { CommonGameConfigurations.Configurations.Add(configurationType, (IConfigurationSerialization)AssetFinder.SafeAssetFind("t:" + configurationType.Name)[0]); } } }
private List <SceneAsset> RefreshScenesToLoad() { this.levelManager = GameObject.FindObjectOfType <LevelManager>(); if (levelManager == null) { Debug.LogError("No level manager found."); return(null); } else { this.levelHierarchyConfiguration = AssetFinder.SafeSingleAssetFind <LevelHierarchyConfiguration>("t:" + typeof(LevelHierarchyConfiguration).Name); this.chunkZonesConfiguration = AssetFinder.SafeSingleAssetFind <ChunkZonesSceneConfiguration>("t:" + typeof(ChunkZonesSceneConfiguration).Name); if (chunkZonesConfiguration == null) { Debug.LogError("The chunk zone configuration has not been found."); return(null); } } return(levelHierarchyConfiguration.GetLevelHierarchy(levelManager.GetCurrentLevel()).ConvertAll((chunkId) => { return chunkZonesConfiguration.ConfigurationInherentData[chunkId].scene; })); }
private void DoPasting() { EditorGUILayout.BeginVertical(); if (GUILayout.Button("PASTE")) { var sourceScene = AssetFinder.SafeSingleAssetFind <SceneAsset>(this.sourceScene.name + " t:Scene"); EditorSceneManager.OpenScene(AssetDatabase.GetAssetPath(sourceScene), OpenSceneMode.Single); this.sourceLightmapEditorSettingsWrapper = this.ExtractLightmapEditorSettingsFromActiveScene(); foreach (var targetScene in this.targetScenes) { var targetSceneLoaded = AssetFinder.SafeSingleAssetFind <SceneAsset>(targetScene.SceneAsset.name + " t:Scene"); EditorSceneManager.OpenScene(AssetDatabase.GetAssetPath(targetSceneLoaded), OpenSceneMode.Single); this.PasteLightMapEditorSettingsFromWrapper(this.sourceLightmapEditorSettingsWrapper); // EditorSceneManager.MarkSceneDirty() EditorSceneManager.MarkAllScenesDirty(); EditorSceneManager.SaveOpenScenes(); } } EditorGUILayout.EndVertical(); }
public override void OnEnabled() { levelConfiguration = AssetFinder.SafeSingleAssetFind <LevelConfiguration>("t:" + typeof(LevelConfiguration)); }