public void LoadTool(GridBoxType type, string name, Texture2D texture, Color color) { Console.WriteLine("Now Loading " + name); Unit unit = new Unit(color, texture); Units.addUnit(type, name, unit); }
public void MouseAction(Point pos, MouseState state) { if (state.LeftButton == ButtonState.Pressed) { foreach (TabEntity tab in Tabs) { if (tab.Rect.Contains(pos)) { tab.IsSelected = true; currentTab = tab.Type; } else { tab.IsSelected = false; } } if (ToolTray.Rect.Contains(pos)) { foreach (ToolEntity tool in ToolTray.getTools(currentTab)) { if (tool.Rect.Contains(pos)) { tool.IsSelected = true; currentUnit = tool.Unit; } else { tool.IsSelected = false; } } } } }
public TabEntity(Rectangle rect, bool isSelected, bool isMouseover, GridBoxType type) { this.Rect = rect; this.IsSelected = isSelected; this.IsMouseover = isMouseover; this.type = type; TabTools = new Hashtable(); }
public GridEntity(Rectangle rect, GridBoxType type, GridStatus status, bool isSelected, bool isMouseover) { this.Rect = rect; this.IsMouseover = isMouseover; this.IsSelected = isSelected; this.type = type; this.status = status; color = new Color(0, 170, 0); }
public void AddTool(GridBoxType type, Unit unit, Rectangle rect) { switch (type) { case GridBoxType.Enemy: enemyTools.Add(new ToolEntity(unit, rect, false, false)); break; case GridBoxType.Landscape: landscapeTools.Add(new ToolEntity(unit, rect, false, false)); break; case GridBoxType.Obstruction: obstructionTools.Add(new ToolEntity(unit, rect, false, false)); break; default: throw new Exception("Undefined GridBoxType found when adding unit to Units list: " + type.ToString()); } }
public List<ToolEntity> getTools(GridBoxType type) { switch (type) { case GridBoxType.Enemy: return enemyTools; break; case GridBoxType.Landscape: return landscapeTools; break; case GridBoxType.Obstruction: return obstructionTools; break; default: throw new Exception("Undefined GridBoxType found when return unit to Units list: " + type.ToString()); } }
public int Count(GridBoxType gridType) { switch (gridType) { case GridBoxType.Enemy: return enemyTools.Count; break; case GridBoxType.Landscape: return landscapeTools.Count; break; case GridBoxType.Obstruction: return obstructionTools.Count; break; default: throw new Exception("Undefined GridBoxType found when adding unit to Units list: " + gridType.ToString()); } }
public void addUnit(GridBoxType gridType, string name, Unit unit) { switch (gridType) { case GridBoxType.Enemy: enemyTools[name] = unit; enemyNameList.Add(name); break; case GridBoxType.Landscape: landscapeTools[name] = unit; landscapeNameList.Add(name); break; case GridBoxType.Obstruction: obstructionTools[name] = unit; obstructionNameList.Add(name); break; default: throw new Exception("Undefined GridBoxType found when adding unit to Units list: " + gridType.ToString()); } }
public List <ToolEntity> getTools(GridBoxType type) { switch (type) { case GridBoxType.Enemy: return(enemyTools); break; case GridBoxType.Landscape: return(landscapeTools); break; case GridBoxType.Obstruction: return(obstructionTools); break; default: throw new Exception("Undefined GridBoxType found when return unit to Units list: " + type.ToString()); } }
public int Count(GridBoxType gridType) { switch (gridType) { case GridBoxType.Enemy: return(enemyTools.Count); break; case GridBoxType.Landscape: return(landscapeTools.Count); break; case GridBoxType.Obstruction: return(obstructionTools.Count); break; default: throw new Exception("Undefined GridBoxType found when adding unit to Units list: " + gridType.ToString()); } }
public Unit getUnit(GridBoxType gridType, string unitName) { switch (gridType) { case GridBoxType.Enemy: return((Unit)enemyTools[unitName]); break; case GridBoxType.Landscape: return((Unit)landscapeTools[unitName]); break; case GridBoxType.Obstruction: return((Unit)obstructionTools[unitName]); break; default: throw new Exception("Undefined GridBoxType found when adding unit to Units list: " + gridType.ToString()); } }
public void LoadTool(GridBoxType type, string name, Texture2D text, Color color) { toolBox.LoadTool(type, name, text, color); }
public Unit getUnit(GridBoxType gridType, string unitName) { switch (gridType) { case GridBoxType.Enemy: return (Unit) enemyTools[unitName]; break; case GridBoxType.Landscape: return (Unit) landscapeTools[unitName]; break; case GridBoxType.Obstruction: return (Unit)obstructionTools[unitName]; break; default: throw new Exception("Undefined GridBoxType found when adding unit to Units list: " + gridType.ToString()); } }
public void MouseAction(Point pos, MouseState state) { if (state.LeftButton == ButtonState.Pressed) { foreach (TabEntity tab in Tabs) { if (tab.Rect.Contains(pos)) { tab.IsSelected = true; currentTab = tab.Type; } else tab.IsSelected = false; } if (ToolTray.Rect.Contains(pos)) { foreach (ToolEntity tool in ToolTray.getTools(currentTab)) { if (tool.Rect.Contains(pos)) { tool.IsSelected = true; currentUnit = tool.Unit; } else tool.IsSelected = false; } } } }