/// <summary> /// Called once at the startup of the game /// </summary> public void Initialize() { DriverInstance.Assets.LoadCoreContent(DriverInstance); CurState = State.Menu; Shader.Load(); // Intialize all UI elements in the game #region UI Interface Initialization #region Menu Buttons InterfaceManager.AddComponent(new Bar("menuTopBar", new Rectangle(0, 20, (int)Dimensions.X, 80), 1.0f, 0.65f, Color.Black, EasingFunctions.AnimationType.QuinticInOut, GUIComponent.AnimationDirection.Down, DriverInstance.Assets)); InterfaceManager.AddComponent(new Button("playButton", new Rectangle(120, 20, 200, 80), Color.White, "Play", 1.5f, EasingFunctions.AnimationType.QuinticOut, GUIComponent.AnimationDirection.Up, DriverInstance.Assets)); InterfaceManager.AddComponent(new Button("mapEditorButton", new Rectangle(400, 20, 200, 80), Color.White, "Editor", 1.5f, EasingFunctions.AnimationType.QuinticOut, GUIComponent.AnimationDirection.Up, DriverInstance.Assets)); InterfaceManager.AddComponent(new Button("optionsButton", new Rectangle(750, 20, 200, 80), Color.White, "Options", 1.5f, EasingFunctions.AnimationType.QuinticOut, GUIComponent.AnimationDirection.Up, DriverInstance.Assets)); InterfaceManager.AddComponent(new Button("quitButton", new Rectangle(1100, 20, 200, 80), Color.White, "Quit", 1.5f, EasingFunctions.AnimationType.QuinticOut, GUIComponent.AnimationDirection.Up, DriverInstance.Assets)); InterfaceManager.FormPage("defaultMenu"); #endregion #region Play Menu InterfaceManager.AddComponent(new Bar("playBar", new Rectangle(0, 100, (int)Dimensions.X, 600), 1.0f, 0.8f, Color.Black, EasingFunctions.AnimationType.QuinticInOut, GUIComponent.AnimationDirection.Down, DriverInstance.Assets)); InterfaceManager.AddComponent(new Button("connectButton", new Rectangle(150, 200, 200, 80), Color.White, "Connect", 1.0f, EasingFunctions.AnimationType.QuinticInOut, GUIComponent.AnimationDirection.None, DriverInstance.Assets)); InterfaceManager.FormPage("playMenu"); #endregion #region Options Menu InterfaceManager.AddComponent(new Bar("optionsBar", new Rectangle(0, 100, (int)Dimensions.X, 600), 1.0f, 0.8f, Color.Black, EasingFunctions.AnimationType.QuinticInOut, GUIComponent.AnimationDirection.Down, DriverInstance.Assets)); InterfaceManager.AddComponent(new TextBox("masterVolumeText", new Vector2(200, 200), "Master Volume", Color.White, 1.0f, EasingFunctions.AnimationType.QuinticInOut, GUIComponent.AnimationDirection.Down, DriverInstance.Assets)); InterfaceManager.AddComponent(new TextBox("uiVolumeText", new Vector2(200, 250), "UI Volume", Color.White, 1.1f, EasingFunctions.AnimationType.QuinticInOut, GUIComponent.AnimationDirection.Down, DriverInstance.Assets)); InterfaceManager.AddComponent(new TextBox("musicVolumeText", new Vector2(200, 300), "Music Volume", Color.White, 1.2f, EasingFunctions.AnimationType.QuinticInOut, GUIComponent.AnimationDirection.Down, DriverInstance.Assets)); InterfaceManager.AddComponent(new TextBox("sfxVolumeText", new Vector2(200, 350), "Sound Effects Volume", Color.White, 1.3f, EasingFunctions.AnimationType.QuinticInOut, GUIComponent.AnimationDirection.Down, DriverInstance.Assets)); InterfaceManager.AddComponent(new TextBox("voiceVolumeText", new Vector2(200, 400), "Voice Volume Volume", Color.White, 1.4f, EasingFunctions.AnimationType.QuinticInOut, GUIComponent.AnimationDirection.Down, DriverInstance.Assets)); InterfaceManager.FormPage("optionsMenu"); #endregion #region Buy Menu InterfaceManager.AddComponent(new Bar("buyMenuBar", new Rectangle(90, 20, 1100, 650), 0.4f, 0.8f, Color.Black, EasingFunctions.AnimationType.QuinticInOut, GUIComponent.AnimationDirection.Right, DriverInstance.Assets)); InterfaceManager.AddComponent(new TextBox("buyMenuTitle", new Vector2(94, 20), "Buy Menu", Color.White, 0.4f, EasingFunctions.AnimationType.QuinticInOut, GUIComponent.AnimationDirection.Down, DriverInstance.Assets)); InterfaceManager.FormPage("buyMenu"); #endregion #region Team Select Menu InterfaceManager.AddComponent(new TextBox("teamSelectTitle", new Vector2(94, 20), "Buy Menu", Color.White, 0.4f, EasingFunctions.AnimationType.QuinticInOut, GUIComponent.AnimationDirection.Down, DriverInstance.Assets)); InterfaceManager.AddComponent(new Button("ctButton", new Rectangle(90, 50, 549, 630), new Color(0, 81, 200), Color.DarkBlue, Color.Gray, "Counter-Terrorists", 0.8f, EasingFunctions.AnimationType.QuinticInOut, GUIComponent.AnimationDirection.Up, DriverInstance.Assets)); InterfaceManager.AddComponent(new Button("tButton", new Rectangle(639, 50, 549, 630), new Color(255, 0, 25), Color.DarkRed, Color.Gray, "Terrorists", 0.8f, EasingFunctions.AnimationType.QuinticInOut, GUIComponent.AnimationDirection.Up, DriverInstance.Assets)); InterfaceManager.FormPage("teamSelectMenu"); #endregion #region Buy Menu Buttons InterfaceManager.AddComponent(new Button("pistolMenuButton", new Rectangle(100, 80, 200, 40), Color.Gray, Color.White, Color.DarkGray, "1. PISTOLS", 0.4f, EasingFunctions.AnimationType.QuinticInOut, GUIComponent.AnimationDirection.Right, DriverInstance.Assets)); InterfaceManager.AddComponent(new Button("heavyMenuButton", new Rectangle(100, 160, 200, 40), Color.Gray, Color.White, Color.DarkGray, "2. HEAVY", 0.4f, EasingFunctions.AnimationType.QuinticInOut, GUIComponent.AnimationDirection.Right, DriverInstance.Assets)); InterfaceManager.AddComponent(new Button("smgMenuButton", new Rectangle(100, 240, 200, 40), Color.Gray, Color.White, Color.DarkGray, "3. SMGs", 0.4f, EasingFunctions.AnimationType.QuinticInOut, GUIComponent.AnimationDirection.Right, DriverInstance.Assets)); InterfaceManager.AddComponent(new Button("rifleMenuButton", new Rectangle(100, 320, 200, 40), Color.Gray, Color.White, Color.DarkGray, "4. RIFLES", 0.4f, EasingFunctions.AnimationType.QuinticInOut, GUIComponent.AnimationDirection.Right, DriverInstance.Assets)); InterfaceManager.AddComponent(new Button("gearMenuButton", new Rectangle(100, 400, 200, 40), Color.Gray, Color.White, Color.DarkGray, "5. GEAR", 0.4f, EasingFunctions.AnimationType.QuinticInOut, GUIComponent.AnimationDirection.Right, DriverInstance.Assets)); InterfaceManager.AddComponent(new Button("grenadeMenuButton", new Rectangle(100, 480, 200, 40), Color.Gray, Color.White, Color.DarkGray, "6. GRENADES", 0.4f, EasingFunctions.AnimationType.QuinticInOut, GUIComponent.AnimationDirection.Right, DriverInstance.Assets)); InterfaceManager.FormPage("buyButtonMenu"); #endregion #region Pistol Menu Buttons InterfaceManager.AddComponent(new Button("uspMenuButton", new Rectangle(100, 80, 200, 40), Color.Gray, Color.White, Color.DarkGray, "USP-S", 0.4f, EasingFunctions.AnimationType.QuinticInOut, GUIComponent.AnimationDirection.Right, DriverInstance.Assets)); InterfaceManager.AddComponent(new Button("dualMenuButton", new Rectangle(100, 160, 200, 40), Color.Gray, Color.White, Color.DarkGray, "Dual Berettas", 0.4f, EasingFunctions.AnimationType.QuinticInOut, GUIComponent.AnimationDirection.Right, DriverInstance.Assets)); InterfaceManager.AddComponent(new Button("p250menuButton", new Rectangle(100, 240, 200, 40), Color.Gray, Color.White, Color.DarkGray, "P250", 0.4f, EasingFunctions.AnimationType.QuinticInOut, GUIComponent.AnimationDirection.Right, DriverInstance.Assets)); InterfaceManager.AddComponent(new Button("57menuButton", new Rectangle(100, 320, 200, 40), Color.Gray, Color.White, Color.DarkGray, "Five-SeveN", 0.4f, EasingFunctions.AnimationType.QuinticInOut, GUIComponent.AnimationDirection.Right, DriverInstance.Assets)); InterfaceManager.AddComponent(new Button("deagleMenuButton", new Rectangle(100, 400, 200, 40), Color.Gray, Color.White, Color.DarkGray, "Desert Eagle", 0.4f, EasingFunctions.AnimationType.QuinticInOut, GUIComponent.AnimationDirection.Right, DriverInstance.Assets)); InterfaceManager.FormPage("pistolButtonMenu"); #endregion #region CT Rifle Menu Buttons InterfaceManager.AddComponent(new Button("famasMenuButton", new Rectangle(100, 80, 200, 40), Color.Gray, Color.White, Color.DarkGray, "Famas", 0.4f, EasingFunctions.AnimationType.QuinticInOut, GUIComponent.AnimationDirection.Right, DriverInstance.Assets)); InterfaceManager.AddComponent(new Button("m4a1MenuButton", new Rectangle(100, 160, 200, 40), Color.Gray, Color.White, Color.DarkGray, "M4A1", 0.4f, EasingFunctions.AnimationType.QuinticInOut, GUIComponent.AnimationDirection.Right, DriverInstance.Assets)); InterfaceManager.AddComponent(new Button("ssgMenuButton", new Rectangle(100, 240, 200, 40), Color.Gray, Color.White, Color.DarkGray, "SSG 08", 0.4f, EasingFunctions.AnimationType.QuinticInOut, GUIComponent.AnimationDirection.Right, DriverInstance.Assets)); InterfaceManager.AddComponent(new Button("augMenuButton", new Rectangle(100, 320, 200, 40), Color.Gray, Color.White, Color.DarkGray, "AUG", 0.4f, EasingFunctions.AnimationType.QuinticInOut, GUIComponent.AnimationDirection.Right, DriverInstance.Assets)); InterfaceManager.AddComponent(new Button("awpMenuButton", new Rectangle(100, 400, 200, 40), Color.Gray, Color.White, Color.DarkGray, "AWP", 0.4f, EasingFunctions.AnimationType.QuinticInOut, GUIComponent.AnimationDirection.Right, DriverInstance.Assets)); InterfaceManager.FormPage("ctRifleButtonMenu"); #endregion #region T Rifle Menu Buttons InterfaceManager.AddComponent(new Button("galilMenuButton", new Rectangle(100, 80, 200, 40), Color.Gray, Color.White, Color.DarkGray, "Galil", 0.4f, EasingFunctions.AnimationType.QuinticInOut, GUIComponent.AnimationDirection.Right, DriverInstance.Assets)); InterfaceManager.AddComponent(new Button("ak47MenuButton", new Rectangle(100, 160, 200, 40), Color.Gray, Color.White, Color.DarkGray, "AK47", 0.4f, EasingFunctions.AnimationType.QuinticInOut, GUIComponent.AnimationDirection.Right, DriverInstance.Assets)); InterfaceManager.AddComponent(new Button("ssgMenuButton", new Rectangle(100, 240, 200, 40), Color.Gray, Color.White, Color.DarkGray, "SSG 08", 0.4f, EasingFunctions.AnimationType.QuinticInOut, GUIComponent.AnimationDirection.Right, DriverInstance.Assets)); InterfaceManager.AddComponent(new Button("sg558MenuButton", new Rectangle(100, 320, 200, 40), Color.Gray, Color.White, Color.DarkGray, "SG558", 0.4f, EasingFunctions.AnimationType.QuinticInOut, GUIComponent.AnimationDirection.Right, DriverInstance.Assets)); InterfaceManager.AddComponent(new Button("awpMenuButton", new Rectangle(100, 400, 200, 40), Color.Gray, Color.White, Color.DarkGray, "AWP", 0.4f, EasingFunctions.AnimationType.QuinticInOut, GUIComponent.AnimationDirection.Right, DriverInstance.Assets)); InterfaceManager.FormPage("tRifleButtonMenu"); #endregion #region Scoreboard Menu InterfaceManager.AddComponent(new Bar("scoreboardBar", new Rectangle(90, 20, 1100, 650), 0.4f, 0.8f, Color.Black, EasingFunctions.AnimationType.QuinticInOut, GUIComponent.AnimationDirection.Right, DriverInstance.Assets)); InterfaceManager.AddComponent(new TextBox("scoreboardTitle", new Vector2(94, 20), "Scoreboard", Color.White, 0.4f, EasingFunctions.AnimationType.QuinticInOut, GUIComponent.AnimationDirection.Down, DriverInstance.Assets)); InterfaceManager.AddComponent(new TextBox("ctTitle", new Vector2(94, 50), "Counter-Terrorists", ServerClientInterface.CT_Colour, 0.4f, EasingFunctions.AnimationType.QuinticInOut, GUIComponent.AnimationDirection.Right, DriverInstance.Assets)); InterfaceManager.AddComponent(new TextBox("tTitle", new Vector2(645, 50), "Terrorists", ServerClientInterface.T_Colour, 0.4f, EasingFunctions.AnimationType.QuinticInOut, GUIComponent.AnimationDirection.Right, DriverInstance.Assets)); InterfaceManager.FormPage("scoreboard"); #endregion #endregion // Show the menu InterfaceManager.ShowPage("defaultMenu"); // Set the default address to empty Address = string.Empty; // Determine menu background, true if the number is not 0 MenuBackgroundType = NumGen.Next(0, 2) != 0; FadeIn = true; // Initialize camera Camera = new Camera2D { Position = Vector2.Zero }; }