void Init() { m_enableBackgroundFade = true; m_size = new Vector2(0.8f, 0.4f); // Add screen title AddCaption(); Vector2 originDelta = new Vector2(0.05f, 0.02f); Vector2 controlsOriginLeft = GetControlsOriginLeftFromScreenSize() + originDelta; AddActivatedCheckbox(controlsOriginLeft, Prefab.Activated); m_onLabel = new MyGuiControlLabel(this, controlsOriginLeft + 1 * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.On, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); Controls.Add(m_onLabel); m_on = new MyGuiControlCheckbox(this, controlsOriginLeft + 1 * MyGuiConstants.CONTROLS_DELTA + new Vector2(0.1f, 0f), Prefab.Enabled, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR); Controls.Add(m_on); m_alarmLabel = new MyGuiControlLabel(this, controlsOriginLeft + 2 * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.Alarm, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); Controls.Add(m_alarmLabel); var alarmComboboxPredefinedSize = MyGuiControlPreDefinedSize.MEDIUM; var alarmComboboxSize = MyGuiControlCombobox.GetPredefinedControlSize(alarmComboboxPredefinedSize); m_alarmComboBox = new MyGuiControlCombobox( this, controlsOriginLeft + 2 * MyGuiConstants.CONTROLS_DELTA + new Vector2(0.075f + alarmComboboxSize.X / 2, 0f), alarmComboboxPredefinedSize, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE); m_alarmComboBox.AddItem(0, MyTextsWrapperEnum.Default); m_alarmComboBox.AddItem(1, MyTextsWrapperEnum.On); m_alarmComboBox.AddItem(2, MyTextsWrapperEnum.Off); if (Prefab.DefaultCausesAlarm()) { m_alarmComboBox.SelectItemByKey(0); } else { m_alarmComboBox.SelectItemByKey(Prefab.CausesAlarm ? 1 : 2); } Controls.Add(m_alarmComboBox); AddOkAndCancelButtonControls(); }
public MyGuiScreenOptionsControls() : base(new Vector2(0.5f, 0.5f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, null) { m_size = new Vector2(1110f / 1600f, 1127f / 1200f); m_backgroundTexture = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\BackgroundScreen\\ControlsBackground", flags: TextureFlags.IgnoreQuality); m_enableBackgroundFade = true; AddCaption(MyTextsWrapperEnum.Controls, new Vector2(0, 0.005f)); MyGuiManager.GetInput().TakeSnapshot(); m_controlsOriginLeft = new Vector2(-m_size.Value.X / 2.0f + 0.06f, -m_size.Value.Y / 2.0f + 0.102f); m_controlsOriginRight = new Vector2(-m_size.Value.X / 2.0f + 0.333f, -m_size.Value.Y / 2.0f + 0.102f); #region Add Revert, OK, Cancel and selection combobox /* // Buttons Revert, OK and CANCEL float buttonsY = m_size.Value.Y / 2.0f - MyGuiConstants.MESSAGE_BOX_BORDER_AREA_Y - MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE.Y / 2.0f; Controls.Add(new MyGuiControlButton(this, new Vector2((MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE.X + 0.015f) * -1, buttonsY), MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyTextsWrapperEnum.Ok, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnOkClick, MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true)); Controls.Add(new MyGuiControlButton(this, new Vector2(0, buttonsY), MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyTextsWrapperEnum.Cancel, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnCancelClick, MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true)); Controls.Add(new MyGuiControlButton(this, new Vector2(m_controlsOriginRight.X + MyGuiConstants.TEXTBOX_MEDIUM_SIZE.X, buttonsY), new Vector2(MyGuiConstants.BUTTON_DEFAULTS_WIDTH, MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE.Y), MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyTextsWrapperEnum.Revert, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnResetDefaultsClick, MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true)); */ var okButton = new MyGuiControlButton(this, new Vector2(-0.1942f, 0.3435f), MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE_SMALL, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyGuiManager.GetConfirmButton(), null, null, MyTextsWrapperEnum.Ok, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnOkClick, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true); var cancelButton = new MyGuiControlButton(this, new Vector2(-0.0597f, 0.3435f), MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE_SMALL, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyGuiManager.GetConfirmButton(), null, null, MyTextsWrapperEnum.Cancel, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnCancelClick, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true); var resetButton = new MyGuiControlButton(this, new Vector2(0.1942f, 0.3435f), MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE_SMALL, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyGuiManager.GetConfirmButton(), null, null, MyTextsWrapperEnum.Revert, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnResetDefaultsClick, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true); Controls.Add(okButton); Controls.Add(cancelButton); Controls.Add(resetButton); // Page selection combobox m_currentControlType = MyGuiControlTypeEnum.General; var cBoxPosition = m_controlsOriginRight + 0.5f * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.COMBOBOX_MEDIUM_SIZE.X / 2.0f, 0) - new Vector2(0.065f, 0); m_controlTypeList = new MyGuiControlCombobox(this, cBoxPosition, MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE); m_controlTypeList.AddItem((int)MyGuiControlTypeEnum.General, MyTextsWrapperEnum.General); m_controlTypeList.AddItem((int)MyGuiControlTypeEnum.Navigation, MyTextsWrapperEnum.Navigation); // There are no controls for this category now, so hide it completely and uncomment, when we have new comms controls //m_controlTypeList.AddItem((int)MyGuiInputTypeEnum.Communications, MyTextsWrapperEnum.Comms); m_controlTypeList.AddItem((int)MyGuiControlTypeEnum.Weapons, MyTextsWrapperEnum.Weapons); m_controlTypeList.AddItem((int)MyGuiControlTypeEnum.SpecialWeapons, MyTextsWrapperEnum.SpecialWeapons); m_controlTypeList.AddItem((int)MyGuiControlTypeEnum.Systems1, MyTextsWrapperEnum.Systems1); m_controlTypeList.AddItem((int)MyGuiControlTypeEnum.Systems2, MyTextsWrapperEnum.Systems2); m_controlTypeList.AddItem((int)MyGuiControlTypeEnum.Editor, MyTextsWrapperEnum.Editor); m_controlTypeList.SelectItemByKey((int)m_currentControlType); Controls.Add(m_controlTypeList); #endregion AddControls(); ActivateControls(m_currentControlType); }
void Init() { m_enableBackgroundFade = true; m_size = new Vector2(0.97f, 0.85f); Vector2 controlsOriginLeft = GetControlsOriginLeftFromScreenSize() + new Vector2(0.04f, 0); m_bots = new Dictionary<int, BotTemplate>(); // Add screen title AddCaption(new Vector2(0, 0.028f)); //Faction Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 1 * CONTROLS_DELTA, null, MyTextsWrapperEnum.SetShipFaction, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_selectShipFactionCombobox = new MyGuiControlCombobox(this, (new Vector2(0.31f, 0)) + controlsOriginLeft + 1 * CONTROLS_DELTA, MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE, 8); foreach (MyMwcObjectBuilder_FactionEnum enumValue in MyGuiSmallShipHelpers.MyMwcObjectBuilder_SmallShip_ShipFactionNationalityEnumValues) { MyGuiHelperBase factionNationalityHelper = MyGuiSmallShipHelpers.GetMyGuiSmallShipFactionNationality(enumValue); m_selectShipFactionCombobox.AddItem((int)enumValue, null, factionNationalityHelper.Description); } m_selectShipFactionCombobox.SelectItemByKey((int)MyMwcObjectBuilder_FactionEnum.China);//hopefuly china Controls.Add(m_selectShipFactionCombobox); //radius slider Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 2 * CONTROLS_DELTA, null, MyTextsWrapperEnum.Radius, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_radiusSlider = new MyGuiControlSlider(this, (new Vector2(0.25f, 0) + controlsOriginLeft) + 2 * CONTROLS_DELTA, MyGuiConstants.SLIDER_WIDTH, 15, 200, MyGuiConstants.SLIDER_BACKGROUND_COLOR, new StringBuilder(), MyGuiConstants.SLIDER_WIDTH_LABEL, 0, MyGuiConstants.LABEL_TEXT_SCALE * 0.85f); m_radiusSlider.SetNormalizedValue(0.2f); m_radiusSlider.OnChange = OnComponentChange; Controls.Add(m_radiusSlider); Controls.Add(m_radiusLabel = new MyGuiControlLabel(this, new Vector2(m_radiusSlider.GetPosition().X + m_radiusSlider.GetSize().Value.X / 2 + 0.01f, controlsOriginLeft.Y) + 2 * CONTROLS_DELTA, null, MyTextsWrapperEnum.Radius, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); //first spawn timer Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 3 * CONTROLS_DELTA, null, MyTextsWrapperEnum.FirstSpawn, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_firstSpawnTimeSlider = new MyGuiControlSlider(this, (new Vector2(0.25f, 0) + controlsOriginLeft) + 3 * CONTROLS_DELTA, MyGuiConstants.SLIDER_WIDTH, 0, 10 * 60 * 1000, MyGuiConstants.SLIDER_BACKGROUND_COLOR, new StringBuilder(), MyGuiConstants.SLIDER_WIDTH_LABEL, 0, MyGuiConstants.LABEL_TEXT_SCALE * 0.85f); m_firstSpawnTimeSlider.OnChange = OnComponentChange; m_firstSpawnTimeSlider.SetNormalizedValue(0.0f); Controls.Add(m_firstSpawnTimeSlider); Controls.Add(m_firstSpawnLabel = new MyGuiControlLabel(this, new Vector2(m_firstSpawnTimeSlider.GetPosition().X + m_firstSpawnTimeSlider.GetSize().Value.X / 2 + 0.01f, controlsOriginLeft.Y) + 3 * CONTROLS_DELTA, null, MyTextsWrapperEnum.Respawn, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); //respawn timer Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 4 * CONTROLS_DELTA, null, MyTextsWrapperEnum.Respawn, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_respawnTimeSlider = new MyGuiControlSlider(this, controlsOriginLeft + new Vector2(0.25f, 0) + 4 * CONTROLS_DELTA, MyGuiConstants.SLIDER_WIDTH, 0, 10 * 60 * 1000, MyGuiConstants.SLIDER_BACKGROUND_COLOR, new StringBuilder(), MyGuiConstants.SLIDER_WIDTH_LABEL, 0, MyGuiConstants.LABEL_TEXT_SCALE * 0.85f); m_respawnTimeSlider.OnChange = OnComponentChange; m_respawnTimeSlider.SetNormalizedValue(0.0f); Controls.Add(m_respawnTimeSlider); Controls.Add(m_respawnLabel = new MyGuiControlLabel(this, new Vector2(m_respawnTimeSlider.GetPosition().X + m_respawnTimeSlider.GetSize().Value.X / 2 + 0.01f, controlsOriginLeft.Y) + 4 * CONTROLS_DELTA, null, MyTextsWrapperEnum.Respawn, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); //waypoints Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 5 * CONTROLS_DELTA, null, MyTextsWrapperEnum.WayPointPath, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_waypointPathCombobox = new MyGuiControlCombobox(this, new Vector2(0.31f, 0) + controlsOriginLeft + 5 * CONTROLS_DELTA, MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE, 8); int k = 0; int selected = 0; m_waypointPathCombobox.AddItem(k++, null, MyTextsWrapper.Get(MyTextsWrapperEnum.None)); foreach (var path in MyWayPointGraph.StoredPaths) { if (HasEntity() && String.Compare(path.Name, m_spawnPoint.GetWaypointPath()) == 0) { selected = k; } m_waypointPathCombobox.AddItem(k++, null, new StringBuilder(path.Name)); } m_waypointPathCombobox.SelectItemByKey(selected);// Controls.Add(m_waypointPathCombobox); // patrol mode Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 6 * CONTROLS_DELTA, null, MyTextsWrapperEnum.PatrolMode, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_patrolModeCombobox = new MyGuiControlCombobox(this, new Vector2(0.31f, 0) + controlsOriginLeft + 6 * CONTROLS_DELTA, MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE, 8); foreach (MyPatrolMode enumValue in MyGuiSmallShipHelpers.MyMwcObjectBuilder_SmallShip_PatrolModes) { MyGuiHelperBase patrolModeHelper = MyGuiSmallShipHelpers.GetMyGuiSmallShipPatrolMode(enumValue); m_patrolModeCombobox.AddItem((int)enumValue, null, patrolModeHelper.Description); } m_patrolModeCombobox.SelectItemByKey(HasEntity() ? (int)m_spawnPoint.PatrolMode : 0); Controls.Add(m_patrolModeCombobox); #region Smallship Bots To Spawn //MyGuiControlLabel smallShipLabel = new MyGuiControlLabel(this, controlsOriginLeft + 6 * CONTROLS_DELTA, null, MyTextsWrapperEnum.ChooseModel, MyGuiConstants.LABEL_TEXT_COLOR, // MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); //Controls.Add(smallShipLabel); m_selectShipsListbox = new MyGuiControlListbox(this, controlsOriginLeft + 7 * CONTROLS_DELTA + new Vector2(MyGuiConstants.COMBOBOX_LARGE_SIZE.X / 2.0f + MyGuiConstants.LISTBOX_SCROLLBAR_WIDTH / 2.0f, MyGuiConstants.COMBOBOX_LARGE_SIZE.Y * 2.5f), MyGuiConstants.LISTBOX_LONGMEDIUM_SIZE, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, null, MyGuiConstants.LABEL_TEXT_SCALE, 1, 6, 1, false, true, false); //m_selectShipsListbox.ItemSelect = OnItemSelect; m_selectShipsListbox.ItemDoubleClick += OnDoubleClick; Controls.Add(m_selectShipsListbox); Vector2 columnOriginLeft = new Vector2(0.178f, controlsOriginLeft.Y); Vector2 controlsOriginRight = new Vector2(m_size.Value.X / 2.0f - 0.05f, controlsOriginLeft.Y); // Activated Controls.Add(new MyGuiControlLabel(this, columnOriginLeft + MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.Active, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_activeCheckbox = new MyGuiControlCheckbox(this, controlsOriginRight + MyGuiConstants.CONTROLS_DELTA - new Vector2(MyGuiConstants.CHECKBOX_SIZE.X / 2.0f + 0.02f, 0), true, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR); Controls.Add(m_activeCheckbox); // Spawn in groups Controls.Add(new MyGuiControlLabel(this, columnOriginLeft + 2 * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.SpawnInGroups, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_spawnInGroupsCheckbox = new MyGuiControlCheckbox(this, controlsOriginRight + 2 * MyGuiConstants.CONTROLS_DELTA - new Vector2(MyGuiConstants.CHECKBOX_SIZE.X / 2.0f + 0.02f, 0), true, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR); Controls.Add(m_spawnInGroupsCheckbox); Controls.Add(new MyGuiControlLabel(this, columnOriginLeft + 3 * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.SpawnedBots, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_spawnedBotsTextbox = new MyGuiControlTextbox(this, columnOriginLeft + 4 * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.TEXTBOX_MEDIUM_SIZE.X / 2 - 0.01f, 0), MyGuiControlPreDefinedSize.MEDIUM, string.Empty, TEXTBOX_NUMBERS_MAX_LENGTH, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.DIGITS_ONLY); Controls.Add(m_spawnedBotsTextbox); #endregion #region Bots Listbox Buttons Controls.Add(new MyGuiControlButton(this, controlsOriginLeft + 7 * CONTROLS_DELTA + new Vector2(0.77f, -0.005f), MyGuiConstants.PROGRESS_CANCEL_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyTextsWrapperEnum.Add, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnAddClick, MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true)); Controls.Add(new MyGuiControlButton(this, controlsOriginLeft + 8 * CONTROLS_DELTA + new Vector2(0.77f, -0.005f), MyGuiConstants.PROGRESS_CANCEL_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyTextsWrapperEnum.Edit, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnEditClick, MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true)); Controls.Add(new MyGuiControlButton(this, controlsOriginLeft + 9 * CONTROLS_DELTA + new Vector2(0.77f, -0.005f), MyGuiConstants.PROGRESS_CANCEL_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyTextsWrapperEnum.Inventory, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnInventoryClick, MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true)); Controls.Add(new MyGuiControlButton(this, controlsOriginLeft + 10 * CONTROLS_DELTA + new Vector2(0.77f, -0.005f), MyGuiConstants.PROGRESS_CANCEL_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyTextsWrapperEnum.Copy, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnDuplicateClick, MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true)); Controls.Add(new MyGuiControlButton(this, controlsOriginLeft + 11 * CONTROLS_DELTA + new Vector2(0.77f, -0.005f), MyGuiConstants.PROGRESS_CANCEL_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyTextsWrapperEnum.Delete, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnDeleteClick, MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true)); #endregion AddOkAndCancelButtonControls(new Vector2(0, -0.038f)); if (HasEntity()) { m_radiusSlider.SetValue( m_spawnPoint.BoundingSphereRadius ); m_spawnInGroupsCheckbox.Checked = m_spawnPoint.SpawnInGroups; m_spawnedBotsTextbox.Text = m_spawnPoint.LeftToSpawn >= 0 ? m_spawnPoint.LeftToSpawn.ToString() : string.Empty; m_firstSpawnTimeSlider.SetValue(m_spawnPoint.FirstSpawnTimer); m_respawnTimeSlider.SetValue(m_spawnPoint.RespawnTimer); m_selectShipFactionCombobox.SelectItemByKey((int)m_spawnPoint.Faction); m_bots.Clear(); foreach (BotTemplate bt in m_spawnPoint.GetBotTemplates()) { if (bt.m_builder.ShipTemplateID != null) { AddBot(bt.m_builder, MySmallShipTemplates.GetTemplate(bt.m_builder.ShipTemplateID.Value)); } else { AddBot(bt.m_builder); } } m_activeCheckbox.Checked = m_spawnPoint.IsActive(); } // Just UI update OnComponentChange(null); }
private void InitControls() { Vector2 controlsLeftPosition = -m_size.Value / 2f; Vector2 controlsRightPosition = controlsLeftPosition + new Vector2(m_size.Value.X / 2f, 0f); Vector2 labelOffset = new Vector2(0.25f, 0f); // use solo Controls.Add(new MyGuiControlLabel(this, controlsLeftPosition, null, MyTextsWrapperEnum.UseSolo, m_labelColor, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_useSoloCheckbox = new MyGuiControlCheckbox(this, controlsLeftPosition + labelOffset, MyGuiConstants.CHECKBOX_SIZE, (m_useProperties.UseType & MyUseType.Solo) != 0, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR); Controls.Add(m_useSoloCheckbox); controlsLeftPosition += MyGuiConstants.CONTROLS_DELTA/* + new Vector2(m_useSoloCheckbox.GetSize().Value.Y)*/; if ((m_useProperties.UseMask & MyUseType.Solo) == 0) { m_useSoloCheckbox.Enabled = false; m_useSoloCheckbox.Checked = false; } // hack solo Controls.Add(new MyGuiControlLabel(this, controlsRightPosition, null, MyTextsWrapperEnum.HackSolo, m_labelColor, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_hackSoloCheckbox = new MyGuiControlCheckbox(this, controlsRightPosition + labelOffset, MyGuiConstants.CHECKBOX_SIZE, (m_useProperties.HackType & MyUseType.Solo) != 0, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR); Controls.Add(m_hackSoloCheckbox); controlsRightPosition += MyGuiConstants.CONTROLS_DELTA/* + new Vector2(m_hackSoloCheckbox.GetSize().Value.Y)*/; if ((m_useProperties.HackMask & MyUseType.Solo) == 0) { m_hackSoloCheckbox.Enabled = false; m_hackSoloCheckbox.Checked = false; } // use from HUB Controls.Add(new MyGuiControlLabel(this, controlsLeftPosition, null, MyTextsWrapperEnum.UseFromHUB, m_labelColor, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_useHUBCheckbox = new MyGuiControlCheckbox(this, controlsLeftPosition + labelOffset, MyGuiConstants.CHECKBOX_SIZE, (m_useProperties.UseType & MyUseType.FromHUB) != 0, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR); Controls.Add(m_useHUBCheckbox); controlsLeftPosition += MyGuiConstants.CONTROLS_DELTA; if ((m_useProperties.UseMask & MyUseType.FromHUB) == 0) { m_useHUBCheckbox.Enabled = false; m_useHUBCheckbox.Checked = false; } // hack from HUB Controls.Add(new MyGuiControlLabel(this, controlsRightPosition, null, MyTextsWrapperEnum.HackFromHUB, m_labelColor, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_hackHUBCheckbox = new MyGuiControlCheckbox(this, controlsRightPosition + labelOffset, MyGuiConstants.CHECKBOX_SIZE, (m_useProperties.HackType & MyUseType.FromHUB) != 0, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR); Controls.Add(m_hackHUBCheckbox); controlsRightPosition += MyGuiConstants.CONTROLS_DELTA; if ((m_useProperties.HackMask & MyUseType.FromHUB) == 0) { m_hackHUBCheckbox.Enabled = false; m_hackHUBCheckbox.Checked = false; } // is hacked Controls.Add(new MyGuiControlLabel(this, controlsLeftPosition, null, MyTextsWrapperEnum.IsHacked, m_labelColor, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_isHackedCheckbox = new MyGuiControlCheckbox(this, controlsLeftPosition + labelOffset, MyGuiConstants.CHECKBOX_SIZE, m_useProperties.IsHacked, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR); Controls.Add(m_isHackedCheckbox); controlsLeftPosition += MyGuiConstants.CONTROLS_DELTA; // move the two last controls to the right a bit. labelOffset.X = labelOffset.X + 0.075f; // hacking time Controls.Add(new MyGuiControlLabel(this, controlsLeftPosition, null, MyTextsWrapperEnum.HackingTime, m_labelColor, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_hackingTimeTextbox = new MyGuiControlTextbox(this, controlsLeftPosition + labelOffset, MyGuiControlPreDefinedSize.MEDIUM, m_useProperties.HackingTime.ToString(), 6, MyGuiConstants.DEFAULT_CONTROL_NONACTIVE_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.DIGITS_ONLY); Controls.Add(m_hackingTimeTextbox); controlsLeftPosition += MyGuiConstants.CONTROLS_DELTA; // hacking level Controls.Add(new MyGuiControlLabel(this, controlsLeftPosition, null, MyTextsWrapperEnum.HackingLevel, m_labelColor, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_hackingLevelCombobox = new MyGuiControlCombobox(this, controlsLeftPosition + labelOffset, MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE); Controls.Add(m_hackingLevelCombobox); for (int i = 1; i <= 5; i++) { m_hackingLevelCombobox.AddItem(i, new StringBuilder(i.ToString())); } m_hackingLevelCombobox.SelectItemByKey(m_useProperties.HackingLevel); }
void Init() { m_enableBackgroundFade = true; m_size = new Vector2(0.73f, 0.93f); Vector2 controlsOriginLeft = GetControlsOriginLeftFromScreenSize() + new Vector2(0.02f, 0.01f); Vector2 controlsOriginRight = GetControlsOriginRightFromScreenSize(); // Add screen title AddCaption(); #region Faction nationality Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 1 * CONTROLS_DELTA, null, MyTextsWrapperEnum.SetShipFaction, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_selectShipFactionCombobox = new MyGuiControlCombobox(this, controlsOriginRight + 1 * CONTROLS_DELTA + new Vector2(MyGuiConstants.COMBOBOX_MEDIUM_SIZE.X / 2.0f, 0), MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE, 5); foreach (MyMwcObjectBuilder_FactionEnum enumValue in MyGuiSmallShipHelpers.MyMwcObjectBuilder_SmallShip_ShipFactionNationalityEnumValues) { MyGuiHelperBase factionNationalityHelper = MyGuiSmallShipHelpers.GetMyGuiSmallShipFactionNationality(enumValue); m_selectShipFactionCombobox.AddItem((int)enumValue, null, factionNationalityHelper.Description); } m_selectShipFactionCombobox.SelectItemByKey(1); Controls.Add(m_selectShipFactionCombobox); #endregion // AI Template Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 2 * CONTROLS_DELTA, null, MyTextsWrapperEnum.AITemplate, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_selectAITemplateCombobox = new MyGuiControlCombobox(this, controlsOriginRight + 2 * CONTROLS_DELTA + new Vector2(MyGuiConstants.COMBOBOX_MEDIUM_SIZE.X / 2.0f, 0), MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE, 5); foreach (MyAITemplateEnum enumValue in MyGuiSmallShipHelpers.MyMwcObjectBuilder_SmallShip_BotAITemplateValues) { MyGuiHelperBase aiTemplateHelper = MyGuiSmallShipHelpers.GetMyGuiSmallShipBotAITemplate(enumValue); if (aiTemplateHelper != null) m_selectAITemplateCombobox.AddItem((int)enumValue, null, aiTemplateHelper.Description); } m_selectAITemplateCombobox.SelectItemByKey(0); Controls.Add(m_selectAITemplateCombobox); // Aggresivity Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 3 * CONTROLS_DELTA, null, MyTextsWrapperEnum.Aggressivity, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_aggresivitySlider = new MyGuiControlSlider(this, controlsOriginRight + 3 * CONTROLS_DELTA + new Vector2(MyGuiConstants.SLIDER_WIDTH / 2, 0), MyGuiConstants.SLIDER_WIDTH, 0, 1, MyGuiConstants.SLIDER_BACKGROUND_COLOR, new StringBuilder(), MyGuiConstants.SLIDER_WIDTH_LABEL, 0, MyGuiConstants.LABEL_TEXT_SCALE * 0.85f); m_aggresivityLabel = new MyGuiControlLabel(this, controlsOriginRight + 3 * CONTROLS_DELTA + new Vector2(MyGuiConstants.SLIDER_WIDTH, 0), null, MyTextsWrapperEnum.SetShipFaction, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); Controls.Add(m_aggresivitySlider); Controls.Add(m_aggresivityLabel); m_aggresivitySlider.OnChange += OnAggresivityChanged; OnAggresivityChanged(m_aggresivitySlider); // See distance Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 4 * CONTROLS_DELTA, null, MyTextsWrapperEnum.SeeDistance, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_seeDistanceSlider = new MyGuiControlSlider(this, controlsOriginRight + 4 * CONTROLS_DELTA + new Vector2(MyGuiConstants.SLIDER_WIDTH / 2, 0), MyGuiConstants.SLIDER_WIDTH, 0, 1000, MyGuiConstants.SLIDER_BACKGROUND_COLOR, new StringBuilder(), MyGuiConstants.SLIDER_WIDTH_LABEL, 0, MyGuiConstants.LABEL_TEXT_SCALE * 0.85f); m_seeDistanceLabel = new MyGuiControlLabel(this, controlsOriginRight + 4 * CONTROLS_DELTA + new Vector2(MyGuiConstants.SLIDER_WIDTH, 0), null, MyTextsWrapperEnum.SetShipFaction, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); Controls.Add(m_seeDistanceSlider); Controls.Add(m_seeDistanceLabel); m_seeDistanceSlider.OnChange += OnSeeDistanceChanged; OnSeeDistanceChanged(m_seeDistanceSlider); #region Smallship Model MyGuiControlLabel smallShipLabel = new MyGuiControlLabel(this, controlsOriginLeft + 5 * CONTROLS_DELTA, null, MyTextsWrapperEnum.ChooseModel, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); Controls.Add(smallShipLabel); //COMBOBOX - small ship var comboboxPredefinedSize = MyGuiControlPreDefinedSize.LONGMEDIUM; var comboboxSize = MyGuiControlCombobox.GetPredefinedControlSize(comboboxPredefinedSize); m_selectSmallShipCombobox = new MyGuiControlCombobox( this, controlsOriginLeft + 5 * CONTROLS_DELTA + 0.5f * new Vector2(comboboxSize.X, 0) + new Vector2(0.19f, 0.01f), comboboxPredefinedSize, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE, 6, true, false, true); if (m_templatesBuilders == null) { foreach (MyMwcObjectBuilder_SmallShip_TypesEnum enumValue in MyGuiSmallShipHelpers.MyMwcObjectBuilder_SmallShip_TypesEnumValues) { //MyGuiSmallShipHelperSmallShip smallShipHelper = MyGuiSmallShipHelpers.GetMyGuiSmallShipHelperSmallShip(enumValue); MyGuiSmallShipHelperSmallShip smallShipHelper = MyGuiObjectBuilderHelpers.GetGuiHelper(MyMwcObjectBuilderTypeEnum.SmallShip, (int)enumValue) as MyGuiSmallShipHelperSmallShip; m_selectSmallShipCombobox.AddItem((int)enumValue, smallShipHelper.Icon, smallShipHelper.Name); } m_selectSmallShipCombobox.SelectItemByKey(1); } else { for(int i = 0; i < m_templatesBuilders.Count; i++) { var templateBuilder = m_templatesBuilders[i]; m_selectSmallShipCombobox.AddItem(i, templateBuilder.Name); } } m_selectSmallShipCombobox.OnSelectItemDoubleClick += OnOkClick; Controls.Add(m_selectSmallShipCombobox); #endregion if (m_bot != null) { Controls.Add(new MyGuiControlButton(this, controlsOriginLeft + 10 * CONTROLS_DELTA + new Vector2(0.07f, 0.02f), MyGuiConstants.PROGRESS_CANCEL_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyTextsWrapperEnum.Inventory, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnInventoryClick, MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true)); AddActivatedCheckbox(controlsOriginLeft, m_bot.Activated); } AddOkAndCancelButtonControls(new Vector2(0, -0.02f)); }
private void InitControls() { Controls.Clear(); string entityName; if (m_entities.Count == 1) { entityName = "(" + m_entities[0].GetFriendlyName() + ")"; } else { entityName = "(Mutliedit)"; } Controls.Add(new MyGuiControlLabel(this, new Vector2(0f, -m_size.Value.Y / 2f + 0.063f), null, new StringBuilder(entityName), MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER)); Vector2 controlsStartPosition = new Vector2(-m_size.Value.X / 2f + 0.05f, -m_size.Value.Y / 2f + 0.12f); Vector2 labelPosition = controlsStartPosition; Vector2 controlPosition = controlsStartPosition + new Vector2(0.4f, 0f); Vector4 notSameColor = Color.Red.ToVector4(); // name if ((m_editPropertiesFlags & MyEditPropertyEnum.Name) != 0) { AddLabel(labelPosition, MyTextsWrapperEnum.Name, m_editPropertiesNotSame[(int)MyEditPropertyEnum.Name]); m_name = new MyGuiControlTextbox(this, controlPosition, MyGuiControlPreDefinedSize.MEDIUM, m_editProperties.Name != null ? m_editProperties.Name : string.Empty, TEXTBOX_MAX_LENGTH, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.NORMAL); Controls.Add(m_name); labelPosition += MyGuiConstants.CONTROLS_DELTA; controlPosition += MyGuiConstants.CONTROLS_DELTA; } // display name if ((m_editPropertiesFlags & MyEditPropertyEnum.DisplayName) != 0) { AddLabel(labelPosition, MyTextsWrapperEnum.DisplayName, m_editPropertiesNotSame[(int)MyEditPropertyEnum.DisplayName]); m_displayName = new MyGuiControlTextbox(this, controlPosition, MyGuiControlPreDefinedSize.MEDIUM, m_editProperties.DisplayName != null ? m_editProperties.DisplayName : string.Empty, TEXTBOX_MAX_LENGTH, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.NORMAL); Controls.Add(m_displayName); labelPosition += MyGuiConstants.CONTROLS_DELTA; controlPosition += MyGuiConstants.CONTROLS_DELTA; } // display hud if ((m_editPropertiesFlags & MyEditPropertyEnum.DisplayHud) != 0) { AddLabel(labelPosition, MyTextsWrapperEnum.DisplayHud, m_editPropertiesNotSame[(int)MyEditPropertyEnum.DisplayHud]); m_displayHud = new MyGuiControlCheckbox(this, controlPosition, m_editProperties.DisplayHud, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR); Controls.Add(m_displayHud); labelPosition += MyGuiConstants.CONTROLS_DELTA; controlPosition += MyGuiConstants.CONTROLS_DELTA; } // difficulty if ((m_editPropertiesFlags ^ MyEditPropertyEnum.Difficulty) != 0) { AddLabel(labelPosition, MyTextsWrapperEnum.ActivatedUpToDifficulty, m_editPropertiesNotSame[(int)MyEditPropertyEnum.Difficulty]); m_difficulty = new MyGuiControlCombobox(this, controlPosition, MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE); m_difficulty.AddItem((int)MyGameplayDifficultyEnum.EASY, MyTextsWrapperEnum.DifficultyEasy); m_difficulty.AddItem((int)MyGameplayDifficultyEnum.NORMAL, MyTextsWrapperEnum.DifficultyNormal); m_difficulty.AddItem((int)MyGameplayDifficultyEnum.HARD, MyTextsWrapperEnum.DifficultyHard); m_difficulty.SelectItemByKey((int)m_editProperties.Difficulty); Controls.Add(m_difficulty); labelPosition += MyGuiConstants.CONTROLS_DELTA; controlPosition += MyGuiConstants.CONTROLS_DELTA; } // faction if ((m_editPropertiesFlags & MyEditPropertyEnum.Faction) != 0) { AddLabel(labelPosition, MyTextsWrapperEnum.Faction, m_editPropertiesNotSame[(int)MyEditPropertyEnum.Faction]); m_faction = new MyGuiControlCombobox(this, controlPosition, MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE); foreach (MyMwcObjectBuilder_FactionEnum faction in Enum.GetValues(typeof(MyMwcObjectBuilder_FactionEnum))) { MyGuiHelperBase factionHelper = MyGuiSmallShipHelpers.GetMyGuiSmallShipFactionNationality(faction); m_faction.AddItem((int)faction, factionHelper.Description); } m_faction.SelectItemByKey((int)m_editProperties.Faction); Controls.Add(m_faction); labelPosition += MyGuiConstants.CONTROLS_DELTA; controlPosition += MyGuiConstants.CONTROLS_DELTA; } // health if ((m_editPropertiesFlags & MyEditPropertyEnum.HealthRatio) != 0) { AddLabel(labelPosition, MyTextsWrapperEnum.HealthPercentage, m_editPropertiesNotSame[(int)MyEditPropertyEnum.HealthRatio]); m_healthPercentage = new MyGuiControlTextbox(this, controlPosition, MyGuiControlPreDefinedSize.MEDIUM, m_editProperties.HealthRatio != null ? GetFormatedFloat( m_editProperties.HealthRatio.Value * 100f) : string.Empty, TEXTBOX_NUMBERS_MAX_LENGTH, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.DIGITS_ONLY); Controls.Add(m_healthPercentage); labelPosition += MyGuiConstants.CONTROLS_DELTA; controlPosition += MyGuiConstants.CONTROLS_DELTA; AddLabel(labelPosition, MyTextsWrapperEnum.Health, m_editPropertiesNotSame[(int)MyEditPropertyEnum.HealthRatio]); m_health = new MyGuiControlTextbox(this, controlPosition, MyGuiControlPreDefinedSize.MEDIUM, m_editProperties.HealthRatio != null && m_editProperties.MaxHealth != null ? GetFormatedFloat( m_editProperties.HealthRatio.Value * m_editProperties.MaxHealth.Value) : string.Empty, TEXTBOX_NUMBERS_MAX_LENGTH, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.DIGITS_ONLY); Controls.Add(m_health); labelPosition += MyGuiConstants.CONTROLS_DELTA; controlPosition += MyGuiConstants.CONTROLS_DELTA; m_healthPercentage.TextChanged -= HealthChanged; m_healthPercentage.TextChanged += HealthChanged; m_health.TextChanged -= HealthChanged; m_health.TextChanged += HealthChanged; } // maxhealth if ((m_editPropertiesFlags & MyEditPropertyEnum.MaxHealth) != 0) { AddLabel(labelPosition, MyTextsWrapperEnum.MaxHealth, m_editPropertiesNotSame[(int)MyEditPropertyEnum.MaxHealth]); m_maxHealth = new MyGuiControlTextbox(this, controlPosition, MyGuiControlPreDefinedSize.MEDIUM, m_editProperties.MaxHealth != null ? GetFormatedFloat( m_editProperties.MaxHealth.Value) : string.Empty, TEXTBOX_NUMBERS_MAX_LENGTH, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.DIGITS_ONLY); Controls.Add(m_maxHealth); labelPosition += MyGuiConstants.CONTROLS_DELTA; controlPosition += MyGuiConstants.CONTROLS_DELTA; m_maxHealth.TextChanged -= HealthChanged; m_maxHealth.TextChanged += HealthChanged; } // prefab kinematic parts health and max health if ((m_editPropertiesFlags & MyEditPropertyEnum.KinematicPartsHealthAndMaxHealth) != 0) { AddLabel(labelPosition, MyTextsWrapperEnum.EditPrefabKinematicPartsHealthAndMaxHealth, m_editPropertiesNotSame[(int)MyEditPropertyEnum.KinematicPartsHealthAndMaxHealth]); m_kinematicPartsHealthAndMaxHealth = new MyGuiControlButton(this, controlPosition + new Vector2(0.1f, 0f), MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyTextsWrapperEnum.Edit, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnEditPrefabKinematicPartsHealthAndMaxHealthClick, MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true); Controls.Add(m_kinematicPartsHealthAndMaxHealth); labelPosition += MyGuiConstants.CONTROLS_DELTA; controlPosition += MyGuiConstants.CONTROLS_DELTA; } // indestructible if ((m_editPropertiesFlags & MyEditPropertyEnum.Indestructible) != 0) { AddLabel(labelPosition, MyTextsWrapperEnum.Indestructible, m_editPropertiesNotSame[(int)MyEditPropertyEnum.Indestructible]); m_indestructible = new MyGuiControlCheckbox(this, controlPosition, m_editProperties.IsIndestructible, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR); m_indestructible.OnCheck -= OnIndestructibleChecked; m_indestructible.OnCheck += OnIndestructibleChecked; Controls.Add(m_indestructible); labelPosition += MyGuiConstants.CONTROLS_DELTA; controlPosition += MyGuiConstants.CONTROLS_DELTA; } // change faction appearance if ((m_editPropertiesFlags & MyEditPropertyEnum.FactionAppearance) != 0) { AddLabel(labelPosition, MyTextsWrapperEnum.PrefabMaterials, false); m_appearance = new MyGuiControlCombobox(this, controlPosition, MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE); foreach (MyMwcObjectBuilder_Prefab_AppearanceEnum factionAppearance in MyGuiPrefabHelpers.MyMwcFactionTextureEnumValues) { m_appearance.AddItem((int)factionAppearance, MyGuiPrefabHelpers.GetFactionName(factionAppearance)); } Controls.Add(m_appearance); Controls.Add(new MyGuiControlButton( this, controlPosition + new Vector2(.2f, 0), MyGuiConstants.BACK_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyTextsWrapperEnum.Ok, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnChangeAppearanceClick, MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true)); labelPosition += MyGuiConstants.CONTROLS_DELTA; controlPosition += MyGuiConstants.CONTROLS_DELTA; } // Requires energy if ((m_editPropertiesFlags & MyEditPropertyEnum.RequiresEnergy) != 0) { AddLabel(labelPosition, MyTextsWrapperEnum.RequiresEnergy, m_editPropertiesNotSame[(int)MyEditPropertyEnum.RequiresEnergy]); m_requiresEnergyCheckbox = new MyGuiControlCheckbox(this, controlPosition, m_editProperties.RequiresEnergy.Value, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR); //m_requiresEnergyCheckbox.OnCheck -= OnRequiresEnergyChecked; //m_requiresEnergyCheckbox.OnCheck += OnRequiresEnergyChecked; Controls.Add(m_requiresEnergyCheckbox); labelPosition += MyGuiConstants.CONTROLS_DELTA; controlPosition += MyGuiConstants.CONTROLS_DELTA; } // use properties if ((m_editPropertiesFlags & MyEditPropertyEnum.UseProperties) != 0) { m_useProperties = new MyGuiControlUseProperties(this, controlPosition, m_editProperties.UseProperties, m_editPropertiesNotSame[(int)MyEditPropertyEnum.UseProperties] ? new Vector4(1f, 0f, 0f, 1f) : MyGuiConstants.LABEL_TEXT_COLOR); Vector2 usePropertiesSize = m_useProperties.GetSize().Value; m_useProperties.SetPosition(labelPosition + usePropertiesSize / 2f); Controls.Add(m_useProperties); labelPosition += new Vector2(0f, usePropertiesSize.Y) + MyGuiConstants.CONTROLS_DELTA; controlPosition += new Vector2(0f, usePropertiesSize.Y) + MyGuiConstants.CONTROLS_DELTA; } // Activated /* //Temporary disabled because there is no way how to select invisible object if ((m_editPropertiesFlags & MyEditPropertyEnum.Activated) != 0) { AddLabel(labelPosition, MyTextsWrapperEnum.Active, m_editPropertiesNotSame[(int)MyEditPropertyEnum.Activated]); m_activated = new MyGuiControlCheckbox(this, controlPosition, m_editProperties.IsActivated, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR); m_activated.OnCheck -= OnActivatedChecked; m_activated.OnCheck += OnActivatedChecked; Controls.Add(m_activated); labelPosition += MyGuiConstants.CONTROLS_DELTA; controlPosition += MyGuiConstants.CONTROLS_DELTA; } */ foreach (var notSameFlag in m_editPropertiesNotSame) { if (notSameFlag) { Controls.Add(new MyGuiControlLabel(this, new Vector2(-m_size.Value.X / 2f + 0.05f, m_size.Value.Y / 2.0f - MyGuiConstants.MESSAGE_BOX_BORDER_AREA_Y - MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE.Y / 2.0f + 0.03f), null, MyTextsWrapperEnum.RedColoredPropertiesAreNotSame, new Vector4(1f, 0f, 0f, 1f), MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); break; } } AddOkAndCancelButtonControls(new Vector2(0, 0.0f)); }
void Init() { m_enableBackgroundFade = true; m_size = new Vector2(0.92f, 0.95f); // Add screen title AddCaption(); Vector2 originDelta = new Vector2(0.02f, 0); Vector2 controlsOriginLeft = GetControlsOriginLeftFromScreenSize() + originDelta; Vector2 controlsOriginRight = GetControlsOriginRightFromScreenSize() + originDelta; // Decide if screen is for editing existing phys object or adding new if (HasEntity()) { //controlsOriginLeft.X += 0.5f * MyGuiConstants.COMBOBOX_LONGMEDIUM_SIZE.X; controlsOriginLeft.Y += 0.075f; //AddEditPositionControls(); AddVoxelMaterialCombobox( controlsOriginLeft + new Vector2(0.1f,-0.02f), controlsOriginLeft + new Vector2(MyGuiConstants.COMBOBOX_LONGMEDIUM_SIZE.X / 2.0f, 0) + 2 * CONTROLS_DELTA + new Vector2(0.1f,-0.065f), m_entity.VoxelMaterial); if (this.m_entity is MyVoxelMap) { Vector2 buttonDelta = new Vector2(-0.15f, m_size.Value.Y / 2.0f - MyGuiConstants.MESSAGE_BOX_BORDER_AREA_Y - MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE.Y / 2.0f - 0.085f); Controls.Add(new MyGuiControlButton(this, new Vector2(buttonDelta.X, buttonDelta.Y), new Vector2(0.25f, 0.0475f), MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyTextsWrapperEnum.RemoveVoxels, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnClearClick, MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true)); buttonDelta.X = -buttonDelta.X; Controls.Add(new MyGuiControlButton(this, new Vector2(buttonDelta.X, buttonDelta.Y), new Vector2(0.25f, 0.0475f), MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyTextsWrapperEnum.RemoveAllVoxelHands, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnClearVoxelHands, MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true)); } Vector2 controlsColumn2OriginLabel = new Vector2(controlsOriginLeft.X + MyGuiConstants.COMBOBOX_LONGMEDIUM_SIZE.X / 2 + MyGuiConstants.TEXTBOX_MEDIUM_SIZE.X + 0.03f, -m_size.Value.Y / 2.0f + 0.04f); Vector2 controlsColumn2Origin = new Vector2(controlsColumn2OriginLabel.X + 0.02f, -m_size.Value.Y / 2.0f + 0.04f); m_positionX = new MyGuiControlTextbox(this, controlsColumn2Origin + 3 * CONTROLS_DELTA + new Vector2(MyGuiConstants.TEXTBOX_MEDIUM_SIZE.X / 2.0f, 0), MyGuiControlPreDefinedSize.MEDIUM, "", 20, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.NORMAL); m_positionY = new MyGuiControlTextbox(this, controlsColumn2Origin + 4 * CONTROLS_DELTA + new Vector2(MyGuiConstants.TEXTBOX_MEDIUM_SIZE.X / 2.0f, 0), MyGuiControlPreDefinedSize.MEDIUM, "", 20, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.NORMAL); m_positionZ = new MyGuiControlTextbox(this, controlsColumn2Origin + 5 * CONTROLS_DELTA + new Vector2(MyGuiConstants.TEXTBOX_MEDIUM_SIZE.X / 2.0f, 0), MyGuiControlPreDefinedSize.MEDIUM, "", 20, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.NORMAL); Controls.Add(new MyGuiControlLabel(this, controlsColumn2OriginLabel + 3 * CONTROLS_DELTA, null, MyTextsWrapperEnum.X, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); Controls.Add(new MyGuiControlLabel(this, controlsColumn2OriginLabel + 4 * CONTROLS_DELTA, null, MyTextsWrapperEnum.Y, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); Controls.Add(new MyGuiControlLabel(this, controlsColumn2OriginLabel + 5 * CONTROLS_DELTA, null, MyTextsWrapperEnum.Z, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); Controls.Add(m_positionX); Controls.Add(m_positionY); Controls.Add(m_positionZ); m_positionX.Text = m_entity.WorldMatrix.Translation.X.ToString(); m_positionY.Text = m_entity.WorldMatrix.Translation.Y.ToString(); m_positionZ.Text = m_entity.WorldMatrix.Translation.Z.ToString(); m_changeMaterial = new MyGuiControlCheckbox(this, controlsColumn2OriginLabel + 6 * CONTROLS_DELTA + new Vector2(0.16f, 0), true, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR); Controls.Add(new MyGuiControlLabel(this, controlsColumn2OriginLabel + 6 * CONTROLS_DELTA, null, MyTextsWrapperEnum.ChangeMaterial, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); Controls.Add(m_changeMaterial); AddOkAndCancelButtonControls(); } else { #region Asteroid Type //choose asteroid type label //Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 1 * CONTROLS_DELTA + new Vector2(0, -0.0f), null, MyTextsWrapperEnum.AsteroidType, MyGuiConstants.LABEL_TEXT_COLOR, // MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); //COMBOBOX - asteroid type m_selectAsteroidTypeCombobox = new MyGuiControlCombobox(this, controlsOriginRight + 1 * CONTROLS_DELTA + new Vector2(- controlsOriginRight.X, -0.045f), MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE, 2); foreach (MyGuiAsteroidTypesEnum enumValue in MyGuiAsteroidHelpers.MyGuiAsteroidTypeEnumValues) { MyGuiAsteroidHelper asteroidTypeHelper = MyGuiAsteroidHelpers.GetMyGuiAsteroidTypeHelper(enumValue); m_selectAsteroidTypeCombobox.AddItem((int)enumValue, null, asteroidTypeHelper.Description); } m_selectAsteroidTypeCombobox.SelectItemByKey(0); Controls.Add(m_selectAsteroidTypeCombobox); m_selectAsteroidTypeCombobox.OnSelect += OnComboboxAsteroidTypeSelect; #endregion ReloadControls(); AddOkAndCancelButtonControls(); } }
void AddVoxelMaterialCombobox(Vector2 labelPosition, Vector2 comboboxPosition, MyMwcVoxelMaterialsEnum? selectedMaterial) { //choose material label m_selectMaterialLabel = new MyGuiControlLabel(this, labelPosition, null, MyTextsWrapperEnum.AsteroidMaterial, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); Controls.Add(m_selectMaterialLabel); //COMBOBOX - voxel materials enum m_selectVoxelMapMaterialCombobox = new MyGuiControlCombobox(this, comboboxPosition, MyGuiControlPreDefinedSize.LONGMEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE, 11, true, false, true); foreach (MyMwcVoxelMaterialsEnum enumValue in MyGuiAsteroidHelpers.MyMwcVoxelMaterialsEnumValues) { MyGuiVoxelMaterialHelper voxelMaterialHelper = MyGuiAsteroidHelpers.GetMyGuiVoxelMaterialHelper(enumValue); if (voxelMaterialHelper != null) m_selectVoxelMapMaterialCombobox.AddItem((int)enumValue, voxelMaterialHelper.Icon, voxelMaterialHelper.Description); } int selectedIndex; if (selectedMaterial == null) { selectedIndex = 0; } else { selectedIndex = (int)selectedMaterial.Value; } m_selectVoxelMapMaterialCombobox.SelectItemByKey(selectedIndex); m_selectVoxelMapMaterialCombobox.OnSelectItemDoubleClick += OnDoubleClick; Controls.Add(m_selectVoxelMapMaterialCombobox); }
public void ReloadControls() { Vector2 originDelta = new Vector2(0.02f, 0); Vector2 controlsOriginLeft = GetControlsOriginLeftFromScreenSize() + originDelta; if (GetAsteroidType() == MyGuiAsteroidTypesEnum.VOXEL) { #region Voxel File //choose asteroid label m_selectAsteroidLabel = new MyGuiControlLabel(this, controlsOriginLeft + 2.5f * CONTROLS_DELTA + new Vector2(0.02f, -0.02f), null, MyTextsWrapperEnum.AsteroidName, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); Controls.Add(m_selectAsteroidLabel); //COMBOBOX - voxel files m_selectVoxelMapCombobox = new MyGuiControlCombobox(this, controlsOriginLeft + 4.5f * CONTROLS_DELTA + new Vector2(MyGuiConstants.COMBOBOX_LONGMEDIUM_SIZE.X / 2.0f + 0.02f, -0.065f), MyGuiControlPreDefinedSize.LONGMEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE, 11, true, false, true); foreach (MyMwcVoxelFilesEnum enumValue in MyGuiAsteroidHelpers.MyMwcVoxelFilesEnumValues) { MyGuiAsteroidHelper voxelFileHelper = MyGuiAsteroidHelpers.GetMyGuiVoxelFileHelper(enumValue); Debug.Assert(voxelFileHelper.Description != null); m_selectVoxelMapCombobox.AddItem((int)enumValue, voxelFileHelper.Icon, voxelFileHelper.Description); } m_selectVoxelMapCombobox.SortItemsByValueText(); m_selectVoxelMapCombobox.SelectItemByKey(1); m_selectVoxelMapCombobox.OnSelectItemDoubleClick += OnDoubleClick; Controls.Add(m_selectVoxelMapCombobox); #endregion #region Voxel Material Vector2 delta = new Vector2(m_selectVoxelMapCombobox.GetSize().Value.X + 0.02f, 0); AddVoxelMaterialCombobox( controlsOriginLeft + 2.5f * CONTROLS_DELTA + delta + new Vector2(0.14f, -0.02f), controlsOriginLeft + 4.5f * CONTROLS_DELTA + new Vector2(MyGuiConstants.COMBOBOX_LONGMEDIUM_SIZE.X / 2.0f, 0) + delta + new Vector2(0.14f, -0.065f), null); #endregion } else if (GetAsteroidType() == MyGuiAsteroidTypesEnum.STATIC) { #region Static Asteroid m_selectAsteroidLabel = new MyGuiControlLabel(this, controlsOriginLeft + 2.5f * CONTROLS_DELTA + new Vector2(0.02f,-0.02f), null, MyTextsWrapperEnum.AsteroidName, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); Controls.Add(m_selectAsteroidLabel); //COMBOBOX - static asteroids m_selectVoxelMapCombobox = new MyGuiControlCombobox(this, controlsOriginLeft + 4.5f * CONTROLS_DELTA + new Vector2(MyGuiConstants.COMBOBOX_LONGMEDIUM_SIZE.X / 2.0f + 0.02f, -0.065f), MyGuiControlPreDefinedSize.LONGMEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE, 11, true, false, true); m_selectVoxelMapCombobox.OnSelectItemDoubleClick += OnDoubleClick; foreach (MyMwcObjectBuilder_StaticAsteroid_TypesEnum enumValue in MyGuiAsteroidHelpers.MyMwcStaticAsteroidTypesEnumValues) { MyGuiAsteroidHelper staticAsteroidHelper = MyGuiAsteroidHelpers.GetStaticAsteroidTypeHelper(enumValue); if (staticAsteroidHelper != null) { m_selectVoxelMapCombobox.AddItem((int)enumValue, staticAsteroidHelper.Icon, staticAsteroidHelper.Description); } } m_selectVoxelMapCombobox.SelectItemByIndex(0); Controls.Add(m_selectVoxelMapCombobox); Vector2 delta = new Vector2(m_selectVoxelMapCombobox.GetSize().Value.X + 0.02f, 0); AddVoxelMaterialCombobox( controlsOriginLeft + 2.5f * CONTROLS_DELTA + delta + new Vector2(0.14f, -0.02f), controlsOriginLeft + 4.5f * CONTROLS_DELTA + new Vector2(MyGuiConstants.COMBOBOX_LONGMEDIUM_SIZE.X / 2.0f, 0) + delta + new Vector2(0.14f,-0.065f), null); m_selectVoxelMapMaterialCombobox.SelectItemByKey(0); // Select default material #endregion } }
void CreateControls(Vector2 controlsOrigin) { var panel = new MyGuiControlPanel(m_parent, m_position, m_size, m_backgroundColor.Value, 2, m_backgroundColor.Value * 2f); m_controls.Add(panel); float dPos = -1; float dPosFalloff; MyTextsWrapperEnum[] colorNames = { MyTextsWrapperEnum.Red, MyTextsWrapperEnum.Green, MyTextsWrapperEnum.Blue }; Vector2 sliderOffset = new Vector2(0.21f, 0f); float buttonsY = m_size.Value.Y / 2.0f - MyGuiConstants.MESSAGE_BOX_BORDER_AREA_Y - MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE.Y / 2.0f; AddControl(true, new MyGuiControlButton(m_parent, new Vector2(m_position.X, controlsOrigin.Y) + dPos * MyGuiConstants.CONTROLS_DELTA, MyGuiConstants.MAIN_MENU_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyTextsWrapperEnum.SwitchToSpotLight, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnSpotClick, MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true)); ++dPos; m_controls.Add(new MyGuiControlLabel(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.EachlightHasInternallyTwoLightsPointAndSpot, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); /* * * Point light * * */ // Checkboxes for Disabled/Point/Hemisphere Vector2 checkBoxOffset = new Vector2(0.14f, 0); dPos++; AddControl(true, new MyGuiControlLabel(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA, null, new StringBuilder("Point enabled"), MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_pointLightCheckbox = new MyGuiControlCheckbox(m_parent, (checkBoxOffset + controlsOrigin) + dPos * MyGuiConstants.CONTROLS_DELTA, false, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR); AddControl(true, m_pointLightCheckbox); //dPos++; AddControl(true, new MyGuiControlLabel(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA + new Vector2(0.2f, 0), null, new StringBuilder("Hemispheric enabled"), MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_hemisphereLightCheckbox = new MyGuiControlCheckbox(m_parent, (checkBoxOffset + controlsOrigin) + dPos * MyGuiConstants.CONTROLS_DELTA + new Vector2(0.26f, 0), false, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR); AddControl(true, m_hemisphereLightCheckbox); //text dPos += 0.9f; AddControl(true, new MyGuiControlLabel(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.DiffuseColor, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); Vector2 buttonsColumn = new Vector2(0.165f, 0.0025f); Vector2 copyPasteButtonScale = MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE * new Vector2(0.7f, 0.7f); float copyPasteButtonFontScale = MyGuiConstants.BUTTON_TEXT_SCALE * 0.75f; Vector2 pasteButtonShift = new Vector2(0.115f, 0f); AddControl(true, new MyGuiControlButton(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA + buttonsColumn, copyPasteButtonScale, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyTextsWrapperEnum.Copy, MyGuiConstants.BUTTON_TEXT_COLOR, copyPasteButtonFontScale, OnCopyPointDiffuseColor, MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, true)); AddControl(true, new MyGuiControlButton(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA + buttonsColumn + pasteButtonShift, copyPasteButtonScale, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyTextsWrapperEnum.Paste, MyGuiConstants.BUTTON_TEXT_COLOR, copyPasteButtonFontScale, OnPastePointDiffuseColor, MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, true)); dPos += 0.1f; //point color sliders for (int i = 0; i < 3; i++) { dPos += 0.75f; AddControl(true, new MyGuiControlLabel(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA, null, colorNames[i], MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_pointNormalLightColorSlider[i] = new MyGuiControlSlider(m_parent, (sliderOffset + controlsOrigin) + dPos * MyGuiConstants.CONTROLS_DELTA, MyGuiConstants.SLIDER_WIDTH, MyEditorConstants.COLOR_COMPONENT_MIN_VALUE, MyEditorConstants.COLOR_COMPONENT_MAX_VALUE, MyGuiConstants.SLIDER_BACKGROUND_COLOR, new StringBuilder(), MyGuiConstants.SLIDER_WIDTH_LABEL, 0, MyGuiConstants.LABEL_TEXT_SCALE * 0.85f * 0.75f); AddControl(true, m_pointNormalLightColorSlider[i]); } //text dPos += 0.9f; AddControl(true, new MyGuiControlLabel(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.SpecularColor, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); AddControl(true, new MyGuiControlButton(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA + buttonsColumn, copyPasteButtonScale, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyTextsWrapperEnum.Copy, MyGuiConstants.BUTTON_TEXT_COLOR, copyPasteButtonFontScale, OnCopyPointSpecularColor, MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, true)); AddControl(true, new MyGuiControlButton(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA + buttonsColumn + pasteButtonShift, copyPasteButtonScale, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyTextsWrapperEnum.Paste, MyGuiConstants.BUTTON_TEXT_COLOR, copyPasteButtonFontScale, OnPastePointSpecularColor, MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, true)); dPos += 0.1f; // specular color sliders for (int i = 0; i < 3; i++) { dPos += 0.75f; AddControl(true, new MyGuiControlLabel(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA, null, colorNames[i], MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_specularLightColorSlider[i] = new MyGuiControlSlider(m_parent, (sliderOffset + controlsOrigin) + dPos * MyGuiConstants.CONTROLS_DELTA, MyGuiConstants.SLIDER_WIDTH, MyEditorConstants.COLOR_COMPONENT_MIN_VALUE, MyEditorConstants.COLOR_COMPONENT_MAX_VALUE, MyGuiConstants.SLIDER_BACKGROUND_COLOR, new StringBuilder(), MyGuiConstants.SLIDER_WIDTH_LABEL, 0, MyGuiConstants.LABEL_TEXT_SCALE * 0.85f * 0.75f); AddControl(true, m_specularLightColorSlider[i]); } /* * Effect */ //effect dPos += 1.25f; m_controls.Add( new MyGuiControlLabel(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.Options, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_effectComboBox = new MyGuiControlCombobox(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA + sliderOffset + new Vector2(0.03f, 0f), MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE); foreach (MyLightEffectTypeEnum enumValue in Enum.GetValues(typeof(MyLightEffectTypeEnum))) { m_effectComboBox.AddItem((int)enumValue, MyPrefabLight.GetStringFromMyLightEffectTypeEnum(enumValue)); } m_effectComboBox.SelectItemByKey(0); m_effectComboBox.OnSelect += OnComboBoxChange; //m_controls.Add(m_effectComboBox); m_controls.Add(m_effectComboBox); //falloff slider dPos += 1.25f; dPosFalloff = dPos; AddControl(true, new MyGuiControlLabel(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA, null, new StringBuilder("Falloff"), MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_pointFallOffSlider = new MyGuiControlSlider(m_parent, (sliderOffset + controlsOrigin) + dPos * MyGuiConstants.CONTROLS_DELTA, MyGuiConstants.SLIDER_WIDTH, 0.1f, 5.0f, MyGuiConstants.SLIDER_BACKGROUND_COLOR, new System.Text.StringBuilder(" {0}"), MyGuiConstants.SLIDER_WIDTH_LABEL + 0.05f, 3, MyGuiConstants.LABEL_TEXT_SCALE); AddControl(true, m_pointFallOffSlider); //range slider dPos++; AddControl(true, new MyGuiControlLabel(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA, null, new StringBuilder("Range"), MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_pointRangeSlider = new MyGuiControlSlider(m_parent, (sliderOffset + controlsOrigin) + dPos * MyGuiConstants.CONTROLS_DELTA, MyGuiConstants.SLIDER_WIDTH, 0.1f, MyLightsConstants.MAX_POINTLIGHT_RADIUS, MyGuiConstants.SLIDER_BACKGROUND_COLOR, new System.Text.StringBuilder(" {0}"), MyGuiConstants.SLIDER_WIDTH_LABEL + 0.05f, 3, MyGuiConstants.LABEL_TEXT_SCALE); AddControl(true, m_pointRangeSlider); //intensity slider dPos++; AddControl(true, new MyGuiControlLabel(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA, null, new StringBuilder("Intensity"), MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_pointIntensitySlider = new MyGuiControlSlider(m_parent, (sliderOffset + controlsOrigin) + dPos * MyGuiConstants.CONTROLS_DELTA, MyGuiConstants.SLIDER_WIDTH, 0.1f, 10.0f, MyGuiConstants.SLIDER_BACKGROUND_COLOR, new System.Text.StringBuilder(" {0}"), MyGuiConstants.SLIDER_WIDTH_LABEL + 0.05f, 3, MyGuiConstants.LABEL_TEXT_SCALE); AddControl(true, m_pointIntensitySlider); // Offset slider dPos++; AddControl(true, new MyGuiControlLabel(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA, null, new StringBuilder("Offset"), MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_pointOffsetSlider = new MyGuiControlSlider(m_parent, (sliderOffset + controlsOrigin) + dPos * MyGuiConstants.CONTROLS_DELTA, MyGuiConstants.SLIDER_WIDTH, -0.5f, 1.5f, MyGuiConstants.SLIDER_BACKGROUND_COLOR, new System.Text.StringBuilder(" {0}"), MyGuiConstants.SLIDER_WIDTH_LABEL + 0.05f, 3, MyGuiConstants.LABEL_TEXT_SCALE); AddControl(true, m_pointOffsetSlider); dPos++; AddControl(true, m_flashOffsetLabel = new MyGuiControlLabel(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA, null, new StringBuilder("Flash Ofst."), MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_flashOffsetSlider = new MyGuiControlSlider(m_parent, (sliderOffset + controlsOrigin) + dPos * MyGuiConstants.CONTROLS_DELTA, MyGuiConstants.SLIDER_WIDTH, 0f, 1f, MyGuiConstants.SLIDER_BACKGROUND_COLOR, new System.Text.StringBuilder(" {0}"), MyGuiConstants.SLIDER_WIDTH_LABEL + 0.05f, 3, MyGuiConstants.LABEL_TEXT_SCALE); AddControl(true, m_flashOffsetSlider); /* * * Reflector spot light * * */ dPos = -1; AddControl(false, new MyGuiControlButton(m_parent, new Vector2(m_position.X, controlsOrigin.Y) + dPos * MyGuiConstants.CONTROLS_DELTA, MyGuiConstants.MAIN_MENU_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyTextsWrapperEnum.SwitchToPointLight, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnPointClick, MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true)); dPos = 1; AddControl(false, new MyGuiControlLabel(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.Enabled, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_spotLightCheckbox = new MyGuiControlCheckbox(m_parent, (checkBoxOffset + controlsOrigin) + dPos * MyGuiConstants.CONTROLS_DELTA, false, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR); AddControl(false, m_spotLightCheckbox); //text dPos += 0.9f; AddControl(false, new MyGuiControlLabel(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.DiffuseColor, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); AddControl(false, new MyGuiControlButton(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA + buttonsColumn, copyPasteButtonScale, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyTextsWrapperEnum.Copy, MyGuiConstants.BUTTON_TEXT_COLOR, copyPasteButtonFontScale, OnCopySpotDiffuseColor, MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, true)); AddControl(false, new MyGuiControlButton(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA + buttonsColumn + pasteButtonShift, copyPasteButtonScale, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyTextsWrapperEnum.Paste, MyGuiConstants.BUTTON_TEXT_COLOR, copyPasteButtonFontScale, OnPasteSpotDiffuseColor, MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, true)); dPos += 0.1f; //color sliders for (int i = 0; i < 3; i++) { dPos += 0.75f; AddControl(false, new MyGuiControlLabel(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA, null, colorNames[i], MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_spotNormalLightColorSlider[i] = new MyGuiControlSlider(m_parent, (sliderOffset + controlsOrigin) + dPos * MyGuiConstants.CONTROLS_DELTA, MyGuiConstants.SLIDER_WIDTH, MyEditorConstants.COLOR_COMPONENT_MIN_VALUE, MyEditorConstants.COLOR_COMPONENT_MAX_VALUE, MyGuiConstants.SLIDER_BACKGROUND_COLOR, new StringBuilder(), MyGuiConstants.SLIDER_WIDTH_LABEL, 0, MyGuiConstants.LABEL_TEXT_SCALE * 0.85f * 0.75f); AddControl(false, m_spotNormalLightColorSlider[i]); } dPos++; AddControl(false, new MyGuiControlLabel(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA, null, new StringBuilder("Shadows Distance"), MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); dPos++; m_spotLightShadowDistance = new MyGuiControlSlider(m_parent, (sliderOffset + controlsOrigin) + dPos * MyGuiConstants.CONTROLS_DELTA, MyGuiConstants.SLIDER_WIDTH, 0.0f, MyLightsConstants.MAX_SPOTLIGHT_SHADOW_RANGE, MyGuiConstants.SLIDER_BACKGROUND_COLOR, new System.Text.StringBuilder(" {0}"), MyGuiConstants.SLIDER_WIDTH_LABEL + 0.05f, 3, MyGuiConstants.LABEL_TEXT_SCALE); AddControl(false, m_spotLightShadowDistance); //angle slider dPos = dPosFalloff; AddControl(false, new MyGuiControlLabel(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA, null, new StringBuilder("Angle"), MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_spotAngleSlider = new MyGuiControlSlider(m_parent, (sliderOffset + controlsOrigin) + dPos * MyGuiConstants.CONTROLS_DELTA, MyGuiConstants.SLIDER_WIDTH, 0.1f, MyLightsConstants.MAX_SPOTLIGHT_ANGLE, MyGuiConstants.SLIDER_BACKGROUND_COLOR, new System.Text.StringBuilder(" {0}"), MyGuiConstants.SLIDER_WIDTH_LABEL + 0.05f, 3, MyGuiConstants.LABEL_TEXT_SCALE); AddControl(false, m_spotAngleSlider); //falloff slider dPos++; AddControl(false, new MyGuiControlLabel(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA, null, new StringBuilder("Falloff"), MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_spotFallOffSlider = new MyGuiControlSlider(m_parent, (sliderOffset + controlsOrigin) + dPos * MyGuiConstants.CONTROLS_DELTA, MyGuiConstants.SLIDER_WIDTH, 0.1f, 5.0f, MyGuiConstants.SLIDER_BACKGROUND_COLOR, new System.Text.StringBuilder(" {0}"), MyGuiConstants.SLIDER_WIDTH_LABEL + 0.05f, 3, MyGuiConstants.LABEL_TEXT_SCALE); AddControl(false, m_spotFallOffSlider); //range slider dPos++; AddControl(false, new MyGuiControlLabel(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA, null, new StringBuilder("Range"), MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_spotRangeSlider = new MyGuiControlSlider(m_parent, (sliderOffset + controlsOrigin) + dPos * MyGuiConstants.CONTROLS_DELTA, MyGuiConstants.SLIDER_WIDTH, 0.1f, MyLightsConstants.MAX_SPOTLIGHT_RANGE, MyGuiConstants.SLIDER_BACKGROUND_COLOR, new System.Text.StringBuilder(" {0}"), MyGuiConstants.SLIDER_WIDTH_LABEL + 0.05f, 3, MyGuiConstants.LABEL_TEXT_SCALE); AddControl(false, m_spotRangeSlider); //intensity slider dPos++; AddControl(false, new MyGuiControlLabel(m_parent, controlsOrigin + dPos * MyGuiConstants.CONTROLS_DELTA, null, new StringBuilder("Intensity"), MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_spotIntensitySlider = new MyGuiControlSlider(m_parent, (sliderOffset + controlsOrigin) + dPos * MyGuiConstants.CONTROLS_DELTA, MyGuiConstants.SLIDER_WIDTH, 0.1f, 10.0f, MyGuiConstants.SLIDER_BACKGROUND_COLOR, new System.Text.StringBuilder(" {0}"), MyGuiConstants.SLIDER_WIDTH_LABEL + 0.05f, 3, MyGuiConstants.LABEL_TEXT_SCALE); AddControl(false, m_spotIntensitySlider); dPos = 15; m_controls.Add(new MyGuiControlButton(m_parent, new Vector2(m_position.X - 0.05f, controlsOrigin.Y) + dPos * MyGuiConstants.CONTROLS_DELTA, MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyTextsWrapperEnum.Ok, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnOkClick, MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER, true)); m_controls.Add(new MyGuiControlButton(m_parent, new Vector2(m_position.X + 0.05f, controlsOrigin.Y) + dPos * MyGuiConstants.CONTROLS_DELTA, MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyTextsWrapperEnum.Cancel, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnCancelClick, MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, true)); ActivateLightType(true); //m_tabControl.ActivateTab((int)MyGuiLightPrefabTypeEnum.PointLight); }