예제 #1
0
        //private buy

        private void Start()
        {
            if (_instance != null && _instance != this)
            {
                Destroy(this.gameObject);
                return;
            }
            _instance = this;

            Main.onSceneChange.AddListener(SceneChanging);
            InAppBilling.onProBuy.AddListener(ProBought);

            if (!InAppBilling.ProIsOwned())
            {
                Debug.Log("is not owned");
                animator.SetTrigger("fadeBuy");
            }
            else
            {
                Debug.Log("is owned");
                animator.SetTrigger("fadeOwned");
            }
            // check if the item is bought or not and then fade the correct ui in

            // else: animator.SetTrigger("fadeThanks");
        }
예제 #2
0
        public static void LoadProgressData()
        {
            ProgressData progressLoading;
            string       savePath;

#if UNITY_ANDROID && !UNITY_EDITOR
            savePath = SavePathAndroid;
#else
            savePath = SavePath;
#endif

            if (File.Exists(savePath))
            {
                try
                {
                    progressLoading = JsonUtility.FromJson <ProgressData>(File.ReadAllText(savePath, Encoding.UTF8));

                    // check object integrity - aka were objects added or removed - not effected by object attribute changes
                    string loadedChecksum    = progressLoading.checksum;
                    string generatedChecksum = progressLoading.GenerateChecksum();
                    Debug.Log("loadedChecksum " + loadedChecksum);
                    Debug.Log("generatedChecksum " + generatedChecksum);
                    //if (loadedChecksum == generatedChecksum)
                    //{
                    Debug.Log("Progress checksums are the same, have fun!");
                    progress            = progressLoading;
                    progress.proVersion = InAppBilling.ProIsOwned();
                    //}
                    //else
                    // {
                    Debug.LogError("Progress checksums mismatching. Someone tried to mess with the it!");
                    //    SaveProgressData();
                    //}
                }
                catch (SerializationException e)
                {
                    Debug.LogError("[LevelLoader]: Failed to deserialize progress. Reason: " + e.Message);
                    throw;
                }
                IsLoaded = true;
            }
            else
            {
                SaveProgressData();
            }
        }