예제 #1
0
        protected MyGuiControlCheckbox addCheckBox(StringBuilder text, bool enabled = true, List<MyGuiControlBase> controlGroup = null, Vector4? color = null)
        {
            MyGuiControlLabel label = new MyGuiControlLabel(this, m_currentPosition, null, text, color ?? m_defaultColor, MyGuiConstants.LABEL_TEXT_SCALE * MyGuiConstants.DEBUG_LABEL_TEXT_SCALE * m_scale,
                                                            MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);

            float labelWidth = label.GetTextSize().Size.X + 0.02f;
            m_maxWidth = Math.Max(m_maxWidth, labelWidth);
            label.Enabled = enabled;
            Controls.Add(label);


            Vector2? m = this.GetSize();

            Vector2 checkBoxSize = MyGuiConstants.CHECKBOX_SIZE * m_scale;
            MyGuiControlCheckbox checkBox = new MyGuiControlCheckbox(this, m_currentPosition + new Vector2(m.Value.X - 2 * checkBoxSize.X - m_checkBoxOffset, 0),
                checkBoxSize, false, 0.8f * (color ?? m_defaultColor));
            checkBox.Enabled = enabled;

            Controls.Add(checkBox);

            m_currentPosition.Y += 0.04f * m_scale;

            if (controlGroup != null)
            {
                controlGroup.Add(label);
                controlGroup.Add(checkBox);
            }

            return checkBox;
        }
        public override void RecreateControls(bool contructor)
        {
            Controls.Clear();

            AddCaption(new StringBuilder("Player Head Shake"), Color.Yellow.ToVector4());

            MyGuiControlLabel label = new MyGuiControlLabel(this, new Vector2(0.01f, -m_size.Value.Y / 2.0f + 0.07f), null, new System.Text.StringBuilder("(press ALT to share focus)"), Color.Yellow.ToVector4(), MyGuiConstants.LABEL_TEXT_SCALE * 0.7f,
                                   MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_TOP);
            Controls.Add(label);

            m_currentPosition = -m_size.Value / 2.0f + new Vector2(0.02f, 0.10f);

            m_currentPosition.Y += 0.01f;

            MySmallShip ship = MySession.PlayerShip;

            if (ship != null)
            {
                AddSlider(new StringBuilder("MaxShake"), 0, 30, ship.GetShake(), MemberHelper.GetMember(() => ship.GetShake().m_MaxShake));
                AddSlider(new StringBuilder("MaxShakePos"), 0, 1, ship.GetShake(), MemberHelper.GetMember(() => ship.GetShake().m_MaxShakePos));
                AddSlider(new StringBuilder("MaxShakeDir"), 0, 1, ship.GetShake(), MemberHelper.GetMember(() => ship.GetShake().m_MaxShakeDir));
                AddSlider(new StringBuilder("Reduction"), 0, 1, ship.GetShake(), MemberHelper.GetMember(() => ship.GetShake().m_Reduction));
                AddSlider(new StringBuilder("Damping"), 0, 1, ship.GetShake(), MemberHelper.GetMember(() => ship.GetShake().m_Damping));
                AddSlider(new StringBuilder("OffConstant"), 0, 1, ship.GetShake(), MemberHelper.GetMember(() => ship.GetShake().m_OffConstant));
                AddSlider(new StringBuilder("DirReduction"), 0, 30, ship.GetShake(), MemberHelper.GetMember(() => ship.GetShake().m_DirReduction));
            }

            m_currentPosition.Y += 0.01f;
        }
        public override void RecreateControls(bool contructor)
        {
            Controls.Clear();

            AddCaption(new StringBuilder("Player Head Shake"), Color.Yellow.ToVector4());

            MyGuiControlLabel label = new MyGuiControlLabel(this, new Vector2(0.01f, -m_size.Value.Y / 2.0f + 0.07f), null, new System.Text.StringBuilder("(press ALT to share focus)"), Color.Yellow.ToVector4(), MyGuiConstants.LABEL_TEXT_SCALE * 0.7f,
                                   MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_TOP);
            Controls.Add(label);

            m_currentPosition = -m_size.Value / 2.0f + new Vector2(0.02f, 0.10f);

            m_currentPosition.Y += 0.01f;

            MySmallShip ship = MySession.PlayerShip;
            if (ship != null)
            {
                AddSlider(new StringBuilder("MaxVelocity"), 0, 1, ship.GetCameraSpring(), MemberHelper.GetMember(() => ship.GetCameraSpring().m_MaxVelocity));
                AddSlider(new StringBuilder("MaxAccel"), 0, 80, ship.GetCameraSpring(), MemberHelper.GetMember(() => ship.GetCameraSpring().m_MaxAccel));
                AddSlider(new StringBuilder("MaxDistanceSpeed"), 0, 500, ship.GetCameraSpring(), MemberHelper.GetMember(() => ship.GetCameraSpring().m_MaxDistanceSpeed));
                AddSlider(new StringBuilder("linearVelocityDumping"), 0, 1, ship.GetCameraSpring(), MemberHelper.GetMember(() => ship.GetCameraSpring().m_linearVelocityDumping));
                AddSlider(new StringBuilder("localTranslationDumping"), 0, 1, ship.GetCameraSpring(), MemberHelper.GetMember(() => ship.GetCameraSpring().m_localTranslationDumping));
            }

            m_currentPosition.Y += 0.01f;
        }
        public override void RecreateControls(bool contructor)
        {
            Controls.Clear();

            AddCaption(new StringBuilder("Small ship weapons"), Color.Yellow.ToVector4());

            MyGuiControlLabel label = 
                new MyGuiControlLabel(this, new Vector2(0.01f, -m_size.Value.Y / 2.0f + 0.07f), null, new StringBuilder("(press ALT to share focus)"), 
                                      Color.Yellow.ToVector4(), MyGuiConstants.LABEL_TEXT_SCALE * 0.7f, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_TOP);
            Controls.Add(label);

            AddSlider(new StringBuilder("Drill ejecting speed"), 0.10f, 0.50f, null,
                      MemberHelper.GetMember(() => MyDrillDeviceConstants.DRILL_EJECTING_SPEED));

            AddSlider(new StringBuilder("LightOffsetX"), -20, 20, null, MemberHelper.GetMember(() => MySmallShip.LightOffsetX));
            AddSlider(new StringBuilder("LightOffsetY"), -20, 20, null, MemberHelper.GetMember(() => MySmallShip.LightOffsetY));
            AddSlider(new StringBuilder("LightOffsetZ"), -20, 20, null, MemberHelper.GetMember(() => MySmallShip.LightOffsetZ));

            m_scale = 0.7f;
            m_currentPosition = -m_size.Value / 2.0f + new Vector2(0.02f, 0.10f);

            if (MyGuiScreenGamePlay.Static != null && MySession.PlayerShip != null)
            {
                List<MySmallShipGunBase> shipGuns = MySession.PlayerShip.Weapons.GetMountedWeaponsWithHarvesterAndDrill();
                for(int i = 0; i < shipGuns.Count; i++)
                {
                    MySmallShipGunBase shipGun = shipGuns[i];
                    //AddSlider(new StringBuilder(shipGun.WeaponType + "_" + i), MIN_OFFSET, MAX_OFFSET, shipGun, MemberHelper.GetMember(() => shipGun.YOffset));
                    AddSlider(new StringBuilder(shipGun.WeaponType + "_" + i), MIN_OFFSET, MAX_OFFSET, shipGun, MemberHelper.GetMember(() => shipGun.ZOffset));
                }
            }

            m_currentPosition.Y += 0.01f;
        }
        public override void RecreateControls(bool contructor)
        {
            Controls.Clear();

            m_scale = 0.7f;

            AddCaption(new System.Text.StringBuilder("Pruning and culling"), Color.Yellow.ToVector4());

            MyGuiControlLabel label = new MyGuiControlLabel(this, new Vector2(0.01f, -m_size.Value.Y / 2.0f + 0.07f), null, new System.Text.StringBuilder("(press ALT to share focus)"), Color.Yellow.ToVector4(), MyGuiConstants.LABEL_TEXT_SCALE * 0.7f,
                               MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_TOP);
            Controls.Add(label);

            m_currentPosition = -m_size.Value / 2.0f + new Vector2(0.02f, 0.10f);

            MyRender.MyRenderModuleItem renderModule = MyRender.GetRenderModules(MyRenderStage.DebugDraw).Find((x) => x.Name == MyRenderModuleEnum.PrunningStructure);
            MyRender.MyRenderModuleItem renderModulePhysics = MyRender.GetRenderModules(MyRenderStage.DebugDraw).Find((x) => x.Name == MyRenderModuleEnum.PhysicsPrunningStructure);
            
            AddSlider(new StringBuilder("Worst allowed balance"), 0.01f, 0.5f, null, MemberHelper.GetMember(() => MyRender.CullingStructureWorstAllowedBalance));
            AddSlider(new StringBuilder("Box cut penalty"), 0, 30, null, MemberHelper.GetMember(() => MyRender.CullingStructureCutBadness));
            AddSlider(new StringBuilder("Imbalance penalty"), 0, 5, null, MemberHelper.GetMember(() => MyRender.CullingStructureImbalanceBadness));
            AddSlider(new StringBuilder("Off-center penalty"), 0, 5, null, MemberHelper.GetMember(() => MyRender.CullingStructureOffsetBadness));

            m_currentPosition.Y += 0.01f;
            AddCheckBox(new StringBuilder("Show prunning structure"), renderModule, MemberHelper.GetMember(() => renderModule.Enabled));

            m_currentPosition.Y += 0.01f;
            AddCheckBox(new StringBuilder("Show physics prunning structure"), renderModulePhysics, MemberHelper.GetMember(() => renderModulePhysics.Enabled));

            m_currentPosition.Y += 0.01f;
            AddButton(new StringBuilder("Rebuild now"), delegate { MyRender.RebuildCullingStructure(); });

            m_currentPosition.Y += 0.01f;
            AddButton(new StringBuilder("Rebuild to test lowest triangle count"), delegate { MyRender.RebuildCullingStructureCullEveryPrefab(); });
        }
        public MyGuiScreenMultiplayerEnterGameRequest(MyGuiScreenGamePlay.MyJoinGameRequest request)
            : base(new Vector2(0.5f, 0.5f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, new Vector2(574f / 1600f, 600 / 1200f), false, MyGuiManager.GetSandboxBackgoround())
        {
            m_enableBackgroundFade = true;
            m_backgroundFadeColor = new Vector4(0.0f, 0.0f, 0.0f, 0.5f);

            m_request = request;
            AddCaption(MyTextsWrapperEnum.JoinRequestTitle);

            Vector2 menuPositionOrigin = new Vector2(0.0f, -m_size.Value.Y / 2.0f + 0.146f);
            MyGuiControlButtonTextAlignment menuButtonTextAlignement = MyGuiControlButtonTextAlignment.CENTERED;

            Controls.Add(new MyGuiControlLabel(this, menuPositionOrigin + 0 * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, null, new StringBuilder(MyTextsWrapper.GetFormatString(MyTextsWrapperEnum.JoinRequest, request.Message.PlayerInfo.DisplayName)), MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiConstants.DEFAULT_CONTROL_FONT));

            Controls.Add(new MyGuiControlButton(this, menuPositionOrigin + 1 * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyGuiConstants.MAIN_MENU_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                MyTextsWrapperEnum.AllowEnter, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnAllowEnter, menuButtonTextAlignement, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true));

            Controls.Add(new MyGuiControlButton(this, menuPositionOrigin + 2 * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyGuiConstants.MAIN_MENU_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                MyTextsWrapperEnum.DenyEnter, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnDenyEnter, menuButtonTextAlignement, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true));

            MyGuiControlLabel lblRememberSetting = new MyGuiControlLabel(this, menuPositionOrigin + 3 * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA - new Vector2(0.03f, 0), null, MyTextsWrapperEnum.Remember, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);
            Controls.Add(lblRememberSetting);

            m_chkRememberSetting = new MyGuiControlCheckbox(this, menuPositionOrigin + 3 * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA + new Vector2(0.05f, 0), false, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR, lblRememberSetting);
            Controls.Add(m_chkRememberSetting);
        }
예제 #7
0
 public MyGuiControlCheckbox(IMyGuiControlsParent parent, Vector2 position, Vector2 size, MyTexture2D texture, MyTexture2D checkedTexture,
     StringBuilder toolTip, bool checkedVal, Vector4 color, bool highlightWhenChecked, MyGuiControlLabel label, Vector2? innerSize = null)
     : base(parent, position, size, color, toolTip, texture, null, null, true)
 {
     m_canHandleKeyboardActiveControl = true;
     m_checked = checkedVal;
     m_highlightWhenChecked = false; // highlightWhenChecked; this feature is depracted
     m_checkedTexture = checkedTexture;
     m_label = label;
     if (m_label != null) {
         m_label.MouseEnter += delegate
         {
             m_highlight = true;
         };
         m_label.MouseLeave += delegate
         {
             m_highlight = false;
         };
         m_label.Click += delegate
         {
             UserCheck();
         };
     }
     if (innerSize == null) m_innerSize = size;
     else m_innerSize = innerSize;
 }
        public override void RecreateControls(bool contructor)
        {
            Controls.Clear();

            m_scale = .9f;

            AddCaption(new System.Text.StringBuilder("Render Global FX"), Color.Yellow.ToVector4());

            MyGuiControlLabel label = new MyGuiControlLabel(this, new Vector2(0.01f, -m_size.Value.Y / 2.0f + 0.07f), null, new System.Text.StringBuilder("(press ALT to share focus)"), Color.Yellow.ToVector4(), MyGuiConstants.LABEL_TEXT_SCALE * 0.7f,
                               MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_TOP);
            Controls.Add(label);

            m_currentPosition = -m_size.Value / 2.0f + new Vector2(0.02f, 0.10f);

            m_currentPosition.Y += 0.01f * m_scale;
            AddLabel(new StringBuilder("FXAA"), Color.Yellow.ToVector4(), 1.2f);

            AddCheckBox(new StringBuilder("Enable FXAA"), null, MemberHelper.GetMember(() => MyMwcFinalBuildConstants.EnableFxaa));

            m_currentPosition.Y += 0.01f * m_scale;
            AddLabel(new StringBuilder("Fog"), Color.Yellow.ToVector4(), 1.2f);

            var fogObj = MySector.FogProperties;

            AddCheckBox(new StringBuilder("Enable fog"), null, MemberHelper.GetMember(() => MyRender.EnableFog));
            AddSlider(new StringBuilder("Fog near distance"), 1.0f, MyCamera.FAR_PLANE_DISTANCE, fogObj, MemberHelper.GetMember(() => MySector.FogProperties.FogNear));
            AddSlider(new StringBuilder("Fog far distance"), 1.0f, MyCamera.FAR_PLANE_DISTANCE, fogObj, MemberHelper.GetMember(() => MySector.FogProperties.FogFar));
            AddSlider(new StringBuilder("Fog multiplier"), 0.0f, 1.0f, fogObj, MemberHelper.GetMember(() => MySector.FogProperties.FogMultiplier));
            AddSlider(new StringBuilder("Fog backlight multiplier"), 0.0f, 5.0f, fogObj, MemberHelper.GetMember(() => MySector.FogProperties.FogBacklightMultiplier));
            AddColor(new StringBuilder("Fog color"), fogObj, MemberHelper.GetMember(() => MySector.FogProperties.FogColor));
           
        }
        protected override void LoadControls()
        {
            Vector2 position = GetNextControlPosition() + new Vector2(0.38f, 0);

            m_onButton = new MyGuiControlButton(this, position, new Vector2(0.051f, 0.061f), Vector4.One, MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\ButtonOnOff", flags: TextureFlags.IgnoreQuality), null, null,
                MyTextsWrapperEnum.On, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE_SMALLER,
                MyGuiControlButtonTextAlignment.CENTERED, OnOnOffClick, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true, MyGuiControlHighlightType.WHEN_ACTIVE);
            Controls.Add(m_onButton);
            m_onButton.DrawRedTextureWhenDisabled = false;
            m_onButton.UseSwitchMode = true;

            position.X -= 0.04f;

            m_offButon = new MyGuiControlButton(this, position, new Vector2(0.051f, 0.061f), Vector4.One, MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\ButtonOnOff", flags: TextureFlags.IgnoreQuality), null, null,
                MyTextsWrapperEnum.Off, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE_SMALLER,
                MyGuiControlButtonTextAlignment.CENTERED, OnOnOffClick, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true, MyGuiControlHighlightType.WHEN_ACTIVE);
            Controls.Add(m_offButon);
            m_offButon.DrawRedTextureWhenDisabled = false;
            m_offButon.UseSwitchMode = true;

            position.X -= 0.11f;

            m_unpoweredLabel = new MyGuiControlLabel(this, position, null, MyTextsWrapperEnum.Unpowered, MyGuiConstants.LABEL_TEXT_COLOR, 1.5f, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue());
            m_remoteControlledLabel = new MyGuiControlLabel(this, position, null, MyTextsWrapperEnum.MP_RemoteControlled, MyGuiConstants.LABEL_TEXT_COLOR, 1.5f, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue());
            Controls.Add(m_unpoweredLabel);
            Controls.Add(m_remoteControlledLabel);

            m_isPrefabElectrified = !Prefab.IsElectrified();
            UpdateVisibility();
            UpdateEnabledState();
        }
        public override void RecreateControls(bool contructor)
        {
            Controls.Clear();

            AddCaption(new System.Text.StringBuilder("Debris field"), Color.Yellow.ToVector4());

            MyGuiControlLabel label = new MyGuiControlLabel(this, new Vector2(0.01f, -m_size.Value.Y / 2.0f + 0.07f), null, new System.Text.StringBuilder("(press ALT to share focus)"), Color.Yellow.ToVector4(), MyGuiConstants.LABEL_TEXT_SCALE * 0.7f,
                               MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_TOP);
            Controls.Add(label);

            m_scale = 0.7f;
            m_currentPosition = -m_size.Value / 2.0f + new Vector2(0.02f, 0.10f);

            var debrisObj = MySector.DebrisProperties;
            AddLabel(new StringBuilder("Debris field"), Vector4.One, 1.0f);
            AddCheckBox(new StringBuilder("Enabled"), debrisObj, MemberHelper.GetMember(() => MySector.DebrisProperties.Enabled));
            AddSlider(new StringBuilder("Distance between"), 1, 500, debrisObj, MemberHelper.GetMember(() => MySector.DebrisProperties.DistanceBetween));
            AddSlider(new StringBuilder("Half count in direction"), 1, 50, debrisObj, MemberHelper.GetMember(() => MySector.DebrisProperties.CountInDirectionHalf));
            AddSlider(new StringBuilder("Max distance"), 1, 1000, debrisObj, MemberHelper.GetMember(() => MySector.DebrisProperties.MaxDistance));
            AddSlider(new StringBuilder("Full scale distance"), 1, 1000, debrisObj, MemberHelper.GetMember(() => MySector.DebrisProperties.FullScaleDistance));

            m_currentPosition.Y += 0.01f;

            AddLabel(new StringBuilder("Voxel debris"), Vector4.One, 1.0f);
            var low = AddSlider(new StringBuilder("Lower size"), 0.0005f, 0.05f, null, MemberHelper.GetMember(() => MyExplosionDebrisVoxel.DebrisScaleLower));
            var high = AddSlider(new StringBuilder("Upper size"), 0.0005f, 0.05f, null, MemberHelper.GetMember(() => MyExplosionDebrisVoxel.DebrisScaleUpper));
            AddSlider(new StringBuilder("Clamp size"), 0.1f, 2.0f, null, MemberHelper.GetMember(() => MyExplosionDebrisVoxel.DebrisScaleClamp));

            low.LabelDecimalPlaces = 4;
            high.LabelDecimalPlaces = 4;
        }
        public override void RecreateControls(bool contructor)
        {
            Controls.Clear();

            m_scale = 0.7f;

            AddCaption(new System.Text.StringBuilder("System debug"), Color.Yellow.ToVector4());

            
            MyGuiControlLabel label = new MyGuiControlLabel(this, new Vector2(0.01f, -m_size.Value.Y / 2.0f + 0.07f), null, new System.Text.StringBuilder("(press ALT to share focus)"), Color.Yellow.ToVector4(), MyGuiConstants.LABEL_TEXT_SCALE * 0.7f,
                               MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_TOP);
            Controls.Add(label);


            m_currentPosition = -m_size.Value / 2.0f + new Vector2(0.02f, 0.10f);

            AddLabel(new StringBuilder("System"), Color.Yellow.ToVector4(), 1.2f);

            //System debugging
            AddCheckBox(MyTextsWrapperEnum.DrawCollisionSpotsInHud, null, MemberHelper.GetMember(() => MyMwcFinalBuildConstants.DrawCollisionSpotsInHud));
            AddCheckBox(MyTextsWrapperEnum.DrawVoxelContentAsBillboards, null, MemberHelper.GetMember(() => MyMwcFinalBuildConstants.DrawVoxelContentAsBillboards));
            AddCheckBox(MyTextsWrapperEnum.ShowVertexNormals, null, MemberHelper.GetMember(() => MyMwcFinalBuildConstants.DrawNormalVectors));
            AddCheckBox(new StringBuilder("Disable bots"), null, MemberHelper.GetMember(() => MyMwcFinalBuildConstants.DisableEnemyBots));
            AddCheckBox(new StringBuilder("Show waypoints"), null, MemberHelper.GetMember(() => MyMwcFinalBuildConstants.BOT_DEBUG_MODE));
            AddCheckBox(MyTextsWrapperEnum.LoggingInDrawUpdate, null, MemberHelper.GetMember(() => MyMwcFinalBuildConstants.EnableLoggingInDrawAndUpdateAndGuiLoops));
            AddCheckBox(MyTextsWrapperEnum.SimulateSlowUpdate, null, MemberHelper.GetMember(() => MyMwcFinalBuildConstants.SimulateSlowUpdate));
            AddCheckBox(MyTextsWrapperEnum.SimulateSlowDraw, null, MemberHelper.GetMember(() => MyMwcFinalBuildConstants.SimulateSlowDraw));
            AddCheckBox(MyTextsWrapperEnum.LogGarbageCollection, null, MemberHelper.GetMember(() => MyMwcFinalBuildConstants.EnableLoggingGarbageCollectionCalls));
            AddCheckBox(MyTextsWrapperEnum.SimulateLostMessages, MyMwcFinalBuildConstants.SIMULATE_LOST_MESSAGES_SENT_OUT > 0, SimulateLostMessagesChange);
            AddCheckBox(new StringBuilder("Must look at target in interactions"), null, MemberHelper.GetMember(() => MySmallShipInteraction.MUST_LOOK_AT_TARGET));

            m_currentPosition.Y += 0.01f;
            
        }
        public override void RecreateControls(bool contructor)
        {
            Controls.Clear();

            m_scale = 0.7f;

            AddCaption(new System.Text.StringBuilder("Global Events Debug"), Color.Yellow.ToVector4());


            MyGuiControlLabel label = new MyGuiControlLabel(this, new Vector2(0.01f, -m_size.Value.Y / 2.0f + 0.07f), null, new System.Text.StringBuilder("(press ALT to share focus)"), Color.Yellow.ToVector4(), MyGuiConstants.LABEL_TEXT_SCALE * 0.7f,
                               MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_TOP);
            Controls.Add(label);


            m_currentPosition = -m_size.Value / 2.0f + new Vector2(0.12f, 0.15f);

            var globalEventEnumValues = Enum.GetValues(typeof (MyGlobalEventEnum));

            foreach (MyGlobalEventEnum globalEventEnum in globalEventEnumValues)
            {

                var globalEvent = MyGlobalEvents.GetGlobalEventByType(globalEventEnum);
                var button = AddButton(MyTextsWrapper.Get(globalEvent.Name), OnGlobalEvent);
                button.UserData = globalEventEnum;

            }


        }
        public override void RecreateControls(bool contructor)
        {
            Controls.Clear();

            m_scale = 0.7f;

            AddCaption(new System.Text.StringBuilder("Render Lights debug"), Color.Yellow.ToVector4());

            MyGuiControlLabel label = new MyGuiControlLabel(this, new Vector2(0.01f, -m_size.Value.Y / 2.0f + 0.07f), null, new System.Text.StringBuilder("(press ALT to share focus)"), Color.Yellow.ToVector4(), MyGuiConstants.LABEL_TEXT_SCALE * 0.7f,
                               MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_TOP);
            Controls.Add(label);

            m_currentPosition = -m_size.Value / 2.0f + new Vector2(0.02f, 0.10f);

            m_currentPosition.Y += 0.01f;
            AddLabel(new StringBuilder("Lights"), Color.Yellow.ToVector4(), 1.2f);

            AddCheckBox(new StringBuilder("Enable lights"), null, MemberHelper.GetMember(() => EnableRenderLights));
            AddCheckBox(new StringBuilder("Enable light glares"), null, MemberHelper.GetMember(() => MyLightGlare.EnableLightGlares));
            AddCheckBox(new StringBuilder("Enable spot shadows"), null, MemberHelper.GetMember(() => MyRender.EnableSpotShadows));
            AddCheckBox(new StringBuilder("Enable spectator light"), null, MemberHelper.GetMember(() => MyRender.EnableSpectatorReflector));
            AddCheckBox(new StringBuilder("Only specular intensity"), null, MemberHelper.GetMember(() => MyRender.ShowSpecularIntensity));
            AddCheckBox(new StringBuilder("Only specular power"), null, MemberHelper.GetMember(() => MyRender.ShowSpecularPower));
            AddCheckBox(new StringBuilder("Only emissivity"), null, MemberHelper.GetMember(() => MyRender.ShowEmissivity));
            AddCheckBox(new StringBuilder("Only reflectivity"), null, MemberHelper.GetMember(() => MyRender.ShowReflectivity));

            MyEffectShadowMap shadowMapEffect = MyRender.GetEffect(MyEffects.ShadowMap) as MyEffectShadowMap;

            if (shadowMapEffect != null)
            {
                m_currentPosition.Y += 0.01f;
                AddLabel(new StringBuilder("Sun"), Color.Yellow.ToVector4(), 1.2f);
                AddCheckBox(new StringBuilder("Enable sun"), null, MemberHelper.GetMember(() => MyRender.EnableSun));
                AddCheckBox(new StringBuilder("Enable shadows"), null, MemberHelper.GetMember(() => MyRender.EnableShadows));
                AddCheckBox(new StringBuilder("Enable asteroid shadows"), null, MemberHelper.GetMember(() => MyRender.EnableAsteroidShadows));
                AddCheckBox(new StringBuilder("Enable ambient map"), MyRender.EnableEnvironmentMapAmbient, OnAmbientMapChecked);
                AddCheckBox(new StringBuilder("Enable reflection map"), MyRender.EnableEnvironmentMapReflection, OnReflectionMapChecked);
                AddCheckBox(new StringBuilder("Enable voxel ambient"), null, MemberHelper.GetMember(() => MyRender.EnablePerVertexVoxelAmbient));
                AddSlider(new StringBuilder("Intensity"), 0, 10.0f, MySector.SunProperties, MemberHelper.GetMember(() => MySector.SunProperties.SunIntensity));
                AddCheckBox(new StringBuilder("Show cascade splits"), null, MemberHelper.GetMember(() => MyRender.ShowCascadeSplits));
                //nefunguje po obfuskaci
               // AddSlider(new StringBuilder("ShadowBias"), 0, 0.01f, shadowMapEffect, MemberHelper.GetMember(() => shadowMapEffect.ShadowBias));

                AddCheckBox(new StringBuilder("Enable shadow interleaving"), null, MemberHelper.GetMember(() => MyRender.ShadowInterleaving));
                AddCheckBox(new StringBuilder("Freeze cascade 0"), null, MemberHelper.GetMember(() => MyRender.FreezeCascade0));
                AddCheckBox(new StringBuilder("Freeze cascade 1"), null, MemberHelper.GetMember(() => MyRender.FreezeCascade1));
                AddCheckBox(new StringBuilder("Freeze cascade 2"), null, MemberHelper.GetMember(() => MyRender.FreezeCascade2));
                AddCheckBox(new StringBuilder("Freeze cascade 3"), null, MemberHelper.GetMember(() => MyRender.FreezeCascade3));
            }               
        }
        public MyGuiScreenSimpleProgress(MyTextsWrapperEnum caption, StringBuilder text) 
            : base(new Vector2(0.5f, 0.5f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, new Vector2(0.4f, 0.4f))
        {
            m_text = text;
            m_closeOnEsc = false;
            m_isTopMostScreen = true;

            AddCaption(caption, new Vector2(0f, 0.021f));

            m_progressWheel = new MyGuiControlRotatingWheel(this, Vector2.Zero, MyGuiConstants.DEFAULT_CONTROL_FOREGROUND_COLOR.ToVector4(), 0.5f, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiManager.GetLoadingTexture());
            Controls.Add(m_progressWheel);

            m_progressText = new MyGuiControlLabel(this, new Vector2(0f, 0.12f), null, m_text, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);
            Controls.Add(m_progressText);
        }
        public override void RecreateControls(bool contructor)
        {
            Controls.Clear();

            AddCaption(new StringBuilder("Volumetric SSAO Debug"), Color.Yellow.ToVector4());

            MyGuiControlLabel label = new MyGuiControlLabel(this, new Vector2(0.01f, -m_size.Value.Y / 2.0f + 0.07f), null, new System.Text.StringBuilder("(press ALT to share focus)"), Color.Yellow.ToVector4(), MyGuiConstants.LABEL_TEXT_SCALE * 0.7f,
                                   MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_TOP);
            Controls.Add(label);

            m_currentPosition = -m_size.Value / 2.0f + new Vector2(0.02f, 0.10f);

            MyPostProcessVolumetricSSAO2 volumetricSsaoPP = MyRender.GetPostProcess(MyPostProcessEnum.VolumetricSSAO2) as MyPostProcessVolumetricSSAO2;
            if (volumetricSsaoPP == null)
            {
                label = new MyGuiControlLabel(this, new Vector2(0.01f, -m_size.Value.Y / 2.0f + 0.1f), null, new System.Text.StringBuilder("Sorry SSAO post process is not available"), Color.Red.ToVector4(), MyGuiConstants.LABEL_TEXT_SCALE * 0.7f,
                                       MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_TOP);
                Controls.Add(label);
                return;
            }


            MyEffectVolumetricSSAO2 volumetricSsaoEffect = MyRender.GetEffect(MyEffects.VolumetricSSAO) as MyEffectVolumetricSSAO2;
                                         
            AddCheckBox(new StringBuilder("Use SSAO"), volumetricSsaoPP, MemberHelper.GetMember(() => volumetricSsaoPP.Enabled));
            AddCheckBox(new StringBuilder("Use blur"), volumetricSsaoEffect, MemberHelper.GetMember(() => volumetricSsaoEffect.UseBlur));
            AddCheckBox(new StringBuilder("Show only SSAO"), volumetricSsaoEffect, MemberHelper.GetMember(() => volumetricSsaoEffect.ShowOnlySSAO));

            m_currentPosition.Y += 0.01f;

//            AddSlider(new StringBuilder("Offset"), 0, 10, volumetricSsaoEffect, MemberHelper.GetMember(() => volumetricSsaoEffect.Offset));
  //          AddSlider(new StringBuilder("SiluetteDist"), 0, 10, volumetricSsaoEffect, MemberHelper.GetMember(() => volumetricSsaoEffect.SiluetteDist));
    //        AddSlider(new StringBuilder("R"), 0, 10, volumetricSsaoEffect, MemberHelper.GetMember(() => volumetricSsaoEffect.R));
                                 

            AddSlider(new StringBuilder("MinRadius"), 0, 10, volumetricSsaoPP, MemberHelper.GetMember(() => volumetricSsaoPP.MinRadius));
            AddSlider(new StringBuilder("MaxRadius"), 0, 1000, volumetricSsaoPP, MemberHelper.GetMember(() => volumetricSsaoPP.MaxRadius));
            AddSlider(new StringBuilder("RadiusGrowZScale"), 0, 10, volumetricSsaoPP, MemberHelper.GetMember(() => volumetricSsaoPP.RadiusGrowZScale));
            AddSlider(new StringBuilder("CameraZFar"), 0, 100000, volumetricSsaoPP, MemberHelper.GetMember(() => volumetricSsaoPP.CameraZFar));

            AddSlider(new StringBuilder("Bias"), 0, 10, volumetricSsaoPP, MemberHelper.GetMember(() => volumetricSsaoPP.Bias));
            AddSlider(new StringBuilder("Falloff"), 0, 10, volumetricSsaoPP, MemberHelper.GetMember(() => volumetricSsaoPP.Falloff));
            AddSlider(new StringBuilder("NormValue"), 0, 10, volumetricSsaoPP, MemberHelper.GetMember(() => volumetricSsaoPP.NormValue));
            //AddSlider(new StringBuilder("ColorScale"), 0, 10, volumetricSsaoEffect, MemberHelper.GetMember(() => volumetricSsaoEffect.ColorScale));
            AddSlider(new StringBuilder("Contrast"), 0, 10, volumetricSsaoPP, MemberHelper.GetMember(() => volumetricSsaoPP.Contrast));

            m_currentPosition.Y += 0.01f;
        }
        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 override void RecreateControls(bool contructor)
        {
            Controls.Clear();

            m_scale = 0.7f;

            AddCaption(new System.Text.StringBuilder("Render debug"), Color.Yellow.ToVector4());

            MyGuiControlLabel label = new MyGuiControlLabel(this, new Vector2(0.01f, -m_size.Value.Y / 2.0f + 0.07f), null, new System.Text.StringBuilder("(press ALT to share focus)"), Color.Yellow.ToVector4(), MyGuiConstants.LABEL_TEXT_SCALE * 0.7f,
                               MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_TOP);
            Controls.Add(label);

            m_currentPosition = -m_size.Value / 2.0f + new Vector2(0.02f, 0.10f);

            m_currentPosition.Y += 0.01f;
            AddLabel(new StringBuilder("LODs"), Color.Yellow.ToVector4(), 1.2f);

            var profile = MyRenderConstants.RenderQualityProfile; // Obfuscated MemberHelper can't access property, so store it to field

            //AddCheckBox(new StringBuilder("Show LOD screens"), null, MemberHelper.GetMember(() => MyRender.ShowLODScreens));
            AddCheckBox(new StringBuilder("Show blended screens"), null, MemberHelper.GetMember(() => MyRender.ShowBlendedScreens));
            AddCheckBox(new StringBuilder("Show LOD1 red overlay"), null, MemberHelper.GetMember(() => MyRender.ShowLod1WithRedOverlay));
            AddCheckBox(new StringBuilder("Show green background"), null, MemberHelper.GetMember(() => MyRender.ShowGreenBackground));
            AddCheckBox(new StringBuilder("Show environment screens"), null, MemberHelper.GetMember(() => MyRender.ShowEnvironmentScreens));
            AddSlider(new StringBuilder("Lod near distance"), 0.0f, 20000.0f, profile, MemberHelper.GetMember(() => profile.LodTransitionDistanceNear));
            AddSlider(new StringBuilder("Lod far distance"), 0.0f, 20000.0f, profile, MemberHelper.GetMember(() => profile.LodTransitionDistanceFar));
            AddSlider(new StringBuilder("Lod background start"), 0.0f, 50000.0f, profile, MemberHelper.GetMember(() => profile.LodTransitionDistanceBackgroundStart));
            AddSlider(new StringBuilder("Lod background end"), MyCamera.NEAR_PLANE_DISTANCE + 1, 50000.0f, profile, MemberHelper.GetMember(() => profile.LodTransitionDistanceBackgroundEnd));


            m_currentPosition.Y += 0.01f;
            AddLabel(new StringBuilder("Textures"), Color.Yellow.ToVector4(), 1.2f);
            
            AddCheckBox(new StringBuilder("Check diffuse textures"), null, MemberHelper.GetMember(() => MyRender.CheckDiffuseTextures));
            AddCheckBox(new StringBuilder("Check normals textures"), null, MemberHelper.GetMember(() => MyRender.CheckNormalTextures));

            AddCheckBox(new StringBuilder("Debug diffuse texture"), null, MemberHelper.GetMember(() => MyRender.DebugDiffuseTexture));
            AddCheckBox(new StringBuilder("Debug normal texture"), null, MemberHelper.GetMember(() => MyRender.DebugNormalTexture));

            m_currentPosition.Y += 0.01f;
            AddLabel(new StringBuilder("Clip planes"), Color.Yellow.ToVector4(), 1.2f);
            AddSlider(new StringBuilder("Near clip"), 0.05f, 10.0f, null, MemberHelper.GetMember(() => MyCamera.NEAR_PLANE_DISTANCE));
            AddSlider(new StringBuilder("Far clip"), 10000.0f, 100000.0f, null, MemberHelper.GetMember(() => MyCamera.FAR_PLANE_DISTANCE));

            AddSlider(new StringBuilder("FOV"), MyCamera.FieldOfViewAngle, 1.00f, 90.0f, new MyGuiControlSlider.OnSliderChangeCallback(OnFovSlider));
        }
        public override void RecreateControls(bool contructor)
        {
            Controls.Clear();

            AddCaption(new System.Text.StringBuilder("Render modules"), Color.Yellow.ToVector4());

            MyGuiControlLabel label = new MyGuiControlLabel(this, new Vector2(0.01f, -m_size.Value.Y / 2.0f + 0.07f), null, new System.Text.StringBuilder("(press ALT to share focus)"), Color.Yellow.ToVector4(), MyGuiConstants.LABEL_TEXT_SCALE * 0.7f,
                               MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_TOP);
            Controls.Add(label);

            m_scale = 0.7f;

            m_currentPosition = -m_size.Value / 2.0f + new Vector2(0.02f, 0.10f);

            m_currentPosition.Y += 0.01f;
               
            AddLabel(new StringBuilder("Prepare for draw"), Color.Yellow.ToVector4(), 1.2f);
            foreach (MyRender.MyRenderModuleItem renderModule in MyRender.GetRenderModules(MyRenderStage.PrepareForDraw))
            {
                AddCheckBox(new StringBuilder(renderModule.DisplayName), renderModule, MemberHelper.GetMember(() => renderModule.Enabled));
            }

            AddLabel(new StringBuilder("Background"), Color.Yellow.ToVector4(), 1.2f);
            foreach (MyRender.MyRenderModuleItem renderModule in MyRender.GetRenderModules(MyRenderStage.Background))
            {
                AddCheckBox(new StringBuilder(renderModule.DisplayName), renderModule, MemberHelper.GetMember(() => renderModule.Enabled));
            }

            AddLabel(new StringBuilder("Pre-HDR Alpha blend"), Color.Yellow.ToVector4(), 1.2f);
            foreach (MyRender.MyRenderModuleItem renderModule in MyRender.GetRenderModules(MyRenderStage.AlphaBlendPreHDR))
            {
                AddCheckBox(new StringBuilder(renderModule.DisplayName), renderModule, MemberHelper.GetMember(() => renderModule.Enabled));
            }

            AddLabel(new StringBuilder("Alpha blend"), Color.Yellow.ToVector4(), 1.2f);
            foreach (MyRender.MyRenderModuleItem renderModule in MyRender.GetRenderModules(MyRenderStage.AlphaBlend))
            {
                AddCheckBox(new StringBuilder(renderModule.DisplayName), renderModule, MemberHelper.GetMember(() => renderModule.Enabled));
            }

            AddLabel(new StringBuilder("Debug draw"), Color.Yellow.ToVector4(), 1.2f);
            foreach (MyRender.MyRenderModuleItem renderModule in MyRender.GetRenderModules(MyRenderStage.DebugDraw))
            {
                AddCheckBox(new StringBuilder(renderModule.DisplayName), renderModule, MemberHelper.GetMember(() => renderModule.Enabled));
            }
        }
        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;

            m_label = new MyGuiControlLabel(this, controlsOriginLeft, null, MyTextsWrapperEnum.On, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            Controls.Add(m_label);
            m_on = new MyGuiControlCheckbox(this, controlsOriginLeft + new Vector2(0.1f, 0f), PrefabKinematic.CanOpen, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR);
            Controls.Add(m_on);

            AddOkAndCancelButtonControls();            
        }                
        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;
            Vector2 controlsOriginRight = GetControlsOriginRightFromScreenSize() + originDelta;

            AddActivatedCheckbox(controlsOriginLeft, PrefabContainer.Activated);

            m_label = new MyGuiControlLabel(this, controlsOriginLeft + 1 * CONTROLS_DELTA, null, MyTextsWrapperEnum.Alarm, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            Controls.Add(m_label);
            m_alarmOn = new MyGuiControlCheckbox(this, controlsOriginLeft + 1 * CONTROLS_DELTA + new Vector2(0.1f, 0f), PrefabContainer.AlarmOn, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR);
            Controls.Add(m_alarmOn);

            AddOkAndCancelButtonControls();            
        }                
예제 #21
0
        private void InitControls() 
        {
            Vector2 position = new Vector2(-m_size.Value.X / 2f, 0f);
            Vector2 controlsDelta = new Vector2(m_offset, 0f);

            // create description label
            if ((m_flags & MyGuiSizeEnumFlags.Description) > 0) 
            {
                m_descriptionLabel = new MyGuiControlLabel(this, position, null, m_description, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
                Controls.Add(m_descriptionLabel);
                position += controlsDelta;
            }

            // create value slider
            if ((m_flags & MyGuiSizeEnumFlags.Slider) > 0)
            {
                // slider
                m_valueSlider = new MyGuiControlSlider(this, position, MyGuiConstants.SLIDER_WIDTH, m_minValue, m_maxValue, MyGuiConstants.SLIDER_BACKGROUND_COLOR,
                    new StringBuilder(), MyGuiConstants.SLIDER_WIDTH_LABEL, 0, MyGuiConstants.LABEL_TEXT_SCALE * 0.85f);
                m_valueSlider.OnChange = OnSliderChange;
                Controls.Add(m_valueSlider);
                position += controlsDelta;                                
            }

            // create value textbox
            if ((m_flags & MyGuiSizeEnumFlags.TextBox) > 0)
            {
                m_valueTextBox = new MyGuiControlTextbox(this, position, MyGuiControlPreDefinedSize.MEDIUM, string.Empty, 9, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.DIGITS_ONLY);
                m_valueTextBox.TextChanged = OnTextBoxChange;
                Controls.Add(m_valueTextBox);
            }
            else if((m_flags & MyGuiSizeEnumFlags.Slider) > 0)
            {
                // slider value label
                m_valueLabel = new MyGuiControlLabel(this, position, null, MyTextsWrapperEnum.None, MyGuiConstants.LABEL_TEXT_COLOR,
                    MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
                Controls.Add(m_valueLabel);
            }
        }
        public override void RecreateControls(bool contructor)
        {
            Controls.Clear();

            AddCaption(new System.Text.StringBuilder("Filling sector"), Color.Yellow.ToVector4());

            MyGuiControlLabel label = new MyGuiControlLabel(this, new Vector2(0.01f, -m_size.Value.Y / 2.0f + 0.07f), null, new System.Text.StringBuilder("(press ALT to share focus)"), Color.Yellow.ToVector4(), MyGuiConstants.LABEL_TEXT_SCALE * 0.7f,
                               MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_TOP);
            Controls.Add(label);

            m_scale = 0.7f;
            m_currentPosition = -m_size.Value / 2.0f + new Vector2(0.02f, 0.10f);
            m_currentPosition.Y += 0.01f;

            AddLabel(new StringBuilder("Sector world"), Color.Yellow.ToVector4(), 1.2f);
            AddButton(new StringBuilder("Clear sector"), delegate { ClearSector(); });
            AddButton(new StringBuilder("Clear generated"), delegate { ClearGenerated(); });

            AddSlider(new StringBuilder("Voxels 64"), 0.0f, 200.0f, m_sectorObjectCounts, MemberHelper.GetMember(() => m_sectorObjectCounts.Voxels64));
            AddSlider(new StringBuilder("Voxels 128"), 0.0f, 100.0f, m_sectorObjectCounts, MemberHelper.GetMember(() => m_sectorObjectCounts.Voxels128));
            AddSlider(new StringBuilder("Voxels 256"), 0.0f, 50.0f, m_sectorObjectCounts, MemberHelper.GetMember(() => m_sectorObjectCounts.Voxels256));
            AddSlider(new StringBuilder("Voxels 512"), 0.0f, 50.0f, m_sectorObjectCounts, MemberHelper.GetMember(() => m_sectorObjectCounts.Voxels512));
            AddSlider(new StringBuilder("Static asteroids small"), 0.0f, 50000.0f, m_sectorObjectCounts, MemberHelper.GetMember(() => m_sectorObjectCounts.StaticAsteroidSmall));
            AddSlider(new StringBuilder("Static asteroids medium"), 0.0f, 50000.0f, m_sectorObjectCounts, MemberHelper.GetMember(() => m_sectorObjectCounts.StaticAsteroidMedium));
            AddSlider(new StringBuilder("Static asteroids large"), 0.0f, 3000.0f, m_sectorObjectCounts, MemberHelper.GetMember(() => m_sectorObjectCounts.StaticAsteroidLarge));
            AddSlider(new StringBuilder("Motherships"), 0.0f, 1000.0f, m_sectorObjectCounts, MemberHelper.GetMember(() => m_sectorObjectCounts.Motherships));
            AddSlider(new StringBuilder("Large debris"), 0.0f, 1000.0f, m_sectorObjectCounts, MemberHelper.GetMember(() => m_sectorObjectCounts.StaticDebrisFields));
            AddButton(new StringBuilder("Create custom world (STONE)"), delegate { CreateCustomWorldStone(); });
            AddButton(new StringBuilder("Create custom world (ICE)"), delegate { CreateCustomWorldIce(); });
            AddButton(new StringBuilder("Create generated world"), delegate { CreateGeneratedWorld(); });
            AddButton(new StringBuilder("Remove generated world"), delegate { RemoveGeneratedWorld(); });
            AddButton(new StringBuilder("Create solar areas"), delegate { MySolarSystemConstants.CreateAreas(); });

            m_currentPosition.Y += 0.01f;
            AddLabel(new StringBuilder("Impostors"), Color.Yellow.ToVector4(), 1.2f);
            AddButton(new StringBuilder("Reload"), delegate { MyDistantImpostors.ReloadContent(); });

            m_currentPosition.Y += 0.01f;
        }
        public MyGuiScreenSimpleProgressBar(MyTextsWrapperEnum caption, StringBuilder text, float value, MySoundCuesEnum? progressCueEnum, MySoundCuesEnum? cancelCueEnum, int decimals, MySoundCuesEnum? successCueEnum = null) 
            : base(new Vector2(0.5f, 0.5f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, new Vector2(0.4f, 0.4f))
        {
            m_decimals = decimals;
            m_text = text;
            m_closeOnEsc = false;
            m_isTopMostScreen = true;            
            m_backgroundTexture = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\BackgroundScreen\\ProgressBarBackground", flags: TextureFlags.IgnoreQuality);
            m_size = new Vector2(673/1600f, 363/1200f);// MyGuiManager.GetNormalizedCoordsAndPreserveOriginalSize(673, 363);

            m_progressCueEnum = progressCueEnum;
            m_cancelCueEnum = cancelCueEnum;
            m_successCueEnum = successCueEnum;

            AddCaption(caption, new Vector2(0f, 0.015f));
            Vector2 progressBarSize = new Vector2(559 / 1600f, 112 / 1200f);// MyGuiManager.GetNormalizedCoordsAndPreserveOriginalSize(559, 112);            
            m_progressBar = new MyGuiControlProgressBar(this, Vector2.Zero, progressBarSize, Vector4.Zero, new Vector4(1f, 1f, 1f, 1f), Color.White.ToVector4(), MyGuiConstants.LABEL_TEXT_SCALE, value, m_decimals);
            Controls.Add(m_progressBar);

            m_progressText = new MyGuiControlLabel(this, new Vector2(0f, 0.05f), null, m_text, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);
            Controls.Add(m_progressText);
        }
        public override void RecreateControls(bool contructor)
        {
            Controls.Clear();

            

            m_scale = 0.7f;

            AddCaption(new System.Text.StringBuilder("Render Model FX"), Color.Yellow.ToVector4());

            MyGuiControlLabel label = new MyGuiControlLabel(this, new Vector2(0.01f, -m_size.Value.Y / 2.0f + 0.07f), null, new System.Text.StringBuilder("(press ALT to share focus)"), Color.Yellow.ToVector4(), MyGuiConstants.LABEL_TEXT_SCALE * 0.7f,
                               MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_TOP);
            Controls.Add(label);

            m_currentPosition = -m_size.Value / 2.0f + new Vector2(0.02f, 0.10f);


            m_currentPosition.Y += 0.01f;
            /*
            AddLabel(new StringBuilder("Channels"), Color.Yellow.ToVector4(), 1.2f);
            AddSlider(new StringBuilder("Channel0"), 0, 1.0f, null, MemberHelper.GetMember(() => MyRender.Channel0Intensity));
            AddSlider(new StringBuilder("Channel1"), 0, 1.0f, null, MemberHelper.GetMember(() => MyRender.Channel1Intensity));
              */
            AddLabel(new StringBuilder("Environmental maps"), Color.Yellow.ToVector4(), 1.2f);
            AddSlider(new StringBuilder("LOD0 max distance"), 50.0f, 1000.0f, null, MemberHelper.GetMember(() => MyEnvironmentMap.NearDistance));
            AddSlider(new StringBuilder("LOD1 max distance"), 50.0f, 1000.0f, null, MemberHelper.GetMember(() => MyEnvironmentMap.FarDistance));
            AddButton(new StringBuilder("Rebuild"), delegate { MyEnvironmentMap.Reset(); });

            var listbox = AddListbox();
            listbox.ItemSelect += new OnListboxItemSelect(listbox_ItemSelect);
            listbox.AddItem(-1, new StringBuilder("None"));
            for (int i = 0; i < MyVoxelMaterials.GetMaterialsCount(); i++)
            {
                MyMwcVoxelMaterialsEnum mat = (MyMwcVoxelMaterialsEnum)i;
                listbox.AddItem((int)mat, new StringBuilder(mat.ToString()));
            }
            listbox.SetSelectedItem(-1);
        }
        private void Init() 
        {
            Vector2 topLeftPosition = new Vector2(-m_size.Value.X / 2f + 0.05f, -m_size.Value.Y / 2f + 0.15f);
            Vector2 labelHealthPosition = topLeftPosition;
            Vector2 textboxHealthPosition = labelHealthPosition + new Vector2(0.2f, 0f);
            Vector2 labelMaxHealthPosition = textboxHealthPosition + new Vector2(0.13f, 0f);
            Vector2 textboxMaxHealthPosition = labelMaxHealthPosition + new Vector2(0.22f, 0f);
            for (int i = 0; i < m_healthsAndMaxhealths.Length; i++)
            {
                if (m_healthsAndMaxhealths[i] != null)
                {
                    MyGuiControlLabel labelHealth = new MyGuiControlLabel(this, labelHealthPosition, null, MyTextsWrapperEnum.Health, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
                    Controls.Add(labelHealth);

                    m_healthTextboxes[i] = new MyGuiControlTextbox(this, textboxHealthPosition, MyGuiControlPreDefinedSize.MEDIUM, MyValueFormatter.GetFormatedFloat(m_healthsAndMaxhealths[i].Health, 0, string.Empty), 6, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.DIGITS_ONLY);
                    Controls.Add(m_healthTextboxes[i]);

                    MyGuiControlLabel labelMaxHealth = new MyGuiControlLabel(this, labelMaxHealthPosition, null, MyTextsWrapperEnum.MaxHealth, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
                    Controls.Add(labelMaxHealth);

                    m_maxHealthTextboxes[i] = new MyGuiControlTextbox(this, textboxMaxHealthPosition, MyGuiControlPreDefinedSize.MEDIUM, MyValueFormatter.GetFormatedFloat(m_healthsAndMaxhealths[i].MaxHealth, 0, string.Empty), 6, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.DIGITS_ONLY);
                    Controls.Add(m_maxHealthTextboxes[i]);
                }
                else 
                {
                    MyGuiControlLabel labelDestroyed = new MyGuiControlLabel(this, labelHealthPosition, null, MyTextsWrapperEnum.Destroyed, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
                    Controls.Add(labelDestroyed);
                }
                labelHealthPosition += MyGuiConstants.CONTROLS_DELTA;
                textboxHealthPosition += MyGuiConstants.CONTROLS_DELTA;
                labelMaxHealthPosition += MyGuiConstants.CONTROLS_DELTA;
                textboxMaxHealthPosition += MyGuiConstants.CONTROLS_DELTA;
            }

            AddOkAndCancelButtonControls();
        }
        public override void RecreateControls(bool contructor)
        {
            Controls.Clear();

            m_scale = 0.7f;

            AddCaption(new System.Text.StringBuilder("Render HDR"), Color.Yellow.ToVector4());

            MyGuiControlLabel label = new MyGuiControlLabel(this, new Vector2(0.01f, -m_size.Value.Y / 2.0f + 0.07f), null, new System.Text.StringBuilder("(press ALT to share focus)"), Color.Yellow.ToVector4(), MyGuiConstants.LABEL_TEXT_SCALE * 0.7f,
                               MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_TOP);
            Controls.Add(label);

            m_currentPosition = -m_size.Value / 2.0f + new Vector2(0.02f, 0.10f);

            m_currentPosition.Y += 0.01f * m_scale;

            MyPostProcessHDR hdr = MyRender.GetPostProcess(MyPostProcessEnum.HDR) as MyPostProcessHDR;
            if (hdr != null)
            {
                AddLabel(new StringBuilder("HDR"), Color.Yellow.ToVector4(), 1.2f);

                AddCheckBox(new StringBuilder("Enable HDR and bloom"), null, MemberHelper.GetMember(() => MyPostProcessHDR.DebugHDRChecked));

                m_currentPosition.Y += 0.01f * m_scale;

                AddSlider(new StringBuilder("Exposure"), 0, 6.0f, hdr, MemberHelper.GetMember(() => hdr.Exposure));
                AddSlider(new StringBuilder("Bloom Threshold"), 0, 4.0f, hdr, MemberHelper.GetMember(() => hdr.Threshold));
                AddSlider(new StringBuilder("Bloom Intensity"), 0, 4.0f, hdr, MemberHelper.GetMember(() => hdr.BloomIntensity));
                AddSlider(new StringBuilder("Bloom Intensity for Background"), 0, 1.5f, hdr, MemberHelper.GetMember(() => hdr.BloomIntensityBackground));
                AddSlider(new StringBuilder("Vertical Blur Amount"), 1.0f, 8.0f, hdr, MemberHelper.GetMember(() => hdr.VerticalBlurAmount));
                AddSlider(new StringBuilder("Horizontal Blur Amount"), 1.0f, 8.0f, hdr, MemberHelper.GetMember(() => hdr.HorizontalBlurAmount));
                AddSlider(new StringBuilder("Number of blur passes (integer)"), 1.0f, 8.0f, hdr, MemberHelper.GetMember(() => hdr.NumberOfBlurPasses));

                m_currentPosition.Y += 0.01f * m_scale;
            }
        }
예제 #27
0
        public override void RecreateControls(bool contructor)
        {
            Controls.Clear();

            AddCaption(new System.Text.StringBuilder("Player ship debug"), Color.Yellow.ToVector4());

            MyGuiControlLabel label = new MyGuiControlLabel(this, new Vector2(0.01f, -m_size.Value.Y / 2.0f + 0.07f), null, new System.Text.StringBuilder("(press ALT to share focus)"), Color.Yellow.ToVector4(), MyGuiConstants.LABEL_TEXT_SCALE * 0.7f,
                               MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_TOP);
            Controls.Add(label);

            m_scale = 0.6f;
            m_currentPosition = -m_size.Value / 2.0f + new Vector2(0.02f, 0.10f);

            if (MyGuiScreenGamePlay.Static != null && MySession.PlayerShip != null)
            {
                AddSlider(new StringBuilder("Mass"), 1, 30000, MySession.PlayerShip.Physics, MemberHelper.GetMember(() => MySession.PlayerShip.Physics.Mass));
                AddSlider(new StringBuilder("Max speed"), 1, 500, MySession.PlayerShip.Physics, MemberHelper.GetMember(() => MySession.PlayerShip.Physics.MaxLinearVelocity));
                AddSlider(new StringBuilder("Max angular velocity"), 0, 30, MySession.PlayerShip.Physics, MemberHelper.GetMember(() => MySession.PlayerShip.Physics.MaxAngularVelocity));
                AddSlider(new StringBuilder("Multiplier forward & backward"), 0, 300*7, MySession.PlayerShip.ShipTypeProperties.Physics, MemberHelper.GetMember(() => MySession.PlayerShip.ShipTypeProperties.Physics.MultiplierForwardBackward));
                AddSlider(new StringBuilder("Multiplier strafe"), 0, 300*7, MySession.PlayerShip.ShipTypeProperties.Physics, MemberHelper.GetMember(() => MySession.PlayerShip.ShipTypeProperties.Physics.MultiplierStrafe));
                AddSlider(new StringBuilder("Multiplier strafe rotation"), 0, 100, MySession.PlayerShip.ShipTypeProperties.Physics, MemberHelper.GetMember(() => MySession.PlayerShip.ShipTypeProperties.Physics.MultiplierStrafeRotation));
                AddSlider(new StringBuilder("Multiplier up & down"), 0, 300*7, MySession.PlayerShip.ShipTypeProperties.Physics, MemberHelper.GetMember(() => MySession.PlayerShip.ShipTypeProperties.Physics.MultiplierUpDown));
                AddSlider(new StringBuilder("Multiplier roll"), 0, 30, MySession.PlayerShip.ShipTypeProperties.Physics, MemberHelper.GetMember(() => MySession.PlayerShip.ShipTypeProperties.Physics.MultiplierRoll));
                AddSlider(new StringBuilder("Multiplier rotation"), 0, 20, MySession.PlayerShip.ShipTypeProperties.Physics, MemberHelper.GetMember(() => MySession.PlayerShip.ShipTypeProperties.Physics.MultiplierRotation));
                AddSlider(new StringBuilder("Multiplier rotation effect"), 0, 2f, MySession.PlayerShip.ShipTypeProperties.Physics, MemberHelper.GetMember(() => MySession.PlayerShip.ShipTypeProperties.Physics.MultiplierRotationEffect));
                AddSlider(new StringBuilder("Multiplier rotation decelerate"), 0, 150, MySession.PlayerShip.ShipTypeProperties.Physics, MemberHelper.GetMember(() => MySession.PlayerShip.ShipTypeProperties.Physics.MultiplierRotationDecelerate));
                AddSlider(new StringBuilder("Multiplier movement"), 0.2f, 5f, MySession.PlayerShip.ShipTypeProperties.Physics, MemberHelper.GetMember(() => MySession.PlayerShip.ShipTypeProperties.Physics.MultiplierMovement));
                AddSlider(new StringBuilder("Multiplier afterburner"), 0, 10, MySession.PlayerShip.EnginePropertiesForDebug, MemberHelper.GetMember(() => MySession.PlayerShip.EnginePropertiesForDebug.AfterburnerSpeedMultiplier));
                AddSlider(new StringBuilder("Multiplier horizontal angle stabilization"), 0, 1000, MySession.PlayerShip.ShipTypeProperties.Physics, MemberHelper.GetMember(() => MySession.PlayerShip.ShipTypeProperties.Physics.MultiplierHorizontalAngleStabilization));
                AddCheckBox(new StringBuilder("Show secondary camera bounding frustum"), MySession.PlayerShip, MemberHelper<MySmallShip>.GetMember((smallShip) => smallShip.DebugDrawSecondaryCameraBoundingFrustum));
                AddSlider(new StringBuilder("Max zoom sensitivity modifier"), 0, 1, null, MemberHelper.GetMember(() => MySmallShip.SENSITIVITY_MODIFIER_FOR_MAX_ZOOM));
                AddSlider(new StringBuilder("Rotation sensitivity modifier"), 0.5f, 1.3f, null, MemberHelper.GetMember(() => MySmallShip.SHIP_ROTATION_SENSITIVITY_MODIFIER));                
            }

            m_currentPosition.Y += 0.01f;
        }
        void Init()
        {
            m_enableBackgroundFade = true;
            m_size = new Vector2(0.92f, 0.45f);
            Vector2 size = new Vector2(0.8f, MyGuiConstants.SLIDER_HEIGHT);

            // Add screen title
            AddCaption(new Vector2(0,0.015f));

            Vector2 originDelta = new Vector2(0.45f, 0.00f);
            Vector2 controlsOriginLeft = GetControlsOriginLeftFromScreenSize() + originDelta;            

            m_searchingDistance = new MyGuiControlSize(
                this,
                controlsOriginLeft + 1 * MyGuiConstants.CONTROLS_DELTA,
                size,
                Vector4.Zero,
                MyTextsWrapper.Get(MyTextsWrapperEnum.SearchingDistance),
                m_prefabLargeWeapons[0].SearchingDistance,
                MyLargeShipWeaponsConstants.MIN_SEARCHING_DISTANCE,
                MyLargeShipWeaponsConstants.MAX_SEARCHING_DISTANCE,
                MyTextsWrapper.Get(MyTextsWrapperEnum.SearchingDistance),
                MyGuiSizeEnumFlags.All,
                0.3f);
            Controls.Add(m_searchingDistance);

            m_label = new MyGuiControlLabel(this, GetControlsOriginLeftFromScreenSize() + new Vector2(0.25f,0) + 3 * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.On, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            Controls.Add(m_label);
            m_on = new MyGuiControlCheckbox(this, GetControlsOriginLeftFromScreenSize() + new Vector2(0.25f, 0) + 3 * MyGuiConstants.CONTROLS_DELTA + new Vector2(0.07f, 0f), m_prefabLargeWeapons[0].Enabled, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR);
            Controls.Add(m_on);

            AddActivatedCheckbox(GetControlsOriginLeftFromScreenSize() + 3 * MyGuiConstants.CONTROLS_DELTA + new Vector2(0.5f, 0f), m_prefabLargeWeapons[0].Activated);
            //m_searchingDistance.OnValueChange += OnSearchingDistanceChanged;

            AddOkAndCancelButtonControls(new Vector2(0, -0.02f));            
        }
예제 #29
0
        private void InitControls(StringBuilder otherSideInventoryName)
        {
            Vector2 topLeft = new Vector2(-m_size.Value.X / 2.0f + 0.05f, -m_size.Value.Y / 2.0f + 0.1f);
            Vector2 topRight = new Vector2(m_size.Value.X / 2.0f - 0.05f, -m_size.Value.Y / 2.0f + 0.1f);

            List<MyGuiControlListbox> listboxToDrop = new List<MyGuiControlListbox>();
            m_listboxDropConditions = new Dictionary<MyGuiControlListbox, Predicate<MyInventoryItem>>();

            m_inventoryItemTexture = null;
            m_inventoryScrollBarTexture = MyGuiManager.GetInventoryScreenListboxScrollBarTexture();

            #region my ship's inventory and customization

            // Ship's inventory label
            Controls.Add(new MyGuiControlLabel(this,
                                               new Vector2(0.1959f, -0.357f), null,
                                               MyTextsWrapperEnum.ShipInventory, MyGuiConstants.LABEL_TEXT_COLOR,
                                               MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE,
                                               MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER,
                                               MyGuiManager.GetFontMinerWarsBlue()));

            // Ship's inventory capacity label
            m_shipInventoryCapacityLabel = new MyGuiControlLabel(this,
                                                                 new Vector2(0.4f, -0.357f), null, MyTextsWrapperEnum.InventoryCapacityLabel,
                                                                 MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE,
                                                                 MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER);
            Controls.Add(m_shipInventoryCapacityLabel);

            // Ship inventory listbox
            m_shipInventoryListBox = new MyGuiControlListbox(this,
                                                             new Vector2(0.3211f, -0.1425f),
                                                             MyGuiConstants.LISTBOX_SMALL_SIZE + new Vector2(0,0.003f),
                                                             new Vector4(0f, 0f, 0f, 0f),
                                                             null,
                                                             MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE,
                                                             INVENTORY_COLUMNS, INVENTORY_DISPLAY_ROWS,
                                                             INVENTORY_COLUMNS, true, true, false,
                                                             null,
                                                             null,
                                                             m_inventoryScrollBarTexture,
                                                             null, 0, 0, new Vector4(1f, 1f, 1f, 0f), 0.03f, 0, 0, 0, -0.005f, -0.01f, -0.016f, -0.017f);
            InitializeListboxDragAndAddToControls(m_shipInventoryListBox);
            listboxToDrop.Add(m_shipInventoryListBox);
            m_listboxDropConditions.Add(m_shipInventoryListBox, ii => true);

            // Left weapons inventory label
            Controls.Add(new MyGuiControlLabel(this, new Vector2(-0.2637f, 0.2903f),
                                               null, MyTextsWrapperEnum.LeftWeapons, MyGuiConstants.LABEL_TEXT_COLOR,
                                               MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue()));
            
            m_leftWeaponListboxes = new List<MyGuiControlListbox>();
            var leftWeapon1InventoryListBox = new MyGuiControlListbox(this,
                                                        new Vector2(-0.3075f, 0.2203f),
                                                        MyGuiConstants.LISTBOX_SMALL_SIZE,
                                                        new Vector4(1f, 1f, 1f, 0f),
                                                        MyTextsWrapper.Get(MyTextsWrapperEnum.LeftWeapons),
                                                        MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE,
                                                        1, 1,
                                                        1, true, false, false,
                                                        null, null,
                                                        null, null, 0, 0, new Vector4(1f, 1f, 1f, 0f), 0.02f, 0f, 0f, 0f, 0, 0, 0);


            leftWeapon1InventoryListBox.DisplayHighlight = false;
            m_leftWeaponListboxes.Add(leftWeapon1InventoryListBox);
            leftWeapon1InventoryListBox.AddRow();
            InitializeListboxDragAndAddToControls(leftWeapon1InventoryListBox);
            listboxToDrop.Add(leftWeapon1InventoryListBox);
            m_listboxDropConditions.Add(leftWeapon1InventoryListBox,
                                        ii =>
                                        ii.ObjectBuilderType == MyMwcObjectBuilderTypeEnum.SmallShip_Weapon &&
                                        new int[] { 9, 10, 11, 12, 13, 14, 15, 16, 18 }.Contains(ii.ObjectBuilderId.Value) ==
                                        false);

            var leftWeapon2InventoryListBox = new MyGuiControlListbox(this,
                                                        new Vector2(-0.2363f, 0.2303f),
                                                        MyGuiConstants.LISTBOX_SMALL_SIZE,
                                                        new Vector4(1f, 1f, 1f, 0f),
                                                        MyTextsWrapper.Get(MyTextsWrapperEnum.LeftWeapons),
                                                        MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE,
                                                        1, 1,
                                                        1, true, false, false,
                                                        null, null,
                                                        null, null, 0, 0, new Vector4(1f, 1f, 1f, 0f), 0f, 0f, 0f, 0f, 0, 0, 0);
            leftWeapon2InventoryListBox.DisplayHighlight = false;
            m_leftWeaponListboxes.Add(leftWeapon2InventoryListBox);
            leftWeapon2InventoryListBox.AddRow();
            InitializeListboxDragAndAddToControls(leftWeapon2InventoryListBox);
            listboxToDrop.Add(leftWeapon2InventoryListBox);
            m_listboxDropConditions.Add(leftWeapon2InventoryListBox,
                                        ii =>
                                        ii.ObjectBuilderType == MyMwcObjectBuilderTypeEnum.SmallShip_Weapon &&
                                        new int[] { 9, 10, 11, 12, 13, 14, 15, 16, 18 }.Contains(ii.ObjectBuilderId.Value) ==
                                        false);

            var leftWeapon3InventoryListBox = new MyGuiControlListbox(this,
                                                        new Vector2(-0.1668f, 0.2303f),
                                                        MyGuiConstants.LISTBOX_SMALL_SIZE,
                                                        new Vector4(1f, 1f, 1f, 0f),
                                                        MyTextsWrapper.Get(MyTextsWrapperEnum.LeftWeapons),
                                                        MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE,
                                                        1, 1,
                                                        1, true, false, false,
                                                        null, null,
                                                        null, null, 0, 0, new Vector4(1f, 1f, 1f, 0f), 0f, 0f, 0f, 0f, 0, 0, 0);
            leftWeapon3InventoryListBox.DisplayHighlight = false;
            m_leftWeaponListboxes.Add(leftWeapon3InventoryListBox);
            leftWeapon3InventoryListBox.AddRow();
            InitializeListboxDragAndAddToControls(leftWeapon3InventoryListBox);
            listboxToDrop.Add(leftWeapon3InventoryListBox);
            m_listboxDropConditions.Add(leftWeapon3InventoryListBox,
                                        ii =>
                                        ii.ObjectBuilderType == MyMwcObjectBuilderTypeEnum.SmallShip_Weapon &&
                                        new int[] { 9, 10, 11, 12, 13, 14, 15, 16, 18 }.Contains(ii.ObjectBuilderId.Value) ==
                                        false);

            var leftWeapon4InventoryListBox = new MyGuiControlListbox(this,
                                                        new Vector2(-0.1659f, 0.1374f),
                                                        MyGuiConstants.LISTBOX_SMALL_SIZE,
                                                        new Vector4(1f, 1f, 1f, 0f),
                                                        MyTextsWrapper.Get(MyTextsWrapperEnum.LeftWeapons),
                                                        MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE,
                                                        1, 1,
                                                        1, true, false, false,
                                                        null, null,
                                                        null, null, 0, 0, new Vector4(1f, 1f, 1f, 0f), 0f, 0f, 0f, 0f, 0, 0, 0);
            leftWeapon4InventoryListBox.DisplayHighlight = false;
            m_leftWeaponListboxes.Add(leftWeapon4InventoryListBox);
            leftWeapon4InventoryListBox.AddRow();
            InitializeListboxDragAndAddToControls(leftWeapon4InventoryListBox);
            listboxToDrop.Add(leftWeapon4InventoryListBox);
            m_listboxDropConditions.Add(leftWeapon4InventoryListBox,
                                        ii =>
                                        ii.ObjectBuilderType == MyMwcObjectBuilderTypeEnum.SmallShip_Weapon &&
                                        new int[] { 9, 10, 11, 12, 13, 14, 15, 16, 18 }.Contains(ii.ObjectBuilderId.Value) ==
                                        false);

            var leftWeapon5InventoryListBox = new MyGuiControlListbox(this,
                                                        new Vector2(-0.0946f, 0.1374f),
                                                        MyGuiConstants.LISTBOX_SMALL_SIZE,
                                                        new Vector4(1f, 1f, 1f, 0f),
                                                        MyTextsWrapper.Get(MyTextsWrapperEnum.LeftWeapons),
                                                        MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE,
                                                        1, 1,
                                                        1, true, false, false,
                                                        null, null,
                                                        null, null, 0, 0, new Vector4(1f, 1f, 1f, 0f), 0f, 0f, 0f, 0f, 0, 0, 0);
            leftWeapon5InventoryListBox.DisplayHighlight = false;
            m_leftWeaponListboxes.Add(leftWeapon5InventoryListBox);
            leftWeapon5InventoryListBox.AddRow();
            InitializeListboxDragAndAddToControls(leftWeapon5InventoryListBox);
            listboxToDrop.Add(leftWeapon5InventoryListBox);
            m_listboxDropConditions.Add(leftWeapon5InventoryListBox,
                                        ii =>
                                        ii.ObjectBuilderType == MyMwcObjectBuilderTypeEnum.SmallShip_Weapon &&
                                        new int[] { 9, 10, 11, 12, 13, 14, 15, 16, 18 }.Contains(ii.ObjectBuilderId.Value) ==
                                        false);

            // Right weapons inventory label
            Controls.Add(new MyGuiControlLabel(this, new Vector2(0.2021f, 0.2909f),
                                               null, MyTextsWrapperEnum.RighWeapons, MyGuiConstants.LABEL_TEXT_COLOR,
                                               MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue()));
            
            m_rightWeaponListboxes = new List<MyGuiControlListbox>();
            var rightWeapon1InventoryListBox = new MyGuiControlListbox(this,
                                                                     new Vector2(0.0877f, 0.1362f),
                                                                     MyGuiConstants.LISTBOX_SMALL_SIZE,
                                                                     new Vector4(1f, 1f, 1f, 0f),
                                                                     MyTextsWrapper.Get(MyTextsWrapperEnum.RighWeapons),
                                                                     MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE,
                                                                     1, 1,
                                                                     1, true, false, false,
                                                                     null, m_inventoryItemTexture,
                                                                     null, null, 0, 0, new Vector4(1f, 1f, 1f, 0f), 0f, 0f, 0f, 0f, 0, 0, 0);
            rightWeapon1InventoryListBox.DisplayHighlight = false;
            m_rightWeaponListboxes.Insert(0, rightWeapon1InventoryListBox);
            rightWeapon1InventoryListBox.AddRow();
            InitializeListboxDragAndAddToControls(rightWeapon1InventoryListBox);
            listboxToDrop.Add(rightWeapon1InventoryListBox);
            m_listboxDropConditions.Add(rightWeapon1InventoryListBox,
                                        ii =>
                                        ii.ObjectBuilderType == MyMwcObjectBuilderTypeEnum.SmallShip_Weapon &&
                                        new int[] { 9, 10, 11, 12, 13, 14, 15, 16, 18 }.Contains(ii.ObjectBuilderId.Value) == false);

            var rightWeapon2InventoryListBox = new MyGuiControlListbox(this,
                                                                     new Vector2(0.1599f, 0.1362f),
                                                                     MyGuiConstants.LISTBOX_SMALL_SIZE,
                                                                     new Vector4(1f, 1f, 1f, 0f),
                                                                     MyTextsWrapper.Get(MyTextsWrapperEnum.RighWeapons),
                                                                     MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE,
                                                                     1, 1,
                                                                     1, true, false, false,
                                                                     null, m_inventoryItemTexture,
                                                                     null, null, 0, 0, new Vector4(1f, 1f, 1f, 0f), 0f, 0f, 0f, 0f, 0, 0, 0);
            rightWeapon2InventoryListBox.DisplayHighlight = false;
            m_rightWeaponListboxes.Insert(0, rightWeapon2InventoryListBox);
            rightWeapon2InventoryListBox.AddRow();
            InitializeListboxDragAndAddToControls(rightWeapon2InventoryListBox);
            listboxToDrop.Add(rightWeapon2InventoryListBox);
            m_listboxDropConditions.Add(rightWeapon2InventoryListBox,
                                        ii =>
                                        ii.ObjectBuilderType == MyMwcObjectBuilderTypeEnum.SmallShip_Weapon &&
                                        new int[] { 9, 10, 11, 12, 13, 14, 15, 16, 18 }.Contains(ii.ObjectBuilderId.Value) == false);

            var rightWeapon3InventoryListBox = new MyGuiControlListbox(this,
                                                                     new Vector2(0.1581f, 0.2303f),
                                                                     MyGuiConstants.LISTBOX_SMALL_SIZE,
                                                                     new Vector4(1f, 1f, 1f, 0f),
                                                                     MyTextsWrapper.Get(MyTextsWrapperEnum.RighWeapons),
                                                                     MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE,
                                                                     1, 1,
                                                                     1, true, false, false,
                                                                     null, m_inventoryItemTexture,
                                                                     null, null, 0, 0, new Vector4(1f, 1f, 1f, 0f), 0f, 0f, 0f, 0f, 0, 0, 0);
            rightWeapon3InventoryListBox.DisplayHighlight = false;
            m_rightWeaponListboxes.Insert(0, rightWeapon3InventoryListBox);
            rightWeapon3InventoryListBox.AddRow();
            InitializeListboxDragAndAddToControls(rightWeapon3InventoryListBox);
            listboxToDrop.Add(rightWeapon3InventoryListBox);
            m_listboxDropConditions.Add(rightWeapon3InventoryListBox,
                                        ii =>
                                        ii.ObjectBuilderType == MyMwcObjectBuilderTypeEnum.SmallShip_Weapon &&
                                        new int[] { 9, 10, 11, 12, 13, 14, 15, 16, 18 }.Contains(ii.ObjectBuilderId.Value) == false);

            var rightWeapon4InventoryListBox = new MyGuiControlListbox(this,
                                                                     new Vector2(0.2293f, 0.2303f),
                                                                     MyGuiConstants.LISTBOX_SMALL_SIZE,
                                                                     new Vector4(1f, 1f, 1f, 0f),
                                                                     MyTextsWrapper.Get(MyTextsWrapperEnum.RighWeapons),
                                                                     MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE,
                                                                     1, 1,
                                                                     1, true, false, false,
                                                                     null, m_inventoryItemTexture,
                                                                     null, null, 0, 0, new Vector4(1f, 1f, 1f, 0f), 0f, 0f, 0f, 0f, 0, 0, 0);
            rightWeapon4InventoryListBox.DisplayHighlight = false;
            m_rightWeaponListboxes.Insert(0, rightWeapon4InventoryListBox);
            rightWeapon4InventoryListBox.AddRow();
            InitializeListboxDragAndAddToControls(rightWeapon4InventoryListBox);
            listboxToDrop.Add(rightWeapon4InventoryListBox);
            m_listboxDropConditions.Add(rightWeapon4InventoryListBox,
                                        ii =>
                                        ii.ObjectBuilderType == MyMwcObjectBuilderTypeEnum.SmallShip_Weapon &&
                                        new int[] { 9, 10, 11, 12, 13, 14, 15, 16, 18 }.Contains(ii.ObjectBuilderId.Value) == false);

            var rightWeapon5InventoryListBox = new MyGuiControlListbox(this,
                                                                     new Vector2(0.2997f, 0.2303f),
                                                                     MyGuiConstants.LISTBOX_SMALL_SIZE,
                                                                     new Vector4(1f, 1f, 1f, 0f),
                                                                     MyTextsWrapper.Get(MyTextsWrapperEnum.RighWeapons),
                                                                     MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE,
                                                                     1, 1,
                                                                     1, true, false, false,
                                                                     null, m_inventoryItemTexture,
                                                                     null, null, 0, 0, new Vector4(1f, 1f, 1f, 0f), 0f, 0f, 0f, 0f, 0, 0, 0);
            rightWeapon5InventoryListBox.DisplayHighlight = false;
            m_rightWeaponListboxes.Insert(0, rightWeapon5InventoryListBox);
            rightWeapon5InventoryListBox.AddRow();
            InitializeListboxDragAndAddToControls(rightWeapon5InventoryListBox);
            listboxToDrop.Add(rightWeapon5InventoryListBox);
            m_listboxDropConditions.Add(rightWeapon5InventoryListBox,
                                        ii =>
                                        ii.ObjectBuilderType == MyMwcObjectBuilderTypeEnum.SmallShip_Weapon &&
                                        new int[] { 9, 10, 11, 12, 13, 14, 15, 16, 18 }.Contains(ii.ObjectBuilderId.Value) == false);

            // Engine inventory label
            Controls.Add(new MyGuiControlLabel(this, new Vector2(0f, 0.1846f),
                                               null, MyTextsWrapperEnum.Engine, MyGuiConstants.LABEL_TEXT_COLOR,
                                               MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue()));
            // Engine inventory listbox
            m_engineInventoryListBox = new MyGuiControlListbox(this,
                                                               new Vector2(-0.0042f, 0.1256f),
                                                               MyGuiConstants.LISTBOX_SMALL_SIZE, new Vector4(1f, 1f, 1f, 0f),
                                                               MyTextsWrapper.Get(MyTextsWrapperEnum.Engine),
                                                               MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE,
                                                               1, 1, 1, true, false, false,
                                                               null, m_inventoryItemTexture,
                                                               null, null, 0, 0, new Vector4(1f, 1f, 1f, 0f), 0f, 0f, 0f, 0f, 0, 0, 0);
            m_engineInventoryListBox.DisplayHighlight = false;
            m_engineInventoryListBox.AddRow();
            InitializeListboxDragAndAddToControls(m_engineInventoryListBox);
            listboxToDrop.Add(m_engineInventoryListBox);
            m_listboxDropConditions.Add(m_engineInventoryListBox,
                                        ii => ii.ObjectBuilderType == MyMwcObjectBuilderTypeEnum.SmallShip_Engine);

            // Back universal launcher inventory label
            Controls.Add(new MyGuiControlLabel(this, new Vector2(-0.0626f, 0.3374f),
                                               null, MyTextsWrapperEnum.WeaponUniversalLauncherBackTitle, MyGuiConstants.LABEL_TEXT_COLOR,
                                               MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue()));

            // Back universal launcher inventory label
            Controls.Add(new MyGuiControlLabel(this, new Vector2(-0.0626f, 0.3531f),
                                               null, MyTextsWrapperEnum.WeaponUniversalLauncher, MyGuiConstants.LABEL_TEXT_COLOR,
                                               MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue()));


            // Back universal launcher inventory listbox
            m_backUniversalLauncherInventoryListBox = new MyGuiControlListbox(this,
                                                                              new Vector2(-0.0605f, 0.2755f),
                                                                              MyGuiConstants.LISTBOX_SMALL_SIZE,
                                                                              new Vector4(1f, 1f, 1f, 0f),
                                                                              MyTextsWrapper.Get(MyTextsWrapperEnum.WeaponUniversalLauncherBack),
                                                                              MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE,
                                                                              1, 1, 1, true, false, false,
                                                                              null, m_inventoryItemTexture,
                                                                              null, null, 0, 0, new Vector4(1f, 1f, 1f, 0f), 0f, 0f, 0f, 0f, 0, 0, 0);
            m_backUniversalLauncherInventoryListBox.DisplayHighlight = false;
            m_backUniversalLauncherInventoryListBox.AddRow();
            InitializeListboxDragAndAddToControls(m_backUniversalLauncherInventoryListBox);
            listboxToDrop.Add(m_backUniversalLauncherInventoryListBox);
            m_listboxDropConditions.Add(m_backUniversalLauncherInventoryListBox,
                                        ii =>
                                        ii.ObjectBuilderType == MyMwcObjectBuilderTypeEnum.SmallShip_Weapon &&
                                        ii.ObjectBuilderId.Value == 9);

            // Armor inventory label
            Controls.Add(new MyGuiControlLabel(this, new Vector2(0.0573f, 0.3374f),
                                               null, MyTextsWrapperEnum.Armor, MyGuiConstants.LABEL_TEXT_COLOR,
                                               MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue()));
            // Armor inventory listbox
            m_armorInventoryListBox = new MyGuiControlListbox(this,
                                                              new Vector2(0.0555f, 0.2755f),
                                                              MyGuiConstants.LISTBOX_SMALL_SIZE, new Vector4(1f, 1f, 1f, 0f),
                                                              MyTextsWrapper.Get(MyTextsWrapperEnum.Armor),
                                                              MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE,
                                                              1, 1, 1, true, false, false,
                                                              null, m_inventoryItemTexture,
                                                              null, null, 0, 0, new Vector4(1f, 1f, 1f, 0f), 0f, 0f, 0f, 0f, 0, 0, 0);
            m_armorInventoryListBox.DisplayHighlight = false;
            m_armorInventoryListBox.AddRow();
            InitializeListboxDragAndAddToControls(m_armorInventoryListBox);
            listboxToDrop.Add(m_armorInventoryListBox);
            m_listboxDropConditions.Add(m_armorInventoryListBox,
                                        ii => ii.ObjectBuilderType == MyMwcObjectBuilderTypeEnum.SmallShip_Armor);

            // Front universal launcher inventory label
            Controls.Add(new MyGuiControlLabel(this, new Vector2(0f, 0.0323f),
                                               null, MyTextsWrapperEnum.WeaponUniversalLauncherFrontTitle, MyGuiConstants.LABEL_TEXT_COLOR,
                                               MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue()));

            // Front universal launcher inventory label
            Controls.Add(new MyGuiControlLabel(this, new Vector2(0f, 0.0462f),
                                               null, MyTextsWrapperEnum.WeaponUniversalLauncher, MyGuiConstants.LABEL_TEXT_COLOR,
                                               MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue()));

            // Front universal launcher inventory listbox
            m_frontUniversalLauncherInventoryListBox = new MyGuiControlListbox(this,
                                                                               new Vector2(-0.0039f, -0.0287f),
                                                                               MyGuiConstants.LISTBOX_SMALL_SIZE, new Vector4(1f, 1f, 1f, 0f),
                                                                               MyTextsWrapper.Get(MyTextsWrapperEnum.WeaponUniversalLauncherFront),
                                                                               MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE,
                                                                               1, 1, 1, true, false, false,
                                                                               null, m_inventoryItemTexture,
                                                                               null, null, 0, 0, new Vector4(1f, 1f, 1f, 0f), 0f, 0f, 0f, 0f, 0, 0, 0);
            m_frontUniversalLauncherInventoryListBox.DisplayHighlight = false;
            m_frontUniversalLauncherInventoryListBox.AddRow();
            InitializeListboxDragAndAddToControls(m_frontUniversalLauncherInventoryListBox);
            listboxToDrop.Add(m_frontUniversalLauncherInventoryListBox);
            m_listboxDropConditions.Add(m_frontUniversalLauncherInventoryListBox,
                                        ii =>
                                        ii.ObjectBuilderType == MyMwcObjectBuilderTypeEnum.SmallShip_Weapon &&
                                        ii.ObjectBuilderId.Value == 10);

            // Drill inventory label
            Controls.Add(new MyGuiControlLabel(this, new Vector2(-0.0920f, 0.0547f),
                                               null, MyTextsWrapperEnum.Drill, MyGuiConstants.LABEL_TEXT_COLOR,
                                               MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue()));

            Controls.Add(new MyGuiControlLabel(this, new Vector2(-0.0920f, 0.0715f),
                                   null, MyTextsWrapperEnum.device, MyGuiConstants.LABEL_TEXT_COLOR,
                                   MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue()));
            // Drill inventory listbox
            m_drillInventoryListBox = new MyGuiControlListbox(this,
                                                              new Vector2(-0.0944f, -0.0044f),
                                                              MyGuiConstants.LISTBOX_SMALL_SIZE, new Vector4(1f, 1f, 1f, 0f),
                                                              MyTextsWrapper.Get(MyTextsWrapperEnum.Drill),
                                                              MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE,
                                                              1, 1, 1, true, false, false,
                                                              null, m_inventoryItemTexture,
                                                              null, null, 0, 0, new Vector4(1f, 1f, 1f, 0f), 0f, 0f, 0f, 0f, 0, 0, 0);
            m_drillInventoryListBox.DisplayHighlight = false;
            m_drillInventoryListBox.AddRow();
            InitializeListboxDragAndAddToControls(m_drillInventoryListBox);
            listboxToDrop.Add(m_drillInventoryListBox);
            m_listboxDropConditions.Add(m_drillInventoryListBox,
                                        ii =>
                                        ii.ObjectBuilderType == MyMwcObjectBuilderTypeEnum.SmallShip_Weapon &&
                                        new int[] { 12, 13, 14, 15, 16, 18 }.Contains(ii.ObjectBuilderId.Value));

            // Harvesting tool inventory label
            Controls.Add(new MyGuiControlLabel(this, new Vector2(0.0861f, 0.0559f),
                                               null, MyTextsWrapperEnum.Harvester, MyGuiConstants.LABEL_TEXT_COLOR,
                                               MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue()));
            // Harvesting tool inventory label
            Controls.Add(new MyGuiControlLabel(this, new Vector2(0.0861f, 0.0703f),
                                               null, MyTextsWrapperEnum.device, MyGuiConstants.LABEL_TEXT_COLOR,
                                               MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue()));
            // Harvesting tool inventory listbox
            m_harvestingToolInventoryListBox = new MyGuiControlListbox(this,
                                                                       new Vector2(0.0843f, -0.0044f),
                                                                       MyGuiConstants.LISTBOX_SMALL_SIZE, new Vector4(1f, 1f, 1f, 0f),
                                                                       MyTextsWrapper.Get(MyTextsWrapperEnum.WeaponHarvestingDevice),
                                                                       MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE,
                                                                       1, 1, 1, true, false, false,
                                                                       null, m_inventoryItemTexture,
                                                                       null, null, 0, 0, new Vector4(1f, 1f, 1f, 0f), 0f, 0f, 0f, 0f, 0, 0, 0);
            m_harvestingToolInventoryListBox.DisplayHighlight = false;
            m_harvestingToolInventoryListBox.AddRow();
            InitializeListboxDragAndAddToControls(m_harvestingToolInventoryListBox);
            listboxToDrop.Add(m_harvestingToolInventoryListBox);
            m_listboxDropConditions.Add(m_harvestingToolInventoryListBox,
                                        ii =>
                                        ii.ObjectBuilderType == MyMwcObjectBuilderTypeEnum.SmallShip_Weapon &&
                                        ii.ObjectBuilderId.Value == 11);

            #endregion

            // money information
            m_playersMoneyLabel = new MyGuiControlLabel(this, new Vector2(0.355f, 0.1450f), null,
                                                        MyTextsWrapper.Get(MyTextsWrapperEnum.Cash),
                                                        MyGuiConstants.LABEL_TEXT_COLOR,
                                                        MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE * 1.2f,
                                                        MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER,
                                                        MyGuiManager.GetFontMinerWarsBlue());
            Controls.Add(m_playersMoneyLabel);            


            m_okButton = new MyGuiControlButton(this, new Vector2(0f, 0.4086f), MyGuiConstants.OK_BUTTON_SIZE,
                                   MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                                   MyGuiManager.GetInventoryScreenButtonTexture(), null, null, MyTextsWrapperEnum.Close,
                                   MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnOkClick,
                                   true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true);
            Controls.Add(m_okButton);




            if (!m_tradeForMoney)
            {
                //Take all button
                m_ButtonTakeAll = new MyGuiControlButton(this, new Vector2(-0.3095f, 0.1455f), new Vector2(0.1532f, 0.063f),
                           MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                           MyGuiManager.GetInventoryScreenButtonTextureTakeAll(), null, null, MyTextsWrapperEnum.TakeAll,
                           MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE_SMALLER, MyGuiControlButtonTextAlignment.CENTERED, OnTakeAllClick,
                           true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true);
                Controls.Add(m_ButtonTakeAll);
            }

            if (m_inventoryScreenType == MyGuiScreenInventoryType.GodEditor) 
            {
                m_removeAll = new MyGuiControlButton(this, new Vector2(0.29f, -0.4f), new Vector2(0.1532f, 0.063f),
                       MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                       MyGuiManager.GetInventoryScreenButtonTextureTakeAll(), null, null, MyTextsWrapperEnum.RemoveAll,
                       MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE_SMALLER, MyGuiControlButtonTextAlignment.CENTERED, OnRemoveAllClick,
                       true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true);
                Controls.Add(m_removeAll);
            }

            #region other side's inventory

            if (m_otherSideInventoryBuilder != null)
            {
                // Other side's inventory label
                Controls.Add(new MyGuiControlLabel(this,
                                                   new Vector2(-0.4126f, -0.357f), null,
                                                   otherSideInventoryName, MyGuiConstants.LABEL_TEXT_COLOR,
                                                   MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE,
                                                   MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER,
                                                   MyGuiManager.GetFontMinerWarsBlue()));

                // Ship's inventory capacity label
                m_otherSideInventoryCapacityLabel = new MyGuiControlLabel(this,
                                                                     new Vector2(-0.215f, -0.357f), null, MyTextsWrapperEnum.InventoryCapacityLabel,
                                                                     MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE,
                                                                     MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER);
                Controls.Add(m_otherSideInventoryCapacityLabel);
                
                // Other side inventory listbox
                m_otherSideInventoryListBox = new MyGuiControlListbox(this,
                                                                      new Vector2(-0.2925f, -0.1425f),
                                                                      MyGuiConstants.LISTBOX_SMALL_SIZE + new Vector2(0, 0.003f),
                                                                      new Vector4(1f, 1f, 1f, 0f),
                                                                      null,
                                                                      MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE,
                                                                      INVENTORY_COLUMNS, INVENTORY_DISPLAY_ROWS,
                                                                      INVENTORY_COLUMNS, true, true, false,
                                                                      null,
                                                                      null,
                                                                      m_inventoryScrollBarTexture,
                                                                      null, 0, 0, new Vector4(1f, 1f, 1f, 0.0f), 0.03f, 0, 0, 0, -0.005f, -0.01f, -0.0155f, -0.017f);
                InitializeListboxDragAndAddToControls(m_otherSideInventoryListBox);
                listboxToDrop.Add(m_otherSideInventoryListBox);
                m_listboxDropConditions.Add(m_otherSideInventoryListBox, ii => true);                

                m_shipInventoryListBox.ItemDoubleClick += OnShipItemDoubleClick;
                m_otherSideInventoryListBox.ItemDoubleClick += OnOtherSideItemDoubleClick;
            }
            else
            {
                m_otherSideInventoryListBox = new MyGuiControlListbox(this,
                                                                      new Vector2(-0.2925f, -0.1425f),
                                                                      MyGuiConstants.LISTBOX_SMALL_SIZE + new Vector2(0, 0.003f),
                                                                      new Vector4(1f, 1f, 1f, 0f),
                                                                      otherSideInventoryName,
                                                                      MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE,
                                                                      INVENTORY_COLUMNS, INVENTORY_DISPLAY_ROWS,
                                                                      INVENTORY_COLUMNS, true, true, false,
                                                                      null,
                                                                      null,
                                                                      m_inventoryScrollBarTexture,
                                                                      null, 0, 0, new Vector4(1f, 1f, 1f, 0.0f), 0.03f, 0, 0, 0, -0.005f, -0.01f, -0.0155f, -0.017f);
            }

            //Filters All Items

            const float delta = 0.028f;
            var position = new Vector2(-0.2402f, 0.0684f);
            m_sortAll = new MyGuiControlCheckbox(this, position, MyGuiConstants.INVENTORY_FILTER_BUTTON_SIZE,
                                             MyGuiManager.GetInventoryFilterSortAllOff(),
                                             MyGuiManager.GetInventoryFilterSortAllOn(),
                                             MyTextsWrapper.Get(MyTextsWrapperEnum.InventoryShowAll), true, MyGuiConstants.BACK_BUTTON_TEXT_COLOR, true, null, MyGuiConstants.INVENTORY_FILTER_BUTTON_INNER_SIZE);            
            Controls.Add(m_sortAll);
            position.X -= delta;

            m_sortGods = new MyGuiControlCheckbox(this, position, MyGuiConstants.INVENTORY_FILTER_BUTTON_SIZE,
                                             MyGuiManager.GetInventoryFilterSortGodsOff(),
                                             MyGuiManager.GetInventoryFilterSortGodsOn(),
                                             MyTextsWrapper.Get(MyTextsWrapperEnum.InventoryShowGods), false, MyGuiConstants.BACK_BUTTON_TEXT_COLOR, true, null, MyGuiConstants.INVENTORY_FILTER_BUTTON_INNER_SIZE);            
            Controls.Add(m_sortGods);
            position.X -= delta;

            m_sortOres = new MyGuiControlCheckbox(this, position, MyGuiConstants.INVENTORY_FILTER_BUTTON_SIZE,
                                             MyGuiManager.GetInventoryFilterSortOresOff(),
                                             MyGuiManager.GetInventoryFilterSortOresOn(),
                                             MyTextsWrapper.Get(MyTextsWrapperEnum.InventoryShowOres), false, MyGuiConstants.BACK_BUTTON_TEXT_COLOR, true, null, MyGuiConstants.INVENTORY_FILTER_BUTTON_INNER_SIZE);            
            Controls.Add(m_sortOres);
            position.X -= delta;

            m_sortConsumables = new MyGuiControlCheckbox(this, position, MyGuiConstants.INVENTORY_FILTER_BUTTON_SIZE,
                                             MyGuiManager.GetInventoryFilterSortConsumablesOff(),
                                             MyGuiManager.GetInventoryFilterSortConsumablesOn(),
                                             MyTextsWrapper.Get(MyTextsWrapperEnum.InventoryShowConsumables), false, MyGuiConstants.BACK_BUTTON_TEXT_COLOR, true, null, MyGuiConstants.INVENTORY_FILTER_BUTTON_INNER_SIZE);
            Controls.Add(m_sortConsumables);            
            position.X -= delta;

            m_sortEquipment = new MyGuiControlCheckbox(this, position, MyGuiConstants.INVENTORY_FILTER_BUTTON_SIZE,
                                             MyGuiManager.GetInventoryFilterSortEquipmentOff(),
                                             MyGuiManager.GetInventoryFilterSortEquipmentOn(),
                                             MyTextsWrapper.Get(MyTextsWrapperEnum.InventoryShowEquipment), false, MyGuiConstants.BACK_BUTTON_TEXT_COLOR, true, null, MyGuiConstants.INVENTORY_FILTER_BUTTON_INNER_SIZE);
            Controls.Add(m_sortEquipment);            
            position.X -= delta;

            m_sortWeapons = new MyGuiControlCheckbox(this, position, MyGuiConstants.INVENTORY_FILTER_BUTTON_SIZE,
                                             MyGuiManager.GetInventoryFilterSortWeaponsOff(),
                                             MyGuiManager.GetInventoryFilterSortWeaponsOn(),
                                             MyTextsWrapper.Get(MyTextsWrapperEnum.InventoryShowWeapons), false, MyGuiConstants.BACK_BUTTON_TEXT_COLOR, true, null, MyGuiConstants.INVENTORY_FILTER_BUTTON_INNER_SIZE);            
            Controls.Add(m_sortWeapons);

            if (m_otherSideInventoryBuilder != null)
            {
                m_sortAll.OnCheck += OnFilterInventorySortClick;
                m_sortGods.OnCheck += OnFilterInventorySortClick;
                m_sortOres.OnCheck += OnFilterInventorySortClick;
                m_sortConsumables.OnCheck += OnFilterInventorySortClick;
                m_sortEquipment.OnCheck += OnFilterInventorySortClick;
                m_sortWeapons.OnCheck += OnFilterInventorySortClick;
            }
            else 
            {
                m_sortAll.Checked = false;
                m_sortAll.Enabled = false;
                m_sortGods.Enabled = false;
                m_sortOres.Enabled = false;
                m_sortConsumables.Enabled = false;
                m_sortEquipment.Enabled = false;
                m_sortWeapons.Enabled = false;
            }

            //Filters My Inventory
            position = new Vector2(0.373f, 0.0684f);

            m_sortAllMy = new MyGuiControlCheckbox(this, position, MyGuiConstants.INVENTORY_FILTER_BUTTON_SIZE,
                                             MyGuiManager.GetInventoryFilterSortAllOff(),
                                             MyGuiManager.GetInventoryFilterSortAllOn(),
                                             MyTextsWrapper.Get(MyTextsWrapperEnum.InventoryShowAll), true, MyGuiConstants.BACK_BUTTON_TEXT_COLOR, true, null, MyGuiConstants.INVENTORY_FILTER_BUTTON_INNER_SIZE);
            Controls.Add(m_sortAllMy);
            m_sortAllMy.OnCheck += OnFilterInventoryMySortClick;
            position.X -= delta;

            m_sortGodsMy = new MyGuiControlCheckbox(this, position, MyGuiConstants.INVENTORY_FILTER_BUTTON_SIZE,
                                             MyGuiManager.GetInventoryFilterSortGodsOff(),
                                             MyGuiManager.GetInventoryFilterSortGodsOn(),
                                             MyTextsWrapper.Get(MyTextsWrapperEnum.InventoryShowGods), false, MyGuiConstants.BACK_BUTTON_TEXT_COLOR, true, null, MyGuiConstants.INVENTORY_FILTER_BUTTON_INNER_SIZE);
            m_sortGodsMy.OnCheck += OnFilterInventoryMySortClick;
            Controls.Add(m_sortGodsMy);
            position.X -= delta;

            m_sortOresMy = new MyGuiControlCheckbox(this, position, MyGuiConstants.INVENTORY_FILTER_BUTTON_SIZE,
                                             MyGuiManager.GetInventoryFilterSortOresOff(),
                                             MyGuiManager.GetInventoryFilterSortOresOn(),
                                             MyTextsWrapper.Get(MyTextsWrapperEnum.InventoryShowOres), false, MyGuiConstants.BACK_BUTTON_TEXT_COLOR, true, null, MyGuiConstants.INVENTORY_FILTER_BUTTON_INNER_SIZE);
            Controls.Add(m_sortOresMy);
            m_sortOresMy.OnCheck += OnFilterInventoryMySortClick;
            position.X -= delta;

            m_sortConsumablesMy = new MyGuiControlCheckbox(this, position, MyGuiConstants.INVENTORY_FILTER_BUTTON_SIZE,
                                             MyGuiManager.GetInventoryFilterSortConsumablesOff(),
                                             MyGuiManager.GetInventoryFilterSortConsumablesOn(),
                                             MyTextsWrapper.Get(MyTextsWrapperEnum.InventoryShowConsumables), false, MyGuiConstants.BACK_BUTTON_TEXT_COLOR, true, null, MyGuiConstants.INVENTORY_FILTER_BUTTON_INNER_SIZE);
            m_sortConsumablesMy.OnCheck += OnFilterInventoryMySortClick;
            Controls.Add(m_sortConsumablesMy);
            position.X -= delta;

            m_sortEquipmentMy = new MyGuiControlCheckbox(this, position, MyGuiConstants.INVENTORY_FILTER_BUTTON_SIZE,
                                             MyGuiManager.GetInventoryFilterSortEquipmentOff(),
                                             MyGuiManager.GetInventoryFilterSortEquipmentOn(),
                                             MyTextsWrapper.Get(MyTextsWrapperEnum.InventoryShowEquipment), false, MyGuiConstants.BACK_BUTTON_TEXT_COLOR, true, null, MyGuiConstants.INVENTORY_FILTER_BUTTON_INNER_SIZE);
            m_sortEquipmentMy.OnCheck += OnFilterInventoryMySortClick;
            Controls.Add(m_sortEquipmentMy);
            position.X -= delta;

            m_sortWeaponsMy = new MyGuiControlCheckbox(this, position, MyGuiConstants.INVENTORY_FILTER_BUTTON_SIZE,
                                             MyGuiManager.GetInventoryFilterSortWeaponsOff(),
                                             MyGuiManager.GetInventoryFilterSortWeaponsOn(),
                                             MyTextsWrapper.Get(MyTextsWrapperEnum.InventoryShowWeapons), false, MyGuiConstants.BACK_BUTTON_TEXT_COLOR, true, null, MyGuiConstants.INVENTORY_FILTER_BUTTON_INNER_SIZE);
            m_sortWeaponsMy.OnCheck += OnFilterInventoryMySortClick;
            Controls.Add(m_sortWeaponsMy);



            #endregion

            #region combobox for select ship to customization
            if (m_smallShipsBuilders.Count > 1 && m_inventoryScreenType != MyGuiScreenInventoryType.Game)
            {
                m_shipsCombobox = new MyGuiControlCombobox(this, new Vector2(0f, topLeft.Y), MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR,
                        MyGuiConstants.COMBOBOX_TEXT_SCALE);
                m_shipsCombobox.OnSelect += OnComboboxSelectedItemChanged;
                Controls.Add(m_shipsCombobox);                
            }

            Vector2 shipButtonSize = new Vector2(128 / 1600f, 512 / 1200f) * 0.5f;
            m_previousShipButton = new MyGuiControlButton(this, new Vector2(-0.144f, -0.256f), shipButtonSize, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                               MyGuiManager.GetInventoryPreviousShip(), null, null, MyTextsWrapperEnum.EmptyDescription,
                               Vector4.Zero, 0f, MyGuiControlButtonTextAlignment.CENTERED, OnPreviousShipButtonClick,
                               false, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true);
            Controls.Add(m_previousShipButton);

            m_nextShipButton = new MyGuiControlButton(this, new Vector2(0.144f, -0.256f), shipButtonSize, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                               MyGuiManager.GetInventoryNextShip(), null, null, MyTextsWrapperEnum.EmptyDescription,
                               Vector4.Zero, 0f, MyGuiControlButtonTextAlignment.CENTERED, OnNextShipButtonClick,
                               false, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true);
            Controls.Add(m_nextShipButton);
            #endregion

            // ship's name
            m_shipNameLabel = new MyGuiControlLabel(this, 
                                                    new Vector2(0f, -0.1156f), null, new StringBuilder(), MyGuiConstants.LABEL_TEXT_COLOR, 
                                                    MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);
            Controls.Add(m_shipNameLabel);

            // initialize drag and drop
            m_dragAndDrop = new MyGuiControlListboxDragAndDrop(this, listboxToDrop, MyGuiControlPreDefinedSize.SMALL,
                                                               MyGuiConstants.DRAG_AND_DROP_BACKGROUND_COLOR,
                                                               MyGuiConstants.DRAG_AND_DROP_TEXT_COLOR,
                                                               MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE,
                                                               MyGuiConstants.DRAG_AND_DROP_TEXT_OFFSET, true);
            m_dragAndDrop.ListboxItemDropped += OnDrop;
            m_dragAndDrop.DrawBackgroundTexture = false;
            Controls.Add(m_dragAndDrop);
        }
예제 #30
0
 private void UpdateInventoryCapacityLabel(MyGuiControlLabel label, MyGuiControlListbox listbox) 
 {
     int currentItems = GetListboxItemsCount(listbox);
     int maxItems = GetMaxListboxItems(listbox);
     maxItems = Math.Max(currentItems, maxItems);
     label.UpdateParams(new object[] { currentItems, maxItems });
     if (!IsListboxFull(listbox))
     {
         label.Font = MyGuiManager.GetFontMinerWarsBlue();
     }
     else 
     {
         label.Font = MyGuiManager.GetFontMinerWarsRed();
     }
 }