public void highlightTown(RowInfoInitializer tile) { if (tile.ID != currentlyHighlightedIndex) { if (currentlyHighlightedIndex >= 0) { for (int i = 0; i < transform.childCount; i++) { if (transform.GetChild(i).GetComponent <TileInfo>().ID == currentlyHighlightedIndex) { transform.GetChild(i).GetComponent <SpriteRenderer>().color = normal; transform.GetChild(i).localScale = new Vector3(7.0f, 7.0f, 1.0f); } } } for (int i = 0; i < transform.childCount; i++) { if (transform.GetChild(i).GetComponent <TileInfo>().ID == tile.ID) { transform.GetChild(i).GetComponent <SpriteRenderer>().color = highlighted; transform.GetChild(i).localScale = new Vector3(12.0f, 12.0f, 1.0f); currentlyHighlightedIndex = tile.ID; } } } }
private void rowClick(ref DataPool worldData, RowInfoInitializer rowInfo) { if (rowInfo.Type.Equals(RowInfo.Type.Region)) { loadRegion(rowInfo.ID); listController.addRows(MapMenuUtils.generateTownRowInfos(rowInfo.ID, ref worldData)); listController.focusOnList(); } }
private void highlightSelection(RowInfoInitializer tile) { if (tile.Type.Equals(RowInfo.Type.Region)) { regionDrawer.highlightRegion(tile); } else if (tile.Type.Equals(RowInfo.Type.Town)) { topLayer.highlightTown(tile); } }
public void resolveSelection() { if (state.Equals(ListState.Focused)) { RowInfoInitializer infoInitializer = getSelectedRow(); if (infoInitializer.ID == -1) { focusOnList(); } } }
public static List <RowInfoInitializer> generateRegionRowInfos(ref DataPool worldData) { List <RowInfoInitializer> rowInfos = new List <RowInfoInitializer>(); for (int i = 0; i < worldData.Regions.Count; i++) { RowInfoInitializer info = new RowInfoInitializer( RowInfo.Type.Region, i, worldData.Regions[i].Position, worldData.Regions[i].Name); rowInfos.Add(info); } return(rowInfos); }
public static List <RowInfoInitializer> generateTownRowInfos(int regionId, ref DataPool worldData) { List <RowInfoInitializer> rowInfos = new List <RowInfoInitializer>(); foreach (int index in worldData.Regions[regionId].getRegionsTownIndexes()) { RowInfoInitializer infoInitializer = new RowInfoInitializer( RowInfo.Type.Town, index, worldData.Towns[index].Location, worldData.Towns[index].Name); rowInfos.Add(infoInitializer); } return(rowInfos); }
private void constructAndSendJob(RowInfoInitializer rowInfo) { if (rowInfo.Type.Equals(RowInfo.Type.Region)) { //infoLayer.sendJob(new InfoLayerJob(InfoLayerJob.InfoJob.RegionPreview, rowInfo.ID)); mapMenu.setCursorTarget(rowInfo); } else if (rowInfo.Type.Equals(RowInfo.Type.Town)) { infoLayer.sendJob(new InfoLayerJob(InfoLayerJob.InfoJob.TownPreview, rowInfo.ID)); mapMenu.setCursorTarget(rowInfo); } }
private void handleListControllers() { if (listController.State.Equals(ListController.ListState.Clicked)) { RowInfoInitializer rowInfo = listController.getSelectedRow(); if (rowInfo.ID >= 0) { rowClick(ref worldData, rowInfo); } listController.acknowledgeClick(); } listController.resolveSelection(); }
private void checkHoverTile(InfoLayerJob.InfoJob job) { RowInfoInitializer tile = getCurrentTile(); if (tile.ID >= 0) { infoLayer.sendJob(new InfoLayerJob(job, tile.ID)); highlightSelection(tile); } else { infoLayer.sendJob(new InfoLayerJob(InfoLayerJob.InfoJob.Clear, 0)); } }
public void setCursorTarget(RowInfoInitializer rowInfo) { if (rowInfo.Type.Equals(RowInfo.Type.Region)) { cursor.setTarget(new Vector3(rowInfo.Position.x / 2.0f, rowInfo.Position.y / 2.0f, -6.0f)); } else if (rowInfo.Type.Equals(RowInfo.Type.Town)) { Vector3 pos = new Vector3((rowInfo.Position.x + terrainDrawer.XOffset) / 30.0f, (rowInfo.Position.y + terrainDrawer.YOffset) / 30.0f, -6.0f); cursor.setTarget(pos); } }
public void highlightRegion(RowInfoInitializer tile) { int index = determineIndex((int)tile.Position.x, (int)tile.Position.y); if (index != currentHighlightedIndex) { if (currentHighlightedIndex >= 0) { transform.GetChild(currentHighlightedIndex).GetComponent <SpriteRenderer>().color = normal; } transform.GetChild(index).GetComponent <SpriteRenderer>().color = highlighted; currentHighlightedIndex = index; } }
public void addRow(RowInfoInitializer info) { Transform tile = Instantiate(rowOptions[rowColour], new Vector3(0.0f, 0.0f), Quaternion.identity) as Transform; tile.GetComponent <Button>().onClick.AddListener(rowClick); tile.GetComponent <RowInfo>().type = info.Type; tile.GetComponent <RowInfo>().id = info.ID; tile.GetComponent <RowInfo>().position = info.Position; tile.GetComponent <RowInfo>().text = info.Text; tile.GetChild(0).GetComponent <TMPro.TextMeshProUGUI>().text = info.Text; tile.SetParent(content); currentList.Add(info); tile.localScale = new Vector3(1.0f, 1.0f, 1.0f); }
private void checkHoverTile(InfoLayerJob.InfoJob job) { RowInfoInitializer rowInfo = mapMenu.getCurrentTile(); if (rowInfo != null) { if (rowInfo.ID >= 0) { //infoLayer.sendJob(new InfoLayerJob(job, rowInfo.ID)); } } else { //infoLayer.sendJob(new InfoLayerJob(InfoLayerJob.InfoJob.Clear, 0)); } }