Beispiel #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;
        }
Beispiel #2
0
        internal override void InitUI()
        {
            base.InitUI();

             MouseCursor.State = MouseCursorState.None;

             UIWindow wnd = new UIWindow();

             img = new UIImage(WWTexture.FromImageResource("Background 'Blizzard'"));
             wnd.AddComponent(img);

             elapsedTime = 0;
        }
Beispiel #3
0
        internal override void InitUI()
        {
            elapsedTime = 0;

             MouseCursor.State = MouseCursorState.Pointer;

             backgroundWindow = new MenuBackgroundWindow();
             mainMenuWindow = new MainMenuWindow();

             textWindow = new UIWindow();
             UIImage img = new UIImage(WWTexture.FromImageResource("Text 'WarCraft'"));
             textWindow.AddComponent(img);
             textWindow.Height = img.Height;
        }
        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;
        }
Beispiel #5
0
        private void ShowSingleUI()
        {
            // Fail-safe
             if (currentEntities.Length != 1)
            return;

             SpriteResource res = WarFile.GetSpriteResource(race == Race.Humans ? 360 : 359);
             SpriteResource resUnit = WarFile.GetSpriteResource(361);

             Entity ent = currentEntities[0];

             UISpriteImage unitFrame = new UISpriteImage(new Sprite(res));
             unitFrame.FixedSpriteFrame = ent.Mana > 0 ? 1 : 0;
             unitFrame.X = 0;
             unitFrame.Y = 0;
             AddComponent(unitFrame);

             UISpriteImage unitIcon = new UISpriteImage(new Sprite(resUnit));
             unitIcon.FixedSpriteFrame = ent.IconIndex;
             unitIcon.X = 4;
             unitIcon.Y = 4;
             unitFrame.AddComponent(unitIcon);

             UILabel nameLabel = new UILabel(currentEntities[0].Name);
             nameLabel.TextAlign = TextAlignHorizontal.Left;
             nameLabel.X = 4;
             nameLabel.Y = unitIcon.Y + unitIcon.Height + 2;
             unitFrame.AddComponent(nameLabel);

             UIImage img = new UIImage(null);
             img.X = 35;
             img.Y = 20;
             img.Height = 3;
             img.BackgroundColor = new Color(0.0f, 1.0f, 0.0f, 1.0f);
             SetHealthbar(img, ent);
             unitFrame.AddComponent(img);

             healthBars.Add(ent, img);
        }
Beispiel #6
0
 private void SetHealthbar(UIImage img, Entity ent)
 {
     img.Width = (int)(((float)ent.HitPoints / (float)ent.MaxHitPoints) * 27.0f);
 }
 private void LoadUIImage(ref UIImage img, string name)
 {
     img = UIImage.FromImageResource (name);
      AddComponent (img);
 }
Beispiel #8
0
 internal static UIImage FromImageResource(ImageResource resource)
 {
     UIImage res = new UIImage (WWTexture.FromImageResource (resource));
      return res;
 }
Beispiel #9
0
 internal static UIImage FromImageResource(string name)
 {
     UIImage res = new UIImage (WWTexture.FromImageResource (name));
      return res;
 }