private void ReDrawSCOEditors() { //Je regénère l'Editor du nouveau SCO et refres le lastSCO if (graphic_SCO != null) { graphic_SCOEditor = Editor.CreateEditor(graphic_SCO); } else { graphic_SCOEditor = Editor.CreateEditor(tempGraphic_SCO); } lastGraphic_SCO = graphic_SCO; if (Balancing_SCO != null) { Balancing_SCOEditor = Editor.CreateEditor(Balancing_SCO); } else { Balancing_SCOEditor = Editor.CreateEditor(tempBalancing_SCO); } lastBalancing_SCO = Balancing_SCO; if (sound_SCO != null) { sound_SCOEditor = Editor.CreateEditor(sound_SCO); } else { sound_SCOEditor = Editor.CreateEditor(tempSound_SCO); } lastSound_SCO = sound_SCO; }
private static void ReinitialisationTempSCO(Mode mode) { //Temp Creation #pragma warning disable switch (mode) { case Mode.Graphic: tempGraphic_SCO = ScriptableObject.CreateInstance <ArtTweekScriptableObject>(); break; case Mode.Balancing: tempBalancing_SCO = ScriptableObject.CreateInstance <GameplayTweekScriptableObject>(); break; case Mode.Audio: tempSound_SCO = ScriptableObject.CreateInstance <SoundTweekScriptableObject>(); break; default: break; } #pragma warning restore //Graphic Editor regenerate switch (mode) { case Mode.Graphic: if (graphic_SCO != null) { graphic_SCOEditor = Editor.CreateEditor(graphic_SCO); } else { graphic_SCOEditor = Editor.CreateEditor(ScriptableObject.CreateInstance <ArtTweekScriptableObject>()); } break; case Mode.Balancing: if (Balancing_SCO != null) { Balancing_SCOEditor = Editor.CreateEditor(Balancing_SCO); } else { Balancing_SCOEditor = Editor.CreateEditor(ScriptableObject.CreateInstance <GameplayTweekScriptableObject>()); } break; case Mode.Audio: if (sound_SCO != null) { sound_SCOEditor = Editor.CreateEditor(sound_SCO); } else { sound_SCOEditor = Editor.CreateEditor(ScriptableObject.CreateInstance <SoundTweekScriptableObject>()); } break; default: break; } }
private void OnGUI() { //Si je perd la référence (SCO supprimé) if (graphic_SCO == null || Balancing_SCO == null || sound_SCO == null) { graphic_SCO = tempGraphic_SCO; Balancing_SCO = tempBalancing_SCO; sound_SCO = tempSound_SCO; } //Si la valeur Change if (lastGraphic_SCO != graphic_SCO || lastBalancing_SCO != Balancing_SCO || lastSound_SCO != sound_SCO) { ReDrawSCOEditors(); } //ReCalcSCO on Projet using (new GUILayout.VerticalScope(EditorStyles.helpBox)) { float _minWidth = 90; float _height = 30; //All SCO Rebuild if (GUILayout.Button("Rebuild All SCO for Project", GUILayout.MinWidth(_minWidth * 3), GUILayout.Height(_height))) { isCompilling = true; TweekCore.LaunchScoUpdate(TweekCore.ScoUpdateMode.Global); } using (new GUILayout.HorizontalScope()) { //Graphic SCO Rebuild if (GUILayout.Button("Rebuild only Graphic", GUILayout.MinWidth(_minWidth), GUILayout.Height(_height))) { isCompilling = true; TweekCore.LaunchScoUpdate(TweekCore.ScoUpdateMode.Art); } //Balancing SCO Rebuild if (GUILayout.Button("Rebuild only Balancing", GUILayout.MinWidth(_minWidth), GUILayout.Height(_height))) { isCompilling = true; TweekCore.LaunchScoUpdate(TweekCore.ScoUpdateMode.Gameplay); } //Sound SCO Rebuild if (GUILayout.Button("Rebuild only Sound", GUILayout.MinWidth(_minWidth), GUILayout.Height(_height))) { isCompilling = true; TweekCore.LaunchScoUpdate(TweekCore.ScoUpdateMode.Sound); } } } //Zone Input du SCO à edit using (new GUILayout.VerticalScope(EditorStyles.helpBox)) { float _width = 140; //Graphic Emplacement using (new GUILayout.HorizontalScope()) { //Nom GUILayout.Label("graphic_SCO", actualMode == Mode.Graphic ? EditorStyles.boldLabel : EditorStyles.label, GUILayout.Width(_width)); //Scriptable Object graphic_SCO = (ArtTweekScriptableObject)EditorGUILayout.ObjectField(graphic_SCO, typeof(ArtTweekScriptableObject), false); //Button New SCO if (GUILayout.Button("New", GUILayout.Width(60))) { GenerateNewSco <ArtTweekScriptableObject>(tempGraphic_SCO, Mode.Graphic); } } //Balancing Emplacement using (new GUILayout.HorizontalScope()) { //Nom GUILayout.Label("Balancing_SCO", actualMode == Mode.Balancing ? EditorStyles.boldLabel : EditorStyles.label, GUILayout.Width(_width)); //Scriptable Object Balancing_SCO = (GameplayTweekScriptableObject)EditorGUILayout.ObjectField(Balancing_SCO, typeof(GameplayTweekScriptableObject), false); //Button New SCO if (GUILayout.Button("New", GUILayout.Width(60))) { GenerateNewSco <GameplayTweekScriptableObject>(tempBalancing_SCO, Mode.Balancing); } } //Sound Emplacement using (new GUILayout.HorizontalScope()) { //Nom GUILayout.Label("sound_SCO", actualMode == Mode.Audio ? EditorStyles.boldLabel : EditorStyles.label, GUILayout.Width(_width)); //Scriptable Object sound_SCO = (SoundTweekScriptableObject)EditorGUILayout.ObjectField(sound_SCO, typeof(SoundTweekScriptableObject), false); //Button New SCO if (GUILayout.Button("New", GUILayout.Width(60))) { GenerateNewSco <SoundTweekScriptableObject>(tempSound_SCO, Mode.Audio); } } } GUILayout.Space(10); GUILayout.Label("Mode"); using (new GUILayout.HorizontalScope()) { ModeButton("Graphic", Mode.Graphic); ModeButton("Equilibrage", Mode.Balancing); ModeButton("Sound", Mode.Audio); } //Debug show in what mode i am GUILayout.Label(actualMode.ToString(), EditorStyles.helpBox); //Draw SCO Information if (!isCompilling) { //Draw SCO Information using (var scrollViewScope = new GUILayout.ScrollViewScope(scrollPosition, EditorStyles.helpBox)) { scrollPosition = scrollViewScope.scrollPosition; switch (actualMode) { case Mode.None: GUILayout.Label("Select a mode"); break; case Mode.Graphic: graphic_SCOEditor.OnInspectorGUI(); break; case Mode.Balancing: Balancing_SCOEditor.OnInspectorGUI(); break; case Mode.Audio: sound_SCOEditor.OnInspectorGUI(); break; default: GUILayout.TextField("!!!Error!!!"); break; } } } else { actualMode = Mode.None; GUILayout.Label("The Scriptables Objects are compilling, please wait"); GUILayout.Space(20); GUILayout.Label("Fun Fact : " + "\n Arthur essaie de vous divertir en attendant de pouvoir travailler" + "\n " + "\n J'espère que ça ne va pas être le giga rush en fin de projet, " + "\n si c'est le cas... bah RIP" + "\n TRAVAIL PLUS VITE !!!" + "\n " + "\n Nan je déconne, faut attendre que ça recompille" + "\n " + "\n Imagine une petite musique d'ascenseur "); } GUILayout.FlexibleSpace(); GUILayout.Space(20); if (GUILayout.Button("ApplyValue", GUILayout.Height(30))) { ApplyValues(); } }