//------------------------------------------------------------------------------ // Constructor: ICAchievementSystem // Author: Neil Holmes // Summary: main constructor for the achievement display system //------------------------------------------------------------------------------ public ICAchievementSystem(Game game, GraphicsDeviceManager graphicsDeviceManager, ICELandaLib.CoAchievementGroup achievementGroup, ICAchievementPosition positionMode, ICAchievementScale scale) { // create a content manager to handle loading the textures we need ContentManager content = new ContentManager(game.Services); // store the graphics device for future reference this.graphicsDevice = game.GraphicsDevice; // store the achievement group this.achievementGroup = achievementGroup; // store the position mode that we are using this.positionMode = positionMode; // store the scale we are using if (scale == ICAchievementScale.normal) displayScale = 1.0f; else displayScale = 0.5f; // create a sprite batch for rendering spriteBatch = new SpriteBatch(graphicsDevice); // defulat display to false display = false; // load the achievement display textures badgeTexture = content.Load<Texture2D>(@"Content\ICAchievements\Badge"); bannerTexture = content.Load<Texture2D>(@"Content\ICAchievements\Shadow"); padlockTexture = content.Load<Texture2D>(@"Content\ICAchievements\Padlock"); // load the achievement font if (scale == ICAchievementScale.normal) { messageFont = content.Load<SpriteFont>(@"Content\ICAchievements\MessageFont"); valueFont = content.Load<SpriteFont>(@"Content\ICAchievements\ValueFont"); } else { messageFont = content.Load<SpriteFont>(@"Content\ICAchievements\MessageFontSmall"); valueFont = content.Load<SpriteFont>(@"Content\ICAchievements\ValueFontSmall"); } // calculate some constants for the display system badgeRect.Width = badgeRect.Height = (int)(badgeTexture.Width * displayScale); halfBadgeSize = badgeRect.Width / 2; }
//------------------------------------------------------------------------------ // Method: SetPositionMode // Author: Neil Holmes // Summary: allows user to set a different position mode after the initial setup //------------------------------------------------------------------------------ public void SetPositionMode(ICAchievementPosition positionMode) { this.positionMode = positionMode; }
//------------------------------------------------------------------------------ // Constructor: AchievementPopUp // Author: Neil Holmes // Summary: Constructor - prepares the achievement pop up system //------------------------------------------------------------------------------ public ICAchievementPopUp(Game game, GraphicsDeviceManager graphicsDeviceManager, ICAchievementPosition positionMode, ICAchievementScale scale) : base(game, graphicsDeviceManager, null, positionMode, scale) { // set the achievement display stage to 'idle' so nothing is displayed this.stage = AchievementStage.idle; // achievement pop-ups always have full brightness icons iconColor = Color.White; }