public override void OnInspectorGUI() { DrawDefaultInspector(); SE_SkillControl myScript = (SE_SkillControl)target; if (GUILayout.Button("Open Editor")) { SE_SkillEditorWindow window = EditorWindow.GetWindow(typeof(SE_SkillEditorWindow), false) as SE_SkillEditorWindow; window.SetTarget(myScript); } if (GUILayout.Button("Restart All Emitters")) { myScript.RestartAllEmitters(); } var centeredStyle = new GUIStyle(EditorStyles.boldLabel); centeredStyle.alignment = TextAnchor.UpperCenter; GUILayout.Label("Save Load", centeredStyle); if (GUILayout.Button("Save To Asset File")) { SE_SkillUtils.SaveSkillControlToScriptableObject(myScript); } if (GUILayout.Button("Load Asset File")) { SE_SkillUtils.LoadSkillControlFromScriptableObject(myScript); } }
public override void UpdateView(Rect editorRect, Rect percentageRect, Event e, SE_SkillControl curSkillControl, SE_SkillUIEditorSetting editorSetting) { base.UpdateView(editorRect, percentageRect, e, curSkillControl, editorSetting); GUI.Box(viewRect, viewTitle, viewSkin.GetStyle("PropertyViewBG")); GUILayout.BeginArea(viewRect); GUILayout.BeginHorizontal(); if (curSkillControl != null) { bool showProperty = curSkillControl.showProperties; if (!showProperty) { //EditorGUILayout.LabelField("None"); } else { GUILayout.BeginVertical(); curSkillControl.DrawnNodeProperties(inspectorSkin); GUILayout.EndVertical(); } } GUILayout.EndHorizontal(); GUILayout.EndArea(); ProcessEvents(e); }
public static void LoadSkillControlFromScriptableObject(SE_SkillControl skillControl) { string path = EditorUtility.OpenFilePanel("Overwrite Skill Control From Asset File", "", "asset"); path = path.Replace(Application.dataPath, "Assets"); SE_SaveObject loadObj = AssetDatabase.LoadAssetAtPath <SE_SaveObject>(path); skillControl.gameObject.name = loadObj.skillControlName; }
public static void SaveSkillControlToScriptableObject(SE_SkillControl skillControl) { ScriptableObjectUtility.CreateAsset <SE_SaveObject>( "Save Skill Control To Asset File", skillControl.gameObject.name, (obj) => { obj.skillControlName = skillControl.gameObject.name; }); }
public virtual void UpdateView(Rect editorRect, Rect percentageRect, Event e, SE_SkillControl curSkillControl, SE_SkillUIEditorSetting editorSetting) { this.skillControl = curSkillControl; viewTitle = curSkillControl != null ? curSkillControl.skillName : "No Graph"; //Update View Rectangle viewRect = new Rect(editorRect.x * percentageRect.x, editorRect.y * percentageRect.y, editorRect.width * percentageRect.width, editorRect.height * percentageRect.height); }
public override void UpdateView(Rect editorRect, Rect percentageRect, Event e, SE_SkillControl curSkillControl, SE_SkillUIEditorSetting editorSetting) { base.UpdateView(editorRect, percentageRect, e, curSkillControl, editorSetting); GUI.Box(viewRect, viewTitle, viewSkin.GetStyle("ViewBG")); //draw grid SE_SkillUtils.DrawGrid(viewRect, 60f, .15f, Color.white, offset); SE_SkillUtils.DrawGrid(viewRect, 20f, .05f, Color.white, offset); GUILayout.BeginArea(viewRect); if (curSkillControl != null) { curSkillControl.UpdateEditorGUI(e, viewRect, offset, viewSkin, editorSetting); } GUILayout.EndArea(); ProcessEvents(e); }
public void SetTarget(SE_SkillControl target) { this.curSkillControl = target; RefreshEditor(); }