protected override void UpdateName(string startName)
    {
        string generateTypeName = generateType.ToString();

        base.UpdateName(generateTypeName + " " + startName);
    }
Exemple #2
0
    private void OnGUI()
    {
        if (generateType == GenerateType.None)
        {
            InitPath();
        }

        #region Title
        //Title Label
        GUILayout.Space(20);
        GUIStyle centeredStyle = new GUIStyle(GUI.skin.GetStyle("Label"));
        centeredStyle.alignment = TextAnchor.UpperCenter;
        centeredStyle.fontSize  = 20;
        GUILayout.Label(new GUIContent("Select Excel Files To ScriptableObj"), centeredStyle);
        GUILayout.Space(20);
        #endregion

        GUILayout.BeginVertical();

        #region GenerateType
        //GenerateType
        GenerateType type = (GenerateType)EditorGUILayout.EnumPopup(new GUIContent("GenerateType", "Choose target type to generate for."), generateType);
        if (type != generateType)
        {
            generateType = type;
            PlayerPrefs.SetString("GenerateType", type.ToString());
        }
        #endregion

        GUILayout.Space(5);

        #region CSOutputPath
        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.BeginVertical();
        GUILayout.Space(5);
        //CS Output Path
        csOutPath = EditorGUILayout.TextField("CS Output Path:", csOutPath, GUILayout.MaxWidth(900));
        EditorGUILayout.EndVertical();
        //Browse "Output Path"
        GUILayout.FlexibleSpace();
        if (GUILayout.Button("Browse", GUILayout.MaxWidth(80)))
        {
            BrowseForFolder(ref csOutPath);
            PlayerPrefs.SetString("CSOutPath", csOutPath);
        }
        EditorGUILayout.EndHorizontal();
        #endregion


        GUILayout.Space(5);

        #region ObjOutputPath
        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.BeginVertical();
        GUILayout.Space(5);
        //Obj Output Path
        objOutPath = EditorGUILayout.TextField("Obj Output Path:", objOutPath, GUILayout.MaxWidth(900));
        EditorGUILayout.EndVertical();
        //Browse "Output Path"
        GUILayout.FlexibleSpace();
        if (GUILayout.Button("Browse", GUILayout.MaxWidth(80)))
        {
            BrowseForFolder(ref objOutPath);
            PlayerPrefs.SetString("ObjOutPath", objOutPath);
        }
        EditorGUILayout.EndHorizontal();
        #endregion


        GUILayout.Space(20);


        DrawLine(new Vector3(0, 180), new Vector3(400, 180), Color.gray);
        DrawLine(new Vector3(400, 180), new Vector3(400, 1000), Color.gray);


        EditorGUILayout.BeginHorizontal();

        #region LeftChooseArea
        //Left Choose Area
        GUILayout.BeginArea(new Rect(0, 180, 400, 1000));

        GUIStyle labelSty = new GUIStyle("HeaderLabel");
        labelSty.fontSize = 15;

        GUILayout.Label("History Log:", labelSty);
        GUILayout.Space(5);

        if (generateType == GenerateType.Single_File)
        {
            string[] records = fileRecordPaths.Split(';');

            for (int i = 0; i < records.Length; i++)
            {
                HistoryLogItem(records[i], generateType);
            }
        }
        else if (generateType == GenerateType.Folder_Files)
        {
            string[] records = foldRecordPaths.Split(';');
            for (int i = 0; i < records.Length; i++)
            {
                HistoryLogItem(records[i], generateType);
            }
        }


        GUILayout.EndArea();
        #endregion

        #region Right Generate Area
        //Right Generate Area
        GUILayout.BeginArea(new Rect(400, 180, 600, 1000));
        if (generateType == GenerateType.Single_File)
        {
            filePath = EditorGUILayout.TextField("SelectExcel:", filePath);
            EditorGUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Browse", GUILayout.MaxWidth(80)))
            {
                BrowseForFiles(ref filePath);
                PlayerPrefs.SetString("FilePath", filePath);
            }
            EditorGUILayout.EndHorizontal();
            GUILayout.Space(20);


            if (GUI.Button(new Rect(130, 200, 150, 20), "Generate CS"))
            {
                GenerateCSFile();
            }
            if (GUI.Button(new Rect(330, 200, 150, 20), "Create Obj"))
            {
                GenerateAsset();
            }
        }
        else if (generateType == GenerateType.Folder_Files)
        {
            folderPath = EditorGUILayout.TextField("SelectFolder:", folderPath);
            EditorGUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Browse", GUILayout.MaxWidth(80)))
            {
                BrowseForFolder(ref folderPath);
                PlayerPrefs.SetString("FoldPath", folderPath);
            }
            EditorGUILayout.EndHorizontal();
            GUILayout.Space(20);

            if (GUI.Button(new Rect(130, 200, 150, 20), "Generate CS"))
            {
                GenerateCSFile();
            }
            if (GUI.Button(new Rect(330, 200, 150, 20), "Generate Obj"))
            {
                GenerateAsset();
            }
        }
        GUILayout.EndArea();
        #endregion


        EditorGUILayout.EndHorizontal();

        EditorGUILayout.EndVertical();
    }