// ------------------------------------------------------------------ // Public // ------------------------------------------------------------------ public override void DrawContents() { Sprite icon = Action == null ? null : Action.Icon; if (icon != null) { var drawParameters = DrawParameters.Default; if (!Enabled) { drawParameters.Transform = ColorTransform.BlackAndWhite; drawParameters.Transform.ColorOffset = new Color(0.2f, 0.2f, 0.2f, 0f); } drawParameters.Scale = new Vector2(SIZE / icon.rect.width, SIZE / icon.rect.height); SmartUI.Draw(0, 0, icon, drawParameters); } if (Action != null) { if (Action.Type == ActionType.Spell) { var style = CoM.SubtextStyle; style.alignment = TextAnchor.LowerCenter; string costString = Action.Spell.CostFor(CoM.Party.Selected).ToString(); Rect rect = ContentsFrame; rect.height -= 4; SmartUI.TextWithShadow(rect, costString, style, 1); } } }
/** * Draw label with potential dropshadow */ public override void Draw() { SmartUI.Color = Color; if (EnableBackground) { SmartUI.Draw(Bounds, Style); } SmartUI.Color = Color.white; if (FauxEdge) { // SmartUI has quite slow shadowing as it has to go in an modify all the color codes. So I use my own cached one here. SmartUI.Text(ContentsBounds.Translated(new Vector2(ShadowDistance, ShadowDistance)), shadowCaption, Style); SmartUI.Text(ContentsBounds.Translated(new Vector2(-ShadowDistance, ShadowDistance)), shadowCaption, Style); SmartUI.Text(ContentsBounds.Translated(new Vector2(-ShadowDistance, -ShadowDistance)), shadowCaption, Style); SmartUI.Text(ContentsBounds.Translated(new Vector2(ShadowDistance, -ShadowDistance)), shadowCaption, Style); SmartUI.Text(ContentsBounds, colorisedCaption, Style); } else if (DropShadow) { // SmartUI has quite slow shadowing as it has to go in an modify all the color codes. So I use my own cached one here. SmartUI.Text(ContentsBounds.Translated(new Vector2(ShadowDistance, ShadowDistance)), shadowCaption, Style); SmartUI.Text(ContentsBounds, colorisedCaption, Style); } else { SmartUI.Text(ContentsBounds, colorisedCaption, Style); } SmartUI.Color = Color.white; }
protected virtual void drawOverlay() { if (OverlaySprite != null) { SmartUI.Draw(X, Y, OverlaySprite); } }
/** * Draws this item's representation */ public override void Draw() { Engine.PerformanceStatsInProgress.GuiUpdates++; if (ItemInstance != null) { var item = ItemInstance.Item; Sprite icon = CoM.Instance.ItemIconSprites[item.IconID]; DrawParameters dp = DrawParameters.Default; int offsetX = (int)((Width) - icon.rect.width) / 2; int offsetY = (int)((Height) - icon.rect.height) / 2; SmartUI.Color = Color; dp.Transform = ColorTransform; if (BeingDragged || !Enabled) { SmartUI.Color = Color.gray; dp = DrawParameters.BlackAndWhite; } SmartUI.Draw(X + offsetX, Y + offsetY, icon, dp); SmartUI.Color = Color.white; if (ItemInstance.Item.Usable) { GUIStyle myStyle = CoM.SubtextStyle; myStyle.alignment = TextAnchor.LowerLeft; SmartUI.TextWithShadow(new Rect(X + offsetX + 2, Y + offsetY, 40, 35), ItemInstance.RemainingCharges.ToString(), myStyle, 1); } } }
/** Draw the selected image */ public override void DrawContents() { if (Pictures != null) { SmartUI.Draw((this.ContentsBounds.width - Pictures[SelectedIndex].Sprite.rect.width) / 2, 0, Pictures[SelectedIndex].Sprite); } base.DrawContents(); }
public override void Draw() { Trace.Log("Draw"); if (Spell != null) { SmartUI.Draw(Bounds, Spell.Icon); } }
/** Draws the slot. */ protected virtual void drawSlot() { var sprite = IsEmpty ? EmptySlotSprite : (FullSlotSprite ?? EmptySlotSprite); if (sprite != null) { SmartUI.Draw(X, Y, sprite); } }
public override void Draw() { base.Draw(); var overlaySprite = isCurrent ? OVERLAY_SELECTED : OVERLAY_STANDARD; if (overlaySprite != null) { SmartUI.Draw(X - 2, Y - 2, overlaySprite); } }
/** Draws the indicator under the object */ protected virtual void drawIndicator() { if (IndicatorColor != Color.clear) { var backgroundSprite = ResourceManager.GetSprite("Icons/SlotInlay"); SmartUI.PushAndSetColor(IndicatorColor); SmartUI.Draw(X, Y, backgroundSprite); SmartUI.PopColor(); } }
/** If there is a party then draws the party icon at the correct orientation */ private void DrawParty() { if (Party == null) { return; } Vector2 location = TileToScreen(Party.LocationX, Party.LocationY); Sprite partyIcon = MapIcons[PARTY_DIRECTION_ICON + Party.Facing.Sector]; SmartUI.Draw(location.x, location.y, partyIcon); }
/** Draw the map */ public override void DrawContents() { if (Map == null) { return; } if (Dirty) { RenderMap(); } // calculate our offset if (TrackParty && (Party != null)) { MapDisplayOffset.x = MAP_FRAME + (int)((Party.LocationX) * TILE_SIZE - Width / 2); MapDisplayOffset.y = MAP_FRAME + (int)((30 - Party.LocationY + 1.5f) * TILE_SIZE - Height / 2); } else { MapDisplayOffset.Set(0.0f, 0.0f); } if (Background != null) { if (Mode == MapMode.Small) { Background.X = (-Party.LocationX + 5 - BACKGROUND_BORDER) * TILE_SIZE; Background.Y = (Party.LocationY - 32 + 6 - BACKGROUND_BORDER) * TILE_SIZE; } else { Background.X = 0; Background.Y = 0; } Background.Draw(); } Rect textureRect = new Rect(MapDisplayOffset.x, (MapCanvas.height - Height - MapDisplayOffset.y), Width, Height); SmartUI.Color = new Color(0.8f, 0.8f, 0.8f); SmartUI.Draw(new Rect(0, 0, Width, Height), MapCanvas, textureRect, DrawParameters.Default); DrawParty(); }
/** Draws the sprite */ public override void DrawContents() { if (Sprite != null) { DrawParameters dp = GetDrawParameters; dp.AlphaBlend = AlphaBlend; dp.Scale = new Vector2(ContentsFrame.width / Sprite.rect.width, ContentsFrame.height / Sprite.rect.height); dp.Rotation = Rotation; if (!ImageColorTransform.IsIdentity) { dp.Transform = dp.Transform + ImageColorTransform; } SmartUI.Color = Color * ImageColor; SmartUI.Draw(0, 0, Sprite, dp); SmartUI.Color = Color.white; } }
// ---------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------- /** Draw an item type indicator on slots that are restricted by type */ public override void DrawContents() { // Sometimes the contents is changed but no update was called inbetween so we make sure the changes // are in sync now. if (_dirty) { Apply(); } if (DataLink != null) { if ((ItemRestriction != ItemLocation.Any) && DataLink.IsEmpty) { int iconID = MDRItem.GetSpriteForItemLocation(ItemRestriction); Sprite icon = (iconID >= 0) ? CoM.Instance.ItemIconSprites[iconID] : null; if (icon) { var dp = DrawParameters.BlackAndWhite; SmartUI.Color = new Color(0.35f, 0.35f, 0.35f, 0.75f); SmartUI.Draw(6, 6, icon, dp); SmartUI.Color = Color.white; } } // draw paired item if required. if (DataLink.PairedSlot != null) { if ((!DataLink.PairedSlot.IsEmpty) && (DataLink.PairedSlot.ItemInstance.Item.Hands == 2)) { var dp = DrawParameters.BlackAndWhite; SmartUI.DrawFillRect(new Rect(3, 3, Width - 6, Height - 6), new Color(0.1f, 0.1f, 0.1f, 0.9f)); SmartUI.Color = new Color(0.35f, 0.35f, 0.35f, 0.75f); SmartUI.Draw(6, 6, DataLink.PairedSlot.ItemInstance.Item.Icon, dp); SmartUI.Color = Color.white; } } } base.DrawContents(); }
public override void Draw() { if (CompositeAlpha <= 0f) { return; } if (hasRenderTexture && SmartUI.isRepaint && !forceStandardDraw) { // setup for render texture draw var dp = (CacheMode == CacheMode.Solid) ? DrawParameters.NoAlpha : DrawParameters.Default; dp.Transform = CompositeColorTransform; if (repaintedTextureThisFrame && Settings.Advanced.ShowCacheRenders) { dp = new DrawParameters(ColorTransform.TintAndMultiply(Color.red, Color.gray)); } if (CompositeAlpha < 1f) { var colorOffset = dp.Transform.ColorOffset; colorOffset[3] = ((1f - colorOffset[3]) * CompositeAlpha) - 1f; dp.Transform.ColorOffset = colorOffset; dp.AlphaBlend = true; } SmartUI.Draw(Bounds, compositeRenderTexture, new Rect(0, 0, compositeRenderTexture.width, compositeRenderTexture.height), dp); } else { if (hasBackgroundChildren) { SmartUI.BeginGroup(Bounds, false); DrawChildren(-1); SmartUI.EndGroup(); } base.Draw(); } }
/** Draws the panel */ protected override void DrawBackground() { SmartUI.Color = Color; SmartUI.Draw(new Rect(X, Y, Width, Height), Style); SmartUI.Color = Color.white; }
public override void DrawContents() { SmartUI.Draw(Frame, slotGraphic); }