Inheritance: MonoBehaviour
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;
    }
 public override void OnCreate()
 {
     base.OnCreate();
     Kiip.Init(this, KP_APP_KEY, KP_APP_SECRET);
     startSessionListener = new StartSessionListener(this) as ME.Kiip.Api.Kiip.IRequestListener;
     endSessionListener   = new EndSessionListener(this) as ME.Kiip.Api.Kiip.IRequestListener;
 }
Example #3
0
 private void Start()
 {
             #if UNITY_ANDROID
     Kiip.saveMoment(MomentName);
     Kiip.showPoptart();
             #endif
 }
Example #4
0
 void onSaveMomentFinishedEvent(bool flag)
 {
     if (flag)
     {
         Kiip.showPoptart();
     }
     Debug.Log("onSaveMomentFinishedEvent ---- " + flag);
 }
Example #5
0
        public override void OnCreate()
        {
            base.OnCreate();
            Kiip kiip = Kiip.Init(this, APP_KEY, APP_SECRET);

            kiip.TestMode = (Java.Lang.Boolean)true;
            kiip.SetOnContentListener(this);
            Kiip.Instance = kiip;
        }
 public void OnFinished(Kiip p0, Java.Lang.Object p1)
 {
     //ME.Kiip.Api.Resource response = p1.JavaCast<ME.Kiip.Api.Resource>();
     //if (response != null)
     //{
     //    example.toast("Start Session Finished w/ Promo");
     //}
     //else
     //{
     //    example.toast("Start Session Finished No Promo");
     //}
     //p0.ShowResource(response);
 }
 void onSaveMomentFinishedEvent(bool flag)
 {
     if (flag)
     {
         if (notificationType == 0)
         {
             Kiip.showPoptart(); // show kiip default notification
         }
         else
         {
             GameObject.Find("ui").SendMessage("ShowNotification"); //show custom notificatino
         }
     }
     Debug.Log("onSaveMomentFinishedEvent ---- " + flag);
 }
Example #8
0
        public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
        {
            // Override point for customization after application launch.
            // If not required for your application you can safely delete this method

            // Code to start the Xamarin Test Cloud Agent
            #if ENABLE_TEST_CLOUD
            Xamarin.Calabash.Start();
            #endif

            Kiip kiip = new Kiip();
            kiip.InitWithAppKey(APP_KEY, APP_SECRET);
            kiip.Delegate = new TestKiipDelegate(this);
            Kiip.SetSharedInstance(kiip);

            return true;
        }
Example #9
0
        public void OnClick(View v)
        {
            Kiip manager = Kiip.Instance;

            switch (v.Id)
            {
            case Resource.Id.getActivePromos:
                manager.GetActivePromos(mActivePromosListener);
                break;

            case Resource.Id.unlockAchievement:
                manager.UnlockAchievement(mAchievementId.Text, new RewardRequestListener(this)
                {
                });
                break;

            case Resource.Id.saveLeaderboard:
                manager.SaveLeaderboard(mLeaderboardId.Text, 100, mRewardsListener);
                break;

            case Resource.Id.showNotification:
                if (mResources.Count > 0)
                {
                    ME.Kiip.Api.Resource resource = mResources[0];
                    manager.ShowResource(resource);
                }
                break;

            case Resource.Id.showFullscreen:
                if (mResources.Count > 0)
                {
                    toast("Showing Fullscreen (" + mResources.Count + ")");

                    ME.Kiip.Api.Resource resource = mResources[0];
                    resource.Position = ME.Kiip.Api.Kiip.Position.Fullscreen;
                    manager.ShowResource(resource);
                }
                break;

            case Resource.Id.newActivity:
                Intent intent = new Intent(this, this.Class);
                StartActivity(intent);
                break;
            }
        }
Example #10
0
        public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
        {
            // Override point for customization after application launch.
            // If not required for your application you can safely delete this method

            // Code to start the Xamarin Test Cloud Agent
                        #if ENABLE_TEST_CLOUD
            Xamarin.Calabash.Start();
                        #endif


            Kiip kiip = new Kiip();
            kiip.InitWithAppKey(APP_KEY, APP_SECRET);
            kiip.Delegate = new TestKiipDelegate(this);
            Kiip.SetSharedInstance(kiip);

            return(true);
        }
Example #11
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            // Perform any additional setup after loading the view, typically from a nib.

            Kiip.SharedInstance().TestMode = true;
            String deviceIdentifier        = Kiip.SharedInstance().DeviceIdentifier;

            DeviceID.Text = deviceIdentifier;

            DismissKeyboardTapGesture.AddTarget(DismissKeyboard);

            SaveMomentButton.TouchUpInside += (object sender, EventArgs e) => {
                DismissKeyboard();
                String momentId    = MomentIdField.Text;
                double?momentValue = MomentValueField.Text.Length > 0 ? (double?)Double.Parse(MomentValueField.Text) : null;

                if (!momentValue.HasValue)
                {
                    Kiip.SharedInstance().SaveMoment(momentId, (KPPoptart poptart, NSError error) => {
                        if (poptart != null)
                        {
                            poptart.Show();
                        }
                    });
                }
                else
                {
                    Kiip.SharedInstance().SaveMoment(momentId, momentValue.Value, (KPPoptart poptart, NSError error) => {
                        if (poptart != null)
                        {
                            poptart.Show();
                        }
                    });
                }
            };

            var myUITextFieldDelegate = new MyUITextFieldDelegate(this);

            MomentIdField.Delegate    = myUITextFieldDelegate;
            MomentValueField.Delegate = myUITextFieldDelegate;
        }
Example #12
0
 public void OnFinished(Kiip p0, Java.Lang.Object p1)
 {
     ME.Kiip.Api.Resource response = p1.JavaCast <ME.Kiip.Api.Resource>();
     if (response != null)
     {
         if (mRewardActionToggle.Checked)
         {
             p0.ShowResource(response);
         }
         else
         {
             example.toast("Reward Queued");
             example.mResources.Add(response);
         }
     }
     else
     {
         example.toast("No Reward");
     }
 }
    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;
        }
    }
Example #14
0
    void Awake()
    {
        // collect our key and secret
        DontDestroyOnLoad(this);
        string appKey    = string.Empty;
        string appSecret = string.Empty;

#if UNITY_ANDROID
        appKey    = androidAppKey;
        appSecret = androidAppSecret;
#elif UNITY_IPHONE
        appKey    = iOSappKey;
        appSecret = iOSappSecret;
#endif

        if (appKey.Length == 0 || appSecret.Length == 0)
        {
            Debug.LogError("Enter your appKey and appSecret in the Kiip inspector for any platforms you support!");
            Destroy(gameObject);
            return;
        }

        // enforce one Kiip object
        var kiipObjects = FindObjectsOfType(typeof(Kiip));
        if (kiipObjects.Length > 1)
        {
            Destroy(gameObject);
            return;
        }

        _instance = this;
        DontDestroyOnLoad(gameObject);
        name = "Kiip";

        // start up the SDK
        KiipShim.init(appKey, appSecret);
    }
 public void OnError(Kiip p0, KiipException p1)
 {
     example.toast("End Session Failed: " + "(" + p1.Code + ") " + p1.Message);
 }
Example #16
0
 public override void DidReceiveContent(Kiip kiip, string content, int quantity, string transactionId, string signature)
 {
 }
Example #17
0
 public void OnFinished(Kiip p0, Java.Lang.Object p1)
 {
     ME.Kiip.Api.Resource response = p1.JavaCast <ME.Kiip.Api.Resource>();
     example.toast(response.ToString());
 }
Example #18
0
 public void OnContent(Kiip kiip, string content, int quantity, string transactionId, string signature)
 {
     Log.Debug(TAG, "onContent content=" + content + " quantity=" + quantity + " transactionId=" + transactionId + " signature=" + signature);
 }
Example #19
0
 public void OnError(Kiip p0, KiipException p1)
 {
     example.toast("error (" + p1.Code + ") " + p1.Message);
 }
Example #20
0
    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;
        }
    }
Example #21
0
		public virtual void OnFinished (Kiip kiip, Poptart poptart)
		{
			OnPoptart(poptart);
		}
	void onContentEvent( Kiip.Content content )
	{
		Debug.Log( "onContentEvent: " + content );
	}
 public void OnFinished(Kiip p0, Java.Lang.Object p1)
 {
     //ME.Kiip.Api.Resource response = p1.JavaCast<ME.Kiip.Api.Resource>();
     //if (response != null)
     //{
     //    example.toast("Start Session Finished w/ Promo");
     //}
     //else
     //{
     //    example.toast("Start Session Finished No Promo");
     //}
     //p0.ShowResource(response);
 }
 public void OnFinished(Kiip p0, Java.Lang.Object p1)
 {
     example.toast("End Session Finished");
 }
 public void OnError(Kiip p0, KiipException p1)
 {
     example.toast("End Session Failed: " + "(" + p1.Code + ") " + p1.Message);
 }
 public void OnFinished(Kiip p0, Java.Lang.Object p1)
 {
     example.toast("End Session Finished");
 }
Example #27
0
	void Awake()
	{
		// collect our key and secret
		string appKey = string.Empty;
		string appSecret = string.Empty;
		
#if UNITY_ANDROID
		appKey = androidAppKey;
		appSecret = androidAppSecret;
#elif UNITY_IPHONE
		appKey = iOSappKey;
		appSecret = iOSappSecret;
#endif
		
		if( appKey.Length == 0 || appSecret.Length == 0 )
		{
			Debug.LogError( "Enter your appKey and appSecret in the Kiip inspector for any platforms you support!" );
			Destroy( gameObject );
			return;
		}
		
		// enforce one Kiip object
		var kiipObjects = FindObjectsOfType( typeof( Kiip ) );
		if( kiipObjects.Length > 1 )
		{
			Destroy( gameObject );
			return;
		}
		
		_instance = this;
		DontDestroyOnLoad( gameObject );
		name = "Kiip";
		
		// start up the SDK
		KiipShim.init( appKey, appSecret );
	}
Example #28
0
 public virtual void OnFailed(Kiip kiip, Java.Lang.Exception exception)
 {
 }
Example #29
0
		public virtual void OnFailed (Kiip kiip, Java.Lang.Exception exception)
		{

		}
Example #30
0
 public virtual void OnFinished(Kiip kiip, Poptart poptart)
 {
     OnPoptart(poptart);
 }
Example #31
0
		public void OnContent (Kiip kiip, string content, int quantity, string transactionId, string signature)
		{
			Log.Debug (TAG, "onContent content=" + content + " quantity=" + quantity + " transactionId=" + transactionId + " signature=" + signature);
		}
 public void OnFinished(Kiip p0, Java.Lang.Object p1)
 {
     ME.Kiip.Api.Resource response = p1.JavaCast<ME.Kiip.Api.Resource>();
     example.toast(response.ToString());
 }
Example #33
0
 public void OnNotificationClick()
 {
     HideNotificaition();
     Kiip.showPoptart();
 }
 public void OnError(Kiip p0, KiipException p1)
 {
     example.toast("error (" + p1.Code + ") " + p1.Message);
 }
Example #35
0
 public override void DidReceiveContent(Kiip kiip, string content, int quantity, string transactionId, string signature)
 {
 }
 public void OnFinished(Kiip p0, Java.Lang.Object p1)
 {
     ME.Kiip.Api.Resource response = p1.JavaCast<ME.Kiip.Api.Resource>();
     if (response != null)
     {
         if (mRewardActionToggle.Checked)
         {
             p0.ShowResource(response);
         }
         else
         {
             example.toast("Reward Queued");
             example.mResources.Add(response);
         }
     }
     else
     {
         example.toast("No Reward");
     }
 }