예제 #1
0
        private void portalList_SelectedIndexChanged(object sender, EventArgs e)
        {
            selectedPortal.name = null;
            selectedPortal.x = -1;
            selectedPortal.y = -1;
            selectedLandingSpot.X = -1;
            selectedLandingSpot.Y = -1;

            if (portalList.SelectedItem != null)
            {
                //selectedLandingSpot.X = int.Parse(.SubItems[0].Text);
                //selectedLandingSpot.Y = int.Parse(((ListViewItem)portalList.SelectedItem).SubItems[1].Text);

                foreach (PortalDestination dest in GLB_Data.destinations)
                {
                    if (dest.name == ((ListViewItem)portalList.SelectedItem).Text)
                    {
                        selectedPortal = dest.destinationPortal;

                        selectedLandingSpot.X = dest.x;
                        selectedLandingSpot.Y = dest.y;
                    }
                }

            }

            parentForm.goldenTile.grid_location.X = int.Parse(((ListViewItem)portalList.SelectedItem).SubItems[1].Text);
            parentForm.goldenTile.grid_location.Y = int.Parse(((ListViewItem)portalList.SelectedItem).SubItems[2].Text);

            this.Refresh();
        }
예제 #2
0
        private void PortalPaint(object sender, MouseEventArgs e)
        {
            XNA.Point selected_tile = HelperClass.TileSnapToGrid(Camera.WorldPosition(e.Location));
            Tile tile_in_map = GLB_Data.TileMap[0, selected_tile.X, selected_tile.Y];

            Portal portal = new Portal();
            portal.x = tile_in_map.grid_location.X;
            portal.y = tile_in_map.grid_location.Y;
            portal.name = "P" + GLB_Data.portalIndex;

            bool portalFound = false;
            Portal deadPortal = new Portal();

            foreach (Portal p in GLB_Data.portals)
            {
                if (portal.x == p.x && portal.y == p.y)
                {
                    portalFound = true;
                    deadPortal = p;
                }
            }

            if (portalFound)
            {
                GLB_Data.portals.Remove(deadPortal);
            }
            else
            {
                GLB_Data.portals.Add(portal);
                GLB_Data.portalIndex++;
            }
        }