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; }
internal static UIWindow FromUIResource(string name) { int idx = WarFile.KnowledgeBase.IndexByName(name); if (idx == -1) { return(null); } UIResource tr = WarFile.GetUIResource(idx); return(FromUIResource(tr)); }
internal void InitWithUIResource(string name) { int idx = WarFile.KnowledgeBase.IndexByName(name); if (idx == -1) { return; } UIResource tr = WarFile.GetUIResource(idx); InitWithUIResource(tr); }
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; }