// Use this for initialization
 void Start()
 {
     GUI_Dialog.ClearStack();
     //GameDataManager.GEMU_APP_ID = "1431032373";
     transition.Show(Transition.TransitionMode.EaseOut);
     Screen.orientation = ScreenOrientation.LandscapeLeft;
     if (PlayerPrefs.HasKey(PlayerPrefHandler.keyCoin) == false)
     {
         PlayerPrefs.SetInt(PlayerPrefHandler.keyCoin, 5);
         CoinTimerHandler.instance.countCoin = 5;
     }
     else
     {
         CoinTimerHandler.instance.countCoin = PlayerPrefs.GetInt(PlayerPrefHandler.keyCoin);
         //CoinTimerHandler.instance.countCoin = 0;
     }
     if (PlayerPrefs.HasKey(PlayerPrefHandler.keyUserTiket) == false)
     {
         PlayerPrefs.SetInt(PlayerPrefHandler.keyUserTiket, 0);
     }
     //GameDataManager.instance.SendPlayResult(GameDataManager.GEMU_APP_ID,"0","50","0","0");
     //GameDataManager.instance.LoadData ();
 }
Ejemplo n.º 2
0
    // Use this for initialization
    void Start()
    {
        GUI_Dialog.ClearStack();
        Screen.orientation = ScreenOrientation.Portrait;
        //GameDataManager.GEMU_APP_ID = "1430386500";
        PlayerPrefs.SetInt(PlayerPrefHandler.keyLevelAktif, gameLevelActive);
        PlayerPrefs.SetInt(PlayerPrefHandler.keyPause, 0);
        PlayerPrefs.SetInt(PlayerPrefHandler.keyGameId, GameID);

        PlayerPrefs.SetInt(PlayerPrefHandler.keyCurrentScore, 0);

        if (PlayerPrefs.HasKey("highscore") == false)
        {
            PlayerPrefs.SetInt("highscore", 0);
        }

        //Handle Tickets
        if (PlayerPrefs.HasKey(PlayerPrefHandler.keyUserTiket) == false)
        {
            PlayerPrefs.SetInt(PlayerPrefHandler.keyUserTiket, 0);
        }

        //Handle Suara
        audioSourceSFX = GameObject.Find("Main Camera").GetComponent <AudioSource> ();
        //rImgSound = GameObject.Find ("btnSound").GetComponent<RawImage> ();

        if (PlayerPrefs.HasKey(PlayerPrefHandler.keySound) == false)
        {
            PlayerPrefs.SetInt(PlayerPrefHandler.keySound, 1);
        }
        else
        {
            if (PlayerPrefs.GetInt(PlayerPrefHandler.keySound) == 1)
            {
                //audioSourceSFX.enabled = true;
                //rImgSound.texture = soundActive;
            }
            else
            {
                //audioSourceSFX.enabled = false;
                //rImgSound.texture = soundNonActive;
            }
        }

        hitung_tiket_user();
        if (PlayerPrefs.HasKey(PlayerPrefHandler.keyLastLogin) == false)
        {
            PlayerPrefs.SetString(PlayerPrefHandler.keyLastLogin, System.DateTime.Now.ToString());
        }
        //if (PlayerPrefs.HasKey (PlayerPrefHandler.keyLoginActive) == false)
        //{
        //	PlayerPrefs.SetString (PlayerPrefHandler.keyLoginActive, "guest");
        //	PlayerPrefs.SetString (PlayerPrefHandler.keyUserName, "guest");
        //PlayerPrefs.SetInt(PlayerPrefHandler.keyCoinGuest,3);
        //GameObject.Find ("txtTimerUser").SendMessage ("updateCoins");
        //}

        //if (PlayerPrefs.GetString (PlayerPrefHandler.keyLoginActive) == "guest") {
        //	GameObject.Find ("txtTimerUser").SendMessage ("updateCoins");
        //}

        //cek status Login
        //Debug.Log("[ Login Name : " + PlayerPrefs.GetString (PlayerPrefHandler.keyUserName) + " | " + PlayerPrefs.GetString (PlayerPrefHandler.keyLoginActive) + " ]");

        /*
         * if (PlayerPrefs.GetString(PlayerPrefHandler.keyLoginActive)=="guest") {
         *      Debug.Log("-- Proses ulang login Guest --");
         *      PlayerPrefs.SetString (PlayerPrefHandler.keyUserName, "guest");
         *      coinsUserActive = PlayerPrefs.GetInt(PlayerPrefHandler.keyCoin);
         *
         *      GameObject.Find("FB_gameobj").SendMessage("loadGambarGuest");
         *
         *      //Text txtCoins = GameObject.Find("txtCoinsUser").GetComponent<Text>();
         *      //txtCoins.text = "X "+coinsUserActive.ToString();
         *
         * } else if (PlayerPrefs.GetString(PlayerPrefHandler.keyLoginActive)=="facebook") {
         *      Debug.Log("-- Proses ulang login Facebook --");
         *
         *
         *
         *      GameObject.Find("FB_gameobj").SendMessage("GetFotoAndName");
         *
         *      //Text txtCoins = GameObject.Find("txtCoinsUser").GetComponent<Text>();
         *      //txtCoins.text = "X "+coinsUserActive.ToString();
         * } else if (PlayerPrefs.GetString(PlayerPrefHandler.keyLoginActive)=="gemu") {
         *      Debug.Log("-- Proses ulang login Gemu --");
         *      get_asset_API(PlayerPrefs.GetString (PlayerPrefHandler.keyUserName));
         *
         * } else if (PlayerPrefs.GetString(PlayerPrefHandler.keyLoginActive)=="gplus") {
         *      Debug.Log("-- Proses ulang login GPlus --");
         *
         * }
         * PlayerPrefs.Save();
         */
        GemuAPI.OnGetUserResponse += OnGetUserResponse;
        GemuAPI.OnLoginResponse   += OnLoginResponse;


        //GameDataManager.instance.SendPlayResult(GameDataManager.GEMU_APP_ID,"0","10","0","1");
        //GameDataManager.instance.LoadData ();

        //sementara aja
        //Text txtData = GameObject.Find ("txtData").GetComponent<Text> ();
        //txtData.text = "[ Name:" + PlayerPrefs.GetString (PlayerPrefHandler.keyUserName) + " | Login:"******" | GameID:"+ PlayerPrefs.GetInt(PlayerPrefHandler.keyGameId) +" ]";
        //Debug.Log("--- MainMenu : " + PlayerPrefs.GetString(PlayerPrefHandler.keyUserName) + " | statLogin : "******" ---");
    }