Пример #1
0
        // Constructor
        public GamePage()
        {
            // Create the XAML defined components
            InitializeComponent();

            // set singleton
            gamePage = this;

            // create rest client
            restCommand = new RestCommand();

            // Load Various Images
            LoadImages();

            // Load Zones
            LoadZones();

            // Initialize the state
            mapState.x = startX;
            mapState.y = startY;
            mapState.vx = mapState.vy = 0.0;

            mouseState.mouseOrigin = null;
            mouseState.mouseDown = false;
            mouseState.selectedZone = null;

            // Copy the original size and zoom out. Default to zoomed out.
            mapState.OriginalSizeX = MapWidth;
            mapState.OriginalSizeY = MapHeight;
            mapState.scaleDown = canvas.ActualHeight / mapState.OriginalSizeY; // used for all the scaling
            mapState.scaleUp = mapState.OriginalSizeY / canvas.ActualHeight; // used for all the scaling
            mapState.zoomed = false;

            zoomScreen(mapState.zoomed);

            // Start the tick
            tick = new DispatcherTimer();
            tick.Interval = new TimeSpan(500);
            tick.Tick += tick_Tick;
            tick.Start();
        }