Example #1
0
        internal IngameMenuWindow(Race setRace)
        {
            curRace = setRace;
             LevelGameScreen.Game.GamePaused = true;

             BackgroundColor = new Microsoft.Xna.Framework.Color (0.3f, 0.0f, 0.0f, 0.5f);

             //Width = background.Width;
             //Height = background.Height;

             UIResource res = WarFile.GetUIResource(setRace == Race.Humans ? 368 : 369);

             background = new UIImage(WWTexture.FromImageResource(WarFile.GetImageResource(res.BackgroundImageResourceIndex)));
             background.InitWithUIResource (res);
             AddComponent (background);

             background.X = 120;
             background.Y = 20;

             continueButton = (UIButton)background.Components [6];
             continueButton.OnMouseUpInside += closeButton_OnMouseUpInside;

             quitButton = (UIButton)background.Components [5];
             quitButton.OnMouseUpInside += quitButton_OnMouseUpInside;

             MouseCursor.State = MouseCursorState.Pointer;
        }
Example #2
0
        internal IngameQuitMenuWindow(Race setRace)
        {
            UIResource res = WarFile.GetUIResource(setRace == Race.Humans ? 391 : 392);

             background = new UIImage(WWTexture.FromImageResource(WarFile.GetImageResource(res.BackgroundImageResourceIndex)));
             background.InitWithUIResource (res);
             AddComponent (background);

             background.CenterOnScreen();

             cancelButton = (UIButton)background.Components [3];
             cancelButton.OnMouseUpInside += cancelButton_OnMouseUpInside;

             menuButton = (UIButton)background.Components [2];
             menuButton.OnMouseUpInside += menuButton_OnMouseUpInside;

             quitButton = (UIButton)background.Components [1];
             quitButton.OnMouseUpInside += quitButton_OnMouseUpInside;

             MouseCursor.State = MouseCursorState.Pointer;
        }
Example #3
0
        internal void InitWithUIResource(UIResource resource)
        {
            ClearComponents();

             for (int i = 0; i < resource.Labels.Count; i++)
             {
            WinWarCS.Data.Resources.UIResource.UIEntry me = resource.Labels[i];

            UILabel label = new UILabel(me.Text);
            label.X = (int)me.X;
            label.Y = (int)me.Y;
            label.TextAlign = (TextAlignHorizontal)me.Alignment;
            AddComponent(label);
             }

             for (int i = 0; i < resource.Elements.Count; i++)
             {
            WinWarCS.Data.Resources.UIResource.UIEntry me = resource.Elements[i];

            if (me.Type == UIResource.UIEntryType.ValueList)
            {
               UILabel lbl = new UILabel(me.Values[0]);
               lbl.X = (int)(me.X);
               lbl.Y = (int)(me.Y);
               lbl.TextAlign = (TextAlignHorizontal)me.Alignment;
               AddComponent(lbl);
            }
            else
            {
               UIButton btn = new UIButton(me.Text, me.ButtonReleasedResourceIndex, me.ButtonPressedResourceIndex);
               btn.X = (int)(me.X);
               btn.Y = (int)(me.Y);
               AddComponent(btn);
            }
             }
        }
Example #4
0
        private void InitUI()
        {
            ClearComponents ();

             MapControl = new UIMapControl();
             MapControl.OnSelectedEntitiesChanged += HandleOnSelectedEntitiesChanged;
             AddComponent (MapControl);

             EntityControl = new UIEntityControl(LevelGameScreen.Game.UIRace);
             MinimapControl = new UIMinimapControl(MapControl);

             LoadUIImage (ref leftSidebarTop, "Sidebar Left Minimap Black (" + LevelGameScreen.Game.UIRace + ")");
             LoadUIImage (ref leftSidebar, "Sidebar Left (" + LevelGameScreen.Game.UIRace + ")");
             leftSidebar.Y = leftSidebarTop.Height;

             LoadUIImage (ref topBar, "Topbar (" + LevelGameScreen.Game.UIRace + ")");
             LoadUIImage (ref bottomBar, "Lower Bar (" + LevelGameScreen.Game.UIRace + ")");

             topBar.X = leftSidebarTop.Width;
             bottomBar.X = leftSidebar.Width;
             bottomBar.Y = 200 - bottomBar.Height;

             LoadUIImage (ref rightBar, "Sidebar Right (" + LevelGameScreen.Game.UIRace + ")");
             rightBar.X = 320 - rightBar.Width;

             MapControl.X = leftSidebarTop.Width;
             MapControl.Y = topBar.Height;
             MapControl.Width = rightBar.X - MapControl.X;
             MapControl.Height = bottomBar.Y - MapControl.Y;

             MinimapControl.X = 3;
             MinimapControl.Y = 6;
             MinimapControl.Width = 64;
             MinimapControl.Height = 64;
             MinimapControl.BackgroundColor = Color.AliceBlue;
             MinimapControl.Init ();

             menuButton = new UIButton ("", WarFile.KnowledgeBase.IndexByName("Menu Button"), WarFile.KnowledgeBase.IndexByName("Menu Button (Pressed)"));
             menuButton.X = leftSidebar.Width / 2 - menuButton.Width / 2 - 1;
             menuButton.Y = leftSidebarTop.Height + leftSidebar.Height - menuButton.Height - 1;
             menuButton.OnMouseUpInside += menuButton_OnMouseUpInside;
             AddComponent (menuButton);

             EntityControl.X = 2;
             EntityControl.Y = MinimapControl.Y + MinimapControl.Height + 2;
             EntityControl.Width = 64;
             EntityControl.Height = MainGame.OriginalAppHeight - EntityControl.Y - menuButton.Height - 2;

             lumberLabel = new UILabel ("Lumber:");
             lumberLabel.X = 95;
             lumberLabel.Y = 0;
             lumberLabel.Width = 72;
             lumberLabel.Height = 10;
             lumberLabel.TextAlign = TextAlignHorizontal.Left;
             AddComponent (lumberLabel);

             lumberValueLabel = new UILabel ("1000");
             lumberValueLabel.X = 95;
             lumberValueLabel.Y = 0;
             lumberValueLabel.Width = 72;
             lumberValueLabel.Height = 10;
             lumberValueLabel.TextAlign = TextAlignHorizontal.Right;
             AddComponent (lumberValueLabel);

             goldLabel = new UILabel ("Gold:");
             goldLabel.X = 206;
             goldLabel.Y = 0;
             goldLabel.Width = 60;
             goldLabel.Height = 10;
             goldLabel.TextAlign = TextAlignHorizontal.Left;
             AddComponent (goldLabel);

             goldValueLabel = new UILabel ("1000");
             goldValueLabel.X = 206;
             goldValueLabel.Y = 0;
             goldValueLabel.Width = 60;
             goldValueLabel.Height = 10;
             goldValueLabel.TextAlign = TextAlignHorizontal.Right;
             AddComponent (goldValueLabel);

             AddComponent (MinimapControl);
             AddComponent (EntityControl);
        }