/// <summary> /// When overridden in the derived class, initializes a <see cref="Grh"/> to display the information for an item. /// </summary> /// <param name="grh">The <see cref="Grh"/> to initialize (cannot be null).</param> /// <param name="itemInfo">The item information to be displayed. Can be null.</param> protected override void InitializeItemInfoSprite(Grh grh, IItemTable itemInfo) { if (itemInfo == null) { // Clear the sprite grh.SetGrh(null); } else { // Set the new sprite var newGD = GrhInfo.GetData(itemInfo.Graphic); grh.SetGrh(newGD); } }
/// <summary> /// Sets the icon for an animated <see cref="GrhData"/>. /// </summary> /// <param name="grhData">The <see cref="GrhData"/>.</param> void SetIconImageAnimated(GrhData grhData) { // If we have already created the Grh for animations, we just need to make sure we have the // correct GrhData set on it if (_animationGrh != null) { _animationGrh.SetGrh(grhData); return; } _animationGrh = new Grh(grhData, AnimType.Loop, TickCount.Now); _grhImageList.GetImageAsync(grhData.GetFrame(0), _asyncCallback, this); }
/// <summary> /// Sets the quick bar item's type and value. /// </summary> /// <param name="type">The <see cref="QuickBarItemType"/>.</param> /// <param name="value">The value.</param> public void SetQuickBar(QuickBarItemType type, int value) { // Check that at least one of the values are new if (type == QuickBarItemType && value == QuickBarItemValue) { return; } // Set the new values _quickBarItemType = type; _quickBarItemValue = value; // Clear some values _grh.SetGrh(null); _skillInfo = null; // Additional type-based handling switch (type) { case QuickBarItemType.Skill: _skillInfo = SkillInfoManager.Instance[(SkillType)QuickBarItemValue]; if (_skillInfo == null) { SetQuickBar(QuickBarItemType.None, 0); return; } _grh.SetGrh(_skillInfo.Icon, AnimType.Loop, TickCount.Now); if (_grh.GrhData == null) { SetQuickBar(QuickBarItemType.None, 0); return; } break; } }
/// <summary> /// Handles initialization of the GameScreen. This will be invoked after the GameScreen has been /// completely and successfully added to the ScreenManager. It is highly recommended that you /// use this instead of the constructor. This is invoked only once. /// </summary> public override void Initialize() { base.Initialize(); PlayMusic = false; // Create the background sprite _background = new Grh(); var bgGrhData = GrhInfo.GetData("Background", "menu"); if (bgGrhData != null) { _background.SetGrh(bgGrhData); } else { const string errmsg = "Failed to find menu background image for screen `{0}` - background will not be drawn."; if (log.IsErrorEnabled) { log.ErrorFormat(errmsg, this); } Debug.Fail(string.Format(errmsg, this)); } }
/// <summary> /// Sets up the <see cref="EmoticonDisplayInfo"/>. /// </summary> /// <param name="grhIndex">The <see cref="GrhIndex"/> of the emoticon.</param> /// <param name="currentTime">The current game time.</param> public void Initialize(GrhIndex grhIndex, TickCount currentTime) { _grh.SetGrh(grhIndex, AnimType.LoopOnce, currentTime); _initializeTime = currentTime; _isAlive = true; }