public GameUIManager() { UIMain uiMain = LKernel.GetG<UIMain>(); //This mess gets the height and width of the window for centering UI entities. uint uheight, uwidth, colorDepth; int height, width; RenderWindow window = LKernel.GetG<RenderWindow>(); window.GetMetrics(out uwidth, out uheight, out colorDepth); width = (int)uwidth; height = (int)uheight; inGameUI = uiMain.GetGUI("ingame gui"); itembox = inGameUI.GetControl<PictureBox>("itembox"); //itembox.Top = (height / 2); //itembox.Bottom = (height / 2); //itembox.Left = (width / 2); //itembox.Right = (width / 2); itemimage = inGameUI.GetControl<PictureBox>("itemimage"); //itemimage.Top = (height / 2); //itemimage.Bottom = (height / 2); //itemimage.Left = (width / 2); //itemimage.Right = (width / 2); }
public RaceResultUIHandler() { winnerGui = LKernel.Get<UIMain>().GetGUI("winner gui"); winnerLabel = winnerGui.GetControl<Label>("winner label"); LapCounter.OnFirstFinish += new RaceFinishEvent(OnFirstFinish); winnerGui.Visible = false; }
public MainMenuManager() { LevelManager.OnLevelLoad += new LevelEvent(OnLevelLoad); LevelManager.OnLevelPreUnload += new LevelEvent(OnLevelPreUnload); UIMain uiMain = LKernel.GetG<UIMain>(); MenuBackgroundGui = uiMain.GetGUI("menu background gui"); GameTypeGui = uiMain.GetGUI("menu game type gui"); LevelSelectGui = uiMain.GetGUI("menu level select gui"); NetworkHostGui = uiMain.GetGUI("menu host info gui"); NetworkClientGui = uiMain.GetGUI("menu client info gui"); LobbyGui = uiMain.GetGUI("menu lobby gui"); CharacterSelectGui = uiMain.GetGUI("menu character select gui"); OptionsGui = uiMain.GetGUI("menu options gui"); // the checkers bit in the corner PictureBox checkersPicture = MenuBackgroundGui.GetControl<PictureBox>("checkers picture"); checkersPicture.Bitmap = new Bitmap("media/gui/checkers.png"); // set up events and stuff GameTypeGui.GetControl<Button>("game type single player button").MouseClick += (o, e) => Invoke(OnGameType_SelectSinglePlayer, o, e); GameTypeGui.GetControl<Button>("game type networked host button").MouseClick += (o, e) => Invoke(OnGameType_SelectNetworkedHost, o, e); GameTypeGui.GetControl<Button>("game type networked client button").MouseClick += (o, e) => Invoke(OnGameType_SelectNetworkedClient, o, e); GameTypeGui.GetControl<Button>("game type options button").MouseClick += (o, e) => Invoke(OnGameType_SelectOptions, o, e); GameTypeGui.GetControl<Button>("quit button").MouseClick += (o, e) => Launch.Quit = true; NetworkHostPortTextBox = NetworkHostGui.GetControl<TextBox>("host info port text box"); NetworkHostPasswordTextBox = NetworkHostGui.GetControl<TextBox>("host info password text box"); NetworkHostGui.GetControl<Button>("host info next button").MouseClick += (o, e) => Invoke(OnHostInfo_SelectNext, o, e); NetworkHostGui.GetControl<Button>("host info back button").MouseClick += (o, e) => Invoke(OnHostInfo_SelectBack, o, e); NetworkClientIPTextBox = NetworkClientGui.GetControl<TextBox>("client info IP text box"); NetworkClientPortTextBox = NetworkClientGui.GetControl<TextBox>("client info port text box"); NetworkClientPasswordTextBox = NetworkClientGui.GetControl<TextBox>("client info password text box"); NetworkClientGui.GetControl<Button>("client info next button").MouseClick += (o, e) => Invoke(OnClientInfo_SelectNext, o, e); NetworkClientGui.GetControl<Button>("client info back button").MouseClick += (o, e) => Invoke(OnClientInfo_SelectBack, o, e); LobbyLabel = LobbyGui.GetControl<Label>("lobby label"); LobbyGui.GetControl<Button>("lobby next button").MouseClick += (o, e) => Invoke(OnLobby_SelectNext, o, e); LobbyGui.GetControl<Button>("lobby back button").MouseClick += (o, e) => Invoke(OnLobby_SelectBack, o, e); LevelSelectGui.GetControl<Button>("level select flat button").MouseClick += (o, e) => Invoke(OnLevelSelect, o, e, "flat"); LevelSelectGui.GetControl<Button>("level select testlevel button").MouseClick += (o, e) => Invoke(OnLevelSelect, o, e, "testlevel"); LevelSelectGui.GetControl<Button>("level select SAA button").MouseClick += (o, e) => Invoke(OnLevelSelect, o, e, "SweetAppleAcres"); LevelSelectGui.GetControl<Button>("level select WTW button").MouseClick += (o, e) => Invoke(OnLevelSelect, o, e, "WhitetailWoods"); LevelSelectGui.GetControl<Button>("level select TestAI button").MouseClick += (o, e) => Invoke(OnLevelSelect, o, e, "TestAI"); LevelSelectGui.GetControl<Button>("level select roulette button").MouseClick += (o, e) => Invoke(OnLevelSelect, o, e, "roulette"); LevelSelectGui.GetControl<Button>("level select back button").MouseClick += (o, e) => Invoke(OnLevelSelect_SelectBack, o, e); CharacterSelectGui.GetControl<Button>("character select TS button").MouseClick += (o, e) => Invoke(OnCharacterSelect, o, e, "Twilight Sparkle"); CharacterSelectGui.GetControl<Button>("character select RD button").MouseClick += (o, e) => Invoke(OnCharacterSelect, o, e, "Rainbow Dash"); CharacterSelectGui.GetControl<Button>("character select AJ button").MouseClick += (o, e) => Invoke(OnCharacterSelect, o, e, "Applejack"); CharacterSelectGui.GetControl<Button>("character select PP button").MouseClick += (o, e) => Invoke(OnCharacterSelect, o, e, "Pinkie Pie"); CharacterSelectGui.GetControl<Button>("character select FS button").MouseClick += (o, e) => Invoke(OnCharacterSelect, o, e, "Fluttershy"); CharacterSelectGui.GetControl<Button>("character select rarity button").MouseClick += (o, e) => Invoke(OnCharacterSelect, o, e, "Rarity"); CharacterSelectGui.GetControl<Button>("character select back button").MouseClick += (o, e) => Invoke(OnCharacterSelect_SelectBack, o, e); OptionsGui.GetControl<Button>("options ok button").MouseClick += (o, e) => Invoke(OnOptions_SelectOK, o, e); }
public LapCounterUIHandler() { lapCountGUI = LKernel.Get<UIMain>().GetGUI("lap count gui"); lapCountLabel = lapCountGUI.GetControl<Label>("lap count label"); LapCounter.OnLap += new LapCounterEvent(OnLap); LevelManager.OnLevelPostLoad += new LevelEvent(OnPostLoad); }
public CountdownUIHandler() { // set up our label countGui = LKernel.GetG<UIMain>().GetGUI("countdown gui"); countLabel = countGui.GetControl<Label>("countdown label"); // hook up to events RaceCountdown.OnCountdown += new RaceCountdownEvent(OnCountdown); LevelManager.OnLevelPreUnload += new LevelEvent(OnLevelPreUnload); }
/// <summary> /// Make the level UI /// </summary> void SetupLevelUI() { this.levelGui = LKernel.GetG<UIMain>().GetGUI("level debug gui"); // the button Button commandsButton = levelGui.GetControl<Button>("show/hide commands button"); commandsButton.UserData = new UIUserData { ObstructsViewport = true, }; #if !DEBUG commandsButton.Visible = false; #endif // subscribe to the events that change the current texture commandsButton.MouseDown += CommandsButton_MouseDown; // and the text that's toggled commandsLabel = levelGui.GetControl<Label>("commands label"); }
/// <summary> /// I don't really need to have this in a separate method, but eh it doesn't matter /// </summary> void Create() { luaGui = LKernel.GetG<UIMain>().GetGUI("lua console gui"); // make the panel panel = luaGui.GetControl<Panel>("lua console panel"); panel.UserData = new UIUserData { ObstructsViewport = true, }; // make the text box textBox = luaGui.GetControl<TextBox>("lua console text box"); textBox.UserData = new UIUserData { ObstructsViewport = true, }; // eeeeeeeeveeeeeeeeeents textBox.Submit += TextBoxSubmit; }