public void InitEditorData(int instanceIndex) { if (this.GameDesignerEditorProfile == null) { var GameDesignerEditorProfiles = AssetFinder.SafeAssetFind <GameDesignerEditorProfile>("t:" + typeof(GameDesignerEditorProfile).Name); foreach (var GameDesignerEditorProfile in GameDesignerEditorProfiles) { if (GameDesignerEditorProfile.GameDesignerProfileInstanceIndex == instanceIndex) { this.GameDesignerEditorProfile = GameDesignerEditorProfile; break; } } if (this.GameDesignerEditorProfile == null) { var CreatedGameDesignerEditorProfile = (GameDesignerEditorProfile)GameDesignerEditorProfile.CreateInstance(typeof(GameDesignerEditorProfile)); CreatedGameDesignerEditorProfile.GameDesignerProfileInstanceIndex = instanceIndex; AssetDatabase.CreateAsset(CreatedGameDesignerEditorProfile, GameDesignerProfilePath + "/GameDesignerEditorProfile_" + instanceIndex + ".asset"); this.GameDesignerEditorProfile = CreatedGameDesignerEditorProfile; } } if (this.GameDesignerEditorProfile != null) { if (this.ChoiceTree == null) { this.ChoiceTree = new GameDesignerChoiceTree(this.GameDesignerEditorProfile); } } }
private void OnGUI() { if (this.GameDesignerEditorProfile != null) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.BeginVertical(GUILayout.Width(200f)); if (this.ChoiceTree == null) { this.ChoiceTree = new GameDesignerChoiceTree(this.GameDesignerEditorProfile); } if (this.ChoiceTree != null) { this.ChoiceTree.GUITick(() => { this.Repaint(); }); } EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical(); if (this.GameDesignerEditorProfile.CurrentGameDesignerModule != null) { this.GameDesignerEditorProfile.ScrollPosition = EditorGUILayout.BeginScrollView(this.GameDesignerEditorProfile.ScrollPosition); this.GameDesignerEditorProfile.CurrentGameDesignerModule.GUITick(ref this.GameDesignerEditorProfile); EditorGUILayout.EndScrollView(); } EditorGUILayout.EndVertical(); EditorGUILayout.EndHorizontal(); } EditorGUILayout.ObjectField(this.GameDesignerEditorProfile, typeof(UnityEngine.Object), false); if (GUI.changed) { this.Repaint(); } }