示例#1
0
        private void OnGUI()
        {
            if (ExEditorGUI.ButtonAsToolBar("Reload SpreadSheets"))
            {
                GetMasterDataSheets();
            }

            if (sheetInfoList.IsNullOrEmpty())
            {
                ExEditorGUI.HelpErrorBox("Master Data Sheet List is null or empty.");
                return;
            }

            scrollPos = EditorGUILayout.BeginScrollView(scrollPos);
            foreach (SheetInfo sheetInfo in sheetInfoList)
            {
                EditorGUILayout.BeginHorizontal();
                ExEditorGUI.LabelField(sheetInfo.Title);
                if (ExEditorGUI.Button("Update"))
                {
                    spreadSheetSettingAsset.UpdateMasterData(sheetInfo);
                }

                EditorGUILayout.EndHorizontal();
            }

            EditorGUILayout.EndScrollView();

            if (ExEditorGUI.Button("All Update"))
            {
                spreadSheetSettingAsset.UpdateAllMasterData(sheetInfoList);
            }
        }
        private void OnGUI()
        {
            EditorGUILayout.ObjectField(nameof(SpreadSheetSettingAsset), spreadSheetSettingAsset,
                                        typeof(SpreadSheetSettingAsset), false);

            ExEditorGUI.BeginDisabledGroupUnityEditorBusy();

            ExEditorGUI.LabelFieldAsBold("Table Definition");

            foreach (SpreadSheetInfo spreadSheetInfo in spreadSheetSettingAsset.SpreadSheetInfoList)
            {
                EditorGUILayout.BeginHorizontal();

                if (ExEditorGUI.Button($"Generate {spreadSheetInfo.Name} Script"))
                {
                    try {
                        spreadSheetSettingAsset.GenerateScriptAsync(spreadSheetInfo);
                    }
                    catch (Exception e) {
                        Debug.LogError(e);
                    }
                    finally {
                        EditorUtility.ClearProgressBar();
                    }
                }

                EditorGUILayout.EndHorizontal();
            }

            EditorGUI.EndDisabledGroup();

            ExEditorGUI.Space();
            ExEditorGUI.LabelFieldAsBold("SheetApi Get Credencial.json");
            if (ExEditorGUI.ButtonAsToolBar("--->"))
            {
                System.Diagnostics.Process.Start(@"https://developers.google.com/sheets/api/quickstart/dotnet");
            }

            // https://developers.google.com/drive/api/v3/quickstart/dotnet
            // credencial.json for google drive
        }