Exemplo n.º 1
0
        public override void OnFlowSettingsGUI()
        {
            if (ABTesting.settings == null)
            {
                ABTesting.settings = ABTesting.GetSettingsFile();
            }

            var settings = ABTesting.settings;

            if (settings == null)
            {
                EditorGUILayout.HelpBox(string.Format(FlowAddon.MODULE_HAS_ERRORS, "Settings file not found (ABTestingSettings)."), MessageType.Error);
            }
            else
            {
                GUILayout.Label(FlowAddon.MODULE_INSTALLED, EditorStyles.centeredGreyMiniLabel);

                if (this.editor == null)
                {
                    this.editor = Editor.CreateEditor(settings) as ABTestingSettingsEditor;
                }

                if (this.editor != null)
                {
                    this.editor.OnInspectorGUI();
                }
            }
        }
Exemplo n.º 2
0
        protected override void OnInspectorGUI(ABTestingSettings settings, ABTestingServiceItem item, System.Action onReset, GUISkin skin)
        {
            var data = FlowSystem.GetData();

            if (data == null)
            {
                return;
            }

            UnityEditor.EditorGUI.BeginDisabledGroup(item.processing);
            if (GUILayout.Button(item.processing == true ? "Saving..." : "Save All", skin.button) == true)
            {
                if (item.processing == false)
                {
                    item.processing = true;

                    // Connecting
                    this.OnEditorAuth(item.authKey, (result) => {
                        UnityEditor.EditorApplication.delayCall += () => {
                            Dictionary <int, ABTestingItemsTO> testMap = new Dictionary <int, ABTestingItemsTO>();

                            foreach (var testWindow in data.GetWindows())
                            {
                                if (testWindow.IsABTest() == true)
                                {
                                    testMap.Add(testWindow.id, testWindow.abTests.GetTO());
//									this.Save(testWindow.id, testWindow.abTests.GetTO(), (saveResult) => {});
                                }
                            }

                            if (testMap.Count != 0)
                            {
                                this.SaveAll(testMap, (saveResult) => {});
                            }

                            item.processing = false;
                        };
                    });
                }
            }
            UnityEditor.EditorGUI.EndDisabledGroup();
        }