Exemplo n.º 1
0
        public Tile addTile(string tileName)
        {
            Tile t = new Tile(tileName, content);
               tiles.Add(t);

               return t;
        }
Exemplo n.º 2
0
 private void duplicateTile()
 {
     if (getTileAtMouse() != null)
      {
     xnaContext.placeTile(currTile);
     currTile = xnaContext.addTile(currTile.type);
      }
 }
Exemplo n.º 3
0
        //This function should be called when placing a tile. It will overwrite
        // Anything that currently occupies that position.
        public void placeTile(Tile entry)
        {
            int latestIndex = tiles.IndexOf(entry);

            if (entry == null)
            {
                return;
            }
               /* for (int i = currentState; i < 11; i++)
            {
                states[i].Clear();
            }*/
            if (currentState == 11)
            {
                states.RemoveAt(0);
                states.Add(new List<Tile>());
                currentState--;
            }
            else if (currentState == states.Count)
            {
                states.Add(new List<Tile>());
            }
            states[currentState].Clear();
            foreach (Tile t in tiles)
            {
                if (tiles.IndexOf(t) != latestIndex)
                {
                    states[currentState].Add(t);
                }
            }
            currentState++;

            foreach (Tile current in tiles)
            {
                if (current.pos == entry.pos && tiles.IndexOf(current) != latestIndex)
                {
                    tiles.Remove(current);
                    break;
                }
            }
        }
Exemplo n.º 4
0
 public void removeTile(Tile currTile)
 {
     foreach (Tile t in tiles)
        {
       if (t.Equals(currTile))
       {
          tiles.Remove(currTile);
          break;
       }
        }
 }
Exemplo n.º 5
0
        private void frownyButton_Click(object sender, EventArgs e)
        {
            currTile = xnaContext.addTile("frowny");
             // xnaContext.undo();

             // Set XNA context to focus so that duplication works
             this.xnaContext.Focus();
        }
Exemplo n.º 6
0
        void xnaContext_KeyUp(object sender, KeyEventArgs e)
        {
            int DELETE_KEY = 46;

             if (e.KeyValue == DELETE_KEY)
             {
            xnaContext.removeTile(currTile);
            currTile = null;
             }
        }
Exemplo n.º 7
0
        private void xnaContext_Click(object sender, System.EventArgs e)
        {
            if (currTile == null)
             {
            currTile = getTileAtMouse();
             }
             else
             {
            xnaContext.placeTile(currTile);
            currTile = null;
             }

             this.xnaContext.Focus();
        }
Exemplo n.º 8
0
        private void tileSelector_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (this.tileSelection.SelectedIndex != -1)
             {
            String selected = ((TileTypes)this.tileSelection.SelectedItem).FileName;

            currTile = this.xnaContext.addTile(selected);
             }
        }