Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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;
                        }
                    }
                }
            }
        }
Exemplo n.º 3
0
 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();
 }
Exemplo n.º 4
0
 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();
 }
Exemplo n.º 5
0
 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);
 }
Exemplo n.º 6
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());
     }
 }
Exemplo n.º 7
0
 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());
     }
 }
Exemplo n.º 8
0
 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());
     }
 }
Exemplo n.º 9
0
 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());
     }
 }
Exemplo n.º 10
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());
            }
        }
Exemplo n.º 11
0
        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());
            }
        }
Exemplo n.º 12
0
        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());
            }
        }
Exemplo n.º 13
0
        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());
            }
        }
Exemplo n.º 14
0
        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());
            }
        }
Exemplo n.º 15
0
 public void LoadTool(GridBoxType type, string name, Texture2D text, Color color)
 {
     toolBox.LoadTool(type, name, text, color);
 }
Exemplo n.º 16
0
 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());
     }
 }
Exemplo n.º 17
0
 public void LoadTool(GridBoxType type, string name, Texture2D text, Color color)
 {
     toolBox.LoadTool(type, name, text, color);
 }
Exemplo n.º 18
0
        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;
                    }
                }
            }
        }
Exemplo n.º 19
0
 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);
 }