示例#1
0
    public void setScore(double userScore)
    {
        App42API.Initialize("47675efb1d62deab9e46b9d43795e45c381c341bec9033abb9622fa1a88e5720", "256e86ad5fe1038aaf20334d51c894f1dfa9839996dbaa2e92376141761a07f0");
        ScoreBoardService scoreBoardService = App42API.BuildScoreBoardService();

        scoreBoardService.EditScoreValueById(scoreID, userScore, new UnityCallBack());
    }
 public void saveScore()
 {
     if (playerName != null && LeveliManeger._instance.getIdScore() == null)
     {
         Debug.Log(name);
         App42Log.SetDebug(true);
         scoreBoardService = sp.BuildScoreBoardService();              // Initializing ScoreBoard Service.
         Debug.Log(LeveliManeger._instance.getSkupniCas() + "skupni cassss");
         scoreBoardService.SaveUserScore(gameName, playerName, Mathf.Floor(LeveliManeger._instance.getSkupniCas() * 10), saveScoreCall);
     }
     else if (LeveliManeger._instance.getIdScore() != null)
     {
         scoreBoardService = sp.BuildScoreBoardService();
         scoreBoardService.EditScoreValueById(LeveliManeger._instance.getIdScore(), Mathf.Floor(LeveliManeger._instance.getSkupniCas() * 10), saveScoreCall);
     }
 }
    void OnGUI()
    {
        if (Time.time % 2 < 1) {
            success = callBack.getResult ();
        }
        // For Setting Up ResponseBox.
        GUI.TextArea (new Rect (10, 5, 1300, 175), success);

        //======================================{{{{************}}}}================================
        if (GUI.Button (new Rect (50, 200, 200, 30), "SaveUserScore")) {
            App42Log.SetDebug (true);
            scoreBoardService = sp.BuildScoreBoardService (); // Initializing ScoreBoard Service.
            scoreBoardService.SaveUserScore (cons.gameName, cons.userName, userScore, callBack);
        }

        //======================================{{{{************}}}}=================================
        if (GUI.Button (new Rect (260, 200, 200, 30), "GetScoresByUser")) {
            scoreBoardService = sp.BuildScoreBoardService (); // Initializing ScoreBoard Service.
            scoreBoardService.GetScoresByUser (cons.gameName, cons.userName, callBack);
        }

        //======================================{{{{************}}}}==========================================
        if (GUI.Button (new Rect (470, 200, 200, 30), "GetHighestScoreByUser")) {
            scoreBoardService = sp.BuildScoreBoardService (); // Initializing ScoreBoard Service.
            scoreBoardService.GetHighestScoreByUser (cons.gameName, cons.userName, callBack);
        }

        //======================================{{{{************}}}}==========================================
        if (GUI.Button (new Rect (680, 200, 200, 30), "GetLowestScoreByUser")) {
            scoreBoardService = sp.BuildScoreBoardService (); // Initializing ScoreBoard Service.
            scoreBoardService.GetLowestScoreByUser (cons.gameName, cons.userName, callBack);
        }

        //======================================{{{{************}}}}==========================================
        if (GUI.Button (new Rect (890, 200, 200, 30), "GetTopRankings")) {
            scoreBoardService = sp.BuildScoreBoardService (); // Initializing ScoreBoard Service.
            scoreBoardService.GetTopRankings (cons.gameName, callBack);
        }

        //======================================{{{{************}}}}==========================================
        if (GUI.Button (new Rect (50, 250, 200, 30), "GetAverageScoreByUser")) {
            scoreBoardService = sp.BuildScoreBoardService (); // Initializing ScoreBoard Service.
            scoreBoardService.GetAverageScoreByUser (cons.gameName, cons.userName, callBack);
        }

        //======================================{{{{************}}}}==========================================
        if (GUI.Button (new Rect (260, 250, 200, 30), "GetLastScoreByUser")) {
            scoreBoardService = sp.BuildScoreBoardService (); // Initializing ScoreBoard Service.
            scoreBoardService.GetLastScoreByUser (cons.gameName, cons.userName, callBack);
        }

        //======================================{{{{************}}}}==========================================
        if (GUI.Button (new Rect (470, 250, 200, 30), "GetTopRankings")) {
            scoreBoardService = sp.BuildScoreBoardService (); // Initializing ScoreBoard Service.
            scoreBoardService.GetTopRankings (cons.gameName, callBack);
        }

        //======================================{{{{************}}}}==========================================
        if (GUI.Button (new Rect (680, 250, 200, 30), "GetTopNRankings")) {
            scoreBoardService = sp.BuildScoreBoardService (); // Initializing ScoreBoard Service.
            scoreBoardService.GetTopNRankings (cons.gameName, max, callBack);
        }

        //======================================{{{{************}}}}==========================================
        if (GUI.Button (new Rect (890, 250, 200, 30), "GetTopNRankers")) {
            scoreBoardService = sp.BuildScoreBoardService (); // Initializing ScoreBoard Service.
            scoreBoardService.GetTopNRankers (cons.gameName, max, callBack);
        }

        //======================================{{{{************}}}}==========================================
        if (GUI.Button (new Rect (50, 300, 200, 30), "GetTopRankingsByGroup")) {
            scoreBoardService = sp.BuildScoreBoardService (); // Initializing ScoreBoard Service.
            IList<string> userList = new List<string> ();
            userList.Add (cons.userName);
            userList.Add (cons.userName1);
            scoreBoardService.GetTopRankingsByGroup (cons.gameName, userList, callBack);
        }

        //======================================{{{{************}}}}==========================================
        if (GUI.Button (new Rect (260, 300, 200, 30), "GetTopNRankersByGroup")) {
            scoreBoardService = sp.BuildScoreBoardService (); // Initializing ScoreBoard Service.
            IList<string> userList = new List<string> ();
            userList.Add (cons.userName);
            userList.Add (cons.userName1);
            scoreBoardService.GetTopNRankersByGroup (cons.gameName, userList, callBack);
        }

        //======================================{{{{************}}}}==========================================
        if (GUI.Button (new Rect (470, 300, 200, 30), "EditScoreValueById")) {
            scoreBoardService = sp.BuildScoreBoardService (); // Initializing ScoreBoard Service.
            IList<string> userList = new List<string> ();
            userList.Add (cons.userName);
            userList.Add (cons.userName1);
            scoreBoardService.EditScoreValueById (cons.scoreId, userScore, callBack);
        }
    }
示例#4
0
    void OnGUI()
    {
        if (Time.time % 2 < 1)
        {
            success = callBack.getResult();
        }
        // For Setting Up ResponseBox.
        GUI.TextArea(new Rect(10, 5, 1300, 175), success);

        //======================================{{{{************}}}}================================
        if (GUI.Button(new Rect(50, 200, 200, 30), "SaveUserScore"))
        {
            App42Log.SetDebug(true);
            scoreBoardService = sp.BuildScoreBoardService();              // Initializing ScoreBoard Service.
            scoreBoardService.SaveUserScore(cons.gameName, cons.userName, userScore, callBack);
        }

        //======================================{{{{************}}}}=================================
        if (GUI.Button(new Rect(260, 200, 200, 30), "GetScoresByUser"))
        {
            scoreBoardService = sp.BuildScoreBoardService();              // Initializing ScoreBoard Service.
            scoreBoardService.GetScoresByUser(cons.gameName, cons.userName, callBack);
        }

        //======================================{{{{************}}}}==========================================
        if (GUI.Button(new Rect(470, 200, 200, 30), "GetHighestScoreByUser"))
        {
            scoreBoardService = sp.BuildScoreBoardService();              // Initializing ScoreBoard Service.
            scoreBoardService.GetHighestScoreByUser(cons.gameName, cons.userName, callBack);
        }

        //======================================{{{{************}}}}==========================================
        if (GUI.Button(new Rect(680, 200, 200, 30), "GetLowestScoreByUser"))
        {
            scoreBoardService = sp.BuildScoreBoardService();              // Initializing ScoreBoard Service.
            scoreBoardService.GetLowestScoreByUser(cons.gameName, cons.userName, callBack);
        }

        //======================================{{{{************}}}}==========================================
        if (GUI.Button(new Rect(890, 200, 200, 30), "GetTopRankings"))
        {
            scoreBoardService = sp.BuildScoreBoardService();              // Initializing ScoreBoard Service.
            scoreBoardService.GetTopRankings(cons.gameName, callBack);
        }

        //======================================{{{{************}}}}==========================================
        if (GUI.Button(new Rect(50, 250, 200, 30), "GetAverageScoreByUser"))
        {
            scoreBoardService = sp.BuildScoreBoardService();              // Initializing ScoreBoard Service.
            scoreBoardService.GetAverageScoreByUser(cons.gameName, cons.userName, callBack);
        }

        //======================================{{{{************}}}}==========================================
        if (GUI.Button(new Rect(260, 250, 200, 30), "GetLastScoreByUser"))
        {
            scoreBoardService = sp.BuildScoreBoardService();              // Initializing ScoreBoard Service.
            scoreBoardService.GetLastScoreByUser(cons.gameName, cons.userName, callBack);
        }

        //======================================{{{{************}}}}==========================================
        if (GUI.Button(new Rect(470, 250, 200, 30), "GetTopRankings"))
        {
            scoreBoardService = sp.BuildScoreBoardService();              // Initializing ScoreBoard Service.
            scoreBoardService.GetTopRankings(cons.gameName, callBack);
        }

        //======================================{{{{************}}}}==========================================
        if (GUI.Button(new Rect(680, 250, 200, 30), "GetTopNRankings"))
        {
            scoreBoardService = sp.BuildScoreBoardService();              // Initializing ScoreBoard Service.
            scoreBoardService.GetTopNRankings(cons.gameName, max, callBack);
        }

        //======================================{{{{************}}}}==========================================
        if (GUI.Button(new Rect(890, 250, 200, 30), "GetTopNRankers"))
        {
            scoreBoardService = sp.BuildScoreBoardService();              // Initializing ScoreBoard Service.
            scoreBoardService.GetTopNRankers(cons.gameName, max, callBack);
        }

        //======================================{{{{************}}}}==========================================
        if (GUI.Button(new Rect(50, 300, 200, 30), "GetTopRankingsByGroup"))
        {
            scoreBoardService = sp.BuildScoreBoardService();              // Initializing ScoreBoard Service.
            IList <string> userList = new List <string> ();
            userList.Add(cons.userName);
            userList.Add(cons.userName1);
            scoreBoardService.GetTopRankingsByGroup(cons.gameName, userList, callBack);
        }

        //======================================{{{{************}}}}==========================================
        if (GUI.Button(new Rect(260, 300, 200, 30), "GetTopNRankersByGroup"))
        {
            scoreBoardService = sp.BuildScoreBoardService();              // Initializing ScoreBoard Service.
            IList <string> userList = new List <string> ();
            userList.Add(cons.userName);
            userList.Add(cons.userName1);
            scoreBoardService.GetTopNRankersByGroup(cons.gameName, userList, callBack);
        }

        //======================================{{{{************}}}}==========================================
        if (GUI.Button(new Rect(470, 300, 200, 30), "EditScoreValueById"))
        {
            scoreBoardService = sp.BuildScoreBoardService();              // Initializing ScoreBoard Service.
            IList <string> userList = new List <string> ();
            userList.Add(cons.userName);
            userList.Add(cons.userName1);
            scoreBoardService.EditScoreValueById(cons.scoreId, userScore, callBack);
        }
    }
示例#5
0
        public Results()
        {
            InitializeComponent();
            App42API.Initialize(Constants.API_KEY, Constants.SECRET_KEY);
            string gameName;

            if ((int)settings["trigger"] == 0)
            {
                gameName = "Bollywood_game";
            }
            else
            {
                gameName = "Hollywood_game";
            }


            new_xp = Global.findxp(Global.p1Score, Global.p2Score);
            dbConn = new SQLiteConnection(DB_PATH);

            var tpdata = dbConn.Query <Task>("select * from task where id='" + 1 + "'").FirstOrDefault();

            // Check result is empty or not
            if (tpdata == null)
            {
                MessageBox.Show("Title Not Present in DataBase");
            }
            else
            {
                scoreId = tpdata.ScoreId;
                prev_xp = Convert.ToDouble(tpdata.XP);
                pres_xp = new_xp + prev_xp;

                var tp = dbConn.Query <Task>("update task set XP='" + pres_xp + "' where Username = '******'").FirstOrDefault();
                // Update Database
                dbConn.Update(tp);
                level = Global.levelFromXP(pres_xp);
                switch (level)
                {
                case 1:
                    achievementName = "level_1";
                    break;

                case 2:
                    achievementName = "level_2";
                    break;

                case 3:
                    achievementName = "level_3";
                    break;

                case 4:
                    achievementName = "level_4";
                    break;
                }
            }

            scoreBoardService.SaveUserScore(gameName, Global.localUsername, Global.p1Score, this);

            scoreBoardService.EditScoreValueById(scoreId, pres_xp, this);

            achievementService.EarnAchievement(Global.localUsername, achievementName, "xp_game", "", this);
        }