public void CloneTile(short gridX, short gridY) { RoomFormat roomData = this.levelContent.data.rooms[this.roomID]; Dictionary <string, Dictionary <string, ArrayList> > layerData = null; bool isObject = false; if (LevelContent.VerifyTiles(roomData.obj, gridX, gridY)) { layerData = roomData.obj; isObject = true; } else if (LevelContent.VerifyTiles(roomData.main, gridX, gridY)) { layerData = roomData.main; } else if (LevelContent.VerifyTiles(roomData.fg, gridX, gridY)) { layerData = roomData.fg; } else if (LevelContent.VerifyTiles(roomData.bg, gridX, gridY)) { layerData = roomData.bg; } // If no tile is cloned, set the current Function Tool to "Select" if (layerData == null) { FuncToolSelect selectFunc = (FuncToolSelect)FuncTool.funcToolMap[(byte)FuncToolEnum.Select]; EditorTools.SetFuncTool(selectFunc); selectFunc.ClearSelection(); return; } // Get the Object from the Highlighted Tile (Search Front to Back until a tile is identified) byte[] tileData = LevelContent.GetTileData(layerData, gridX, gridY); // Identify the tile, and set it as the current editing tool (if applicable) TileTool clonedTool = TileTool.GetTileToolFromTileData(tileData, isObject); if (clonedTool is TileTool == true) { byte subIndex = clonedTool.subIndex; // Need to save this value to avoid subIndexSaves[] tracking. EditorTools.SetTileTool(clonedTool, (byte)clonedTool.index); clonedTool.SetSubIndex(subIndex); } }
public static void SetTileToolBySlotGroup(byte slotGroup, byte index = 0) { // If the current slot group is being changed: if (EditorTools.tileTool == null || EditorTools.tileTool.slotGroup != slotGroup) { if (TileTool.tileToolMap.ContainsKey(slotGroup)) { TileTool tool = TileTool.tileToolMap[slotGroup]; if (tool == null) { return; } EditorTools.SetTileTool(tool, tool.index); } } // If the current slot group is the same, need to change the index only. else { TileTool tool = EditorTools.tileTool; EditorTools.SetTileTool(tool, index); } }