//------------------------------------------------------------------------------ // Constructor: achievement // Author: Neil Holmes // Summary: Constructor - prepares the achievement data //------------------------------------------------------------------------------ public achievement(achievement rhs) { this.name = string.Copy(rhs.name); this.description = string.Copy(rhs.description); this.value = rhs.value; this.icon = rhs.icon; this.unlocked = rhs.unlocked; }
//------------------------------------------------------------------------------ // Method: Activate // Author: Neil Holmes // Summary: test function to make the achievement display //------------------------------------------------------------------------------ public void OnAchievementUnlocked(int userId, ICELandaLib.CoAchievement achievement) { int width; int heightPixels; achievement.Image.GetDimensions(out width, out heightPixels); Byte[] pixelData = (Byte[])achievement.Image.PixelData; Texture2D icon = new Texture2D(graphicsDevice, width, heightPixels, false, SurfaceFormat.Color); icon.SetData<Byte>(pixelData); achievement unlockedAchievement = new achievement(); unlockedAchievement.icon = icon; // testIcon; // testAchievements[0].icon; unlockedAchievement.name = String.Copy(achievement.Title); unlockedAchievement.description = String.Copy(achievement.Description); unlockedAchievement.value = (int)achievement.TrueValue; unlockedAchievement.unlocked = false; unlockedAchievements.Enqueue(unlockedAchievement); }