public override void Initialize() { base.Initialize(); Name = "GameOptionsPanel"; var lblScrollRate = new XNALabel(WindowManager); lblScrollRate.Name = "lblScrollRate"; lblScrollRate.ClientRectangle = new Rectangle(12, 14, 0, 0); lblScrollRate.Text = "卷动速率:"; lblScrollRateValue = new XNALabel(WindowManager); lblScrollRateValue.Name = "lblScrollRateValue"; lblScrollRateValue.FontIndex = 1; lblScrollRateValue.Text = "3"; lblScrollRateValue.ClientRectangle = new Rectangle( Width - lblScrollRateValue.Width - 12, lblScrollRate.Y, 0, 0); trbScrollRate = new XNATrackbar(WindowManager); trbScrollRate.Name = "trbClientVolume"; trbScrollRate.ClientRectangle = new Rectangle( lblScrollRate.Right + 32, lblScrollRate.Y - 2, lblScrollRateValue.X - lblScrollRate.Right - 47, 22); trbScrollRate.BackgroundTexture = AssetLoader.CreateTexture(new Color(0, 0, 0, 128), 2, 2); trbScrollRate.MinValue = 0; trbScrollRate.MaxValue = MAX_SCROLL_RATE; trbScrollRate.ValueChanged += TrbScrollRate_ValueChanged; chkScrollCoasting = new XNAClientCheckBox(WindowManager); chkScrollCoasting.Name = "chkScrollCoasting"; chkScrollCoasting.ClientRectangle = new Rectangle( lblScrollRate.X, trbScrollRate.Bottom + 20, 0, 0); chkScrollCoasting.Text = "Scroll Coasting"; chkTargetLines = new XNAClientCheckBox(WindowManager); chkTargetLines.Name = "chkTargetLines"; chkTargetLines.ClientRectangle = new Rectangle( lblScrollRate.X, chkScrollCoasting.Bottom + 24, 0, 0); chkTargetLines.Text = "目标线"; chkTooltips = new XNAClientCheckBox(WindowManager); chkTooltips.Name = "chkTooltips"; chkTooltips.Text = "工具提示"; var lblPlayerName = new XNALabel(WindowManager); lblPlayerName.Name = "lblPlayerName"; lblPlayerName.Text = "玩家名字 (必填)*:"; #if YR chkShowHiddenObjects = new XNAClientCheckBox(WindowManager); chkShowHiddenObjects.Name = "chkShowHiddenObjects"; chkShowHiddenObjects.ClientRectangle = new Rectangle( lblScrollRate.X, chkTargetLines.Bottom + 24, 0, 0); chkShowHiddenObjects.Text = "Show Hidden Objects"; chkTooltips.ClientRectangle = new Rectangle( lblScrollRate.X, chkShowHiddenObjects.Bottom + 24, 0, 0); lblPlayerName.ClientRectangle = new Rectangle( lblScrollRate.X, chkTooltips.Bottom + 30, 0, 0); AddChild(chkShowHiddenObjects); #else chkTooltips.ClientRectangle = new Rectangle( lblScrollRate.X, chkTargetLines.Bottom + 24, 0, 0); #endif #if DTA || TI || TS chkBlackChatBackground = new XNAClientCheckBox(WindowManager); chkBlackChatBackground.Name = "chkBlackChatBackground"; chkBlackChatBackground.ClientRectangle = new Rectangle( chkScrollCoasting.X, chkTooltips.Bottom + 24, 0, 0); chkBlackChatBackground.Text = "游戏内聊天使用黑色底色"; AddChild(chkBlackChatBackground); #endif #if DTA || TS || TI chkAltToUndeploy = new XNAClientCheckBox(WindowManager); chkAltToUndeploy.Name = "chkAltToUndeploy"; chkAltToUndeploy.ClientRectangle = new Rectangle( chkScrollCoasting.X, chkBlackChatBackground.Bottom + 24, 0, 0); chkAltToUndeploy.Text = "用Alt键收回可部署载具,而不是左键移动"; AddChild(chkAltToUndeploy); lblPlayerName.ClientRectangle = new Rectangle( lblScrollRate.X, chkAltToUndeploy.Bottom + 30, 0, 0); #endif tbPlayerName = new XNATextBox(WindowManager); tbPlayerName.Name = "tbPlayerName"; tbPlayerName.MaximumTextLength = ClientConfiguration.Instance.MaxNameLength; tbPlayerName.ClientRectangle = new Rectangle(trbScrollRate.X, lblPlayerName.Y - 2, 200, 19); tbPlayerName.Text = ProgramConstants.PLAYERNAME; var lblNotice = new XNALabel(WindowManager); lblNotice.Name = "lblNotice"; lblNotice.ClientRectangle = new Rectangle(lblPlayerName.X, lblPlayerName.Bottom + 30, 0, 0); lblNotice.Text = "* 如果您已登录CnCNet,您需要注销并重新登录,改名方可生效。"; hotkeyConfigWindow = new HotkeyConfigurationWindow(WindowManager); DarkeningPanel.AddAndInitializeWithControl(WindowManager, hotkeyConfigWindow); hotkeyConfigWindow.Disable(); var btnConfigureHotkeys = new XNAClientButton(WindowManager); btnConfigureHotkeys.Name = "btnConfigureHotkeys"; btnConfigureHotkeys.ClientRectangle = new Rectangle(lblPlayerName.X, lblNotice.Bottom + 36, 160, 23); btnConfigureHotkeys.Text = "快捷键设置"; btnConfigureHotkeys.LeftClick += BtnConfigureHotkeys_LeftClick; AddChild(lblScrollRate); AddChild(lblScrollRateValue); AddChild(trbScrollRate); AddChild(chkScrollCoasting); AddChild(chkTargetLines); AddChild(chkTooltips); AddChild(lblPlayerName); AddChild(tbPlayerName); AddChild(lblNotice); AddChild(btnConfigureHotkeys); }
public override void Initialize() { base.Initialize(); Name = "GameOptionsPanel"; var lblScrollRate = new XNALabel(WindowManager); lblScrollRate.Name = "lblScrollRate"; lblScrollRate.ClientRectangle = new Rectangle(12, 14, 0, 0); lblScrollRate.Text = "Scroll Rate:"; lblScrollRateValue = new XNALabel(WindowManager); lblScrollRateValue.Name = "lblScrollRateValue"; lblScrollRateValue.FontIndex = 1; lblScrollRateValue.Text = "3"; lblScrollRateValue.ClientRectangle = new Rectangle( Width - lblScrollRateValue.Width - 12, lblScrollRate.Y, 0, 0); trbScrollRate = new XNATrackbar(WindowManager); trbScrollRate.Name = "trbClientVolume"; trbScrollRate.ClientRectangle = new Rectangle( lblScrollRate.Right + 32, lblScrollRate.Y - 2, lblScrollRateValue.X - lblScrollRate.Right - 47, 22); trbScrollRate.BackgroundTexture = AssetLoader.CreateTexture(new Color(0, 0, 0, 128), 2, 2); trbScrollRate.MinValue = 0; trbScrollRate.MaxValue = MAX_SCROLL_RATE; trbScrollRate.ValueChanged += TrbScrollRate_ValueChanged; chkScrollCoasting = new XNAClientCheckBox(WindowManager); chkScrollCoasting.Name = "chkScrollCoasting"; chkScrollCoasting.ClientRectangle = new Rectangle( lblScrollRate.X, trbScrollRate.Bottom + 20, 0, 0); chkScrollCoasting.Text = "Scroll Coasting"; chkTargetLines = new XNAClientCheckBox(WindowManager); chkTargetLines.Name = "chkTargetLines"; chkTargetLines.ClientRectangle = new Rectangle( lblScrollRate.X, chkScrollCoasting.Bottom + 24, 0, 0); chkTargetLines.Text = "Target Lines"; chkTooltips = new XNAClientCheckBox(WindowManager); chkTooltips.Name = "chkTooltips"; chkTooltips.Text = "Tooltips"; var lblPlayerName = new XNALabel(WindowManager); lblPlayerName.Name = "lblPlayerName"; lblPlayerName.Text = "Player Name*:"; #if YR chkShowHiddenObjects = new XNAClientCheckBox(WindowManager); chkShowHiddenObjects.Name = "chkShowHiddenObjects"; chkShowHiddenObjects.ClientRectangle = new Rectangle( lblScrollRate.X, chkTargetLines.Bottom + 24, 0, 0); chkShowHiddenObjects.Text = "Show Hidden Objects"; chkTooltips.ClientRectangle = new Rectangle( lblScrollRate.X, chkShowHiddenObjects.Bottom + 24, 0, 0); lblPlayerName.ClientRectangle = new Rectangle( lblScrollRate.X, chkTooltips.Bottom + 30, 0, 0); AddChild(chkShowHiddenObjects); #else chkTooltips.ClientRectangle = new Rectangle( lblScrollRate.X, chkTargetLines.Bottom + 24, 0, 0); #endif #if DTA || TI || TS chkBlackChatBackground = new XNAClientCheckBox(WindowManager); chkBlackChatBackground.Name = "chkBlackChatBackground"; chkBlackChatBackground.ClientRectangle = new Rectangle( chkScrollCoasting.X, chkTooltips.Bottom + 24, 0, 0); chkBlackChatBackground.Text = "Use black background for in-game chat messages"; AddChild(chkBlackChatBackground); #endif #if DTA || TS || TI chkAltToUndeploy = new XNAClientCheckBox(WindowManager); chkAltToUndeploy.Name = "chkAltToUndeploy"; chkAltToUndeploy.ClientRectangle = new Rectangle( chkScrollCoasting.X, chkBlackChatBackground.Bottom + 24, 0, 0); chkAltToUndeploy.Text = "Undeploy units by holding Alt key instead of a regular move command"; AddChild(chkAltToUndeploy); lblPlayerName.ClientRectangle = new Rectangle( lblScrollRate.X, chkAltToUndeploy.Bottom + 30, 0, 0); #endif tbPlayerName = new XNATextBox(WindowManager); tbPlayerName.Name = "tbPlayerName"; tbPlayerName.MaximumTextLength = ClientConfiguration.Instance.MaxNameLength; tbPlayerName.ClientRectangle = new Rectangle(trbScrollRate.X, lblPlayerName.Y - 2, 200, 19); tbPlayerName.Text = ProgramConstants.PLAYERNAME; var lblNotice = new XNALabel(WindowManager); lblNotice.Name = "lblNotice"; lblNotice.ClientRectangle = new Rectangle(lblPlayerName.X, lblPlayerName.Bottom + 30, 0, 0); lblNotice.Text = "* If you are currently connected to CnCNet, you need to log out and reconnect" + Environment.NewLine + "for your new name to be applied."; hotkeyConfigWindow = new HotkeyConfigurationWindow(WindowManager); DarkeningPanel.AddAndInitializeWithControl(WindowManager, hotkeyConfigWindow); hotkeyConfigWindow.Disable(); var btnConfigureHotkeys = new XNAClientButton(WindowManager); btnConfigureHotkeys.Name = "btnConfigureHotkeys"; btnConfigureHotkeys.ClientRectangle = new Rectangle(lblPlayerName.X, lblNotice.Bottom + 36, 160, 23); btnConfigureHotkeys.Text = "Configure Hotkeys"; btnConfigureHotkeys.LeftClick += BtnConfigureHotkeys_LeftClick; AddChild(lblScrollRate); AddChild(lblScrollRateValue); AddChild(trbScrollRate); AddChild(chkScrollCoasting); AddChild(chkTargetLines); AddChild(chkTooltips); AddChild(lblPlayerName); AddChild(tbPlayerName); AddChild(lblNotice); AddChild(btnConfigureHotkeys); }