예제 #1
0
    private void  DrawPath(UnitySO_GeneratorConfig pConfig, string strExplainName, ref string strEditPath, bool bIsFolder, bool bIsRelative)
    {
        GUILayout.BeginHorizontal();

        if (bIsFolder)
        {
            GUILayout.Label($"{strExplainName} Folder Path : ", GUILayout.Width(300f));
        }
        else
        {
            GUILayout.Label($"{strExplainName} File Path : ", GUILayout.Width(300f));
        }

        GUILayout.Label(strEditPath, GUILayout.Width(400f));

        if (GUILayout.Button($"Edit {strExplainName}"))
        {
            string strPath = bIsFolder ? EditorUtility.OpenFolderPanel("Root Folder", "", "") : EditorUtility.OpenFilePanel("File Path", "", "");
            if (bIsRelative)
            {
                Uri pCurrentURI = new Uri(Application.dataPath);
                strEditPath = pCurrentURI.MakeRelativeUri(new Uri(strPath)).ToString();
            }
            else
            {
                strEditPath = strPath;
            }

            pConfig.DoSave();
        }

        GUILayout.EndHorizontal();
    }
예제 #2
0
    // ========================================================================== //

    /* protected - Override & Unity API         */

    private void OnGUI()
    {
        UnitySO_GeneratorConfig pConfig = UnitySO_GeneratorConfig.instance;

        if (pConfig == null)
        {
            Debug.LogError("pConfig == null");
            return;
        }

        GUILayout.Space(10f);
        DrawPath_File(pConfig, "Credential Path", ref pConfig.strCredential_FilePath);
        GUILayout.Space(10f);


        DrawPath_Folder(pConfig, "SOScript Folder Path", ref pConfig.strSOScript_FolderPath);
        DrawPath_Folder(pConfig, "Json Data Folder Path", ref pConfig.strJsonData_FolderPath);
        GUILayout.Space(10f);

        DrawPath_Folder(pConfig, "SO Export Path", ref pConfig.strDataExport_FolderPath);

        if (_pTypeDataList == null)
        {
            ParsingConfig(pConfig);
        }

        GUILayout.BeginHorizontal();
        {
            EditorGUI.BeginChangeCheck();
            pConfig.pTypeDataFile = (TextAsset)EditorGUILayout.ObjectField("TypeData File : ", pConfig.pTypeDataFile, typeof(TextAsset), false, GUILayout.Width(700f));
            if (EditorGUI.EndChangeCheck())
            {
                pConfig.DoSave();
            }

            if (GUILayout.Button("Parsing File"))
            {
                if (ParsingConfig(pConfig) == false)
                {
                    Debug.LogError("TypeDataList JsonParsing Fail");
                    return;
                }
            }
        }
        GUILayout.EndHorizontal();
        GUILayout.Space(30f);

        if (_pTypeDataList != null)
        {
            GUILayout.Label($"TypeData File is Valid");
        }
        else
        {
            GUILayout.Label($"TypeData File is InValid");
        }

        bool bIsPossibleUpdate = Check_IsPossible_Update(pConfig);

        GUI.enabled = bIsPossibleUpdate;

        if (GUILayout.Button("Update Form Local", GUILayout.Width(200f)))
        {
            DoUpdate_FromLocalFile();
        }
        GUILayout.Space(30f);

        GUILayout.BeginHorizontal();
        {
            GUILayout.Label($"SheetID : ", GUILayout.Width(100f));

            EditorGUI.BeginChangeCheck();
            pConfig.strSheetID = GUILayout.TextField(pConfig.strSheetID);
            if (EditorGUI.EndChangeCheck())
            {
                pConfig.DoSave();
            }

            if (GUILayout.Button("Connect!", GUILayout.Width(100f)))
            {
#pragma warning disable 4014
                DoConnect();
#pragma warning restore 4014
            }
        }
        GUILayout.EndHorizontal();

        if (_pConnector.bIsConnected)
        {
            GUILayout.Label($"Excel is Connected : {_strSheetID_Connected} - Sheet List");
        }
        else
        {
            GUILayout.Label($"Excel is Not Connected", GetRedGUIStyle());
        }


        GUILayout.Space(30f);

        if (_pTypeDataList == null)
        {
            return;
        }

        bool bIsMatchSheetID     = Check_IsMatch_SheetID();
        bool bIsPossibleDownload = Check_IsPossibleDownload(bIsMatchSheetID);

        DrawSheetsScroll(pConfig, bIsPossibleUpdate, bIsPossibleDownload);

        GUILayout.Space(30f);

        if (bIsMatchSheetID == false)
        {
            GUILayout.Label($"SheetID Is Not Match - Local : {_pTypeDataList.strFileName}, Current Connected : {_strSheetID_Connected}", GetRedGUIStyle());
        }

        GUILayout.BeginHorizontal();
        {
            GUILayout.Label($"CommandLine : ", GUILayout.Width(100f));

            EditorGUI.BeginChangeCheck();
            pConfig.strSOCommandLine = GUILayout.TextField(pConfig.strSOCommandLine);
            if (EditorGUI.EndChangeCheck())
            {
                pConfig.DoSave();
            }
        }
        GUILayout.EndHorizontal();

        GUI.enabled = bIsPossibleDownload;
        if (GUILayout.Button("Download And Update", GUILayout.Width(200f)))
        {
            DoDownload_And_Update();
        }
    }