public static void UpdateHelperText() { if (Systems.scene is WEScene == false) { return; } WEScene WEScene = (WEScene)Systems.scene; // Tile Tool Helper Text if (WETools.WETileTool != null) { WEPlaceholder ph = WETools.WETileTool.CurrentPlaceholder; if (ph.obj > 0) { // Object ID if (WEShadowTile.HelpText.ContainsKey(ph.obj)) { string[] help = WEShadowTile.HelpText[ph.obj]; WEScene.weUI.statusText.SetText(help[0], help[1]); return; } } } WEScene.weUI.statusText.ClearStatus(); }
public void DrawCurrentGridSquare() { // Draw Currently Slotted Item & Highlighted Grid Square (if not overlapping a UI component) if (UIComponent.ComponentWithFocus == null) { // Draw Temporary Function Tool (if active) if (WETools.WETempTool != null) { WETools.WETempTool.DrawWorldFuncTool(); } // Draw Function Tool (if active) else if (WETools.WEFuncTool != null) { WETools.WEFuncTool.DrawWorldFuncTool(); } // Draw Tile Tool (if active) else if (WETools.WETileTool != null) { WEPlaceholder ph = WETools.WETileTool.CurrentPlaceholder; // Draw Tile this.scene.DrawWorldTile(new byte[] { ph.tBase, ph.top, ph.topLay, ph.cover, ph.coverLay, ph.obj, 0 }, Cursor.MiniGridX * (byte)WorldmapEnum.TileWidth - Systems.camera.posX, Cursor.MiniGridY * (byte)WorldmapEnum.TileHeight - Systems.camera.posY); } } }
public void Draw() { // Only draw the scroll bar if there is a tile tool selected. if (WETools.WETileTool is WETileTool == false) { return; } byte tileHeight = (byte)WorldmapEnum.TileHeight + 2; // Draw Editor Scroller Background Systems.spriteBatch.Draw(Systems.tex2dWhite, new Rectangle(this.x, this.y, this.width, this.height), Color.DarkSlateGray); Systems.spriteBatch.Draw(Systems.tex2dWhite, new Rectangle(this.x + 2, this.y + 2, (byte)WorldmapEnum.TileWidth, this.height - 6), Color.White); // Grid Outline for (byte i = 1; i < (byte)WEScrollerEnum.NumTiles; i++) { Systems.spriteBatch.Draw(Systems.tex2dWhite, new Rectangle(this.x, this.y + i * tileHeight, this.width, 2), Color.DarkSlateGray); } // Draw WorldTileTool Subtype Buttons if (WETools.WETileTool is WETileTool) { List <WEPlaceholder[]> placeholders = WETools.WETileTool.placeholders; // Placeholder Loop WEPlaceholder[] pData = placeholders[WETools.WETileTool.index]; byte phSubLen = (byte)pData.Length; for (byte s = 0; s < phSubLen; s++) { WEPlaceholder ph = pData[s]; this.scene.DrawWorldTile(new byte[] { ph.tBase, ph.top, ph.topLay, ph.cover, ph.coverLay, ph.obj, ph.tNodeId }, this.x + 2, this.y + tileHeight * s + 2); } // Highlight the active color short my = (short)Snap.GridFloor(tileHeight, WETools.WETileTool.subIndex * tileHeight - this.y); //Systems.spriteBatch.Draw(Systems.tex2dDarkRed, new Rectangle(this.x, this.y + my * tileHeight, this.width, tileHeight), Color.White * 0.5f); UIHandler.atlas.DrawAdvanced("Small/Brush", this.x, this.y + my * tileHeight + 2, Color.White * 0.7f); } // Hovering Visual if (UIComponent.ComponentWithFocus is WEScroller) { short my = (short)Snap.GridFloor(tileHeight, Cursor.MouseY - this.y); //Systems.spriteBatch.Draw(Systems.tex2dDarkRed, new Rectangle(this.x, this.y + my * tileHeight, this.width, tileHeight), Color.White * 0.5f); UIHandler.atlas.Draw("Small/Brush", this.x, this.y + my * tileHeight + 2); } }
public void Draw() { byte tileWidth = (byte)WorldmapEnum.TileWidth + 2; // Draw Utility Bar Background Systems.spriteBatch.Draw(Systems.tex2dWhite, new Rectangle(this.x, this.y - 2, this.width, this.height + 2), Color.DarkSlateGray); Systems.spriteBatch.Draw(Systems.tex2dWhite, new Rectangle(this.x + 2, this.y, this.width - 2, this.height), Color.White); // Tile Outlines for (byte i = 0; i <= (byte)WEUtilityBarEnum.BarTiles; i++) { Systems.spriteBatch.Draw(Systems.tex2dWhite, new Rectangle(this.x + i * tileWidth, this.y, 2, this.height), Color.DarkSlateGray); } // World Tile Icons if (WETileTool.WorldTileToolMap.ContainsKey(WE_UI.curWESlotGroup)) { List <WEPlaceholder[]> placeholders = WETileTool.WorldTileToolMap[(byte)WE_UI.curWESlotGroup].placeholders; for (byte i = 0; i < placeholders.Count; i++) { WEPlaceholder ph = placeholders[i][0]; this.scene.DrawWorldTile(new byte[] { ph.tBase, ph.top, ph.topLay, ph.cover, ph.coverLay, ph.obj, 0 }, this.x + i * tileWidth + 2, this.y); } } // Draw Keybind Text for (byte i = 0; i < 10; i++) { Systems.fonts.baseText.Draw((i + 1).ToString(), this.x + i * tileWidth + 4, this.y + this.height - 18, Color.DarkOrange); } // Function Icons foreach (KeyValuePair <byte, WEFuncBut> button in this.buttonMap) { byte barIndex = button.Key; button.Value.DrawFunctionTile(this.x + barIndex * tileWidth + 2, this.y); } // Hovering Visual if (UIComponent.ComponentWithFocus is WEUtilityBar) { short mx = (short)Snap.GridFloor(tileWidth, Cursor.MouseX - this.x); Systems.spriteBatch.Draw(Systems.tex2dDarkRed, new Rectangle(this.x + mx * tileWidth, this.y, tileWidth, this.height), Color.White * 0.5f); } }
public static WETileTool GetWorldTileToolFromTileData(byte[] tileData) { Dictionary <byte, WETileTool> toolMap = WETileTool.WorldTileToolMap; // Standard byte tBase = tileData[0]; byte top = tileData[1]; byte topLay = tileData[2]; byte cover = tileData[3]; byte coverLay = tileData[4]; byte obj = tileData[5]; // Scan each entry in WorldTileToolMap. for (byte slotGroupNum = 0; slotGroupNum < 8; slotGroupNum++) { if (!toolMap.ContainsKey(slotGroupNum)) { continue; } List <WEPlaceholder[]> placeholders = toolMap[slotGroupNum].placeholders; // Loop through each placeholder to see if a tileData match is found. byte phLen = (byte)placeholders.Count; for (byte i = 0; i < phLen; i++) { WEPlaceholder[] pData = placeholders[i]; byte phSubLen = (byte)pData.Length; for (byte s = 0; s < phSubLen; s++) { WEPlaceholder ph = pData[s]; // If the tile is an Object: if (obj > 0) { if (ph.obj != obj) { continue; } } // If the tile is Terrain Cover: else if (cover > 0) { if (ph.cover != cover) { continue; } if (ph.auto == false) { continue; } } // If the tile is Top Layer: else if (top > 0) { if (ph.top != top) { continue; } if (ph.topLay != topLay) { continue; } } // If the tile is Base Layer only: else if (tBase > 0) { if (ph.tBase != tBase) { continue; } if (!ph.auto) { continue; } } // Any other results caught: else { throw new System.Exception("Unable to locate a potential match in WorldTileTool."); } // If the tileData[0] ID & SubType matches with the WorldTileTool placeholder, we've found a match. WETileTool clonedTool = toolMap[(byte)slotGroupNum]; // Set the default values for the tool. clonedTool.index = i; clonedTool.subIndex = s; clonedTool.subIndexSaves[i] = s; return(clonedTool); } } } return(null); }