예제 #1
0
 private void ReloadModelBttn_Click(object sender, EventArgs e)
 {
     DrawTimer.Dispose();
     ChangeTimer.Dispose();
     town.Dispose();
     Image busstop = Properties.Resources.p_BusStop /*@"p_BusStop.png"*/;
     Image passenger = Properties.Resources.p_Passenger/*(@"p_Passenger.png")*/;
     Image bus = Properties.Resources.p_Bus/*(@"p_Bus.png")*/;
     Image revolt = Properties.Resources.mark;
     town = new Town(Width, Height);
     draw = new DrawField(town);
     town.BusStops = new List<BusStop>();
     town.BusStops.Add(new BusStop(busstop.Width, busstop.Height, Width, Height));
     town.BusStops.Add(new BusStop(Width - busstop.Width * 2 - busstop.Width / 2, busstop.Height, Width, Height));
     town.BusStops.Add(new BusStop(busstop.Width, Height - busstop.Height - 50 - busstop.Height / 2, Width, Height));
     town.BusStops.Add(new BusStop(Width - busstop.Width * 2 - busstop.Width / 2, Height - busstop.Height - 50 - busstop.Height / 2, Width, Height));
     town.RandomBusesAndPassengers();
     draw = new DrawField(town, busstop, bus, passenger, revolt);
     DrawTimer.Start();
     ChangeTimer.Start();
 }
예제 #2
0
        /// <summary>
        /// Form closing
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void DecorationForm_FormClosed(object sender, FormClosedEventArgs e)
        {
            if (DrawTimer != null)
            {
                DrawTimer.Dispose();
            }
            DrawTimer = null;

            if (Batch != null)
            {
                Batch.Dispose();
            }
            Batch = null;

            if (BgTileSet != null)
            {
                BgTileSet.Dispose();
            }
            BgTileSet = null;

            if (DecorationSet != null)
            {
                DecorationSet.Dispose();
            }
            DecorationSet = null;

            if (ItemTileset != null)
            {
                ItemTileset.Dispose();
            }
            ItemTileset = null;

            if (OpenGLBox != null)
            {
                OpenGLBox.Dispose();
            }
            OpenGLBox = null;
        }