コード例 #1
0
        public void Awake()
        {
            Instance = this;
            if (Application.loadedLevelName == "map")
            {
                if (GameObject.Find("Canvas").transform.Find("MenuPlay").gameObject.activeSelf)
                {
                    GameObject.Find("Canvas").transform.Find("MenuPlay").gameObject.SetActive(false);
                }
            }
            RestLifeTimer = PlayerPrefs.GetFloat("RestLifeTimer");

//			if(InitScript.DateOfExit == "")
//			print(InitScript.DateOfExit );
            DateOfExit = PlayerPrefs.GetString("DateOfExit", "");

            Gems  = PlayerPrefs.GetInt("Gems");
            Lifes = PlayerPrefs.GetInt("Lifes");

            if (PlayerPrefs.GetInt("Lauched") == 0)
            {    //First lauching
                FirstTime = true;
                Lifes     = CapOfLife;
                Gems      = 5;
                PlayerPrefs.SetInt("Gems", Gems);
                PlayerPrefs.SetInt("Lifes", Lifes);
                PlayerPrefs.SetInt("Lauched", 1);
                PlayerPrefs.SetInt("Music", 1);
                PlayerPrefs.SetInt("Sound", 1);
                PlayerPrefs.Save();
            }

            GameObject.Find("Music").GetComponent <AudioSource>().volume = PlayerPrefs.GetInt("Music");
            SoundBase.Instance.GetComponent <AudioSource>().volume       = PlayerPrefs.GetInt("Sound");

            ReloadBoosts();

            boostPurchased = false;

            if (GameObject.Find("CoreEvents") == null)
            {
                GameObject core = Instantiate(Resources.Load("Soomla/CoreEvents")) as GameObject;
                core.name = "CoreEvents";
                Instantiate(Resources.Load("Soomla/StoreEvents"));
            }
            //StoreEvents.OnSoomlaStoreInitialized += onSoomlaStoreInitialized;
            //StoreEvents.OnCurrencyBalanceChanged += onCurrencyBalanceChanged;
            StoreEvents.OnSoomlaStoreInitialized += onSoomlaStoreInitialized;
            StoreEvents.OnMarketPurchase         += onMarketPurchase;
            try
            {
                SoomlaStore.Initialize(new SoomlaIntegration());
            }
            catch (Exception)
            {
                // throw;
            }
        }
コード例 #2
0
ファイル: InitScript.cs プロジェクト: jaycii27/seal-saver
        public void Awake()
        {
            Instance = this;
            if (LevelEditorBase.THIS == null)
            {
                GameObject gm = Resources.Load("LevelEditorBase") as GameObject;
                GameObject lb = Instantiate(gm) as GameObject;
                lb.name = "LevelEditorBase";
            }
            RestoreLifes();

#if UNITY_INAPPS
            gameObject.AddComponent <UnityInAppsIntegration>();
#endif
            if (SceneManager.GetActiveScene() == SceneManager.GetSceneByName("map"))
            {
                //				if (GameObject.Find ("Canvas").transform.Find ("MenuPlay").gameObject.activeSelf)
                //					GameObject.Find ("Canvas").transform.Find ("MenuPlay").gameObject.SetActive (false);
                NetworkManager.THIS.IsLoggedIn = true;
            }
            RestLifeTimer = PlayerPrefs.GetFloat("RestLifeTimer");

            //			if(InitScript.DateOfExit == "")
            //			print(InitScript.DateOfExit );
            DateOfExit = PlayerPrefs.GetString("DateOfExit", "");

            Gems      = PlayerPrefs.GetInt("Gems");
            Lifes     = PlayerPrefs.GetInt("Lifes");
            CapOfLife = LevelEditorBase.THIS.CapOfLife;
            TotalTimeForRestLifeHours = LevelEditorBase.THIS.TotalTimeForRestLifeHours;
            TotalTimeForRestLifeMin   = LevelEditorBase.THIS.TotalTimeForRestLifeMin;
            TotalTimeForRestLifeSec   = LevelEditorBase.THIS.TotalTimeForRestLifeSec;

            if (PlayerPrefs.GetInt("Lauched") == 0)                  //First lauching
            {
                FirstTime = true;
                Lifes     = CapOfLife;
                //Gems = LevelEditorBase.THIS.FirstGems;
                //PlayerPrefs.SetInt("Gems", Gems);
                PlayerPrefs.SetInt("Lifes", Lifes);
                PlayerPrefs.SetInt("Lauched", 1);
                PlayerPrefs.SetFloat("Music", 1);
                PlayerPrefs.SetInt("Sound", 1);
                PlayerPrefs.Save();
            }

            GameObject.Find("Music").GetComponent <AudioSource>().volume = PlayerPrefs.GetFloat("Music");
            SoundBase.Instance.GetComponent <AudioSource>().volume       = PlayerPrefs.GetInt("Sound");

            //			ReloadBoosts ();

            boostPurchased = false;
        }
コード例 #3
0
        public void Awake()
        {
            Instance = this;
            //if (Application.loadedLevelName == "map")
            //{
            //    if (GameObject.Find("Canvas").transform.Find("MenuPlay").gameObject.activeSelf) GameObject.Find("Canvas").transform.Find("MenuPlay").gameObject.SetActive(false);

            //}
            //RestLifeTimer = PlayerPrefs.GetFloat("RestLifeTimer");

            if (InitScript.DateOfExit == "")
            {
                print(InitScript.DateOfExit);
            }
            DateOfExit = PlayerPrefs.GetString("DateOfExit", "");

            Gems = PlayerPrefs.GetInt("Gems");
            //Lifes = PlayerPrefs.GetInt("Lifes");

            //if (PlayerPrefs.GetInt("Lauched") == 0)
            //{    //First lauching
            //    FirstTime = true;
            //    Lifes = CapOfLife;
            //    Gems = 5;
            //    PlayerPrefs.SetInt("Gems", Gems);
            //    PlayerPrefs.SetInt("Lifes", Lifes);
            //    PlayerPrefs.SetInt("Lauched", 1);
            //    PlayerPrefs.SetInt("Music", 1);
            //    PlayerPrefs.SetInt("Sound", 1);
            //    PlayerPrefs.Save();
            //}

            // GameObject.Find("Music").GetComponent<AudioSource>().volume = PlayerPrefs.GetInt("Music");
            //SoundBase.Instance.GetComponent<AudioSource>().volume = PlayerPrefs.GetInt("Sound");

            //ReloadBoosts();

            // boostPurchased = false;

            if (INAPP.Instance == null)
            {
                Instantiate(Resources.Load("OpenIAB/OpenIABEventManager"));
                Instantiate(Resources.Load("OpenIAB/OpenIABEventListener"));
            }
        }
コード例 #4
0
ファイル: InitScript.cs プロジェクト: dimitrikosmakos/PopSign
        public void Awake()
        {
            Instance = this;

            if (!PlayerPrefs.HasKey("Launched"))
            {
                PlayerPrefs.SetInt("Launched", 1);
                PlayerPrefs.SetInt("Music", 1);
                PlayerPrefs.SetInt("Sound", 1);
                PlayerPrefs.SetInt("MaxLevel", 1);
                PlayerPrefs.SetInt("OpenLevel", 0);
                PlayerPrefs.SetInt("TutorialPlayed", 0);
                PlayerPrefs.SetInt("ReviewModalShown", 0);
                PlayerPrefs.SetString("WordsSeen", "");
                PlayerPrefs.Save();
            }

            GameObject.Find("Music").GetComponent <AudioSource>().volume = PlayerPrefs.GetInt("Music");
            SoundBase.Instance.GetComponent <AudioSource>().volume       = PlayerPrefs.GetInt("Sound");
        }
コード例 #5
0
ファイル: InitScript.cs プロジェクト: yasenRK/BubbleShooter
        public void Awake()
        {
            Instance = this;
            if (Application.loadedLevelName == "Map")
            {
                if (GameObject.Find("Canvas").transform.Find("MenuPlay").gameObject.activeSelf)
                {
                    GameObject.Find("Canvas").transform.Find("MenuPlay").gameObject.SetActive(false);
                }
            }
            RestLifeTimer = PlayerPrefs.GetFloat("RestLifeTimer");

            //			if(InitScript.DateOfExit == "")
            //			print(InitScript.DateOfExit );
            DateOfExit = PlayerPrefs.GetString("DateOfExit", "");

            Gems  = PlayerPrefs.GetInt("Gems");
            Lifes = PlayerPrefs.GetInt("Lifes");

            //当游戏第一次运行时候
            if (PlayerPrefs.GetInt("Lauched") == 0)
            {
                FirstTime = true;
                Lifes     = CapOfLife;
                Gems      = 5;
                //利用PlayerPrefs存储数据
                PlayerPrefs.SetInt("Gems", Gems);
                PlayerPrefs.SetInt("Lifes", Lifes);
                PlayerPrefs.SetInt("Lauched", 1);
                PlayerPrefs.SetInt("Music", 1);
                PlayerPrefs.SetInt("Sound", 1);
                PlayerPrefs.Save();
            }

            GameObject.Find("Music").GetComponent <AudioSource>().volume = PlayerPrefs.GetInt("Music");
            SoundBase.GetInstance().GetComponent <AudioSource>().volume  = PlayerPrefs.GetInt("Sound");

            ReloadBoosts();

            boostPurchased = false;
        }