コード例 #1
0
    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);
        }
    }
コード例 #2
0
    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);
    }
コード例 #3
0
    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;
    }
コード例 #4
0
 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;
     });
 }
コード例 #5
0
    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);
    }
コード例 #6
0
    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);
    }
コード例 #7
0
 public void SetTarget(SE_SkillControl target)
 {
     this.curSkillControl = target;
     RefreshEditor();
 }