Beispiel #1
0
        public IObservable <Unit> LoadDataFromServer()
        {
            var ga       = new GameObject();
            var referrer = ga.AddComponent <StartCorutinReferrer>();
            var sub      = new Subject <Unit>();

            referrer.StartCoroutine(JsonFromGoogleSpreadSheet.GetJsonArrayFromGoogleSpreadSheetUrl(loadingServerUrl, (jsonArry) =>
            {
                List <GameItemVO> parsedItemVos = jsonArry.Select(j => JsonUtility.FromJson <GameItemVO>(j)).ToList();
                foreach (var g in gameItems)
                {
                    foreach (var pi in parsedItemVos)
                    {
                        if (pi.ID == g.ID)
                        {
                            pi.SetSprite(g.Sprite);
                            //pi.InteriourAnimationView = g.InteriourAnimationView;
                        }
                    }
                }

                gameItems = parsedItemVos;
                gameItems.ForEach(gi => gi.Initialize());
                DestroyImmediate(ga);
                sub.OnNext(Unit.Default);
                //保存する
                EditorUtility.SetDirty(this);
                AssetDatabase.SaveAssets();
                //Destroy(ga);
            }));
            return(sub);
        }
        public IEnumerator JsonLoadFromGoogleSpreadSheetTest()
        {
            yield return(JsonFromGoogleSpreadSheet.GetJsonArrayFromGoogleSpreadSheetUrl("https://docs.google.com/spreadsheets/d/1m--rzZdlS0eURgjQ0Fr4oZHLSY5xvrf8adLaOzSgBEA/edit#gid=1515512237", (jsonArry) =>
            {
                foreach (var json in jsonArry)
                {
                    Debug.Log(json);
                }
            }));

            yield return(null);
        }
Beispiel #3
0
        public IObservable <Unit> LoadDataFromServer()
        {
            var ga       = new GameObject();
            var referrer = ga.AddComponent <StartCorutinReferrer>();
            var sub      = new Subject <Unit>();

            referrer.StartCoroutine(JsonFromGoogleSpreadSheet.GetJsonArrayFromGoogleSpreadSheetUrl(loadingServerUrl, (jsonArry) =>
            {
                gachaSettings = jsonArry.Select(j => JsonUtility.FromJson <GachaSettingVO>(j)).ToList();
                DestroyImmediate(ga);
                //保存する
                EditorUtility.SetDirty(this);
                AssetDatabase.SaveAssets();
                sub.OnNext(Unit.Default);
            }));
            return(sub);
        }