ClearProgressBar() приватный Метод

private ClearProgressBar ( ) : void
Результат void
        internal static bool GenerateMetadataEntityScripts()
        {
            var result   = false;
            var settings = MetadataAssetSettings.Load();

            MetadataAssetSettings.CreateEntityScriptsStoreFolder(settings);

            if (string.IsNullOrEmpty(settings.ExcelWorkbookFilesFolderPath))
            {
                if (UnityEditorUtility.DisplayDialog("Error", "'Excel Workbook Files Folder Path' is not valid path!", "OK"))
                {
                    UnityEditorUtility.ClearProgressBar();
                }
            }
            else
            {
                ForEachExcelFile(settings.ExcelWorkbookFilesFolderPath, (table, fileName, index, length) =>
                {
                    if (table == null)
                    {
                        return;
                    }

                    var info     = $"Generating Metadata Entity Script: {fileName}.cs... {index + 1}/{length}";
                    var progress = (float)(index + 1) / length;
                    UnityEditorUtility.DisplayProgressBar("Hold on...", info, progress);
                    var rawInfoList = CreateMetadataEntityRawInfoList(settings, table);
                    result          = GenerateMetadataEntityScript(settings, fileName, rawInfoList);
                });
            }

            UnityEditorUtility.ClearProgressBar();
            return(result);
        }
        private static void BuildAssets()
        {
            EditorUtility.ClearConsole();

            if (UnityEditorUtility.scriptCompilationFailed)
            {
                return;
            }

            try
            {
                var result = MetadataAssetUtility.GenerateMetadataEntityScripts();
                EditorPrefs.SetBool(ScriptsGeneratedPrefKey, result);

                if (result)
                {
                    UnityEditorUtility.DisplayProgressBar("Hold on...", "Compiling metadata entity scripts...", 0f);
                }
                else
                {
                    if (UnityEditorUtility.DisplayDialog("Error", "Failed to generate metadata entity scripts!", "OK"))
                    {
                        UnityEditorUtility.ClearProgressBar();
                    }
                }
            }
            catch (System.Exception e)
            {
                Debug.LogException(e);
            }
        }
Пример #3
0
        private void ErrorCallback(string err)
        {
            UnityEngine.Debug.LogError(err);

            requestingAppId = false;
            this.setupState = SetupState.RegistrationError;
            EditorUtility.ClearProgressBar();
        }
        internal static bool CreateMetadataDatabaseFiles()
        {
            var result   = false;
            var settings = MetadataAssetSettings.Load();

            MetadataAssetSettings.CreateMetadataPersistentStoreFolder(settings);
            DeleteTempDbFiles();

            var dbFolderPath = EditorPath.ConvertToAbsolutePath(settings.MetadataPersistentStorePath);

            ForEachExcelFile(settings.ExcelWorkbookFilesFolderPath, (table, fileName, index, length) =>
            {
                if (table == null)
                {
                    return;
                }

                var entityClassName = fileName.ToTitleCase();
                var info            = $"Creating Database File for Entity {entityClassName}... {index + 1}/{length}";
                var progress        = (float)(index + 1) / length;
                UnityEditorUtility.DisplayProgressBar("Hold on...", info, progress);

                var rawInfoList     = CreateMetadataEntityRawInfoList(settings, table);
                var entityClassType = GetEntityClassType(settings, entityClassName);

                if (entityClassType != null)
                {
                    var entityDataList = CreateEntityDataList(settings, table, entityClassType, rawInfoList);
                    typeof(MetadataAssetUtility).InvokeGenericStaticMethod("InsertEntityData", new[] { entityClassType }, new object[] { dbFolderPath, entityClassName, rawInfoList, entityDataList, index });
                    result = true;
                }
                else
                {
                    UnityDebug.LogErrorFormat(null, "Can not find the entity class: {0}.cs!", entityClassName);
                    result = false;
                }
            });

            // Copy MetadataEntityDBConfig database file.
            if (result)
            {
                CopyDatabaseFile(dbFolderPath, MetadataEntityDBConfig.DatabaseLocalAddress);
            }

            UnityEditorUtility.ClearProgressBar();
            return(result);
        }
        private static void OnScriptsReloaded()
        {
            var scriptsGenerated = EditorPrefs.GetBool(ScriptsGeneratedPrefKey);

            if (!scriptsGenerated)
            {
                return;
            }

            UnityEditorUtility.ClearProgressBar();
            EditorPrefs.SetBool(ScriptsGeneratedPrefKey, false);

            if (!UnityEditorUtility.scriptCompilationFailed)
            {
                try
                {
                    var result = MetadataAssetUtility.CreateMetadataDatabaseFiles();

                    if (result)
                    {
                        if (UnityEditorUtility.DisplayDialog("Success", "Build success!", "OK"))
                        {
                            UnityEditorUtility.ClearProgressBar();
                        }
                    }
                    else
                    {
                        if (UnityEditorUtility.DisplayDialog("Error", "Failed to create metadata database files!", "OK"))
                        {
                            UnityEditorUtility.ClearProgressBar();
                        }
                    }
                }
                catch (System.Exception e)
                {
                    Debug.LogException(e);
                }
            }
            else
            {
                if (UnityEditorUtility.DisplayDialog("Error", "Failed to compile metadata entity scripts!", "OK"))
                {
                    UnityEditorUtility.ClearProgressBar();
                }
            }
        }
Пример #6
0
        private void SuccessCallback(AccountServiceResponse response)
        {
            if (response.ReturnCode == AccountServiceReturnCodes.Success)
            {
                this.setupState = SetupState.RegisteredSuccessful;

                appIdOrEmail = response.ApplicationIds[((int)ServiceTypes.Realtime).ToString()];

                // Save App ID
                AppSettingsInstance.AppIdRealtime = appIdOrEmail;
            }
            else
            {
                this.setupState = SetupState.AlreadyRegistered;
                UnityEngine.Debug.LogWarning("It was not possible to process your request, please go to the Photon Cloud Dashboard.");
                UnityEngine.Debug.LogWarningFormat("Return Code: {0}", response.ReturnCode);
            }

            requestingAppId = false;
            EditorUtility.ClearProgressBar();
        }
Пример #7
0
        private void DrawSetupPhoton()
        {
            DrawInputWithLabel("Photon Cloud Setup", () =>
            {
                GUILayout.BeginVertical();
                GUILayout.Space(5);
                GUILayout.Label(BoltWizardText.PHOTON, textLabel);
                GUILayout.EndVertical();

                GUILayout.BeginHorizontal();
                GUILayout.Label(BoltWizardText.PHOTON_DASH, textLabel);
                if (GUILayout.Button("Visit Dashboard", minimalButton))
                {
                    OpenURL("https://dashboard.photonengine.com/")();
                }

                GUILayout.EndHorizontal();
            }, false);
            GUILayout.Space(15);

            BoltRuntimeSettings settings = BoltRuntimeSettings.instance;

            DrawInputWithLabel("Photon Bolt App ID or Email", () =>
            {
                GUILayout.BeginVertical();

                AppIdOrEmail = EditorGUILayout.TextField(AppIdOrEmail, centerInputText);

                GUILayout.EndVertical();
            }, false, true, 300);

            DrawInputWithLabel("Region",
                               () =>
            {
                settings.photonCloudRegionIndex = EditorGUILayout.Popup(settings.photonCloudRegionIndex,
                                                                        BoltRuntimeSettings.photonCloudRegions);
            }, true, true);

            DrawInputWithLabel("NAT Punchthrough Enabled",
                               () => { settings.photonUsePunch = Toggle(settings.photonUsePunch); }, true, true);

            // Action

            if (beforeNextCallback == null)
            {
                beforeNextCallback = () =>
                {
                    if (requestingAppId)
                    {
                        BoltLog.Info("Please, wait until your request for a new AppID finishes.");
                        return(false);
                    }

                    if (AccountService.IsValidEmail(AppIdOrEmail))
                    {
                        try
                        {
                            EditorUtility.DisplayProgressBar(BoltWizardText.CONNECTION_TITLE,
                                                             BoltWizardText.CONNECTION_INFO, 0.5f);
                            BoltLog.Info("Starting request");

                            requestingAppId = new AccountService().RegisterByEmail(
                                AppIdOrEmail,
                                new List <ServiceTypes>()
                            {
                                ServiceTypes.Bolt
                            },
                                (response) =>
                            {
                                if (response.ReturnCode == AccountServiceReturnCodes.Success)
                                {
                                    var appKey = response.ApplicationIds[((int)ServiceTypes.Bolt).ToString()];

                                    settings.photonAppId = appKey;
                                    AppIdOrEmail         = appKey;

                                    BoltLog.Info("You new App ID: {0}", AppIdOrEmail);
                                }
                                else
                                {
                                    BoltLog.Warn(
                                        "It was not possible to process your request, please go to the Photon Cloud Dashboard.");
                                    BoltLog.Warn("Return Code: {0}",
                                                 AccountServiceReturnCodes.ReturnCodes[response.ReturnCode]);
                                }

                                requestingAppId = false;
                                EditorUtility.ClearProgressBar();
                            }, (err) =>
                            {
                                BoltLog.Error(err);

                                requestingAppId = false;
                                EditorUtility.ClearProgressBar();
                            });

                            if (requestingAppId)
                            {
                                BoltLog.Info("Requesting your new App ID");
                            }
                            else
                            {
                                BoltLog.Warn(
                                    "It was not possible to process your request, please go to the Photon Cloud Dashboard.");
                                EditorUtility.ClearProgressBar();
                            }
                        }
                        catch (Exception ex)
                        {
                            EditorUtility.DisplayDialog("Error", ex.Message, "ok");
                        }
                    }
                    else if (IsAppId(AppIdOrEmail))
                    {
                        settings.photonAppId = AppIdOrEmail;
                        return(true);
                    }
                    else
                    {
                        ShowNotification(new GUIContent("Please specify a valid Photon Bolt App ID or Email."));
                    }

                    return(false);
                };
            }
        }
Пример #8
0
 public void ClearProgressBar()
 {
     EditorUtility.ClearProgressBar();
 }
Пример #9
0
 private void DoApply(SerializedObject so)
 {
     if (this.multipleSprites)
     {
         List <string>      list  = new List <string>();
         List <string>      list2 = new List <string>();
         SerializedProperty serializedProperty = so.FindProperty("m_SpriteSheet.m_Sprites");
         for (int i = 0; i < this.m_RectsCache.Count; i++)
         {
             SpriteRect spriteRect = this.m_RectsCache.RectAt(i);
             if (string.IsNullOrEmpty(spriteRect.name))
             {
                 spriteRect.name = "Empty";
             }
             if (!string.IsNullOrEmpty(spriteRect.originalName))
             {
                 list.Add(spriteRect.originalName);
                 list2.Add(spriteRect.name);
             }
             if (serializedProperty.arraySize < this.m_RectsCache.Count)
             {
                 serializedProperty.InsertArrayElementAtIndex(serializedProperty.arraySize);
             }
             SerializedProperty arrayElementAtIndex = serializedProperty.GetArrayElementAtIndex(i);
             spriteRect.ApplyToSerializedProperty(arrayElementAtIndex);
             EditorUtility.DisplayProgressBar(SpriteEditorWindow.SpriteEditorWindowStyles.saveProgressTitle.text, string.Format(SpriteEditorWindow.SpriteEditorWindowStyles.saveContentText.text, i, this.m_RectsCache.Count), (float)i / (float)this.m_RectsCache.Count);
         }
         while (this.m_RectsCache.Count < serializedProperty.arraySize)
         {
             serializedProperty.DeleteArrayElementAtIndex(this.m_RectsCache.Count);
         }
         if (list.Count > 0)
         {
             PatchImportSettingRecycleID.PatchMultiple(so, 213, list.ToArray(), list2.ToArray());
         }
     }
     else if (this.m_RectsCache.Count > 0)
     {
         SpriteRect spriteRect2 = this.m_RectsCache.RectAt(0);
         so.FindProperty("m_Alignment").intValue                  = (int)spriteRect2.alignment;
         so.FindProperty("m_SpriteBorder").vector4Value           = spriteRect2.border;
         so.FindProperty("m_SpritePivot").vector2Value            = spriteRect2.pivot;
         so.FindProperty("m_SpriteTessellationDetail").floatValue = spriteRect2.tessellationDetail;
         SerializedProperty serializedProperty2 = so.FindProperty("m_SpriteSheet.m_Outline");
         if (spriteRect2.outline != null)
         {
             SpriteRect.ApplyOutlineChanges(serializedProperty2, spriteRect2.outline);
         }
         else
         {
             serializedProperty2.ClearArray();
         }
         SerializedProperty serializedProperty3 = so.FindProperty("m_SpriteSheet.m_PhysicsShape");
         if (spriteRect2.physicsShape != null)
         {
             SpriteRect.ApplyOutlineChanges(serializedProperty3, spriteRect2.physicsShape);
         }
         else
         {
             serializedProperty3.ClearArray();
         }
     }
     EditorUtility.ClearProgressBar();
 }