Пример #1
0
 public static void RaiseStateUpdate(EdExStates state, string status = null, string json = null)
 {
     if (EdExStateUpdate != null)
     {
         EdExStateUpdate(state, status, json);
     }
 }
Пример #2
0
        /// <summary>
        /// Handles state updates within the editor extension.
        /// </summary>
        /// <param name="state">the state that triggered this event.</param>
        /// <param name="status">a generic message about the status.</param>
        /// <param name="json">a generic container for additional JSON encoded info.</param>
        private void StateUpdateHandler(EdExStates state, string status, string json)
        {
            switch (state)
            {
            case EdExStates.OnMenuItemClicked:
                break;

            case EdExStates.OnHttpReq:
                break;

            case EdExStates.OnHttpRes:
                break;

            case EdExStates.OnError:
                ProgressBar.UpdateState(ProgressBar.ProgressBarStates.error);
                EdExLogger.LoggerInstance.LogError(string.Format("App Center Editor Extensions: {0}", status));
                break;

            case EdExStates.OnWarning:
                ProgressBar.UpdateState(ProgressBar.ProgressBarStates.warning);
                EdExLogger.LoggerInstance.LogWarning(string.Format("App Center Editor Extensions: {0}", status));
                break;

            case EdExStates.OnSuccess:
                ProgressBar.UpdateState(ProgressBar.ProgressBarStates.success);
                break;
            }
        }
Пример #3
0
        /// <summary>
        /// Handles state updates within the editor extension.
        /// </summary>
        /// <param name="state">the state that triggered this event.</param>
        /// <param name="status">a generic message about the status.</param>
        /// <param name="json">a generic container for additional JSON encoded info.</param>
        public void StateUpdateHandler(EdExStates state, string status, string json)
        {
            switch (state)
            {
            case EdExStates.OnMenuItemClicked:
                //Debug.Log(string.Format("MenuItem: {0} Clicked", status));
                break;

            case EdExStates.OnHttpReq:
                object temp;
                if (!string.IsNullOrEmpty(json) && Json.PlayFabSimpleJson.TryDeserializeObject(json, out temp))     // Json.JsonWrapper.DeserializeObject(json);)
                {
                    Json.JsonObject deserialized = temp as Json.JsonObject;
                    object          useSpinner   = false;
                    object          blockUi      = false;

                    if (deserialized.TryGetValue("useSpinner", out useSpinner) && bool.Parse(useSpinner.ToString()))
                    {
                        ProgressBar.UpdateState(ProgressBar.ProgressBarStates.spin);
                    }

                    if (deserialized.TryGetValue("blockUi", out blockUi) && bool.Parse(blockUi.ToString()))
                    {
                        AddBlockingRequest(status);
                    }
                }
                break;

            case EdExStates.OnHttpRes:
                ProgressBar.UpdateState(ProgressBar.ProgressBarStates.off);
                ProgressBar.UpdateState(ProgressBar.ProgressBarStates.success);
                ClearBlockingRequest(status);


                break;

            case EdExStates.OnError:

                // deserialize and add json details
                // clear blocking requests
                ProgressBar.UpdateState(ProgressBar.ProgressBarStates.error);
                ClearBlockingRequest();
                Debug.LogError(string.Format("PlayFab EditorExtensions: Caught an error:{0}", status));
                break;

            case EdExStates.OnWarning:
                ProgressBar.UpdateState(ProgressBar.ProgressBarStates.warning);
                ClearBlockingRequest();
                Debug.LogWarning(string.Format("PlayFab EditorExtensions: {0}", status));
                break;

            case EdExStates.OnSuccess:
                ClearBlockingRequest();
                ProgressBar.UpdateState(ProgressBar.ProgressBarStates.success);
                break;
            }
        }
Пример #4
0
        /// <summary>
        /// Handles state updates within the editor extension.
        /// </summary>
        /// <param name="state">the state that triggered this event.</param>
        /// <param name="status">a generic message about the status.</param>
        /// <param name="json">a generic container for additional JSON encoded info.</param>
        private void StateUpdateHandler(EdExStates state, string status, string json)
        {
            switch (state)
            {
            case EdExStates.OnMenuItemClicked:
                PlayFabEditorPrefsSO.Instance.curSubMenuIdx = 0;
                break;

            case EdExStates.OnSubmenuItemClicked:
                int parsed;
                if (int.TryParse(json, out parsed))
                {
                    PlayFabEditorPrefsSO.Instance.curSubMenuIdx = parsed;
                }
                break;

            case EdExStates.OnHttpReq:
                object temp;
                if (string.IsNullOrEmpty(json) || Json.PlayFabSimpleJson.TryDeserializeObject(json, out temp))
                {
                    break;
                }

                var    deserialized = temp as Json.JsonObject;
                object useSpinner   = false;
                object blockUi      = false;

                if (deserialized.TryGetValue("useSpinner", out useSpinner) && bool.Parse(useSpinner.ToString()))
                {
                    ProgressBar.UpdateState(ProgressBar.ProgressBarStates.spin);
                }

                if (deserialized.TryGetValue("blockUi", out blockUi) && bool.Parse(blockUi.ToString()))
                {
                    AddBlockingRequest(status);
                }
                break;

            case EdExStates.OnHttpRes:
                ProgressBar.UpdateState(ProgressBar.ProgressBarStates.off);
                ProgressBar.UpdateState(ProgressBar.ProgressBarStates.success);
                ClearBlockingRequest(status);
                break;

            case EdExStates.OnError:
                // deserialize and add json details
                // clear blocking requests
                ProgressBar.UpdateState(ProgressBar.ProgressBarStates.error);
                ClearBlockingRequest();
                Debug.LogError(string.Format("PlayFab EditorExtensions: Caught an error:{0}", status));
                break;

            case EdExStates.OnWarning:
                ProgressBar.UpdateState(ProgressBar.ProgressBarStates.warning);
                ClearBlockingRequest();
                Debug.LogWarning(string.Format("PlayFab EditorExtensions: {0}", status));
                break;

            case EdExStates.OnSuccess:
                ClearBlockingRequest();
                ProgressBar.UpdateState(ProgressBar.ProgressBarStates.success);
                break;
            }
        }