protected StringBuilder GetEntityName(MyEntity entity)
 {
     if (!string.IsNullOrEmpty(entity.DisplayName))
     {
         return(new StringBuilder(entity.GetCorrectDisplayName()));
     }
     else
     {
         if (entity is MyPrefabLargeWeapon && (entity as MyPrefabLargeWeapon).GetGun() != null)
         {
             MyLargeShipGunBase gun = (entity as MyPrefabLargeWeapon).GetGun();
             if (gun is MyLargeShipAutocannon)
             {
                 return(MyTextsWrapper.Get(MyTextsWrapperEnum.Autocannon));
             }
             else if (gun is MyLargeShipCIWS)
             {
                 return(MyTextsWrapper.Get(MyTextsWrapperEnum.CIWS));
             }
             else if (gun is MyLargeShipMachineGun)
             {
                 return(MyTextsWrapper.Get(MyTextsWrapperEnum.MachineGun));
             }
             else if (gun is MyLargeShipMissileLauncherGun)
             {
                 return(MyTextsWrapper.Get(MyTextsWrapperEnum.MissileLauncher));
             }
         }
         else if (entity is MyPrefabCamera)
         {
             return(MyTextsWrapper.Get(MyTextsWrapperEnum.Camera));
         }
         else if (entity is MyPrefabAlarm)
         {
             return(MyTextsWrapper.Get(MyTextsWrapperEnum.Alarm));
         }
         else if (entity is MyPrefabBankNode)
         {
             return(MyTextsWrapper.Get(MyTextsWrapperEnum.BankNode));
         }
         else if (entity is MyPrefabGenerator)
         {
             return(MyTextsWrapper.Get(MyTextsWrapperEnum.Generator));
         }
         else if (entity is MyPrefabScanner)
         {
             return(MyTextsWrapper.Get(MyTextsWrapperEnum.Scanner));
         }
         else if (entity is MyPrefabContainer)
         {
             return(MyTextsWrapper.Get(MyTextsWrapperEnum.Alarm));
         }
         else if (entity is MyPrefabKinematic)
         {
             MyPrefabKinematic pk = (MyPrefabKinematic)entity;
             return(MyTextsWrapper.Get(MyTextsWrapperEnum.Door));
         }
         return(new StringBuilder());
     }
 }
        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;
            }
        }
        private static void ShowNetworkError()
        {
            var caption = MyTextsWrapper.Get(MyTextsWrapperEnum.MessageBoxNetworkErrorCaption);
            var msg     = new StringBuilder(MyTextsWrapper.GetFormatString(MyTextsWrapperEnum.MP_CannotConnectServerJoin, MinerWars.CommonLIB.AppCode.Utils.MyMwcNetworkingConstants.NETWORKING_PORT_MASTER_SERVER));

            MyGuiManager.AddModalScreen(new MyGuiScreenMessageBox(MyMessageBoxType.ERROR, msg, caption, MyTextsWrapperEnum.Ok, null), null);
        }
Пример #4
0
        private void OnEditButtonClick(MyGuiControlButton sender)
        {
            var selectedItem = m_templatesListbox.GetSelectedItem();

            if (selectedItem != null)
            {
                var selectedType = (MyMwcObjectBuilder_SmallShip_TypesEnum)m_shipTypeCombobox.GetSelectedKey();
                m_selectedTemplate = MySmallShipTemplates.GetTemplate(selectedType, selectedItem.Value);

                var builders = new List <MySmallShipBuilderWithName> {
                    new MySmallShipBuilderWithName(m_selectedTemplate.Builder)
                };

                var inventory = new MyInventory();
                inventory.FillInventoryWithAllItems(null, 100);
                var gui = new MyGuiScreenInventory(
                    builders,
                    0,
                    inventory.GetObjectBuilder(false),
                    MyTextsWrapper.Get(MyTextsWrapperEnum.AllItemsInventory));

                gui.OnSave += UpdateTemplate;
                MyGuiManager.AddScreen(gui);
            }
            else
            {
                WarnNotSelected();
            }
        }
Пример #5
0
        protected override StringBuilder GetDisplayNameSb(string displayName)
        {
            StringBuilder displayNameSb = null;

            if (!string.IsNullOrEmpty(displayName))
            {
                displayNameSb = base.GetDisplayNameSb(displayName);
            }
            else
            {
                if (!string.IsNullOrEmpty(m_owner.DisplayName))
                {
                    displayNameSb = new StringBuilder(m_owner.DisplayName);
                    //displayNameSb.Append(" (");
                    //displayNameSb.Append(MyTextsWrapper.Get(MyTextsWrapperEnum.vendor));
                    //displayNameSb.Append(")");
                }
                else
                {
                    if (PrefabHangarType == MyMwcObjectBuilder_PrefabHangar_TypesEnum.HANGAR)
                    {
                        displayNameSb = MyTextsWrapper.Get(MyTextsWrapperEnum.Hangar);
                    }
                    else if (PrefabHangarType == MyMwcObjectBuilder_PrefabHangar_TypesEnum.VENDOR)
                    {
                        displayNameSb = MyTextsWrapper.Get(MyTextsWrapperEnum.Merchant);
                    }
                }
            }
            return(displayNameSb);
        }
Пример #6
0
 // with delegate for indexed onButtonClick
 public MyGuiControlButton(IMyGuiControlsParent parent, Vector2 position, Vector2?size, Vector4 backgroundColor, MyTextsWrapperEnum textEnum,
                           Vector4 textColor, float textScale, OnIndexedButtonClick onIndexedButtonClick, int buttonIndex, MyGuiControlButtonTextAlignment textAlignment, bool canHandleKeyboardInput,
                           MyGuiDrawAlignEnum align, bool implementedFeature)
     : this(parent, position, size, backgroundColor, MyTextsWrapper.Get(textEnum), textColor, textScale, onIndexedButtonClick, buttonIndex,
            textAlignment, canHandleKeyboardInput, align, null, implementedFeature)
 {
 }
Пример #7
0
            public ControlWithDescription(MyGameControlEnums control)
            {
                MyControl c = MyGuiManager.GetInput().GetGameControl(control);

                Control     = c.GetControlButtonStringBuilder(MyGuiInputDeviceEnum.Keyboard);
                Description = MyTextsWrapper.Get(c.GetControlName());
            }
Пример #8
0
        private void NewNameChosen(ScreenResult result, string resultText)
        {
            if (result == ScreenResult.Ok)
            {
                m_newName = resultText;

                var selectedType = (MyMwcObjectBuilder_SmallShip_TypesEnum)m_shipTypeCombobox.GetSelectedKey();

                var builders = new List <MySmallShipBuilderWithName>
                {
                    new MySmallShipBuilderWithName(MyMwcObjectBuilder_SmallShip_Bot.CreateObjectBuilderWithAllItems(selectedType, MyShipTypeConstants.GetShipTypeProperties(selectedType).GamePlay.CargoCapacity))
                };

                var inventory = new MyInventory();
                inventory.FillInventoryWithAllItems(null, 100);
                var gui = new MyGuiScreenInventory(
                    builders,
                    0,
                    inventory.GetObjectBuilder(false),
                    MyTextsWrapper.Get(MyTextsWrapperEnum.AllItemsInventory));

                gui.OnSave += AddTemplate;
                MyGuiManager.AddScreen(gui);
            }
        }
Пример #9
0
        private bool Validate(ref List <StringBuilder> errorMessages)
        {
            // check healt and max health
            for (int i = 0; i < m_healthsAndMaxhealths.Length; i++)
            {
                if (m_healthTextboxes[i] != null && m_maxHealthTextboxes[i] != null)
                {
                    float?health    = !String.IsNullOrEmpty(m_healthTextboxes[i].Text) ? float.Parse(m_healthTextboxes[i].Text) : (float?)null;
                    float?maxHealth = !String.IsNullOrEmpty(m_maxHealthTextboxes[i].Text) ? float.Parse(m_maxHealthTextboxes[i].Text) : (float?)null;

                    if (health == null)
                    {
                        errorMessages.Add(MyTextsWrapper.Get(MyTextsWrapperEnum.MessageYouMustSetHealth));
                    }
                    if (maxHealth == null)
                    {
                        errorMessages.Add(MyTextsWrapper.Get(MyTextsWrapperEnum.MessageYouMustSetMaxHealth));
                    }
                    if (health != null && health <= 0f)
                    {
                        errorMessages.Add(MyTextsWrapper.Get(MyTextsWrapperEnum.MessageHealthCantBeLessOrEqualZero));
                    }
                    if (maxHealth != null && maxHealth <= 0f)
                    {
                        errorMessages.Add(MyTextsWrapper.Get(MyTextsWrapperEnum.MessageMaxHealthCantBeLessOrEqualZero));
                    }
                    if (health != null && maxHealth != null && health > maxHealth)
                    {
                        errorMessages.Add(MyTextsWrapper.Get(MyTextsWrapperEnum.MessageHealthMustBeLesserOrEqualMaxHealth));
                    }
                }
            }
            return(errorMessages.Count == 0);
        }
Пример #10
0
 private bool Validate(ref List <StringBuilder> errorMessages)
 {
     // check healt and max health
     if (m_editProperties.HealthRatio == null)
     {
         errorMessages.Add(MyTextsWrapper.Get(MyTextsWrapperEnum.MessageYouMustSetHealth));
     }
     if (m_editProperties.MaxHealth == null)
     {
         errorMessages.Add(MyTextsWrapper.Get(MyTextsWrapperEnum.MessageYouMustSetMaxHealth));
     }
     if (m_editProperties.HealthRatio != null && m_editProperties.HealthRatio <= 0f)
     {
         errorMessages.Add(MyTextsWrapper.Get(MyTextsWrapperEnum.MessageHealthCantBeLessOrEqualZero));
     }
     if (m_editProperties.MaxHealth != null && m_editProperties.MaxHealth <= 0f)
     {
         errorMessages.Add(MyTextsWrapper.Get(MyTextsWrapperEnum.MessageMaxHealthCantBeLessOrEqualZero));
     }
     if (m_editProperties.HealthRatio != null && m_editProperties.HealthRatio > 1f)
     {
         errorMessages.Add(MyTextsWrapper.Get(MyTextsWrapperEnum.MessageHealthPercentageCantBeGreaterThen100));
     }
     // check entity name
     if (MyEntities.IsNameExists(m_entities[0], m_editProperties.Name))
     {
         errorMessages.Add(MyTextsWrapper.Get(MyTextsWrapperEnum.MessageEntityNameIsAlreadyExists));
     }
     if (m_useProperties != null)
     {
         m_useProperties.Validate(ref errorMessages);
     }
     return(errorMessages.Count == 0);
 }
        public MyGuiScreenEditorWayPointList()
            : base(new Vector2(0.5f, 0.5f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, null)
        {
            m_enableBackgroundFade = true;
            m_size = new Vector2(0.7f, 0.75f);

            AddCaption(MyTextsWrapperEnum.Waypoints, new Vector2(0, 0.015f));

            var wayPointsListBox = new MyGuiControlListbox(this, new Vector2(0, -0.01f), new Vector2(0.55f, 0.1f), MyGuiConstants.LISTBOX_BACKGROUND_COLOR,
                                                           MyTextsWrapper.Get(MyTextsWrapperEnum.Waypoints), MyGuiConstants.LABEL_TEXT_SCALE, 1, 5, 1, false, true, false,
                                                           null, null, MyGuiManager.GetScrollbarSlider(), MyGuiManager.GetHorizontalScrollbarSlider(), 2, 1, MyGuiConstants.LISTBOX_BACKGROUND_COLOR_BLUE, 0f, 0f, 0f, 0f, 0, 0, -0.01f, -0.01f, -0.02f, 0.02f);

            wayPointsListBox.ItemSelect += new OnListboxItemSelect(wayPointsListBox_ItemSelect);


            MyWayPointGraph.StoredPaths.Sort(Waypoint_Sort);

            for (int i = 0; i < MyWayPointGraph.StoredPaths.Count; i++)
            {
                wayPointsListBox.AddItem(i, new StringBuilder(MyWayPointGraph.StoredPaths[i].Name));
            }

            Controls.Add(wayPointsListBox);


            Controls.Add(new MyGuiControlButton(this, new Vector2(0.2080f, 0.28f), MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                                                MyTextsWrapperEnum.Ok, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnOkClick, MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true));
        }
Пример #12
0
        public override bool Draw(float backgroundFadeAlpha)
        {
            if (base.Draw(backgroundFadeAlpha))
            {
                if (m_customMessage.HasValue)
                {
                    MyGuiManager.DrawString(MyGuiManager.GetFontMinerWarsRed(),
                                            MyTextsWrapper.Get(m_customMessage.Value),
                                            new Vector2(0.5f, 680 / 1200f), 1f,
                                            MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);
                }

                if (MyMultiplayerGameplay.IsRunning && !MyMultiplayerGameplay.Static.IsHost)
                {
                    MyGuiManager.DrawString(MyGuiManager.GetFontMinerWarsRed(),
                                            MyTextsWrapper.Get(MyTextsWrapperEnum.GameOverInstructionsPart2MP),
                                            new Vector2(0.5f, 870 / 1200f), 1f,
                                            MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);
                }
                else
                {
                    MyGuiManager.DrawString(MyGuiManager.GetFontMinerWarsRed(),
                                            MyTextsWrapper.Get(MyTextsWrapperEnum.GameOverInstructionsPart2),
                                            new Vector2(0.5f, 870 / 1200f), 1f,
                                            MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);
                }
                MyGuiManager.DrawString(MyGuiManager.GetFontMinerWarsRed(),
                                        MyTextsWrapper.Get(MyTextsWrapperEnum.GameOverInstructionsPart1),
                                        new Vector2(0.5f, 930 / 1200f), 1f,
                                        MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);
            }
            return(true);
        }
Пример #13
0
        public StringBuilder GetName()
        {
            switch (EventType)
            {
            case EventTypeEnum.GlobalEvent:
                var globalEvent = MyGlobalEvents.GetGlobalEventByType((MyGlobalEventEnum)EventTypeID);
                if (globalEvent != null)
                {
                    return(MyTextsWrapper.Get(globalEvent.Name));
                }
                break;

            case EventTypeEnum.MissionStarted:
            case EventTypeEnum.MissionFinished:
            case EventTypeEnum.SubmissionAvailable:
            case EventTypeEnum.SubmissionFinished:
                //case EventTypeEnum.Story:
                var mission = MyMissions.GetMissionByID((MyMissionID)EventTypeID);
                if (mission != null)
                {
                    return(mission.NameTemp);
                }
                break;
            }
            return(null);
            //return MyTextsWrapperEnum.Null;
        }
Пример #14
0
        public MyGuiControlMultilineText(
            IMyGuiControlsParent parent, Vector2 position,
            Vector2 size, Vector4?backgroundColor,
            MyGuiFont font, float textScale, MyGuiDrawAlignEnum textAlign, StringBuilder contents, bool drawBorders = true, bool drawScrollbar = true)
            : base(parent, position, size, backgroundColor, null)
        {
            m_font          = font;
            m_textScale     = textScale;
            m_textAlign     = textAlign;
            m_drawBorders   = drawBorders;
            m_drawScrollbar = drawScrollbar;
            TextColor       = new Color(MyGuiConstants.LABEL_TEXT_COLOR);

            m_scrollbar            = new MyVScrollbar(this);
            m_scrollbar.TopBorder  = m_scrollbar.RightBorder = m_scrollbar.BottomBorder = false;
            m_scrollbar.LeftBorder = drawBorders;
            m_scrollbarSize        = new Vector2(0.0334f, MyGuiConstants.COMBOBOX_VSCROLLBAR_SIZE.Y);
            m_scrollbarSize        = MyGuiConstants.COMBOBOX_VSCROLLBAR_SIZE;
            float minLineHeight = MyGuiManager.MeasureString(m_font,
                                                             MyTextsWrapper.Get(MyTextsWrapperEnum.ServerShutdownNotificationCaption),
                                                             m_parent.GetPositionAbsolute() + m_position, m_textScale,
                                                             m_textAlign).Size.Y;

            m_label = new MyRichLabel(size.X, minLineHeight);
            if (contents != null && contents.Length > 0)
            {
                SetText(contents);
            }
        }
Пример #15
0
        public MyGuiScreenLoading(MyGuiScreenGamePlay screenToLoad, MyGuiScreenGamePlay screenToUnload, MyTexture2D textureFromConstructor)
            : base(Vector2.Zero, null, null)
        {
            MyLoadingPerformance.Instance.StartTiming();

            System.Diagnostics.Debug.Assert(Static == null);
            Static = this;

            m_screenToLoad         = screenToLoad;
            m_screenToUnload       = screenToUnload;
            m_closeOnEsc           = false;
            DrawMouseCursor        = false;
            m_loadInDrawFinished   = false;
            m_drawEvenWithoutFocus = true;
            m_currentQuoteOfTheDay = MyQuoteOfTheDay.GetRandomQuote();

            Vector2 loadingTextSize = MyGuiManager.GetNormalizedSize(MyGuiManager.GetFontMinerWarsBlue(),
                                                                     MyTextsWrapper.Get(MyTextsWrapperEnum.LoadingPleaseWait), MyGuiConstants.LOADING_PLEASE_WAIT_SCALE);

            m_rotatingWheelTexture = MyGuiManager.GetLoadingTexture();
            Controls.Add(new MyGuiControlRotatingWheel(this, MyGuiConstants.LOADING_PLEASE_WAIT_POSITION - new Vector2(0, 0.075f + loadingTextSize.Y),
                                                       MyGuiConstants.ROTATING_WHEEL_COLOR, MyGuiConstants.ROTATING_WHEEL_DEFAULT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, m_rotatingWheelTexture));
            m_backgroundTextureFromConstructor = textureFromConstructor;

            m_loadFinished = false;

            if (m_screenToLoad != null)
            {
                MyMinerGame.IsGameReady = false;
            }
        }
        private void AddHeaders()
        {
            int   rowIndex  = m_statsListbox.AddRow();
            var   textColor = new Color(0.9f, 0.9f, 0.9f, 1f);
            float textScale = 0.9f;

            m_statsListbox.AddItem(new MyGuiControlListboxItem(rowIndex * 4 + 0,
                                                               new MyColoredText(MyTextsWrapper.Get(MyTextsWrapperEnum.ScoreName), textColor, MyGuiManager.GetFontMinerWarsWhite(), textScale),
                                                               null, new MyToolTips(MyTextsWrapper.Get(MyTextsWrapperEnum.ScoreName))), rowIndex, 0);
            m_statsListbox.AddItem(new MyGuiControlListboxItem(rowIndex * 4 + 1,
                                                               new MyColoredText(MyTextsWrapper.Get(MyTextsWrapperEnum.ScoreKills), textColor, MyGuiManager.GetFontMinerWarsWhite(), textScale),
                                                               null, new MyToolTips(MyTextsWrapper.Get(MyTextsWrapperEnum.ScoreKills)))
            {
                BackgroundColor = Color.Red.ToVector4()
            }, rowIndex, 1);
            m_statsListbox.AddItem(new MyGuiControlListboxItem(rowIndex * 4 + 2,
                                                               new MyColoredText(MyTextsWrapper.Get(MyTextsWrapperEnum.ScoreDeaths), textColor, MyGuiManager.GetFontMinerWarsWhite(), textScale),
                                                               null, new MyToolTips(MyTextsWrapper.Get(MyTextsWrapperEnum.ScoreDeaths)))
            {
                BackgroundColor = Color.Red.ToVector4()
            }, rowIndex, 2);
            m_statsListbox.AddItem(new MyGuiControlListboxItem(rowIndex * 4 + 3,
                                                               new MyColoredText(MyTextsWrapper.Get(MyTextsWrapperEnum.ScorePing), textColor, MyGuiManager.GetFontMinerWarsWhite(), textScale),
                                                               null, new MyToolTips(MyTextsWrapper.Get(MyTextsWrapperEnum.ScorePing)))
            {
                BackgroundColor = Color.Red.ToVector4()
            }, rowIndex, 3);
        }
Пример #17
0
        void O10FindBombDealerLoaded(MyMissionBase sender)
        {
            m_manjeet.LookTarget = null;
            MyScriptWrapper.ApplyTransition(MyMusicTransitionEnum.Special, 1, "MM01");
            MyScriptWrapper.SetSleepDistance(m_marcus, 5000);
            MyScriptWrapper.StopFollow(m_marcus);
            m_marcus.SetWaypointPath("MarcusOut");
            m_marcus.SpeedModifier = 2.0f;
            MyScriptWrapper.AddNotification(MyScriptWrapper.CreateNotification(MyTextsWrapperEnum.MarcusIsLeavingForTarja, MyGuiManager.GetFontMinerWarsGreen(), 5000));
            m_marcus.PatrolMode = MyPatrolMode.ONE_WAY;
            m_marcus.Patrol();

            m_valentin = (MySmallShipBot)MyScriptWrapper.GetEntity("RavenGuy");
            m_valentin.LeaderLostEnabled = true;
            MyScriptWrapper.MarkEntity(m_valentin, MyTextsWrapper.Get(MyActorConstants.GetActorDisplayName(MyActorEnum.VALENTIN)).ToString(), HUD.MyHudIndicatorFlagsEnum.SHOW_DISTANCE | HUD.MyHudIndicatorFlagsEnum.SHOW_ONLY_IF_DETECTED_BY_RADAR | HUD.MyHudIndicatorFlagsEnum.SHOW_TEXT | HUD.MyHudIndicatorFlagsEnum.SHOW_BORDER_INDICATORS, HUD.MyGuitargetMode.Friend);
            MyScriptWrapper.StopFollow(m_valentin);
            MyEntity valentinPosition = MyScriptWrapper.GetEntity((uint)EntityID.ValentinBRPosition);

            m_valentin.SetWorldMatrix(valentinPosition.WorldMatrix);

            m_tarja.LeaderLostEnabled = true;
            MyScriptWrapper.StopFollow(m_tarja);
            MyScriptWrapper.MarkEntity(m_tarja, MyTextsWrapper.Get(MyActorConstants.GetActorDisplayName(MyActorEnum.TARJA)).ToString(), HUD.MyHudIndicatorFlagsEnum.SHOW_DISTANCE | HUD.MyHudIndicatorFlagsEnum.SHOW_ONLY_IF_DETECTED_BY_RADAR | HUD.MyHudIndicatorFlagsEnum.SHOW_TEXT | HUD.MyHudIndicatorFlagsEnum.SHOW_BORDER_INDICATORS, HUD.MyGuitargetMode.Friend);
            MyEntity tarjaPosition = MyScriptWrapper.GetEntity((uint)EntityID.TarjaBRPosition);

            m_tarja.SetWorldMatrix(tarjaPosition.WorldMatrix);
            MyScriptWrapper.SetEntityDisplayName(m_tarja, MyTextsWrapper.Get(MyTextsWrapperEnum.Actor_Tarja).ToString());

            MyScriptWrapper.UnhideEntity(MyScriptWrapper.GetEntity((uint)EntityID.BombDealer));
        }
Пример #18
0
        public void Init(string hudLabelText, MyMwcObjectBuilder_CargoBox objectBuilder, Matrix matrix)
        {
            Flags |= EntityFlags.EditableInEditor;

            StringBuilder hudLabelTextSb = (hudLabelText == null) ? MyTextsWrapper.Get(MyTextsWrapperEnum.CargoBox) : new StringBuilder(hudLabelText);

            // We want to make cargo box "lazy" to prevent rapid movement
            const float cargoBoxMass        = 5000.0f;
            const float cargoAngularDamping = 0.5f;

            var modelLod0Enum = GetModelLod0EnumFromType(objectBuilder.CargoBoxType);

            base.Init(hudLabelTextSb, modelLod0Enum, null, null, null, objectBuilder);
            base.InitBoxPhysics(MyMaterialType.METAL, ModelLod0, cargoBoxMass, cargoAngularDamping, MyConstants.COLLISION_LAYER_DEFAULT, RigidBodyFlag.RBF_RBO_STATIC);
            this.Physics.LinearDamping      = 0.7f;
            this.Physics.MaxLinearVelocity  = 350;
            this.Physics.MaxAngularVelocity = 5;

            m_inventoryTemplate = objectBuilder.Inventory;
            if (m_inventoryTemplate != null)
            {
                Inventory.Init(m_inventoryTemplate);
            }
            CargoBoxType = objectBuilder.CargoBoxType;

            SetWorldMatrix(matrix);

            Save = true;
            this.Physics.Enabled = true;
            UpdateState();
        }
Пример #19
0
        public static StringBuilder GetStringFromMyLightEffectTypeEnum(MyLightEffectTypeEnum t)
        {
            switch (t)
            {
            case MyLightEffectTypeEnum.NORMAL:
                return(MyTextsWrapper.Get(MyTextsWrapperEnum.Normal));

            case MyLightEffectTypeEnum.CONSTANT_FLASHING:
                return(MyTextsWrapper.Get(MyTextsWrapperEnum.ConstantFlashing));

            case MyLightEffectTypeEnum.RANDOM_FLASHING:
                return(MyTextsWrapper.Get(MyTextsWrapperEnum.RandomFlashing));

            case MyLightEffectTypeEnum.DISTANT_GLARE:
                return(MyTextsWrapper.Get(MyTextsWrapperEnum.DistantGlare));

            case MyLightEffectTypeEnum.DISTANT_GLARE_FLASHING:
                return(MyTextsWrapper.Get(MyTextsWrapperEnum.DistantGlareFlashing));

            case MyLightEffectTypeEnum.DISTANT_GLARE_RANDOM_FLASHING:
                return(MyTextsWrapper.Get(MyTextsWrapperEnum.DistantGlareRandomFlashing));

            default:
                throw new IndexOutOfRangeException();
            }
        }
Пример #20
0
        void AddCheat(MyGameplayCheat cheat)
        {
            bool             enabled = MyGuiScreenGamePlay.Static.CheatsEnabled() && cheat.IsImplemented;
            MyGuiControlBase control;

            if (cheat.IsButton)
            {
                if (!m_lastWasButton)
                {
                    m_currentPosition.Y += 0.005f * m_scale;
                }
                m_lastWasButton = true;
                control         = AddButton(MyTextsWrapper.Get(cheat.CheatName), onCheatButtonClick, textColor: Vector4.One, size: new Vector2(0.20f, 0.04f));
            }
            else
            {
                if (m_lastWasButton)
                {
                    m_currentPosition.Y += 0.005f * m_scale;
                }
                m_lastWasButton = false;
                control         = AddCheckBox(cheat.CheatName, MyGameplayCheats.IsCheatEnabled(cheat.CheatEnum), OnCheatCheckedChanged, enabled, color: Vector4.One);
            }

            control.UserData = cheat;

            control.Enabled = enabled;
        }
Пример #21
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MyGuiScreenDebugDeveloper"/> class.
        /// </summary>
        public MyGuiScreenCheats()
            : base(new Vector2(.5f, .5f), new Vector2(0.35f, 0.92f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, true)
        {
            AddCaption(MyTextsWrapperEnum.CheatsCaption, new Vector2(0f, 0.04f), captionScale: 1.35f);

            m_closeOnEsc     = true;
            m_checkBoxOffset = 0.015f;

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

            if (!MyGuiScreenGamePlay.Static.CheatsEnabled())
            {
                m_currentPosition.Y -= 0.025f;
                AddLabel(MyTextsWrapper.Get(MyTextsWrapperEnum.PurchaseCheats), Vector4.One, 0.725f, font: MyGuiManager.GetFontMinerWarsRed());
                m_currentPosition.Y -= 0.005f;
            }

            foreach (MyGameplayCheat cheat in MyGameplayCheats.AllCheats)
            {
                AddCheat(cheat);
            }

            m_currentPosition.Y += 0.01f;

            m_enableBackgroundFade = true;
            m_backgroundFadeColor  = new Vector4(0.0f, 0.0f, 0.0f, 0.5f);

            // resize for drawing
            m_size = new Vector2(0.425f, 0.92f);
        }
Пример #22
0
        protected void DrawGlobalVersionText()
        {
            //  Text "TEST BUILD"
            Color   colorBuildType          = new Color(230, 230, 230, 230) * m_transitionAlpha;
            Vector2 textRightBottomPosition = MyGuiManager.GetScreenTextRightBottomPosition();

            textRightBottomPosition.X -= 0.03f;
            textRightBottomPosition.Y -= 0.01f;
            Vector2 position = textRightBottomPosition;

            if (MyMwcFinalBuildConstants.IS_PUBLIC)
            {
                // There's no text for public
                //MyGuiManager.DrawString(MyGuiManager.GetFontMinerWarsBlue(), MyTextsWrapper.Get(MyTextsWrapperEnum.xxx),
                //      position, MyGuiConstants.APP_GLOBAL_TEXT_SCALE, new Color(MyGuiConstants.LABEL_TEXT_COLOR * m_transitionAlpha)/*colorBuildType*/, MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM);
            }
            else if (MyMwcFinalBuildConstants.IS_TEST)
            {
                MyGuiManager.DrawString(MyGuiManager.GetFontMinerWarsBlue(), MyTextsWrapper.Get(MyTextsWrapperEnum.TestBuild),
                                        position, MyGuiConstants.APP_GLOBAL_TEXT_SCALE, new Color(MyGuiConstants.LABEL_TEXT_COLOR * m_transitionAlpha), MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM);
            }
            else if (MyMwcFinalBuildConstants.IS_DEVELOP)
            {
                MyGuiManager.DrawString(MyGuiManager.GetFontMinerWarsBlue(), MyTextsWrapper.Get(MyTextsWrapperEnum.DevelopBuild),
                                        position, MyGuiConstants.APP_GLOBAL_TEXT_SCALE, new Color(MyGuiConstants.LABEL_TEXT_COLOR * m_transitionAlpha), MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM);
            }
            else
            {
                throw new SysUtils.Utils.MyMwcExceptionApplicationShouldNotGetHere();
            }
        }
Пример #23
0
        private void Init()
        {
            m_windowIsMovable      = false;
            m_enableBackgroundFade = true;
            m_size = new Vector2(0.45f, 0.875f);
            AddCaption(new Vector2(0, -0.005f));

            AddActivatedCheckbox(GetControlsOriginLeftFromScreenSize() + new Vector2(0.05f, 0.01f), PrefabSecurityControlHUB.Activated);
            m_activatedCheckbox.OnCheck = OnActivateClick;

            m_connectedPrefabIdsListbox = new MyGuiControlListbox(this, new Vector2(0, -0.02f), new Vector2(0.2f, 0.07f), MyGuiConstants.LISTBOX_BACKGROUND_COLOR,
                                                                  MyTextsWrapper.Get(MyTextsWrapperEnum.ConnectedPrefabIds), MyGuiConstants.LABEL_TEXT_SCALE, 1, 7, 1, false, true, false);
            foreach (IMyUseableEntity connectedEntity in PrefabSecurityControlHUB.ConnectedEntities)
            {
                MyEntity entity = connectedEntity as MyEntity;
                Debug.Assert(entity.EntityId != null);
                uint entityId = entity.EntityId.Value.NumericValue;
                m_connectedPrefabIdsListbox.AddItem((int)entityId, new StringBuilder(entityId.ToString()));
            }

            Controls.Add(m_connectedPrefabIdsListbox);

            Vector2 buttonPosition = m_connectedPrefabIdsListbox.GetPosition() +
                                     new Vector2(-m_connectedPrefabIdsListbox.GetSize().Value.X / 2f, m_connectedPrefabIdsListbox.GetSize().Value.Y / 2f) +
                                     new Vector2(-0.05f, 0.09f);

            Controls.Add(new MyGuiControlButton(this, buttonPosition, MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                                                MyTextsWrapperEnum.Add, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnAddClick,
                                                MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, true));
            buttonPosition += new Vector2(0.18f, 0f);
            Controls.Add(new MyGuiControlButton(this, buttonPosition, MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                                                MyTextsWrapperEnum.Delete, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnDeleteClick,
                                                MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, true));
        }
Пример #24
0
        public override string GetCorrectDisplayName()
        {
            string displayName = DisplayName;

            switch (m_cargoBoxType)
            {
            case MyMwcObjectBuilder_CargoBox_TypesEnum.Type7:
            case MyMwcObjectBuilder_CargoBox_TypesEnum.Type3:
                if (DisplayName == "Medikit")
                {
                    displayName = MyTextsWrapper.Get(MyTextsWrapperEnum.CargoBoxMedikit).ToString();
                }
                break;

            case MyMwcObjectBuilder_CargoBox_TypesEnum.Type8:
            case MyMwcObjectBuilder_CargoBox_TypesEnum.Type6:
                if (DisplayName == "Ammo")
                {
                    displayName = MyTextsWrapper.Get(MyTextsWrapperEnum.CargoBoxAmmo).ToString();
                }
                break;

            case MyMwcObjectBuilder_CargoBox_TypesEnum.TypeProp_A:
            case MyMwcObjectBuilder_CargoBox_TypesEnum.Type9:
                if (DisplayName == "Oxygen")
                {
                    displayName = MyTextsWrapper.Get(MyTextsWrapperEnum.CargoBoxOxygen).ToString();
                }
                break;

            case MyMwcObjectBuilder_CargoBox_TypesEnum.Type5:
            case MyMwcObjectBuilder_CargoBox_TypesEnum.Type11:
                if (DisplayName == "Fuel")
                {
                    displayName = MyTextsWrapper.Get(MyTextsWrapperEnum.CargoBoxFuel).ToString();
                }
                break;

            case MyMwcObjectBuilder_CargoBox_TypesEnum.Type2:
            case MyMwcObjectBuilder_CargoBox_TypesEnum.Type12:
                if (DisplayName == "Repair")
                {
                    displayName = MyTextsWrapper.Get(MyTextsWrapperEnum.CargoBoxRepair).ToString();
                }
                break;

            default:

                break;
            }

            if (DisplayName == "Health")
            {
                displayName = MyTextsWrapper.Get(MyTextsWrapperEnum.Health).ToString();
            }


            return(displayName);
        }
Пример #25
0
            public ControlWithDescription(MyGameControlEnums control1, MyGameControlEnums control2)
            {
                MyControl c1 = MyGuiManager.GetInput().GetGameControl(control1);
                MyControl c2 = MyGuiManager.GetInput().GetGameControl(control2);

                Control     = new StringBuilder().Append(c1.GetControlButtonStringBuilder(MyGuiInputDeviceEnum.Keyboard)).Append(", ").Append(c2.GetControlButtonStringBuilder(MyGuiInputDeviceEnum.Keyboard));
                Description = new StringBuilder().Append(MyTextsWrapper.Get(c1.GetControlName())).Append(" / ").Append(MyTextsWrapper.Get(c2.GetControlName()));
            }
Пример #26
0
 public MyGuiControlButton(IMyGuiControlsParent parent, Vector2 position, Vector2?size, Vector4 backgroundColor, MyTextsWrapperEnum textEnum,
                           Vector4 textColor, float textScale, OnButtonClick onButtonClick, MyGuiControlButtonTextAlignment textAlignment, bool canHandleKeyboardInput,
                           MyGuiDrawAlignEnum align, bool implementedFeature, MyTextsWrapperEnum?accessForbiddenReason)
     : this(parent, position, size, backgroundColor, MyTextsWrapper.Get(textEnum), null, textColor, textScale, onButtonClick, textAlignment,
            canHandleKeyboardInput, align, implementedFeature)
 {
     m_accessForbiddenReason           = accessForbiddenReason;
     m_canHandleKeyboardActiveControl &= m_accessForbiddenReason == null;
 }
        StringBuilder GetRecommendedAspectRatio(int adapterIndex)
        {
            MyAspectRatioEx recommendedAspectRatio = MyAspectRatioExList.Get(MyAspectRatioExList.GetWindowsDesktopClosestAspectRatio(adapterIndex));

            StringBuilder sb = new StringBuilder();

            sb.AppendFormat(MyTextsWrapper.Get(MyTextsWrapperEnum.RecommendedAspectRatio).ToString(), MyTextsWrapper.Get(recommendedAspectRatio.TextShort));
            return(sb);
        }
Пример #28
0
        //  This method realy initiates/starts the missile
        //  IMPORTANT: Direction vector must be normalized!
        public void Start(Vector3 position, Vector3 initialVelocity, Vector3 direction, float impulseMultiplier, MyEntity owner)
        {
            base.Start(position, initialVelocity, direction, 100, owner, MyTextsWrapper.Get(MyTextsWrapperEnum.EMPBombHud));

            if (!TimeToActivate.HasValue)
            {
                TimeToActivate = MySphereExplosiveConstants.TIME_TO_ACTIVATE;
            }
        }
Пример #29
0
        public override void Load()
        {
            if (!IsMainSector)
            {
                return;
            }

            m_detector_ReachStart = MyScriptWrapper.GetDetector(MyScriptWrapper.GetEntity((uint)EntityID.DetectorStartRacePosition));
            m_detector_Explosion1 = MyScriptWrapper.GetDetector(MyScriptWrapper.GetEntity((uint)EntityID.DetectorExplosion1));

            m_detector_Explosion2      = MyScriptWrapper.GetDetector(MyScriptWrapper.GetEntity((uint)EntityID.DetectorExplosion2));
            m_detector_Explosion3      = MyScriptWrapper.GetDetector(MyScriptWrapper.GetEntity((uint)EntityID.DetectorExplosion3));
            m_detector_TunnelExplosion = MyScriptWrapper.GetDetector(MyScriptWrapper.GetEntity((uint)EntityID.DetectorTunnelExplosion));

            m_marcus   = MyScriptWrapper.GetEntity(MyActorConstants.GetActorName(MyActorEnum.MARCUS));
            m_tarja    = MyScriptWrapper.GetEntity(MyActorConstants.GetActorName(MyActorEnum.TARJA));
            m_vitolino = MyScriptWrapper.GetEntity(MyActorConstants.GetActorName(MyActorEnum.VALENTIN));
            m_manjeet  = (MySmallShipBot)MyScriptWrapper.GetEntity((uint)EntityID.Manjeet);

            MyScriptWrapper.OnDialogueFinished     += Script_DialogueFinished;
            MyScriptWrapper.OnSpawnpointBotSpawned += Script_BotSpawned;

            ShutDownAllLights();

            foreach (var minesDummy in m_minesDummies)
            {
                MyScriptWrapper.GenerateMinesField <MyMineSmart>(MyScriptWrapper.GetEntity(minesDummy),
                                                                 MyMwcObjectBuilder_FactionEnum.Russian, 4,
                                                                 MyTextsWrapper.Get(MyTextsWrapperEnum.MineBasicHud).ToString(),
                                                                 MyHudIndicatorFlagsEnum.SHOW_BORDER_INDICATORS |
                                                                 MyHudIndicatorFlagsEnum.ALPHA_CORRECTION_BY_DISTANCE |
                                                                 MyHudIndicatorFlagsEnum.SHOW_TEXT |
                                                                 MyHudIndicatorFlagsEnum.SHOW_DISTANCE |
                                                                 MyHudIndicatorFlagsEnum.SHOW_FACTION_RELATION_MARKER |
                                                                 MyHudIndicatorFlagsEnum.SHOW_ONLY_IF_DETECTED_BY_RADAR);
            }

            m_playerIsOnStart      = false;
            m_challengerIsOnStart  = false;
            m_unfollowedCompanions = false;

            foreach (var item in m_raceTowers)
            {
                if (item != null)
                {
                    foreach (var item2 in item)
                    {
                        MyScriptWrapper.UnhideEntity(MyScriptWrapper.GetEntity(item2));
                    }
                }
            }

            MyScriptWrapper.UnhideEntity(MyScriptWrapper.GetEntity((uint)EntityID.Transporter));

            base.Load();
        }
Пример #30
0
        public void Start(Vector3 startPos, Vector3 goalPos, MyEntity goalEntity)
        {
            m_startPos   = startPos;
            m_goalPos    = goalPos;
            m_goalEntity = goalEntity;
            Path         = new List <Vector3>();
            Message      = MyTextsWrapper.Get(MyTextsWrapperEnum.GPSNoPath);

            goalEntity.OnClose += goalEntity_OnClose;
        }