示例#1
0
		protected override void ResourceLoader ()
		{
			base.ResourceLoader ();

			for (int i = 0; i < Elements.Count; i ++)
				Console.WriteLine ("{0}: {1} '{2}' : {3}", i, Elements[i].Type, Elements[i].Text, Elements[i].Flags);

			Elements[VERSION_ELEMENT_INDEX].Text = "v" + Consts.Version;

			Elements[SINGLEPLAYER_ELEMENT_INDEX].Flags |= ElementFlags.RightAlignText | ElementFlags.CenterTextVert;

			Elements[SINGLEPLAYER_ELEMENT_INDEX].Activate +=
				delegate () {
					if (Game.Instance.IsBroodWar) {
						ShowGameModeDialog (UIScreenType.Login);
					}
					else {
						GuiUtil.PlaySound (mpq, Builtins.Mousedown2Wav);
						Game.Instance.SwitchToScreen (UIScreenType.Login);
					}
				};

			Elements[MULTIPLAYER_ELEMENT_INDEX].Activate +=
				delegate () {
					if (Game.Instance.IsBroodWar) {
						ShowGameModeDialog (UIScreenType.Connection);
					}
					else {
						GuiUtil.PlaySound (mpq, Builtins.Mousedown2Wav);
						Game.Instance.SwitchToScreen (UIScreenType.Connection);
					}
				};

			Elements[CAMPAIGNEDITOR_ELEMENT_INDEX].Activate +=
				delegate () {
					OkDialog d = new OkDialog (this, mpq,
								   "The campaign editor functionality is not available in SCSharp");
					ShowDialog (d);
				};

			Elements[INTRO_ELEMENT_INDEX].Activate +=
				delegate () {
					Cinematic introScreen = new Cinematic (mpq,
									       Game.Instance.IsBroodWar
									       ? "smk\\starXIntr.smk"
									       : "smk\\starintr.smk");
					introScreen.Finished += delegate () {
						Game.Instance.SwitchToScreen (this);
					};
					Game.Instance.SwitchToScreen (introScreen);
				};

			Elements[CREDITS_ELEMENT_INDEX].Activate += 
				delegate () {
					Game.Instance.SwitchToScreen (new CreditsScreen (mpq));
				};

			Elements[EXIT_ELEMENT_INDEX].Activate += 
				delegate () {
					Game.Instance.Quit ();
				};

			smkElements = new List<UIElement>();

			AddMovieElements (SINGLEPLAYER_ELEMENT_INDEX, "glue\\mainmenu\\Single.smk", "glue\\mainmenu\\SingleOn.smk", 50, 70, false);
			AddMovieElements (MULTIPLAYER_ELEMENT_INDEX, "glue\\mainmenu\\Multi.smk", "glue\\mainmenu\\MultiOn.smk", 20, 12, true);
			AddMovieElements (CAMPAIGNEDITOR_ELEMENT_INDEX, "glue\\mainmenu\\Editor.smk", "glue\\mainmenu\\EditorOn.smk", 20, 18, true);
			AddMovieElements (EXIT_ELEMENT_INDEX, "glue\\mainmenu\\Exit.smk", "glue\\mainmenu\\ExitOn.smk", 15, 0, true);

			smkPainter = new UIPainter (smkElements);
		}
示例#2
0
        protected override void ResourceLoader()
        {
            base.ResourceLoader();

            for (int i = 0; i < Elements.Count; i++)
            {
                Console.WriteLine("{0}: {1} '{2}' : {3}", i, Elements[i].Type, Elements[i].Text, Elements[i].Flags);
            }

            Elements[VERSION_ELEMENT_INDEX].Text = "v" + Consts.Version;

            Elements[SINGLEPLAYER_ELEMENT_INDEX].Flags |= ElementFlags.RightAlignText | ElementFlags.CenterTextVert;

            Elements[SINGLEPLAYER_ELEMENT_INDEX].Activate +=
                delegate() {
                if (Game.Instance.IsBroodWar)
                {
                    ShowGameModeDialog(UIScreenType.Login);
                }
                else
                {
                    GuiUtil.PlaySound(mpq, Builtins.Mousedown2Wav);
                    Game.Instance.SwitchToScreen(UIScreenType.Login);
                }
            };

            Elements[MULTIPLAYER_ELEMENT_INDEX].Activate +=
                delegate() {
                if (Game.Instance.IsBroodWar)
                {
                    ShowGameModeDialog(UIScreenType.Connection);
                }
                else
                {
                    GuiUtil.PlaySound(mpq, Builtins.Mousedown2Wav);
                    Game.Instance.SwitchToScreen(UIScreenType.Connection);
                }
            };

            Elements[CAMPAIGNEDITOR_ELEMENT_INDEX].Activate +=
                delegate() {
                OkDialog d = new OkDialog(this, mpq,
                                          "The campaign editor functionality is not available in SCSharp");
                ShowDialog(d);
            };

            Elements[INTRO_ELEMENT_INDEX].Activate +=
                delegate() {
                Cinematic introScreen = new Cinematic(mpq,
                                                      Game.Instance.IsBroodWar
                                                                               ? "smk\\starXIntr.smk"
                                                                               : "smk\\starintr.smk");
                introScreen.Finished += delegate() {
                    Game.Instance.SwitchToScreen(this);
                };
                Game.Instance.SwitchToScreen(introScreen);
            };

            Elements[CREDITS_ELEMENT_INDEX].Activate +=
                delegate() {
                Game.Instance.SwitchToScreen(new CreditsScreen(mpq));
            };

            Elements[EXIT_ELEMENT_INDEX].Activate +=
                delegate() {
                Game.Instance.Quit();
            };

            smkElements = new List <UIElement>();

            AddMovieElements(SINGLEPLAYER_ELEMENT_INDEX, "glue\\mainmenu\\Single.smk", "glue\\mainmenu\\SingleOn.smk", 50, 70, false);
            AddMovieElements(MULTIPLAYER_ELEMENT_INDEX, "glue\\mainmenu\\Multi.smk", "glue\\mainmenu\\MultiOn.smk", 20, 12, true);
            AddMovieElements(CAMPAIGNEDITOR_ELEMENT_INDEX, "glue\\mainmenu\\Editor.smk", "glue\\mainmenu\\EditorOn.smk", 20, 18, true);
            AddMovieElements(EXIT_ELEMENT_INDEX, "glue\\mainmenu\\Exit.smk", "glue\\mainmenu\\ExitOn.smk", 15, 0, true);

            smkPainter = new UIPainter(smkElements);
        }