public bool DrawLoading(float backgroundFadeAlpha) { m_transitionAlpha = 1.0f; MyMinerGame.Static.GraphicsDevice.Clear(ClearFlags.Target, new SharpDX.ColorBGRA(0), 0, 0); Color colorQuote = new Color(255, 255, 255, 250); // White colorQuote.A = (byte)(colorQuote.A * m_transitionAlpha); //if (m_backgroundTextureFromConstructor == null) { ////////////////////////////////////////////////////////////////////// // Normal loading screen ////////////////////////////////////////////////////////////////////// // Random background texture Rectangle backgroundRectangle; MyGuiManager.GetSafeHeightFullScreenPictureSize(MyGuiConstants.LOADING_BACKGROUND_TEXTURE_REAL_SIZE, out backgroundRectangle); MyGuiManager.DrawSpriteBatch(m_backgroundScreenTexture, backgroundRectangle, new Color(new Vector4(0.95f, 0.95f, 0.95f, m_transitionAlpha))); // Miner Wars logo DrawMinerWarsLogo(); // Current version: //DrawAppVersion(); //DrawGlobalVersionText(); // Quote of the day or something MyGuiManager.DrawStringCentered(MyGuiManager.GetFontMinerWarsBlue(), (new System.Text.StringBuilder()).Append(MyTextsWrapper.Get(MyTextsWrapperEnum.Tip)).Append(" ").Append(MyTextsWrapper.Get(m_currentQuoteOfTheDay)), new Vector2(0.5f, 0.55f), 1.15f, colorQuote, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER); } LastBackgroundTexture = m_backgroundScreenTexture; // Loading Please Wait MyGuiManager.DrawString(MyGuiManager.GetFontMinerWarsBlue(), MyTextsWrapper.Get(MyTextsWrapperEnum.LoadingPleaseWait), MyGuiConstants.LOADING_PLEASE_WAIT_POSITION, MyGuiConstants.LOADING_PLEASE_WAIT_SCALE, new Color(MyGuiConstants.LOADING_PLEASE_WAIT_COLOR * GetTransitionAlpha()), MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_BOTTOM); if (base.Draw(backgroundFadeAlpha) == false) { return(false); } return(true); }
public bool DrawLoading(float backgroundFadeAlpha) { //MyAudio.Update(true); m_transitionAlpha = 1.0f; MyMinerGame.Static.GraphicsDevice.Clear(ClearFlags.Target, new SharpDX.ColorBGRA(0), 0, 0); Color colorQuote = new Color(255, 255, 255, 250); // White colorQuote.A = (byte)(colorQuote.A * m_transitionAlpha); //if (m_backgroundTextureFromConstructor == null) { ////////////////////////////////////////////////////////////////////// // Normal loading screen ////////////////////////////////////////////////////////////////////// MyTextsWrapperEnum sectorName = MyTextsWrapperEnum.Null; MyTextsWrapperEnum sectorDescription = MyTextsWrapperEnum.Null; MyTexture2D sectorTexture = null; bool descriptionAvailable = false; if (m_screenToLoad != null) { var position = m_screenToLoad.GetSectorIdentifier().Position; descriptionAvailable = GetSectorDescription(position, out sectorName, out sectorDescription, out sectorTexture); } else if (MyGuiScreenGamePlay.Static != null) { var position = MyGuiScreenGamePlay.Static.GetSectorIdentifier().Position; descriptionAvailable = GetSectorDescription(position, out sectorName, out sectorDescription, out sectorTexture); } else { descriptionAvailable = false; } // Random background texture Rectangle backgroundRectangle; MyGuiManager.GetSafeHeightFullScreenPictureSize(MyGuiConstants.LOADING_BACKGROUND_TEXTURE_REAL_SIZE, out backgroundRectangle); MyGuiManager.DrawSpriteBatch(descriptionAvailable ? sectorTexture : m_backgroundScreenTexture, backgroundRectangle, new Color(new Vector4(0.95f, 0.95f, 0.95f, m_transitionAlpha))); // Miner Wars logo DrawMinerWarsLogo(); // Current version: //DrawAppVersion(); //DrawGlobalVersionText(); if (descriptionAvailable) { MyGuiManager.DrawStringCentered(MyGuiManager.GetFontMinerWarsBlue(), MyTextsWrapper.Get(sectorName), new Vector2(0.5f, 0.4f), 1.6f, colorQuote, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER); MyGuiManager.DrawStringCentered(MyGuiManager.GetFontMinerWarsBlue(), MyTextsWrapper.Get(sectorDescription), new Vector2(0.5f, 0.5f), 1, colorQuote, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER); } else { // Quote of the day MyGuiManager.DrawStringCentered(MyGuiManager.GetFontMinerWarsBlue(), (new StringBuilder()).Append(MyTextsWrapper.Get(MyTextsWrapperEnum.Tip)).Append(" ").Append(MyTextsWrapper.Get(m_currentQuoteOfTheDay)), new Vector2(0.5f, 0.5f), 1.15f, colorQuote, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER); } } /* else * { * ////////////////////////////////////////////////////////////////////// * // Loading screen when there is specified background texture is little customized * ////////////////////////////////////////////////////////////////////// * * MyGuiManager.DrawSpriteBatch(m_backgroundScreenTexture, Vector2.Zero, new Color(new Vector4(0.95f, 0.95f, 0.95f, m_transitionAlpha))); * }*/ LastBackgroundTexture = m_backgroundScreenTexture; // Loading Please Wait MyGuiManager.DrawString(MyGuiManager.GetFontMinerWarsBlue(), MyTextsWrapper.Get(MyTextsWrapperEnum.LoadingPleaseWait), MyGuiConstants.LOADING_PLEASE_WAIT_POSITION, MyGuiConstants.LOADING_PLEASE_WAIT_SCALE, new Color(MyGuiConstants.LOADING_PLEASE_WAIT_COLOR * GetTransitionAlpha()), MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_BOTTOM); MyGuiManager.DrawString(MyGuiManager.GetFontMinerWarsBlue(), MyTextsWrapper.Get(MyTextsWrapperEnum.LongerLoadingTimes), MyGuiConstants.LOADING_PLEASE_WAIT_POSITION + new Vector2(0, 0.025f), MyGuiConstants.LOADING_PLEASE_WAIT_SCALE * 0.8f, new Color(MyGuiConstants.LOADING_PLEASE_WAIT_COLOR * GetTransitionAlpha()), MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_BOTTOM); if (base.Draw(backgroundFadeAlpha) == false) { return(false); } return(true); }
public override void Start(Vector3 position, Vector3 initialVelocity, Vector3 direction, float impulseMultiplier, MyEntity owner) { base.Start(position, initialVelocity, direction, impulseMultiplier, owner, MyTextsWrapper.Get(MyTextsWrapperEnum.MineBasicHud)); }
void AddDisplayModesToComboBox(int adapterIndex) { m_videoModeCombobox.ClearItems(); int counter = 0; foreach (MyVideoModeEx videoMode in MyVideoModeManager.GetAllSupportedVideoModes(adapterIndex)) { m_videoModeCombobox.AddItem(counter++, new StringBuilder( videoMode.Width + " × " + videoMode.Height + string.Format(videoMode.IsRecommended ? " – {0} ***" : " – {0}", MyTextsWrapper.Get(MyAspectRatioExList.Get(videoMode.AspectRatioEnum).TextShort)) )); } }
public MyGuiScreenOptionsVideo() : base(new Vector2(0.5f, 0.5f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, null) { MyMwcLog.WriteLine("MyGuiScreenOptionsVideo.ctor START"); m_enableBackgroundFade = true; m_size = new Vector2(0.59f, 0.68544f); m_size *= 1.1f; m_backgroundTexture = MyTextureManager.GetTexture <MyTexture2D>("Textures\\GUI\\BackgroundScreen\\VideoBackground", flags: TextureFlags.IgnoreQuality); AddCaption(MyTextsWrapperEnum.VideoOptions, new Vector2(0, 0.005f)); //Controls.Add(new MyGuiControlLabel(this, -m_size.Value / 2.0f + MyGuiConstants.SCREEN_CAPTION_DELTA_Y, null, MyTextsWrapperEnum.VideoOptions, MyGuiConstants.SCREEN_CAPTION_TEXT_COLOR, MyGuiConstants.SCREEN_CAPTION_TEXT_SCALE)); Vector2 controlsOriginLeft = new Vector2(-m_size.Value.X / 2.0f + 0.05f, -m_size.Value.Y / 2.0f + 0.145f) + new Vector2(0.02f, 0f); Vector2 controlsOriginRight = new Vector2(-m_size.Value.X / 2.0f + 0.185f, -m_size.Value.Y / 2.0f + 0.145f) + new Vector2(0.043f, 0f); controlsOriginRight.X += 0.04f; int controlIndex = 0; // Adapter Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + controlIndex * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.VideoAdapter, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE_OPTIONS, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue())); m_videoAdapterCombobox = new MyGuiControlCombobox(this, controlsOriginRight + controlIndex++ *MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.COMBOBOX_MEDIUM_SIZE.X / 2.0f, 0), MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE); m_videoAdapterCombobox.OnSelect += OnVideoAdapterSelected; AddAdaptersToComboBox(); Controls.Add(m_videoAdapterCombobox); // Video Mode Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + controlIndex * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.VideoMode, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE_OPTIONS, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue())); m_videoModeCombobox = new MyGuiControlCombobox(this, controlsOriginRight + controlIndex++ *MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.COMBOBOX_MEDIUM_SIZE.X / 2.0f, 0), MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE); // Populating Video Mode with supported DisplayMode reported by XNA framework m_videoModeCombobox.OnSelect += OnVideoModeSelected; //Added on UpdateSettings //AddDisplayModesToComboBox(MyMinerGame.GraphicsDeviceManager.GraphicsAdapter.AdapterOrdinal); Controls.Add(m_videoModeCombobox); // Recommended aspect ratio m_recommendAspectRatioLabel = new MyGuiControlLabel(this, new Vector2(controlsOriginRight.X + MyGuiConstants.COMBOBOX_TEXT_OFFSET.X, controlsOriginRight.Y + controlIndex++ *MyGuiConstants.CONTROLS_DELTA.Y - 0.015f), null, new StringBuilder(), MyGuiConstants.LABEL_TEXT_COLOR * 0.9f, MyGuiConstants.LABEL_TEXT_SCALE_OPTIONS * 0.85f, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue()); //Added on UpdateSettings //UpdateRecommendecAspectRatioLabel(MyMinerGame.GraphicsDeviceManager.GraphicsAdapter.AdapterOrdinal); Controls.Add(m_recommendAspectRatioLabel); // reduce the spacing between "Recommended aspect ratio" and items below it Vector2 offSet = new Vector2(0, MyGuiConstants.CONTROLS_DELTA.Y / 2); controlsOriginLeft -= offSet; controlsOriginRight -= offSet; // Fullscreen Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + controlIndex * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.Fullscreen, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE_OPTIONS, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue())); m_fullscreenCheckbox = new MyGuiControlCheckbox(this, controlsOriginRight + controlIndex++ *MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.CHECKBOX_WITH_GLOW_SIZE.X / 2.0f, 0), MyGuiConstants.CHECKBOX_WITH_GLOW_SIZE, MyGuiManager.GetCheckboxOffTexture(), MyGuiManager.GetCheckboxOnTexture(), null, true, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR, true, null); //m_fullscreenCheckbox.OnCheck = OnFullScreenCheck; Controls.Add(m_fullscreenCheckbox); // Vertical Sync Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + controlIndex * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.VerticalSync, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE_OPTIONS, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue())); //m_verticalSyncCheckbox = new MyGuiControlCheckbox(this, controlsOriginRight + 3 * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.CHECKBOX_SIZE.X / 2.0f, 0), true, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR); m_verticalSyncCheckbox = new MyGuiControlCheckbox(this, controlsOriginRight + controlIndex++ *MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.CHECKBOX_WITH_GLOW_SIZE.X / 2.0f, 0), MyGuiConstants.CHECKBOX_WITH_GLOW_SIZE, MyGuiManager.GetCheckboxOffTexture(), MyGuiManager.GetCheckboxOnTexture(), null, false, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR, true, null); Controls.Add(m_verticalSyncCheckbox); // Hardware Cursor Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + controlIndex * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.HardwareCursor, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE_OPTIONS, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue())); m_hardwareCursorCheckbox = new MyGuiControlCheckbox(this, controlsOriginRight + controlIndex++ *MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.CHECKBOX_WITH_GLOW_SIZE.X / 2.0f, 0), MyGuiConstants.CHECKBOX_WITH_GLOW_SIZE, MyGuiManager.GetCheckboxOffTexture(), MyGuiManager.GetCheckboxOnTexture(), null, false, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR, true, null); Controls.Add(m_hardwareCursorCheckbox); // Render Quality Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + controlIndex * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.RenderQuality, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE_OPTIONS, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue())); m_renderQualityCombobox = new MyGuiControlCombobox(this, controlsOriginRight + controlIndex++ *MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.COMBOBOX_MEDIUM_SIZE.X / 2.0f, 0), MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE); m_renderQualityCombobox.AddItem((int)MyRenderQualityEnum.LOW, MyTextsWrapperEnum.RenderQualityLow); m_renderQualityCombobox.AddItem((int)MyRenderQualityEnum.NORMAL, MyTextsWrapperEnum.RenderQualityNormal); m_renderQualityCombobox.AddItem((int)MyRenderQualityEnum.HIGH, MyTextsWrapperEnum.RenderQualityHigh); m_renderQualityCombobox.AddItem((int)MyRenderQualityEnum.EXTREME, MyTextsWrapperEnum.RenderQualityExtreme); Controls.Add(m_renderQualityCombobox); // Field of View Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + controlIndex * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.FieldOfView, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE_OPTIONS, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue())); const float fovSliderSize = MyGuiConstants.SLIDER_WIDTH * 1.1f; m_fieldOfViewSlider = new MyGuiControlSlider(this, controlsOriginRight + controlIndex * MyGuiConstants.CONTROLS_DELTA + new Vector2(fovSliderSize / 2.0f, 0), fovSliderSize, MyConstants.FIELD_OF_VIEW_CONFIG_MIN, MyConstants.FIELD_OF_VIEW_CONFIG_MAX, MyGuiConstants.SLIDER_BACKGROUND_COLOR, new StringBuilder(), MyGuiConstants.SLIDER_WIDTH_LABEL, 0, MyGuiConstants.LABEL_TEXT_SCALE_OPTIONS * 0.85f); m_fieldOfViewSlider.OnChange = OnFovChanged; Controls.Add(m_fieldOfViewSlider); m_fieldOfViewLabel = new MyGuiControlLabel(this, controlsOriginRight + controlIndex++ *MyGuiConstants.CONTROLS_DELTA + new Vector2(fovSliderSize * 1.1f, 0), null, new StringBuilder("{0:F1}"), MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE_OPTIONS, MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue()); Controls.Add(m_fieldOfViewLabel); m_fieldOfViewDefaultLabel = new MyGuiControlLabel(this, controlsOriginRight + controlIndex++ *MyGuiConstants.CONTROLS_DELTA + new Vector2(0.009f, 0), null, MyTextsWrapper.Get(MyTextsWrapperEnum.DefaultFOV), MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE_OPTIONS, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM, MyGuiManager.GetFontMinerWarsBlue()); m_fieldOfViewDefaultLabel.UpdateParams(MathHelper.ToDegrees(MyConstants.FIELD_OF_VIEW_CONFIG_DEFAULT)); Controls.Add(m_fieldOfViewDefaultLabel); //MyGuiManager.GetFontMinerWarsBlue() // Brightness //Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 8 * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.Brightness, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE_OPTIONS, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); // Contrast //Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 9 * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.Contrast, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE_OPTIONS, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); //m_contrastTextbox = new MyGuiControlTextbox(this, controlsOriginRight + 9 * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.TEXTBOX_WIDTH / 2.0f, 0), MyGuiConstants.TEXTBOX_WIDTH, "Opicka©123456", 20, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE_OPTIONS, MyGuiControlTextboxType.NORMAL); //Controls.Add(m_contrastTextbox); // Buttons APPLY and BACK var m_okButton = new MyGuiControlButton(this, new Vector2(-0.1379f, 0.2269f), MyGuiConstants.OK_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyGuiManager.GetInventoryScreenButtonTexture(), null, null, MyTextsWrapperEnum.Ok, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnApplyClick, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true); Controls.Add(m_okButton); //Controls.Add(new MyGuiControlButton(this, new Vector2(-buttonDelta.X, buttonDelta.Y), MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR, // MyTextsWrapperEnum.Apply, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnApplyClick, MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true)); //Controls.Add(new MyGuiControlButton(this, new Vector2(+buttonDelta.X, buttonDelta.Y), MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR, // MyTextsWrapperEnum.Back, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnBackClick, MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true)); var m_cancelButton = new MyGuiControlButton(this, new Vector2(0.1428f, 0.2269f), MyGuiConstants.OK_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyGuiManager.GetInventoryScreenButtonTexture(), null, null, MyTextsWrapperEnum.Back, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnBackClick, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true); Controls.Add(m_cancelButton); // Update controls with values from config file UpdateFromConfig(); UpdateControls(m_settingsOld); // Update OLD settings UpdateSettings(m_settingsOld); UpdateSettings(m_settingsNew); MyMwcLog.WriteLine("MyGuiScreenOptionsVideo.ctor END"); }
public void InitControls() { StringBuilder otherSideInventoryName = new StringBuilder(); otherSideInventoryName.Append(string.IsNullOrEmpty(m_entity.DisplayName) ? m_entity.GetFriendlyName() : m_entity.DisplayName); otherSideInventoryName.Append(MyTextsWrapper.Get(MyTextsWrapperEnum.OtherSideInventory)); Vector2 controlsOriginLeft = new Vector2(-m_size.Value.X / 4f + 0.03f, 0.1f); Vector2 controlsOriginRight = new Vector2(+m_size.Value.X / 4f - 0.03f, 0.1f); List <MyGuiControlListbox> listboxesToDragAndDrop = new List <MyGuiControlListbox>(); m_allItemsInventoryListbox = new MyGuiControlListbox(this, controlsOriginLeft, MyGuiConstants.LISTBOX_SMALL_SIZE, MyGuiConstants.LISTBOX_BACKGROUND_COLOR, null, MyGuiConstants.LABEL_TEXT_SCALE, COLUMNS, ROWS, COLUMNS, true, true, false, null, null, MyGuiManager.GetScrollbarSlider(), MyGuiManager.GetHorizontalScrollbarSlider(), 4, 2, MyGuiConstants.LISTBOX_ITEM_COLOR, 0f, 0f, 0f, 0f, 0, 0, -0.01f, -0.01f, -0.02f, 0.02f); AddInventoryListbox(m_allItemsInventoryListbox, m_allItemsInventory, ref listboxesToDragAndDrop); m_entityInventoryListbox = new MyGuiControlListbox(this, controlsOriginRight, MyGuiConstants.LISTBOX_SMALL_SIZE, MyGuiConstants.LISTBOX_BACKGROUND_COLOR, null, MyGuiConstants.LABEL_TEXT_SCALE, COLUMNS, ROWS, COLUMNS, true, true, false, null, null, MyGuiManager.GetScrollbarSlider(), MyGuiManager.GetHorizontalScrollbarSlider(), 4, 2, MyGuiConstants.LISTBOX_ITEM_COLOR, 0f, 0f, 0f, 0f, 0, 0, -0.01f, -0.01f, -0.02f, 0.02f); AddInventoryListbox(m_entityInventoryListbox, EntityWithInventory.Inventory, ref listboxesToDragAndDrop); m_dragAndDrop = new MyGuiControlListboxDragAndDrop(this, listboxesToDragAndDrop, MyGuiControlPreDefinedSize.SMALL, MyGuiConstants.LISTBOX_BACKGROUND_COLOR, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, Vector2.Zero, true); m_dragAndDrop.ListboxItemDropped += DragAndDropListboxItemDropped; Controls.Add(m_dragAndDrop); Vector2 labelOffset = new Vector2(0.05f, -0.05f); Controls.Add(new MyGuiControlLabel(this, m_allItemsInventoryListbox.GetPosition() - m_allItemsInventoryListbox.GetSize().Value / 2f + labelOffset, null, MyTextsWrapperEnum.AllItemsInventory, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); Controls.Add(new MyGuiControlLabel(this, m_entityInventoryListbox.GetPosition() - m_entityInventoryListbox.GetSize().Value / 2f + labelOffset, null, otherSideInventoryName, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); Vector2 otherSettingsPosition = new Vector2(-m_size.Value.X / 2f + 0.1f, -0.35f); Controls.Add(new MyGuiControlLabel(this, otherSettingsPosition, null, MyTextsWrapperEnum.PriceCoeficient, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_priceCoeficientTextbox = new MyGuiControlTextbox(this, otherSettingsPosition + new Vector2(0.5f, 0f), MyGuiControlPreDefinedSize.MEDIUM, string.Empty, 3, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.DIGITS_ONLY); m_priceCoeficientTextbox.Text = MyValueFormatter.GetFormatedFloat(EntityWithInventory.Inventory.PriceCoeficient, 2, string.Empty); Controls.Add(m_priceCoeficientTextbox); if (PrefabContainer != null) { otherSettingsPosition += MyGuiConstants.CONTROLS_DELTA; Controls.Add(new MyGuiControlLabel(this, otherSettingsPosition, null, MyTextsWrapperEnum.InventoryTemplates, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_inventoryTemplatesCombobox = new MyGuiControlCombobox(this, otherSettingsPosition + new Vector2(0.5f, 0f), MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE); m_inventoryTemplatesCombobox.OnSelect += new MyGuiControlCombobox.OnComboBoxSelectCallback(m_inventoryTemplatesCombobox_OnSelect); m_inventoryTemplatesCombobox.AddItem(0, MyTextsWrapperEnum.None); foreach (MyMwcInventoryTemplateTypeEnum inventoryTemplateType in MyGuiInventoryTemplateTypeHelpers.MyInventoryTemplateTypeValues) { if (MyInventoryTemplates.ContainsAnyItems(inventoryTemplateType)) { m_inventoryTemplatesCombobox.AddItem((int)inventoryTemplateType, MyGuiInventoryTemplateTypeHelpers.GetInventoryTemplateTypeHelper(inventoryTemplateType).Description); } } Controls.Add(m_inventoryTemplatesCombobox); otherSettingsPosition += MyGuiConstants.CONTROLS_DELTA; Controls.Add(new MyGuiControlLabel(this, otherSettingsPosition, null, MyTextsWrapperEnum.RefillTime, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_refillTimeTextbox = new MyGuiControlTextbox(this, otherSettingsPosition + new Vector2(0.5f, 0f), MyGuiControlPreDefinedSize.MEDIUM, string.Empty, 9, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.DIGITS_ONLY); Controls.Add(m_refillTimeTextbox); RefillTime = PrefabContainer.RefillTime; SelectedTemplateType = EntityWithInventory.Inventory.TemplateType; } }
public void Start(Vector3 position, Vector3 initialVelocity, Vector3 direction, float impulseMultiplier, MyEntity owner) { base.Start(position, initialVelocity, direction, impulseMultiplier, owner, MyTextsWrapper.Get(MyTextsWrapperEnum.DecoyFlareHud)); if (!TimeToActivate.HasValue) { TimeToActivate = MyDecoyFlareConstants.TIME_TO_ACTIVATE; } }
public void CreateControls(Vector2 controlsOrigin, Vector2 sliderOffset) { float sliderMax = 1000f; AddActivatedCheckbox(controlsOrigin, Scanner.Activated); AddIdTextBox(new Vector2(-0.17f, controlsOrigin.Y), Scanner.EntityId.Value.NumericValue); //Width slider m_widthSize = new MyGuiControlSize(this, controlsOrigin + new Vector2(0.4f, 0f) + 1 * CONTROLS_DELTA, new Vector2(0.8f, MyGuiConstants.SLIDER_HEIGHT), Vector4.Zero, null, 0f, 0.1f, sliderMax, MyTextsWrapper.Get(MyTextsWrapperEnum.Width), MyGuiSizeEnumFlags.All, sliderOffset.X); Controls.Add(m_widthSize); //Height slider m_heightSize = new MyGuiControlSize(this, controlsOrigin + new Vector2(0.4f, 0f) + 2 * CONTROLS_DELTA, new Vector2(0.8f, MyGuiConstants.SLIDER_HEIGHT), Vector4.Zero, null, 0f, 0.1f, sliderMax, MyTextsWrapper.Get(MyTextsWrapperEnum.Height), MyGuiSizeEnumFlags.All, sliderOffset.X); Controls.Add(m_heightSize); //Depth slider m_depthSize = new MyGuiControlSize(this, controlsOrigin + new Vector2(0.4f, 0f) + 3 * CONTROLS_DELTA, new Vector2(0.8f, MyGuiConstants.SLIDER_HEIGHT), Vector4.Zero, null, 0f, 0.1f, sliderMax, MyTextsWrapper.Get(MyTextsWrapperEnum.Depth), MyGuiSizeEnumFlags.All, sliderOffset.X); Controls.Add(m_depthSize); //Scanning speed slider m_scanningSpeedSize = new MyGuiControlSize(this, controlsOrigin + new Vector2(0.4f, 0f) + 4 * CONTROLS_DELTA, new Vector2(0.8f, MyGuiConstants.SLIDER_HEIGHT), Vector4.Zero, null, 0f, 0.1f, sliderMax, MyTextsWrapper.Get(MyTextsWrapperEnum.ScanningSpeed), MyGuiSizeEnumFlags.All, 0.3f); Controls.Add(m_scanningSpeedSize); // Color Vector2 colorPosition = controlsOrigin + 5 * CONTROLS_DELTA; m_colorDrawPosition = colorPosition + sliderOffset; Controls.Add(new MyGuiControlLabel(this, colorPosition, null, MyTextsWrapperEnum.Color, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); MyTextsWrapperEnum[] colorNames = { MyTextsWrapperEnum.Red, MyTextsWrapperEnum.Green, MyTextsWrapperEnum.Blue }; m_colorSlider = new MyGuiControlSlider[3]; //color sliders for (int i = 0; i < 3; i++) { Controls.Add(new MyGuiControlLabel(this, controlsOrigin + (6 + i) * CONTROLS_DELTA, null, colorNames[i], MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_colorSlider[i] = new MyGuiControlSlider(this, (sliderOffset + controlsOrigin) + (6 + i) * 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); Controls.Add(m_colorSlider[i]); } Controls.Add(new MyGuiControlLabel(this, controlsOrigin + 9 * CONTROLS_DELTA, null, MyTextsWrapperEnum.On, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_onCheckbox = new MyGuiControlCheckbox(this, controlsOrigin + sliderOffset + 9 * CONTROLS_DELTA, Scanner.Enabled, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR); Controls.Add(m_onCheckbox); }
void MeetStranger_Success(MyMissionBase sender) { MyScriptWrapper.PlayDialogue(MyDialogueEnum.RUSSIAN_TRANSMITTER_0700_VOLODIAINTRO); MyScriptWrapper.SetEntityDisplayName((uint)EntityID.ShipVolodia, MyTextsWrapper.Get(MyTextsWrapperEnum.Volodia).ToString()); }
private void MarkAsDestroy(MyEntity entity) { string destroyCaption = DestroyCaption ?? (HudName != null ? HudNameTemp.ToString() : null) ?? MyTextsWrapper.Get(MyTextsWrapperEnum.Destroy).ToString(); if (entity is MySmallShipBot) { destroyCaption = ""; } MyScriptWrapper.MarkEntity(entity, destroyCaption, guiTargetMode: MyGuitargetMode.Enemy, flags: MyHudIndicatorFlagsEnum.SHOW_BORDER_INDICATORS | MyHudIndicatorFlagsEnum.SHOW_DISTANCE | MyHudIndicatorFlagsEnum.SHOW_HEALTH_BARS | MyHudIndicatorFlagsEnum.SHOW_TEXT); }
public MyRectangle2D GetTextSize() { if (m_textDraw != null) { // This means that text was changed through UpdateParams return(MyGuiManager.MeasureString(MyGuiManager.GetFontMinerWarsBlue(), m_textDraw, m_parent.GetPositionAbsolute() + m_position, m_textScale, m_textAlign)); } else { return(MyGuiManager.MeasureString(MyGuiManager.GetFontMinerWarsBlue(), MyTextsWrapper.Get(m_textEnum), m_parent.GetPositionAbsolute() + m_position, m_textScale, m_textAlign)); } }
public void DoWork() { try { MyEntities.EntityCloseLock.AcquireShared(); if (m_goalEntity == null) { return; } // try the direct path { var directLine = new MyLine(m_startPos, m_goalPos, true); if (MyEntities.GetAnyIntersectionWithLine(ref directLine, m_goalEntity, null, true, true, true, false) == null) { Path.Add(m_startPos); Path.Add(m_goalPos); Message = new StringBuilder().AppendFormat(MyTextsWrapper.Get(MyTextsWrapperEnum.GPSDistance).ToString(), Vector3.Distance(m_startPos, m_goalPos)); return; } } // get the closest waypoint to the goal (ignore visibility) MyWayPoint goal = MyWayPointGraph.GetClosestNonGeneratedWaypoint(m_goalPos); if (goal == null) { return; } // remember which waypoints were visible/invisible from startPos // remember blocked/unblocked edges var visibleFromStartPosCache = new Dictionary <MyWayPoint, bool>(); //var blockedEdges = new HashSet<Tuple<MyWayPoint, MyWayPoint>>(); HashSet <Tuple <MyWayPoint, MyWayPoint> > blockedEdges = null; using (MyWayPoint.BlockedEdgesLock.AcquireSharedUsing()) { blockedEdges = new HashSet <Tuple <MyWayPoint, MyWayPoint> >(MyWayPoint.BlockedEdgesForPlayer); } var unblockedEdges = new HashSet <Tuple <MyWayPoint, MyWayPoint> >(); // get 7 closest visible waypoints to startPos and compute shortest paths from them // first try 7 closest var closestVisibleWaypoints = MyWayPointGraph.GetClosestVisibleWaypoints(m_startPos, m_goalEntity, 7, 7, visibleFromStartPosCache); if (closestVisibleWaypoints.Count == 0 || !FindPathBetweenWaypoints(closestVisibleWaypoints, goal, visibleFromStartPosCache, blockedEdges, unblockedEdges)) { // failure: try 50 closest closestVisibleWaypoints = MyWayPointGraph.GetClosestVisibleWaypoints(m_startPos, m_goalEntity, 12, 50, visibleFromStartPosCache); if (closestVisibleWaypoints.Count == 0 || !FindPathBetweenWaypoints(closestVisibleWaypoints, goal, visibleFromStartPosCache, blockedEdges, unblockedEdges)) { return; // no use } } } finally { if (m_goalEntity != null) { m_goalEntity.OnClose -= goalEntity_OnClose; } MyEntities.EntityCloseLock.ReleaseShared(); } }
private bool FindPathBetweenWaypoints( List <MyWayPoint> closestVisibleWaypoints, MyWayPoint goal, Dictionary <MyWayPoint, bool> visibleFromStartPosCache, HashSet <Tuple <MyWayPoint, MyWayPoint> > blockedEdges, HashSet <Tuple <MyWayPoint, MyWayPoint> > unblockedEdges ) { // find the best path candidate float shortestPathLength = float.MaxValue; int retryCount = 0; for (int j = 0; j < closestVisibleWaypoints.Count && retryCount < 30; j++) // max retry count is 30 { var path = closestVisibleWaypoints[j].GetShortestPathTo(goal, blockedEdges, true, false); if (path.Count == 0) { continue; } // optimize the path: try to delete waypoints from the start of the path (if the next waypoints are visible) int farthestVisibleWaypointInPath = 0; for (int i = Math.Min(path.Count - 1, 20); i > 0; i--) // path optimization: max 20 raycasts per path candidate, reuse previous results { if (path[i].IsVisibleFrom(m_startPos, m_goalEntity, visibleFromStartPosCache)) { farthestVisibleWaypointInPath = i; break; } } // compute the length of the path candidate float length = Vector3.Distance(m_startPos, path[farthestVisibleWaypointInPath].WorldMatrix.Translation) + Vector3.Distance(path[path.Count - 1].WorldMatrix.Translation, m_goalPos); for (int i = farthestVisibleWaypointInPath; i < path.Count - 1; i++) { length += Vector3.Distance(path[i].WorldMatrix.Translation, path[i + 1].WorldMatrix.Translation); } // if it's the shortest path candidate yet, make it the new GPS path if (length < shortestPathLength) { // but first check that the edges are free of any obstructions (and remember it) bool pathBlocked = false; for (int i = farthestVisibleWaypointInPath; i < path.Count - 2; i++) { // assume that edges between non-generated waypoints are always ok if (path[i].Save && path[i + 1].Save) { continue; } var tuple = Tuple.Create(path[i], path[i + 1]); if (unblockedEdges.Contains(tuple)) // already tested and it was ok { } else if (path[i + 1].IsVisibleFrom(path[i].Position, m_goalEntity)) { unblockedEdges.Add(tuple); unblockedEdges.Add(Tuple.Create(path[i + 1], path[i])); } else { blockedEdges.Add(tuple); blockedEdges.Add(Tuple.Create(path[i + 1], path[i])); pathBlocked = true; break; } } if (pathBlocked) { j--; // retry current waypoint with updated cache of blocked edges retryCount++; continue; } // seems legit shortestPathLength = length; Path = new List <Vector3>(); Path.Add(m_startPos); for (int i = farthestVisibleWaypointInPath; i < path.Count; i++) { Path.Add(path[i].WorldMatrix.Translation); } Path.Add(m_goalPos); } } if (Path.Count != 0) { Message = new StringBuilder().AppendFormat(MyTextsWrapper.Get(MyTextsWrapperEnum.GPSDistance).ToString(), shortestPathLength); return(true); } else { return(false); } }
private void LoadText() { m_text = new StringBuilder(); m_text.Append(MyTextsWrapper.Get(MyTextsWrapperEnum.EnterContextMenu).ToString()); }
private void CreateButtons() { // Toolbar buttons init m_addObjectButton = AddToolbarButton(EditorToolBarButtonType.AddObjectButton, MyTextsWrapperEnum.ToolbarAddObject, MyTextsWrapper.Get(MyTextsWrapperEnum.AddObject), OnAddObject); m_editObjectsButton = AddToolbarButton(EditorToolBarButtonType.EditObjectsButton, MyTextsWrapperEnum.ToolbarEditObjects, new StringBuilder(MyTextsWrapper.Get(MyTextsWrapperEnum.EditObjects) + " \\ " + MyTextsWrapper.Get(MyTextsWrapperEnum.EditVoxelHand)), OnEditObjects); m_resetRotationButton = AddToolbarButton(EditorToolBarButtonType.ResetRotationButton, MyTextsWrapperEnum.ToolbarResetRotation, MyTextsWrapper.Get(MyTextsWrapperEnum.ResetRotation), OnResetRotation); m_copySelectedButton = AddToolbarButton(EditorToolBarButtonType.CopySelectedButton, MyTextsWrapperEnum.ToolbarCopySelected, MyTextsWrapper.Get(MyTextsWrapperEnum.CopySelected), OnCopySelected); m_switchGizmoSpaceButton = AddToolbarButton(EditorToolBarButtonType.SwitchGizmoSpaceButton, MyTextsWrapperEnum.ToolbarSwitchGizmoSpace, MyTextsWrapper.Get(MyTextsWrapperEnum.SwitchGizmoSpace), OnSwitchGizmoSpace); m_switchGizmoModeButton = AddToolbarButton(EditorToolBarButtonType.SwitchGizmoModeButton, MyTextsWrapperEnum.ToolbarSwitchGizmoMode, MyTextsWrapper.Get(MyTextsWrapperEnum.SwitchGizmoMode), OnSwitchGizmoMode); m_linkSnapPoints = AddToolbarButton(EditorToolBarButtonType.LinkSnapPoints, MyTextsWrapperEnum.ToolbarLinkSnapPoints, new StringBuilder(MyTextsWrapper.Get(MyTextsWrapperEnum.LinkSnapPoints) + " \\ " + MyTextsWrapper.Get(MyTextsWrapperEnum.UnlinkSnapPoints)), OnLinkSnapPoints); m_toggleSnapPoints = AddToolbarButton(EditorToolBarButtonType.ToggleSnapPoints, MyTextsWrapperEnum.ToolbarToggleSnapPoints, MyTextsWrapper.Get(MyTextsWrapperEnum.ToggleSnapPoints), OnToggleSnapPoints); m_selectAllObjectsButton = AddToolbarButton(EditorToolBarButtonType.SelectAllObjectsButton, MyTextsWrapperEnum.ToolbarSelectAllObjects, MyTextsWrapper.Get(MyTextsWrapperEnum.SelectAllObjects), OnSelectAllObjects); m_exitSelectedButton = AddToolbarButton(EditorToolBarButtonType.ExitSelectedButton, MyTextsWrapperEnum.ToolbarExitSelected, MyTextsWrapper.Get(MyTextsWrapperEnum.ExitSelected), OnExitSelected); m_enterPrefabContainerButton = AddToolbarButton(EditorToolBarButtonType.EnterPrefabContainerButton, MyTextsWrapperEnum.ToolbarEnterPrefabContainer, new StringBuilder(MyTextsWrapper.Get(MyTextsWrapperEnum.EnterPrefabContainer) + " \\ " + MyTextsWrapper.Get(MyTextsWrapperEnum.ExitEditingMode)), OnEnterPrefabContainer); m_attachToCameraButton = AddToolbarButton(EditorToolBarButtonType.AttachToCameraButton, MyTextsWrapperEnum.ToolbarAttachToCamera, MyTextsWrapper.Get(MyTextsWrapperEnum.AttachToCamera), OnAttachToCamera); m_enterVoxelHandButton = AddToolbarButton(EditorToolBarButtonType.EnterVoxelHandButton, MyTextsWrapperEnum.ToolbarEnterVoxelHand, new StringBuilder(MyTextsWrapper.Get(MyTextsWrapperEnum.EnterVoxelHand) + " \\ " + MyTextsWrapper.Get(MyTextsWrapperEnum.ExitVoxelHand)), OnEnterVoxelHand); m_clearWholeSectorButton = AddToolbarButton(EditorToolBarButtonType.ClearWholeSectorButton, MyTextsWrapperEnum.ToolbarClearWholeSector, MyTextsWrapper.Get(MyTextsWrapperEnum.ClearWholeSector), OnClearWholeSector); m_loadSectorButton = AddToolbarButton(EditorToolBarButtonType.LoadSectorButton, MyTextsWrapperEnum.ToolbarLoadSector, MyTextsWrapper.Get(MyTextsWrapperEnum.LoadSector), OnLoadSector); m_saveSectorButton = AddToolbarButton(EditorToolBarButtonType.SaveSectorButton, MyTextsWrapperEnum.ToolbarSaveSector, MyTextsWrapper.Get(MyTextsWrapperEnum.SaveSector), OnSaveSector); //m_adjustGridButton = AddToolbarButton(EditorToolBarButtonType.AdjustGridButton, MyTextsWrapper.Get(MyTextsWrapperEnum.AdjustGrid), MyGuiManager.GetToolbarAdjustGridTexture(), OnAdjustGrid); //m_sunSettingsButton = AddToolbarButton(EditorToolBarButtonType.SunSettingsButton, MyTextsWrapperEnum.ToolbarSunSettings, MyTextsWrapper.Get(MyTextsWrapperEnum.SunSettings), OnSettings); m_groupsButton = AddToolbarButton(EditorToolBarButtonType.GroupsButton, MyTextsWrapperEnum.ToolbarEditorGroups, MyTextsWrapper.Get(MyTextsWrapperEnum.EditorGroups), OnGroups); m_copyToolButton = AddToolbarButton(EditorToolBarButtonType.CopyToolButton, MyTextsWrapperEnum.ToolbarCopyTool, MyTextsWrapper.Get(MyTextsWrapperEnum.CopyTool), OnCopyTool); m_optionsButton = AddToolbarButton(EditorToolBarButtonType.OptionsButton, MyTextsWrapperEnum.ToolbarEditorOptions, MyTextsWrapper.Get(MyTextsWrapperEnum.EditorOptions), OnOptions); m_selectAndHideButton = AddToolbarButton(EditorToolBarButtonType.SelectAndHideButton, MyTextsWrapperEnum.ToolbarEditorSelectAndHide, MyTextsWrapper.Get(MyTextsWrapperEnum.EditorSelectAndHide), OnSelectAndHide); m_editPropertiesButton = AddToolbarButton(EditorToolBarButtonType.EditProperties, MyTextsWrapperEnum.ToolbarEditProperties, MyTextsWrapper.Get(MyTextsWrapperEnum.EditProperties), OnEditProperties); m_listWayPointsButton = AddToolbarButton(EditorToolBarButtonType.ListWayPoints, MyTextsWrapperEnum.ToolbarWaypoints, MyTextsWrapper.Get(MyTextsWrapperEnum.Waypoints), OnListWaypoints); m_correctSnappedPrefabsButton = AddToolbarButton(EditorToolBarButtonType.CorrectSnappedPrefabsButton, MyTextsWrapperEnum.ToolbarCorrectSnappedPrefabs, MyTextsWrapper.Get(MyTextsWrapperEnum.CorrectSnappedPrefabs), OnCorrectSnappedPrefabs); m_smallShipTemplates = AddToolbarButton(EditorToolBarButtonType.SmallShipTemplates, MyTextsWrapperEnum.ToolbarSmallShipTemplates, MyTextsWrapper.Get(MyTextsWrapperEnum.SmallShipTemplates), OnSmallShipTemplates); m_selectDeactivatedEntityButton = AddToolbarButton(EditorToolBarButtonType.SelectDeactivatedEntityButton, MyTextsWrapperEnum.ToolbarSelectDeactivatedEntity, MyTextsWrapper.Get(MyTextsWrapperEnum.SelectDeactivatedEntity), OnSelectDeactivatedEntity); m_findEntityButton = AddToolbarButton(EditorToolBarButtonType.FindEntityButton, MyTextsWrapperEnum.FindEntityByID, MyTextsWrapper.Get(MyTextsWrapperEnum.FindEntityByID), OnFindEntity); foreach (MyGuiControlBase control in m_editorControls) { control.DrawWhilePaused = false; } UpdateToolbarButtonsSizeAndPosition(); }
// This method realy initiates/starts the missile // IMPORTANT: Direction vector must be normalized! public void Start( Vector3 position, Vector3 initialVelocity, Vector3 direction, float impulseMultiplier, MyEntity owner) { if (Physics.Static) { Physics.Static = false; } base.Start(position, initialVelocity, direction, impulseMultiplier, owner, MyTextsWrapper.Get(MyTextsWrapperEnum.RemoteCameraHud)); Physics.AngularDamping = 1; Health = MaxHealth; m_directionAfterContact = null; var ownerShip = owner as MySmallShip; if (ownerShip != null) { ownerShip.Config.BackCamera.SetOn(); ownerShip.AddRemoteCamera(this); ownerShip.SelectLastRemoteCamera(); } }
public void Start(Vector3 position, Vector3 initialVelocity, Vector3 direction, float impulseMultiplier, MyEntity owner) { base.Start(position, initialVelocity, direction, impulseMultiplier, owner, MyTextsWrapper.Get(MyTextsWrapperEnum.SmokeBombHud)); if (!TimeToActivate.HasValue) { TimeToActivate = MySmokeBombConstants.TIME_TO_ACTIVATE; } m_smokeFired = false; m_smokeEnded = false; }
/// <summary> /// Creates new instance with text's font /// </summary> /// <param name="text">Warning text</param> /// <param name="textFont">Text's font</param> public MyHudTextWarning(MyTextsWrapperEnum text, MyGuiFont textFont) : this(MyTextsWrapper.Get(text), textFont) { }
public MyMinerGame(ServiceContainer services) { MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartProfilingBlock("MyMinerGame()::constructor"); MyMwcLog.WriteLine("MyMinerGame.Constructor() - START"); MyMwcLog.IncreaseIndent(); Services = services; // we want check objectbuilders, prefab's configurations, gameplay constants and building specifications MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartProfilingBlock("Checks"); MyMwcObjectBuilder_Base.Check(); MyPrefabConstants.Check(); MyGameplayConstants.Check(); MyBuildingSpecifications.Check(); MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartNextBlock("Preallocate"); Preallocate(); MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartNextBlock("IsAdmin"); WindowsIdentity windowsIdentity = WindowsIdentity.GetCurrent(); WindowsPrincipal windowsPrincipal = new WindowsPrincipal(windowsIdentity); bool IsAdmin = windowsPrincipal.IsInRole(WindowsBuiltInRole.Administrator); MyMwcLog.WriteLine("IsAdmin " + IsAdmin.ToString()); MyMwcLog.WriteLine("Game dir: " + GameDir); MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartNextBlock("MyCustomGraphicsDeviceManagerDX"); #if !DEBUG try { #endif this.Exiting += MyMinerGame_Exiting; this.Activated += MyMinerGame_OnActivated; this.Deactivated += MyMinerGame_OnDeactivated; this.m_InvokeQueue = new ConcurrentQueue <Tuple <ManualResetEvent, Action> >(); this.m_MainThread = Thread.CurrentThread; GraphicsDeviceManager = new MyCustomGraphicsDeviceManagerDX(this); m_isGraphicsSupported = GraphicsDeviceManager.ChangeProfileSupport(); m_isGraphicsSupported = true; if (m_isGraphicsSupported) { MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartNextBlock("MyVideoModeManager.HookEventHandlers"); MyVideoModeManager.HookEventHandlers(); //Content = new MyCustomContentManager(Services, ContentDir); // Content = new SharpDX.Toolkit.Content.ContentManager(Services); RootDirectory = Path.Combine(GameDir, "Content"); RootDirectoryDebug = Path.GetFullPath(System.IO.Path.Combine(GameDir, "..\\..\\..\\Content")); RootDirectoryEffects = RootDirectory; Static = this; MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartNextBlock("InitNumberOfCores"); InitNumberOfCores(); MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartNextBlock("MyVideoModeManager.LogApplicationInformation"); MyVideoModeManager.LogApplicationInformation(); MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartNextBlock("MyVideoModeManager.LogInformation"); MyVideoModeManager.LogInformation(); MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartNextBlock("MyVideoModeManager.LogEnvironmentInformation"); MyVideoModeManager.LogEnvironmentInformation(); MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartNextBlock("MyPlugins.LoadContent"); MyPlugins.LoadContent(); MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartNextBlock("MyConfig.Load"); MyConfig.Load(); MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartNextBlock("MyMath.Init"); MyMath.Init(); MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartNextBlock("MyTextsWrapper.Init"); MyTextsWrapper.Init(); MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartNextBlock("MyDialoguesWrapper.Init"); MyDialoguesWrapper.Init(); // If I don't set TargetElapsedTime, default value will be used, which is 60 times per second, and it will be more precise than if I calculate // it like below - SO I MUST BE DOING THE WRONG CALCULATION !!! // We use fixed timestep. Update() is called at this precise timesteps. If Update or Draw takes more time, Update will be called more time. Draw is called only after Update. #if RENDER_PROFILING || GPU_PROFILING IsFixedTimeStep = false; MyMinerGame.GraphicsDeviceManager.SynchronizeWithVerticalRetrace = false; #else IsFixedTimeStep = MyFakes.FIXED_TIMESTEP; #endif } MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartNextBlock("InitMultithreading"); InitMultithreading(); #if !DEBUG } catch (Exception ex) { // We are catching exceptions in constructor, because if error occures here, it app will start unloading // so we skip to UnloadContent and there we will get another exception (because app wasn't really loaded when unload started) // So we want original exception in log. MyMwcLog.WriteLine(ex); throw; } #endif MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().EndProfilingBlock(); MyMwcLog.DecreaseIndent(); MyMwcLog.WriteLine("MyMinerGame.Constructor() - END"); MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().EndProfilingBlock(); }
public MyHudTextWarning(MyTextsWrapperEnum text, params object[] args) : this(new StringBuilder(MyTextsWrapper.GetFormatString(text, args))) { }
void CreateControls(Vector2 controlsOrigin, Vector2 sliderOffset) { m_nameLabel = new MyGuiControlLabel(this, controlsOrigin - new Vector2(0, 2 * CONTROLS_DELTA.Y), null, MyTextsWrapperEnum.Name, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); m_nameTextBox = new MyGuiControlTextbox(this, controlsOrigin - new Vector2(-0.2f, 2 * CONTROLS_DELTA.Y), MyGuiControlPreDefinedSize.MEDIUM, DummyPoint.Name ?? String.Empty, 512, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.NORMAL); m_nameTextBox.TextChanged = OnTextChange; Controls.Add(m_nameLabel); Controls.Add(m_nameTextBox); m_typeComboBox = new MyGuiControlCombobox(this, controlsOrigin - new Vector2(-0.25f, CONTROLS_DELTA.Y), MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE); m_typeComboBox.AddItem(0, new StringBuilder("Box")); m_typeComboBox.AddItem(1, new StringBuilder("Sphere")); m_typeComboBox.OnSelect += new MyGuiControlCombobox.OnComboBoxSelectCallback(m_typeComboBox_OnSelect); Controls.Add(m_typeComboBox); MyGuiControlLabel typeLabel = new MyGuiControlLabel(this, controlsOrigin - new Vector2(-0.0f, CONTROLS_DELTA.Y), null, MyTextsWrapperEnum.Width, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); typeLabel.UpdateText("Type"); Controls.Add(typeLabel); float checkBoxOffset = 0.507f; //Enabled Controls.Add(new MyGuiControlLabel(this, controlsOrigin - new Vector2(-checkBoxOffset, 2 * CONTROLS_DELTA.Y), null, MyTextsWrapperEnum.Enabled, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_enabled = new MyGuiControlCheckbox(this, controlsOrigin - new Vector2(-checkBoxOffset, 2 * CONTROLS_DELTA.Y) + new Vector2(0.1f, 0f), false, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR); m_enabled.OnCheck += OnEnabledChange; Controls.Add(m_enabled); // Active AddActivatedCheckbox(controlsOrigin - new Vector2(-checkBoxOffset, CONTROLS_DELTA.Y), DummyPoint.Activated); float sliderMax = 50000; //Width slider m_widthSize = new MyGuiControlSize(this, controlsOrigin + new Vector2(0.35f, 0f), new Vector2(0.7f, MyGuiConstants.SLIDER_HEIGHT), Vector4.Zero, null, 0f, 0.1f, sliderMax, MyTextsWrapper.Get(MyTextsWrapperEnum.Width), MyGuiSizeEnumFlags.All, sliderOffset.X); m_widthSize.OnValueChange += OnWidthChange; Controls.Add(m_widthSize); //Height slider m_heightSize = new MyGuiControlSize(this, controlsOrigin + new Vector2(0.35f, 0f) + 1 * CONTROLS_DELTA, new Vector2(0.7f, MyGuiConstants.SLIDER_HEIGHT), Vector4.Zero, null, 0f, 0.1f, sliderMax, MyTextsWrapper.Get(MyTextsWrapperEnum.Height), MyGuiSizeEnumFlags.All, sliderOffset.X); m_heightSize.OnValueChange += OnHeightChange; Controls.Add(m_heightSize); //Depth slider m_depthSize = new MyGuiControlSize(this, controlsOrigin + new Vector2(0.35f, 0f) + 2 * CONTROLS_DELTA, new Vector2(0.7f, MyGuiConstants.SLIDER_HEIGHT), Vector4.Zero, null, 0f, 0.1f, sliderMax, MyTextsWrapper.Get(MyTextsWrapperEnum.Depth), MyGuiSizeEnumFlags.All, sliderOffset.X); m_depthSize.OnValueChange += OnDepthChange; Controls.Add(m_depthSize); MyGuiControlLabel idLabel = new MyGuiControlLabel(this, controlsOrigin + 3 * CONTROLS_DELTA, null, MyTextsWrapperEnum.Depth, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); Controls.Add(idLabel); idLabel.UpdateText("ID: " + m_entity.EntityId.ToString()); int controlsDelta = 4; // Flags m_colorArea = new MyGuiControlCheckbox(this, controlsOrigin + controlsDelta++ *CONTROLS_DELTA, false, MyGuiConstants.RADIOBUTTON_BACKGROUND_COLOR); m_colorArea.OnCheck += OnFlagChange; m_colorAreaLabel = new MyGuiControlLabel(this, controlsOrigin + new Vector2(MyGuiConstants.RADIOBUTTON_SIZE.X, 0.0f) + 4 * CONTROLS_DELTA, null, MyTextsWrapperEnum.ColorArea, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); Controls.Add(m_colorArea); Controls.Add(m_colorAreaLabel); m_playerStart = new MyGuiControlCheckbox(this, controlsOrigin + controlsDelta * CONTROLS_DELTA, false, MyGuiConstants.RADIOBUTTON_BACKGROUND_COLOR); m_playerStart.OnCheck += OnPlayerStartFlagChange; m_playerStartLabel = new MyGuiControlLabel(this, controlsOrigin + new Vector2(MyGuiConstants.RADIOBUTTON_SIZE.X, 0.0f) + controlsDelta++ *CONTROLS_DELTA, null, MyTextsWrapperEnum.PlayerStart, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); Controls.Add(m_playerStart); Controls.Add(m_playerStartLabel); m_mothershipStart = new MyGuiControlCheckbox(this, controlsOrigin + controlsDelta * CONTROLS_DELTA, false, MyGuiConstants.RADIOBUTTON_BACKGROUND_COLOR); m_mothershipStart.OnCheck += OnMothershipStartFlagChange; m_mothershipStartLabel = new MyGuiControlLabel(this, controlsOrigin + new Vector2(MyGuiConstants.RADIOBUTTON_SIZE.X, 0.0f) + controlsDelta++ *CONTROLS_DELTA, null, MyTextsWrapperEnum.MothershipStart, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); Controls.Add(m_mothershipStart); Controls.Add(m_mothershipStartLabel); m_detector = new MyGuiControlCheckbox(this, controlsOrigin + controlsDelta * CONTROLS_DELTA, false, MyGuiConstants.RADIOBUTTON_BACKGROUND_COLOR); m_detector.OnCheck += OnFlagChange; m_detectorLabel = new MyGuiControlLabel(this, controlsOrigin + new Vector2(MyGuiConstants.RADIOBUTTON_SIZE.X, 0.0f) + controlsDelta++ *CONTROLS_DELTA, null, MyTextsWrapperEnum.Detector, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); Controls.Add(m_detector); Controls.Add(m_detectorLabel); m_sideMission = new MyGuiControlCheckbox(this, controlsOrigin + controlsDelta * CONTROLS_DELTA, false, MyGuiConstants.RADIOBUTTON_BACKGROUND_COLOR); m_sideMission.OnCheck += OnFlagChange; m_sideMissionLabel = new MyGuiControlLabel(this, controlsOrigin + new Vector2(MyGuiConstants.RADIOBUTTON_SIZE.X, 0.0f) + controlsDelta++ *CONTROLS_DELTA, null, MyTextsWrapperEnum.SideMission, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); Controls.Add(m_sideMission); Controls.Add(m_sideMissionLabel); m_particleEffect = new MyGuiControlCheckbox(this, controlsOrigin + controlsDelta * CONTROLS_DELTA, false, MyGuiConstants.RADIOBUTTON_BACKGROUND_COLOR); m_particleEffect.OnCheck += OnFlagChange; m_particleEffectLabel = new MyGuiControlLabel(this, controlsOrigin + new Vector2(MyGuiConstants.RADIOBUTTON_SIZE.X, 0.0f) + controlsDelta++ *CONTROLS_DELTA, null, MyTextsWrapperEnum.ParticleEffect, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); Controls.Add(m_particleEffectLabel); Controls.Add(m_particleEffect); m_respawnPoint = new MyGuiControlCheckbox(this, controlsOrigin + controlsDelta * CONTROLS_DELTA, false, MyGuiConstants.RADIOBUTTON_BACKGROUND_COLOR); m_respawnPoint.OnCheck += OnFlagChange; m_respawnPointLabel = new MyGuiControlLabel(this, controlsOrigin + new Vector2(MyGuiConstants.RADIOBUTTON_SIZE.X, 0.0f) + controlsDelta++ *CONTROLS_DELTA, null, MyTextsWrapperEnum.RespawnPoint, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); Controls.Add(m_respawnPointLabel); Controls.Add(m_respawnPoint); m_safeArea = new MyGuiControlCheckbox(this, controlsOrigin + controlsDelta * CONTROLS_DELTA, false, MyGuiConstants.RADIOBUTTON_BACKGROUND_COLOR); m_safeArea.OnCheck += OnFlagChange; m_safeAreaLabel = new MyGuiControlLabel(this, controlsOrigin + new Vector2(MyGuiConstants.RADIOBUTTON_SIZE.X, 0.0f) + controlsDelta++ *CONTROLS_DELTA, null, MyTextsWrapperEnum.SafeArea, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); Controls.Add(m_safeArea); Controls.Add(m_safeAreaLabel); m_survivePrefabDestruction = new MyGuiControlCheckbox(this, controlsOrigin + controlsDelta * CONTROLS_DELTA, false, MyGuiConstants.RADIOBUTTON_BACKGROUND_COLOR); m_survivePrefabDestruction.OnCheck += OnFlagChange; m_survivePrefabDestructionLabel = new MyGuiControlLabel(this, controlsOrigin + new Vector2(MyGuiConstants.RADIOBUTTON_SIZE.X, 0.0f) + controlsDelta++ *CONTROLS_DELTA, null, MyTextsWrapperEnum.SurvivePrefabDestruction, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); Controls.Add(m_survivePrefabDestructionLabel); Controls.Add(m_survivePrefabDestruction); m_textureQuad = new MyGuiControlCheckbox(this, controlsOrigin + controlsDelta * CONTROLS_DELTA, false, MyGuiConstants.RADIOBUTTON_BACKGROUND_COLOR); m_textureQuad.OnCheck += OnFlagChange; m_textureQuadLabel = new MyGuiControlLabel(this, controlsOrigin + new Vector2(MyGuiConstants.RADIOBUTTON_SIZE.X, 0.0f) + controlsDelta++ *CONTROLS_DELTA, null, MyTextsWrapperEnum.TextureQuad, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); Controls.Add(m_textureQuad); Controls.Add(m_textureQuadLabel); m_note = new MyGuiControlCheckbox(this, controlsOrigin + controlsDelta * CONTROLS_DELTA, false, MyGuiConstants.RADIOBUTTON_BACKGROUND_COLOR); m_note.OnCheck += OnFlagChange; m_noteLabel = new MyGuiControlLabel(this, controlsOrigin + new Vector2(MyGuiConstants.RADIOBUTTON_SIZE.X, 0.0f) + controlsDelta++ *CONTROLS_DELTA, null, MyTextsWrapperEnum.Note, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); Controls.Add(m_note); Controls.Add(m_noteLabel); Vector2 columnOffset = new Vector2(0.15f, 0); Vector2 labelColumnOffset = new Vector2(0.18f, 0); // Red slider m_redSliderLabel = new MyGuiControlLabel(this, labelColumnOffset + controlsOrigin + 4 * CONTROLS_DELTA, null, MyTextsWrapperEnum.Red, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); m_redSlider = new MyGuiControlSlider(this, columnOffset + controlsOrigin + sliderOffset + 4 * 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); m_redSlider.OnChange = OnComponentChange; Controls.Add(m_redSliderLabel); Controls.Add(m_redSlider); // Green slider m_greenSliderLabel = new MyGuiControlLabel(this, labelColumnOffset + controlsOrigin + 5 * CONTROLS_DELTA, null, MyTextsWrapperEnum.Green, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); m_greenSlider = new MyGuiControlSlider(this, columnOffset + controlsOrigin + sliderOffset + 5 * 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); m_greenSlider.OnChange = OnComponentChange; Controls.Add(m_greenSliderLabel); Controls.Add(m_greenSlider); // Blue slider m_blueSliderLabel = new MyGuiControlLabel(this, labelColumnOffset + controlsOrigin + 6 * CONTROLS_DELTA, null, MyTextsWrapperEnum.Blue, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); m_blueSlider = new MyGuiControlSlider(this, columnOffset + controlsOrigin + sliderOffset + 6 * 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); m_blueSlider.OnChange = OnComponentChange; Controls.Add(m_blueSliderLabel); Controls.Add(m_blueSlider); // Alpha slider m_alphaSliderLabel = new MyGuiControlLabel(this, labelColumnOffset + controlsOrigin + 7 * CONTROLS_DELTA, null, MyTextsWrapperEnum.Alpha, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); m_alphaSlider = new MyGuiControlSlider(this, columnOffset + controlsOrigin + sliderOffset + 7 * 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); m_alphaSlider.OnChange = OnComponentChange; m_alphaSliderValueLabel = new MyGuiControlLabel(this, columnOffset + controlsOrigin + 7 * CONTROLS_DELTA + new Vector2(0.4f, 0), null, new StringBuilder("0"), MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); // scale slider m_userScaleSliderLabel = new MyGuiControlLabel(this, labelColumnOffset + controlsOrigin + 8 * CONTROLS_DELTA, null, MyTextsWrapperEnum.UserScale, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); m_userScaleSlider = new MyGuiControlSlider(this, columnOffset + controlsOrigin + sliderOffset + 8 * CONTROLS_DELTA, MyGuiConstants.SLIDER_WIDTH, 0.01f, 3.9f, MyGuiConstants.SLIDER_BACKGROUND_COLOR, new StringBuilder(), MyGuiConstants.SLIDER_WIDTH_LABEL, 0, MyGuiConstants.LABEL_TEXT_SCALE * 0.85f); m_userScaleSlider.OnChange = OnComponentChange; m_userScaleLabel = new MyGuiControlLabel(this, columnOffset + controlsOrigin + 8 * CONTROLS_DELTA + new Vector2(0.4f, 0), null, new StringBuilder("0"), MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); Controls.Add(m_alphaSliderLabel); Controls.Add(m_alphaSliderValueLabel); Controls.Add(m_alphaSlider); Controls.Add(m_userScaleSliderLabel); Controls.Add(m_userScaleSlider); Controls.Add(m_userScaleLabel); // Particle effect //m_particleNameLabel = new MyGuiControlLabel(this, columnOffset + controlsOrigin + 4 * CONTROLS_DELTA, null, MyTextsWrapperEnum.ParticleEffect, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); m_particleCombo = new MyGuiControlCombobox(this, columnOffset + controlsOrigin + 9 * CONTROLS_DELTA + sliderOffset, MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE, 5, false, false, false); foreach (var p in MyParticlesLibrary.GetParticleEffects()) { m_particleCombo.AddItem(p.GetID(), new StringBuilder(p.Name)); m_particleCombo.SortItemsByValueText(); } m_particleCombo.OnSelect += new MyGuiControlCombobox.OnComboBoxSelectCallback(m_particleCombo_OnSelect); //Controls.Add(m_particleNameLabel); Controls.Add(m_particleCombo); m_respawnPointCombo = new MyGuiControlCombobox(this, columnOffset + controlsOrigin + 10 * CONTROLS_DELTA + sliderOffset, MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE, 4); foreach (MyMwcObjectBuilder_FactionEnum enumValue in MyGuiSmallShipHelpers.MyMwcObjectBuilder_SmallShip_ShipFactionNationalityEnumValues) { MyGuiHelperBase factionNationalityHelper = MyGuiSmallShipHelpers.GetMyGuiSmallShipFactionNationality(enumValue); m_respawnPointCombo.AddItem((int)enumValue, null, factionNationalityHelper.Description); } m_respawnPointCombo.OnSelect += new MyGuiControlCombobox.OnComboBoxSelectCallback(m_repawnPointCombo_OnSelect); Controls.Add(m_respawnPointCombo); m_secretCombo = new MyGuiControlCombobox(this, columnOffset + controlsOrigin + 7 * CONTROLS_DELTA + sliderOffset, MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE, 4); m_secretCombo.AddItem(0, null, new StringBuilder("No secret")); foreach (var room in MySecretRooms.SecretRooms) { m_secretCombo.AddItem(room.Key, null, new StringBuilder(room.Value)); } m_secretCombo.OnSelect += new MyGuiControlCombobox.OnComboBoxSelectCallback(m_secretCombo_OnSelect); Controls.Add(m_secretCombo); UpdateValues(); }
public void ReloadName() { NameTemp = MyTextsWrapper.Get(Name); HudNameTemp = (m_hudName == null) ? new StringBuilder("") : MyTextsWrapper.Get(m_hudName.Value); }
StringBuilder GetRecommendedAspectRatio(int adapterIndex) { MyAspectRatioEx recommendedAspectRatio = MyAspectRatioExList.Get(MyAspectRatioExList.GetWindowsDesktopClosestAspectRatio(adapterIndex)); StringBuilder sb = new StringBuilder(); sb.AppendFormat(MyTextsWrapper.Get(MyTextsWrapperEnum.RecommendedAspectRatio).ToString(), MyTextsWrapper.Get(recommendedAspectRatio.TextShort)); return(sb); }
public void InsertRequiredActors() { MyMwcLog.WriteLine("InsertRequiredActors - START"); foreach (MyActorEnum actor in RequiredActors) { switch (actor) { //Insert Madelyn case MyActorEnum.MADELYN: { if (!MyEntities.EntityExists("Madelyn")) { MyMwcLog.WriteLine("Insert Madelyne - START"); // Holds ids for remap IMyEntityIdRemapContext remapContext = new MyEntityIdRemapContext(); //MyMwcObjectBuilder_SectorObjectGroups groups = MySectorGenerator.LoadSectorGroups(MyTemplateGroups.GetGroupSector(MyTemplateGroupEnum.Madelyn)); MyMwcObjectBuilder_SectorObjectGroups groups = MySession.Static.LoadSectorGroups(MyTemplateGroups.GetGroupSector(MyTemplateGroupEnum.Madelyn)); System.Diagnostics.Debug.Assert(groups.Groups.Count > 0); MyMwcObjectBuilder_ObjectGroup madelynGroup = groups.Groups[0]; groups.RemapEntityIds(remapContext); IEnumerable <MyMwcObjectBuilder_Base> rootObjects = madelynGroup.GetRootBuilders(groups.Entities); List <MyMwcObjectBuilder_Base> clonedList = new List <MyMwcObjectBuilder_Base>(); foreach (MyMwcObjectBuilder_Base o in rootObjects) { // Clone var clone = o.Clone() as MyMwcObjectBuilder_Base; // we want Madelyn's prefab container as first builder if (clone is MyMwcObjectBuilder_PrefabContainer) { clonedList.Insert(0, clone); } else { clonedList.Add(clone); } } System.Diagnostics.Debug.Assert(clonedList.Count > 0 && clonedList[0] is MyMwcObjectBuilder_PrefabContainer); // create Madelyn's prefab container MyEntity madelynMothership = MyEntities.CreateFromObjectBuilder(MyTextsWrapper.Get(MyTextsWrapperEnum.Actor_Madelyn).ToString(), clonedList[0], ((MyMwcObjectBuilder_Object3dBase)clonedList[0]).PositionAndOrientation.GetMatrix()); madelynMothership.FindChild(MyMissionLocation.MADELYN_HANGAR).DisplayName = MyTextsWrapper.Get(MyTextsWrapperEnum.Sapho).ToString(); madelynMothership.SetName(MyActorConstants.GetActorName(MyActorEnum.MADELYN)); Matrix madelynMothershipWorldInv = Matrix.Invert(madelynMothership.WorldMatrix); List <MinerWars.AppCode.Game.Entities.WayPoints.MyWayPoint> waypoints = new List <Entities.WayPoints.MyWayPoint>(); // create other entities as children of Madelyn's prefab container for (int i = 1; i < clonedList.Count; i++) { System.Diagnostics.Debug.Assert(clonedList[i] is MyMwcObjectBuilder_Object3dBase); MyEntity childEntity = MyEntities.CreateFromObjectBuilder(null, clonedList[i], ((MyMwcObjectBuilder_Object3dBase)clonedList[i]).PositionAndOrientation.GetMatrix()); childEntity.SetLocalMatrix(childEntity.WorldMatrix * madelynMothershipWorldInv); madelynMothership.Children.Add(childEntity); if (childEntity is MinerWars.AppCode.Game.Entities.WayPoints.MyWayPoint) { waypoints.Add(childEntity as MinerWars.AppCode.Game.Entities.WayPoints.MyWayPoint); } } // connect waypoints of Madelyn's prefab container foreach (var waypoint in waypoints) { waypoint.ResolveLinks(); } // set correct Madelyn's position and add to scene madelynMothership.SetWorldMatrix(MyPlayer.FindMothershipPosition()); madelynMothership.Link(); MyEntities.Add(madelynMothership); MyMwcLog.WriteLine("Insert Madelyne - END"); } else { MyMwcLog.WriteLine("Insert Madelyne - Madelyne already loaded"); } MyWayPointGraph.RecreateWaypointsAroundMadelyn(); } break; //Insert Marcus case MyActorEnum.MARCUS: InsertFriend(MyActorEnum.MARCUS); break; //Insert RavenGirl case MyActorEnum.TARJA: InsertFriend(MyActorEnum.TARJA); break; //Insert RavenGuy case MyActorEnum.VALENTIN: InsertFriend(MyActorEnum.VALENTIN, MyMwcObjectBuilder_SmallShip_TypesEnum.HAMMER); break; default: System.Diagnostics.Debug.Assert(false, "Uknown actor to insert!"); break; } } MyMwcLog.WriteLine("InsertRequiredActors - END"); }
private void AddLockedHud() { DisplayOnHud = true; MyHud.ChangeText(this, MyTextsWrapper.Get(MyTextsWrapperEnum.DoorsLocked), MyGuitargetMode.Enemy, 200f, MyHudIndicatorFlagsEnum.SHOW_BORDER_INDICATORS | MyHudIndicatorFlagsEnum.SHOW_DISTANCE | MyHudIndicatorFlagsEnum.SHOW_TEXT | MyHudIndicatorFlagsEnum.SHOW_HEALTH_BARS | MyHudIndicatorFlagsEnum.SHOW_MISSION_MARKER); }
public static MySmallShipBot InsertFriend(MyActorEnum actorEnum, MyMwcObjectBuilder_SmallShip_TypesEnum?shipType = null) { MyMwcObjectBuilder_SmallShip_TypesEnum selectedShipType; if (shipType.HasValue) { selectedShipType = shipType.Value; } else { switch (actorEnum) { case MyActorEnum.TARJA: selectedShipType = MyMwcObjectBuilder_SmallShip_TypesEnum.DOON; break; case MyActorEnum.VALENTIN: selectedShipType = MyMwcObjectBuilder_SmallShip_TypesEnum.HAMMER; break; default: selectedShipType = MyMwcObjectBuilder_SmallShip_TypesEnum.GETTYSBURG; break; } } MySmallShipBot bot; string actorSystemName = MyActorConstants.GetActorName(actorEnum); if (!MyEntities.EntityExists(actorSystemName)) { MyMwcLog.WriteLine("Insert " + actorSystemName + " - START"); bot = MyGuiScreenGamePlay.Static.CreateFriend(MyTextsWrapper.Get(MyActorConstants.GetActorProperties(actorEnum).DisplayName).ToString(), 100000, 1, selectedShipType); bot.SetName(actorSystemName); bot.Save = true; bot.LeaderLostEnabled = true; bot.IsDestructible = false; bot.SetWorldMatrix(Matrix.CreateWorld(bot.GetPosition(), MySession.PlayerShip.WorldMatrix.Forward, MySession.PlayerShip.WorldMatrix.Up)); bot.Faction = MyMwcObjectBuilder_FactionEnum.Rainiers; bot.AIPriority = -5; MyMwcLog.WriteLine("Insert " + actorSystemName + " - END"); } else { bot = MyEntities.GetEntityByName(actorSystemName) as MySmallShipBot; bot.Save = true; bot.LeaderLostEnabled = true; // Not persisted for now MyMwcLog.WriteLine("Insert " + actorSystemName + " - already loaded"); } //Init smaller box physics because of following player problems bot.InitPhysics(1 / MySmallShipConstants.FRIEND_SMALL_SHIP_MODEL_SCALE, bot.ShipTypeProperties.Visual.MaterialType); bot.Follow(MySession.PlayerShip); if (!MySession.PlayerFriends.Contains(bot)) { MySession.PlayerFriends.Add(bot); } Debug.Assert(bot.Save, "Bot must have save flag to work in coop"); return(bot); }
private static void LoadGameInventory(ref MyInventory otherSideInventory, ref StringBuilder otherSideInventoryName, ref List <MySmallShipBuilderWithName> shipsObjectBuilders) { if (MySession.PlayerShip.TradeDetector != null && m_detectedEntity == null) { m_detectedEntity = MySession.PlayerShip.TradeDetector.GetNearestEntity(); } if (m_detectedEntity != null) { if (m_detectedAction == null) { m_detectedAction = (MySmallShipInteractionActionEnum)MySession.PlayerShip.TradeDetector.GetNearestEntityCriterias(); } m_otherSideInventoryOwner = m_detectedEntity as IMyInventory; otherSideInventory = m_otherSideInventoryOwner.Inventory; string entityName; if (m_detectedEntity is MyPrefabHangar) { entityName = ((m_detectedEntity) as MyPrefabHangar).GetOwner().GetCorrectDisplayName(); } else { entityName = m_detectedEntity.GetCorrectDisplayName(); } switch (m_detectedAction) { case MySmallShipInteractionActionEnum.TradeForFree: if (IsTradingWithMothership()) { List <MyInventoryItem> inventoryItems = new List <MyInventoryItem>(); foreach (MyInventoryItem inventoryItem in m_shipsInventoryOwner.Inventory.GetInventoryItems()) { if (inventoryItem.ObjectBuilderType == MyMwcObjectBuilderTypeEnum.SmallShip_Player) { shipsObjectBuilders.Add(new MySmallShipBuilderWithName(inventoryItem.GetInventoryItemObjectBuilder(false) as MyMwcObjectBuilder_SmallShip_Player)); } else if (inventoryItem.ObjectBuilderType == MyMwcObjectBuilderTypeEnum.SmallShip_HackingTool) { inventoryItem.CanBeMoved = false; } else { continue; } inventoryItem.IsTemporaryItem = true; inventoryItems.Add(inventoryItem); } //m_shipsInventoryOwner.Inventory.RemoveInventoryItems(inventoryItems); //m_shipsInventoryOwner.Inventory.RemoveInventoryItems(MyMwcObjectBuilderTypeEnum.SmallShip_Player, null); //m_shipsInventoryOwner.Inventory.ClearInventoryItems(false); m_shipsInventoryOwner.Inventory.RemoveInventoryItems(inventoryItems, false); otherSideInventory.AddInventoryItems(inventoryItems); } break; case MySmallShipInteractionActionEnum.TradeForMoney: m_tradeForMoney = true; if (m_detectedEntity is MySmallShipBot) { otherSideInventory.PriceCoeficient = 3f; } break; case MySmallShipInteractionActionEnum.Blocked: case MySmallShipInteractionActionEnum.Build: case MySmallShipInteractionActionEnum.Loot: case MySmallShipInteractionActionEnum.Examine: case MySmallShipInteractionActionEnum.ExamineEmpty: break; default: throw new MyMwcExceptionApplicationShouldNotGetHere(); } otherSideInventoryName = new StringBuilder(); if (string.IsNullOrEmpty(entityName)) { otherSideInventoryName.Append(MyTextsWrapper.Get(MyTextsWrapperEnum.OtherSide)); } else { otherSideInventoryName.Append(entityName); //otherSideInventoryName.Append(MyTextsWrapper.Get(MyTextsWrapperEnum.OtherSideInventory)); } if (OpeningInventoryScreen != null) { OpeningInventoryScreen(m_detectedEntity, m_detectedAction.Value); } } }
public void OnPlayMMOClick(MyGuiControlButton sender) { // TODO: See implementation of OnPlayStoryClick() MyGuiManager.AddScreen(new MyGuiScreenMessageBox(MyMessageBoxType.ERROR, MyTextsWrapper.Get(MyTextsWrapperEnum.MessageMmoWillBeAddedLater), new StringBuilder(), MyTextsWrapperEnum.Ok, null)); }
protected override void UpdateName() { m_name = MyTextsWrapper.Get(m_nameTextEnum); }
public MyGuiScreenJoinGame(MyGuiScreenBase closeAfterSuccessfulEnter, MyGameTypes gameTypeFilter) : base(new Vector2(0.5f, 0.5f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, new Vector2(0.95f, 0.8f)) { m_size = new Vector2(0.95f, 0.85f); m_serverDisconnectedHandler = new ConnectionHandler(Static_ServerDisconnected); m_gameTypeFilter = gameTypeFilter; m_backgroundTexture = MyTextureManager.GetTexture <MyTexture2D>("Textures\\GUI\\BackgroundScreen\\VideoBackground", flags: TextureFlags.IgnoreQuality); m_closeAfterSuccessfulEnter = closeAfterSuccessfulEnter; m_enableBackgroundFade = true; m_games = new List <MyGameExtendedInfo>(); AddCaption(MyTextsWrapperEnum.JoinGame, new Vector2(0, 0.0075f)); Vector2 menuPositionOrigin = new Vector2(-0.31f, -m_size.Value.Y / 2.0f + 0.15f); Vector2 buttonDelta = new Vector2(0.22f, 0); const MyGuiControlButtonTextAlignment menuButtonTextAlignement = MyGuiControlButtonTextAlignment.CENTERED; Controls.Add(new MyGuiControlLabel(this, menuPositionOrigin, null, MyTextsWrapperEnum.SearchGameToJoin, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER)); m_searchTextbox = new MyGuiControlTextbox(this, menuPositionOrigin + buttonDelta, MyGuiControlPreDefinedSize.LARGE, "", 40, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlTextboxType.NORMAL); m_searchTextbox.TextChanged += OnSearchTextChanged; Controls.Add(m_searchTextbox); menuPositionOrigin += new Vector2(0.395f, 0); var refreshButton = new MyGuiControlButton( this, menuPositionOrigin + buttonDelta, MyGuiConstants.BACK_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyTextsWrapperEnum.Refresh, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnRefreshButtonClick, menuButtonTextAlignement, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true); Controls.Add(refreshButton); menuPositionOrigin.Y += 0.052f; menuPositionOrigin.X = -0.33f; var storyLabel = new MyGuiControlLabel(this, menuPositionOrigin, null, MyTextsWrapperEnum.Story, Vector4.One, 1.0f, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); Controls.Add(storyLabel); menuPositionOrigin.X = -0.35f; m_storyCheck = new MyGuiControlCheckbox(this, menuPositionOrigin, true, Vector4.One, null); m_storyCheck.OnCheck = CheckChanged; Controls.Add(m_storyCheck); menuPositionOrigin.X = -0.2f; var deathLabel = new MyGuiControlLabel(this, menuPositionOrigin, null, MyTextsWrapperEnum.Deathmatch, Vector4.One, 1.0f, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); Controls.Add(deathLabel); menuPositionOrigin.X = -0.22f; m_deathCheck = new MyGuiControlCheckbox(this, menuPositionOrigin, true, Vector4.One, null); m_deathCheck.OnCheck = CheckChanged; Controls.Add(m_deathCheck); //var storyButton = new MyGuiControlButton(this, menuPositionOrigin, null, Vector4.One, MyTextsWrapperEnum.Story, Vector4.One, 1.0f, menuPositionOrigin.Y += 0.25f; menuPositionOrigin.X = 0; m_gameList = new MyGuiControlListbox(this, menuPositionOrigin, new Vector2(0.22f, 0.04f), MyGuiConstants.LISTBOX_BACKGROUND_COLOR, MyTextsWrapper.Get(MyTextsWrapperEnum.JoinGame), MyGuiConstants.LABEL_TEXT_SCALE, HeaderCount, 10, HeaderCount, true, true, false, null, null, MyGuiManager.GetScrollbarSlider(), MyGuiManager.GetHorizontalScrollbarSlider(), 2, 1, MyGuiConstants.LISTBOX_BACKGROUND_COLOR_BLUE, 0f, 0f, 0f, 0f, 0, 0, -0.01f, -0.01f, -0.02f, 0.02f); m_gameList.ItemSelect += OnGamesItemSelect; m_gameList.DisplayHighlight = true; m_gameList.MultipleSelection = true; m_gameList.ItemDoubleClick += GameListOnItemDoubleClick; m_gameList.HighlightHeadline = true; m_gameList.EnableAllRowHighlightWhileMouseOver(true, true); m_gameList.SetCustomCollumnsWidths(new List <float>() { 0.15f, 0.30f, 0.15f, 0.10f }); Controls.Add(m_gameList); buttonDelta = new Vector2(0.1f, m_size.Value.Y / 2.0f - MyGuiConstants.MESSAGE_BOX_BORDER_AREA_Y - MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE.Y / 2.0f - 0.06f); Controls.Add(new MyGuiControlButton(this, new Vector2(-buttonDelta.X, buttonDelta.Y), 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(+buttonDelta.X, buttonDelta.Y), 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)); AddHeaders(); }