Пример #1
0
    void OnGUI()
    {
        if (Time.time % 2 < 1)
        {
            success = callBack.GetResult();
        }

        // For Setting Up ResponseBox.
        GUI.TextArea(new Rect(10, 5, 1100, 175), success);


        //======================================= Achievement Service======================================

        if (GUI.Button(new Rect(50, 200, 200, 30), "Create Achievement"))
        {
            App42Log.SetDebug(true);
            achievementService = sp.BuildAchievementService();             // Initializing Achievement Service.
            achievementService.CreateAchievement(cons.achievementName, cons.description, callBack);
        }

        //==================================== Achievement Service=========================================

        if (GUI.Button(new Rect(260, 200, 200, 30), "Earn Achievement"))
        {
            App42Log.SetDebug(true);
            achievementService = sp.BuildAchievementService();              // Initializing Achievement Service.
            achievementService.EarnAchievement(cons.userName, cons.achievementName, cons.gameName, cons.description, callBack);
        }

        //==================================== Achievement Service========================================

        if (GUI.Button(new Rect(470, 200, 200, 30), "GetAll Achievements ForUser"))
        {
            App42Log.SetDebug(true);
            achievementService = sp.BuildAchievementService();              // Initializing Achievement Service.
            achievementService.GetAllAchievementsForUser(cons.userName, callBack);
        }

        //===================================== Achievement Service=======================================

        if (GUI.Button(new Rect(680, 200, 200, 30), "GetAll Achievements ForUserInGame"))
        {
            App42Log.SetDebug(true);
            achievementService = sp.BuildAchievementService();              // Initializing Achievement Service.
            achievementService.GetAllAchievementsForUserInGame(cons.userName, cons.gameName, callBack);
        }

        //====================================== Achievement Service======================================

        if (GUI.Button(new Rect(890, 200, 200, 30), "GetAll Achievements"))
        {
            App42Log.SetDebug(true);
            achievementService = sp.BuildAchievementService();              // Initializing Achievement Service.
            achievementService.GetAllAchievements(callBack);
        }

        //====================================== Achievement Service======================================

        if (GUI.Button(new Rect(50, 250, 200, 30), "Get Achievement ByName"))
        {
            App42Log.SetDebug(true);
            achievementService = sp.BuildAchievementService();              // Initializing Achievement Service.
            achievementService.GetAchievementByName(cons.achievementName, callBack);
        }

        //======================================= Achievement Service=====================================

        if (GUI.Button(new Rect(260, 250, 200, 30), "GetUsers Achievement"))
        {
            App42Log.SetDebug(true);
            achievementService = sp.BuildAchievementService();              // Initializing Achievement Service.
            achievementService.GetUsersAchievement(cons.achievementName, cons.gameName, callBack);
        }
    }
Пример #2
0
    void OnGUI()
    {
        if (Time.time % 2 < 1) {
            success = callBack.GetResult ();
        }

        // For Setting Up ResponseBox.
        GUI.TextArea (new Rect (10, 5, 1100, 175), success);

        //======================================= Achievement Service======================================

        if (GUI.Button (new Rect (50, 200, 200, 30), "Create Achievement")) {
            App42Log.SetDebug(true);
            achievementService = sp.BuildAchievementService(); // Initializing Achievement Service.
            achievementService.CreateAchievement (cons.achievementName, cons.description, callBack);
        }

        //==================================== Achievement Service=========================================

        if (GUI.Button (new Rect (260, 200, 200, 30), "Earn Achievement")) {
            App42Log.SetDebug(true);
            achievementService = sp.BuildAchievementService (); // Initializing Achievement Service.
            achievementService.EarnAchievement (cons.userName, cons.achievementName, cons.gameName, cons.description, callBack);
        }

        //==================================== Achievement Service========================================

        if (GUI.Button (new Rect (470, 200, 200, 30), "GetAll Achievements ForUser")) {
            App42Log.SetDebug(true);
            achievementService = sp.BuildAchievementService (); // Initializing Achievement Service.
            achievementService.GetAllAchievementsForUser(cons.userName, callBack);
        }

        //===================================== Achievement Service=======================================

        if (GUI.Button (new Rect (680, 200, 200, 30), "GetAll Achievements ForUserInGame")) {
            App42Log.SetDebug(true);
            achievementService = sp.BuildAchievementService (); // Initializing Achievement Service.
            achievementService.GetAllAchievementsForUserInGame (cons.userName, cons.gameName, callBack);
        }

        //====================================== Achievement Service======================================

        if (GUI.Button (new Rect (890, 200, 200, 30), "GetAll Achievements")) {
            App42Log.SetDebug(true);
            achievementService = sp.BuildAchievementService (); // Initializing Achievement Service.
            achievementService.GetAllAchievements (callBack);
        }

        //====================================== Achievement Service======================================

        if (GUI.Button (new Rect (50, 250, 200, 30), "Get Achievement ByName")) {
            App42Log.SetDebug(true);
            achievementService = sp.BuildAchievementService (); // Initializing Achievement Service.
            achievementService.GetAchievementByName (cons.achievementName, callBack);
        }

        //======================================= Achievement Service=====================================

        if (GUI.Button (new Rect (260, 250, 200, 30), "GetUsers Achievement")) {
            App42Log.SetDebug(true);
            achievementService = sp.BuildAchievementService (); // Initializing Achievement Service.
            achievementService.GetUsersAchievement(cons.achievementName, cons.gameName, callBack);
        }
    }
Пример #3
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);
        }