Ejemplo n.º 1
0
        public void SetCrashPicture(string filename, string url, string folder)
        {
            if (crashPicture != null)
            {
                dialog.RemoveControl(crashPicture);
                crashPicture.Dispose();
                crashPicture = null;
                crashUrl     = null;
            }

            if (filename != null)
            {
                string path = Utility.FindMediaFile(filename, folder);
                crashPicture = dialog.AddPicture((int)CenterHudControlIds.CrashPicture, path, dialog.Width / 4, dialog.Height / 4, dialog.Width / 2, dialog.Height / 2);
                crashPicture.SourceRectangle = new System.Drawing.Rectangle(0, 0, 256, 256);
                crashPicture.IsVisible       = crashed;
                crashPicture.Click          += new EventHandler(crashPicture_Click);
                SetSize(Framework.Instance.Device.PresentationParameters.BackBufferWidth, Framework.Instance.Device.PresentationParameters.BackBufferHeight);
                crashUrl = url;
            }
        }
Ejemplo n.º 2
0
        public void Initialize()
        {
            dialog = new Dialog(Framework.Instance);
            dialog.SetFont(0, "Arial", 14, FontWeight.Normal);
            dialog.SetFont(1, "Arial", 28, FontWeight.Bold);

            captionText = dialog.AddStatic((int)CenterHudControlIds.Static, "Hello world", 0, dialog.Height - 50, dialog.Width, 22);
            Element e = captionText[0];

            e.FontIndex = 1;

            infoText           = dialog.AddStatic((int)CenterHudControlIds.Static, "", 5, 5, 630, 40);
            e                  = infoText[0];
            e.FontIndex        = 0;
            e.textFormat       = DrawTextFormat.Left;
            infoText.IsVisible = false;

            gameText     = dialog.AddStatic((int)CenterHudControlIds.Static, "", 150, 30, dialog.Width - 300, 60);
            e            = gameText[0];
            e.FontIndex  = 1;
            e.textFormat = DrawTextFormat.Center | DrawTextFormat.WordBreak;

            //crashPicture = dialog.AddPicture((int)CenterHudControlIds.CrashPicture, "/data/crash.png", dialog.Width / 4, dialog.Height / 4, dialog.Width / 2, dialog.Height / 2);
            //crashPicture.SourceRectangle = new System.Drawing.Rectangle(0, 0, 512, 512);
            //crashPicture.IsVisible = crashed;

#if LOGO
            if (Utility.MediaExists("/data/logo.png"))
            {
                logoPicture = dialog.AddPicture((int)CenterHudControlIds.LogoPicture, "/data/logo.png", dialog.Width - 100, dialog.Height - 60, 50, 28);
                logoPicture.SourceRectangle = new System.Drawing.Rectangle(0, 0, 128, 64);
            }
#endif

            messages.Add(AddStaticText(dialog.Height - 70));
            messages.Add(AddStaticText(dialog.Height - 50));
            messages.Add(AddStaticText(dialog.Height - 30));

            int y = 10;

            menuButton        = dialog.AddButton((int)CenterHudControlIds.MenuButton, "menu", 10, y += 30, 120, 21);
            menuButton.Click += new EventHandler(menuButton_Click);

            resetButton        = dialog.AddButton((int)CenterHudControlIds.ResetButton, "reset (ENTER)", 10, y += 30, 120, 21);
            resetButton.Click += new EventHandler(resetButton_Click);

            toggleSmokeButton        = dialog.AddButton((int)CenterHudControlIds.ToggleSmokeButton, "toggle smoke (S)", 10, y += 30, 120, 21);
            toggleSmokeButton.Click += new EventHandler(toggleSmokeButton_Click);

            viewButton        = dialog.AddButton((int)CenterHudControlIds.ViewButton, "change view (V)", 10, y += 30, 120, 21);
            viewButton.Click += new EventHandler(viewButton_Click);

            autozoomButton        = dialog.AddButton((int)CenterHudControlIds.AutozoomButton, "camera mode (B)", 10, y += 30, 120, 21);
            autozoomButton.Click += new EventHandler(autozoomButton_Click);

            zoomInButton        = dialog.AddButton((int)CenterHudControlIds.ZoomInButton, "zoom in (+)", 10, y += 30, 120, 21);
            zoomInButton.Click += new EventHandler(zoomInButton_Click);

            zoomOutButton        = dialog.AddButton((int)CenterHudControlIds.ZoomOutButton, "zoom out (-)", 10, y += 30, 120, 21);
            zoomOutButton.Click += new EventHandler(zoomOutButton_Click);

            gameRestartButton           = dialog.AddButton((int)CenterHudControlIds.GameRestartButton, "restart challenge", 10, 10, 120, 21);
            gameRestartButton.IsVisible = false;
            gameRestartButton.Click    += new EventHandler(gameRestartButton_Click);

            mapPicture = dialog.AddPicture((int)CenterHudControlIds.MapPicture, "data/scenery/default/map_1.png", 10, 10, 128, 128);
            mapPicture.SourceRectangle = new System.Drawing.Rectangle(0, 0, 128, 128);

            mapOverlay = dialog.AddPicture((int)CenterHudControlIds.MapOverlayPicture, "data/map_overlay.png", 10, 10, 128, 128);
            mapOverlay.SourceRectangle = new System.Drawing.Rectangle(0, 0, 128, 128);

            altituteText = dialog.AddStatic((int)CenterHudControlIds.AltitudeText, "alt: 0m", 10, 74, 128, 64);
            e            = altituteText[0];
            e.FontIndex  = 0;
            e.textFormat = DrawTextFormat.Center | DrawTextFormat.WordBreak;

            MapVisible = Convert.ToBoolean(Settings.GetValue("CompassVisible", "true"));

            Framework.Instance.Window.MouseMove += new System.Windows.Forms.MouseEventHandler(Window_MouseMove);
        }