Example #1
0
    void Gameover()
    {
        Debug.Log("Score is: " + Score.ToString());
        //float Best;
        //Debug.Log("GameOVER");

        //Debug.Log("LOADED");
        if (Best < Score)
        {
            Debug.Log("ENTERED IF");
            try
            {
                PlayerPrefs.SetFloat("Score", Score);
                //SavedVariables.SaveVariables();
                //Save();
                //SaveHighscore(Score);
            }
            catch (Exception ex)
            {
                Debug.Log(ex.ToString());
            }
            Debug.Log("Saved");
            Social.ReportScore(Convert.ToInt64(Score), "HIGHSCORE1.1", result => {
                if (result)
                {
                    Debug.Log("Successfully reported score progress");
                    Social.LoadScores("HIGHSCORE1.1", ProcessLoadedScores);                     // Make sure to use this.
                    GameCenterPlatform.ShowLeaderboardUI("HIGHSCORE1.1", TimeScope.AllTime);
                }
                else
                {
                    Debug.Log("Failed to report score");
                }
            });

            //	Debug.Log("SAVED");
            Best = Score;
            Kiip.saveMoment("Achieving a HIGHSCORE !!!", Best);
            //	Debug.Log("Done IF");
        }
        else
        {
            if (Score > 10)
            {
                Kiip.saveMoment("Doing Great !!!", Score);
            }
            //revMob.ShowFullscreen ();
        }
        GameOver.SetActive(true);
        outScore.text  = "Score : " + Score;
        bestScore.text = "Best : " + Best;
        if (Best == Score)
        {
            bestScore.color = Color.magenta;
        }
        InGame.gameObject.SetActive(false);
        isRunning = false;
        paused    = true;
        //Score = 0;
    }
Example #2
0
 private void Start()
 {
             #if UNITY_ANDROID
     Kiip.saveMoment(MomentName);
     Kiip.showPoptart();
             #endif
 }
    void OnGUI()
    {
        float yPos       = 5.0f;
        float xPos       = 5.0f;
        float width      = (Screen.width >= 960 || Screen.height >= 960) ? 320 : 160;
        float height     = (Screen.width >= 960 || Screen.height >= 960) ? 80 : 40;
        float heightPlus = height + 10.0f;


        if (GUI.Button(new Rect(xPos, yPos, width, height), "Save Moment"))
        {
            Kiip.saveMoment("my-moment-id");
        }


        if (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "Save Another Moment"))
        {
            Kiip.saveMoment("moment-of-inertia");
        }


        if (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "Save Moment with Value"))
        {
            Kiip.saveMoment("another-moment-id", 45);
        }


        if (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "Set Kiip Properties"))
        {
            Kiip.instance.gender   = "Male";
            Kiip.instance.testMode = true;
            Kiip.instance.birthday = System.DateTime.Now;
            Kiip.instance.email    = "*****@*****.**";

            // these next two are iOS only
            Kiip.instance.interfaceOrientation = DeviceOrientation.LandscapeLeft;
            Kiip.instance.shouldAutoRotate     = true;
        }
    }
    void OnGUI()
    {
        float yPos       = 5.0f;
        float xPos       = 5.0f;
        float width      = (Screen.width >= 960 || Screen.height >= 960) ? 320 : 160;
        float height     = (Screen.width >= 960 || Screen.height >= 960) ? 80 : 40;
        float heightPlus = height + 10.0f;


        if (GUI.Button(new Rect(xPos, yPos, width, height), "Save Moment with Default Notification"))
        {
            HideNotificaition();                                                                // hide custom notification

            GameObject.Find("KiipEventListener").SendMessage("SetNotificationType", "default"); // set default notification

            if (momentText.text != "" && momentText != null)
            {
                Kiip.saveMoment(momentText.text);
            }
        }


        if (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "Save Another Moment with Custom Notification"))
        {
            HideNotificaition();                                                               // hide custom notification

            GameObject.Find("KiipEventListener").SendMessage("SetNotificationType", "custom"); // set custom notification

            if (momentText.text != "" && momentText != null)
            {
                Kiip.saveMoment(momentText.text);
            }
        }


        if (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "Save Moment with Value with Custom Notification"))
        {
            HideNotificaition();                                                               // hide custom notification

            GameObject.Find("KiipEventListener").SendMessage("SetNotificationType", "custom"); // set custom notification

            if (momentText.text != "" && momentText.text != null && momentValue.text != "" && momentValue != null)
            {
                Kiip.saveMoment(momentText.text, double.Parse(momentValue.text));
            }
        }


        if (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "Set Kiip Properties"))
        {
            Kiip.instance.gender   = "Male";
            Kiip.instance.testMode = true;
            Kiip.instance.birthday = System.DateTime.Now;
            Kiip.instance.email    = "*****@*****.**";
            Kiip.instance.ageGroup = 0;

            // these next two are iOS only
            Kiip.instance.interfaceOrientation = DeviceOrientation.LandscapeLeft;
            Kiip.instance.shouldAutoRotate     = true;
        }
    }