예제 #1
0
        protected override void OnInspectorGUI(GameDataSettings settings, GameDataServiceItem item, System.Action onReset, GUISkin skin)
        {
            if (settings == null)
            {
                return;
            }

            var data = FlowSystem.GetData();

            if (data == null)
            {
                return;
            }

            GUILayout.Label("URL:");
            var newKey = GUILayout.TextArea(settings.url);

            if (newKey != settings.url)
            {
                settings.url = newKey;
                UnityEditor.EditorUtility.SetDirty(settings);
            }

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

                    // Connecting
                    this.OnEditorAuth(item.authKey, (result) => {
                        //UnityEditor.EditorApplication.delayCall += () => {

                        this.StartCoroutine(this.GetData(settings.url, (res) => {
                            if (res.hasError == false)
                            {
                                GameDataSystem.TryToSaveCSV(res.data);
                            }

                            item.processing = false;
                        }));

                        //};
                    });
                }
            }
            UnityEditor.EditorGUI.EndDisabledGroup();
        }
예제 #2
0
        public override IEnumerator Auth(string key)
        {
            var settings = this.serviceManager.settings as GameDataSettings;

            return(this.GetData(settings.url, (result) => {
                if (result.hasError == false)
                {
                    GameDataSystem.TryToSaveCSV(result.data);
                }
                else
                {
                    GameDataSystem.TryToLoadCache();
                }
            }));
        }
예제 #3
0
        public override System.Collections.Generic.IEnumerator <byte> Auth(string key, ServiceItem serviceItem)
        {
            var settings = this.serviceManager.settings as GameDataSettings;

            return(this.GetData(settings, (result) => {
                if (result.hasError == false)
                {
                    GameDataSystem.TryToSaveCSV(result.data);
                }
                else
                {
                    Debug.LogError(string.Format("[ GameData.GoogleService ] CSV GetData error: {0}", result.errorText));
                    GameDataSystem.TryToLoadCache();
                }
            }));
        }
예제 #4
0
        public override void EditorLoad(GameDataSettings settings, GameDataServiceItem item)
        {
            if (item.processing == false)
            {
                item.processing = true;

                // Connecting
                this.OnEditorAuth(item.authKey, (result) => {
                    //UnityEditor.EditorApplication.delayCall += () => {

                    this.StartCoroutine(this.GetData(settings, (res) => {
                        if (res.hasError == false)
                        {
                            GameDataSystem.TryToSaveCSV(res.data);
                        }

                        item.processing = false;
                    }));

                    //};
                });
            }
        }