Exemplo n.º 1
0
        /// <summary>
        /// Determines whether the target object satisfiy the specification.
        /// </summary>
        /// <param name="target">The target object to be validated.</param>
        /// <returns><c>true</c> if this instance is satisfied by the specified target; otherwise, <c>false</c>.</returns>
        public override bool IsSatisfiedBy(Achievement target)
        {
            var achievementService           = new AchievementService();
            var otherAchievementWithSameName = achievementService.GetAchievementByName(target.Name);

            if (otherAchievementWithSameName != null && otherAchievementWithSameName != target)
            {
                NotSatisfiedReason = "There is another Achievement with the name '{0}'. Achievements should have unique name.".With(target.Name);
                return(false);
            }

            return(true);
        }
Exemplo n.º 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);
        }
    }
Exemplo n.º 3
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);
        }
    }
Exemplo n.º 4
0
 /// <summary>
 /// Gets the achievement by name.
 /// </summary>
 /// <returns>The achievement</returns>
 /// <param name="name">The name.</param>
 public Achievement GetAchievementByName(string name)
 {
     return(m_service.GetAchievementByName(name));
 }