public override void LoadContent()
        {
            m_texture = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\BackgroundScreen\\PerformanceBackground", flags: TextureFlags.IgnoreQuality);

            float scale = 1.2f;

            m_warningText1 = new MyGuiControlMultilineText(
            this,
            new Vector2(0.245f, -0.09f),
            new Vector2(1.0f, 0.5f),
            Vector4.Zero,
            MyGuiManager.GetFontMinerWarsWhite(), scale,
            MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
            MyTextsWrapper.Get(MyTextsWrapperEnum.PerfWarning1_0), false, true);


            m_warningText2 = new MyGuiControlMultilineText(
            this,
            new Vector2(0.215f, -0.04f),
            new Vector2(1.0f, 0.5f),
            Vector4.Zero,
            MyGuiManager.GetFontMinerWarsWhite(), scale,
            MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
            new StringBuilder(), false, true);
            m_warningText2.AppendText(MyTextsWrapper.Get(MyTextsWrapperEnum.PerfWarning2_0), MyGuiManager.GetFontMinerWarsBlue(), scale, Vector4.One);



            m_warningText3 = new MyGuiControlMultilineText(
            this,
            new Vector2(0.225f, 0.12f),
            new Vector2(1.0f, 0.5f),
            Vector4.Zero,
            MyGuiManager.GetFontMinerWarsWhite(), scale,
            MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
            MyTextsWrapper.Get(MyTextsWrapperEnum.PerfWarning3_0), false, true);

            m_warningText4 = new MyGuiControlMultilineText(
            this,
            new Vector2(0.335f, 0.17f),
            new Vector2(1.0f, 0.5f),
            Vector4.Zero,
            MyGuiManager.GetFontMinerWarsWhite(), scale,
            MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
            MyTextsWrapper.Get(MyTextsWrapperEnum.PerfWarning4_0).Append(" "), false, true);
            m_warningText4.AppendText(MyTextsWrapper.Get(MyTextsWrapperEnum.PerfWarning4_1).Append(" "), MyGuiManager.GetFontMinerWarsBlue(), scale, Vector4.One);
            m_warningText4.AppendText(MyTextsWrapper.Get(MyTextsWrapperEnum.PerfWarning4_2).Append(": "), MyGuiManager.GetFontMinerWarsWhite(), scale, Vector4.One);
            m_warningText4.AppendText(new StringBuilder("VRAGE"), MyGuiManager.GetFontMinerWarsBlue(), scale, Vector4.One);



            m_warningText5 = new MyGuiControlMultilineText(
       this,
       new Vector2(0.26f, 0.33f),
       new Vector2(1.0f, 0.5f),
       Vector4.Zero,
       MyGuiManager.GetFontMinerWarsWhite(), scale,
       MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
       MyTextsWrapper.Get(MyTextsWrapperEnum.PerfWarning5_0), false, true);

            m_warningText6 = new MyGuiControlMultilineText(
          this,
          new Vector2(0.363f, 0.38f),
          new Vector2(1.0f, 0.5f),
          Vector4.Zero,
          MyGuiManager.GetFontMinerWarsWhite(), scale,
          MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
          MyTextsWrapper.Get(MyTextsWrapperEnum.PerfWarning6_0), false, true);



            m_button = new MyGuiControlButton(this,
                new Vector2(0, 0.3f),
                new Vector2(0.25f, 0.09f),
                new Vector4(0.8f, 0.8f, 0.8f, 1),
                new StringBuilder("I UNDERSTAND"),
                null,
                Vector4.One,
                1,
                OnButtonClick,
                MyGuiControlButtonTextAlignment.CENTERED,
                true,
                MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_TOP,
                true);

            Controls.Add(m_button);

            OnEnterCallback += delegate
            {
                CloseScreen();
            };

            base.LoadContent();
        }
        public MyGuiScreenMission(MyMission missionBase, bool canDecline = true)
            : base(new Vector2(0.5f, 0.5f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, new Vector2(0.75f, 0.75f))
        {
            Debug.Assert(missionBase != null);
            m_mission = missionBase;
            m_backgroundTexture = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\BackgroundScreen\\MissionAcceptBackground", flags: TextureFlags.IgnoreQuality);
            m_size = new Vector2(1010/1600f,855/1200f);

            // Title
            var titleLabel = new MyGuiControlLabel(
                            this,
                            new Vector2(0, -0.3052f),
                            null,
                            MyTextsWrapperEnum.Mission,
                            MyGuiConstants.LABEL_TEXT_COLOR,
                            MyGuiConstants.SCREEN_CAPTION_TEXT_SCALE,
                            MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);
            // append mission name to the title of the screen
            titleLabel.UpdateParams(new[] { missionBase.Name });
            Controls.Add(titleLabel);

            // mission description on the left
            Controls.Add(new MyGuiControlLabel(
                                this, 
                                new Vector2(-m_size.Value.X / 4.5f, -0.2501f),
                                null, MyTextsWrapperEnum.Description,
                                MyGuiConstants.LABEL_TEXT_COLOR, .8f,
                                MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER));



            var multiLineText = new MyGuiControlMultilineText(
                this,
                new Vector2(-m_size.Value.X/4.5f - 28/1600f, -0.0167f),
                new Vector2(370/1600f, 489/1200f),
                null,
                MyGuiManager.GetFontMinerWarsBlue(), .66f,
                MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                m_mission.DescriptionTemp, false, true);


            Controls.Add(multiLineText);
            multiLineText.ScrollbarOffset = 71/1600f;

  
            // mission objectives (submissions) on the right
            Controls.Add(new MyGuiControlLabel(
                                this,
                                new Vector2(m_size.Value.X / 4.5f, -0.2501f),
                                null, MyTextsWrapperEnum.Objectives,
                                MyGuiConstants.LABEL_TEXT_COLOR, .8f,
                                MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER));

            var objectives = new StringBuilder();
            foreach (MyObjective t in m_mission.Objectives)
            {

                    objectives.Append("- ");
                    objectives.Append(t.DescriptionTemp.ToString());
                    objectives.AppendLine("\n");
                    //objectives.AppendLine();
            }

            var textControl = new MyGuiControlMultilineText(
                this,
                new Vector2(m_size.Value.X/4.5f - 28/1600f, -0.0167f),
                new Vector2(370/1600f, 489/1200f),
                null,
                MyGuiManager.GetFontMinerWarsBlue(), .66f,
                MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                objectives, false, true) {ScrollbarOffset = 64/1600f};


            Controls.Add(textControl);

            textControl.Clear();
            textControl.AppendText(objectives);


            var okButton = new MyGuiControlButton(this, new Vector2(-0.1379f, 0.2489f), MyGuiConstants.OK_BUTTON_SIZE,
               MyGuiConstants.BUTTON_BACKGROUND_COLOR,
               MyGuiManager.GetInventoryScreenButtonTexture(), null, null, MyTextsWrapperEnum.Accept,
               MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnAccept_Click,
               true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true);
            Controls.Add(okButton);




            // decline button
            if (canDecline)
            {
                var declineButton = new MyGuiControlButton(this, new Vector2(0.1379f, 0.2489f), MyGuiConstants.OK_BUTTON_SIZE,
                   MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                   MyGuiManager.GetInventoryScreenButtonTexture(), null, null, MyTextsWrapperEnum.Decline,
                   MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnDecline_Click,
                   true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true);
                Controls.Add(declineButton);


            }
            else
            {
                m_closeOnEsc = canDecline;
            }
        }
示例#3
0
        public static void LoadContent(MyGuiScreenBase parent)
        {     
            MyMwcLog.WriteLine("MyHud.LoadContent() - START");
            MyMwcLog.IncreaseIndent();

            MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartProfilingBlock("MyHud::LoadContent");

            MyUtils.LoadTextureAtlas(MyEnumsToStrings.HudTextures, "Textures\\HUD\\", MyMinerGame.Static.RootDirectory + "\\Textures\\HUD\\HudAtlas.tai", out m_texture, out m_textureCoords);
            Debug.Assert(m_texture.LevelCount > 1, "HudAtlas does not have mip maps geneated");

            m_texts = new MyObjectsPoolSimple<MyHudText>(MyHudConstants.MAX_HUD_TEXTS_COUNT);
            m_vertices = new MyVertexFormatPositionTextureColor[MyHudConstants.MAX_HUD_QUADS_COUNT * MyHudConstants.VERTEXES_PER_HUD_QUAD];

            Vector2 size = new Vector2(0.4f, 0.25f);
            Vector2 origin = MyGuiManager.GetNormalizedCoordinateFromScreenCoordinate(new Vector2(MyMinerGame.ScreenSize.X, 0f))
                + new Vector2(-size.X / 2f, size.Y / 2f);
            m_missionDescriptions = new StringBuilder();
            new MyGuiControlMultilineText(parent, origin, size, MyGuiConstants.MULTILINE_LABEL_BACKGROUND_COLOR,
                                          MyGuiManager.GetFontMinerWarsWhite(), 0.6f, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, m_missionDescriptions);

            m_dialogueTextAreaControl = new MyGuiControlMultilineText(parent, MyHudConstants.DIALOGUE_TEXTAREA_POSITION, MyHudConstants.DIALOGUE_TEXTAREA_SIZE,
                Vector4.Zero, MyGuiManager.GetFontMinerWarsBlue(), MyHudConstants.DIALOGUE_TEXTAREA_FONT_SIZE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, new StringBuilder(), false, false);

            m_dialogueActorNameControl = new MyGuiControlMultilineText(parent, MyHudConstants.DIALOGUE_ACTORNAME_POSITION, MyHudConstants.DIALOGUE_ACTORNAME_SIZE,
                Vector4.Zero, MyGuiManager.GetFontMinerWarsBlue(), MyHudConstants.DIALOGUE_ACTORNAME_FONT_SIZE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, new StringBuilder(), false, false);


            for (int i = 0; i < DamageIndicators.Length; i++)
            {
                DamageIndicators[i].Used = false;
            }

            MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().EndProfilingBlock();
            MyMwcLog.DecreaseIndent();
            MyMwcLog.WriteLine("MyHud.LoadContent() - END");       
        }
示例#4
0
        public static void UnloadContent()
        {
            MyMwcLog.WriteLine("MyHud.UnloadContent - START");
            MyMwcLog.IncreaseIndent();

            if (m_missionDescriptions != null)
            {
                m_missionDescriptions.Clear();
                m_missionDescriptions = null;
            }

            m_dialogueTextAreaControl = null;
            m_lastDialogueSentence = null;

            MyMwcLog.DecreaseIndent();
            MyMwcLog.WriteLine("MyHud.UnloadContent - END");
        }        
        public override void LoadContent()
        {
            m_texture = MyTextureManager.GetTexture <MyTexture2D>("Textures\\GUI\\BackgroundScreen\\PerformanceBackground", flags: TextureFlags.IgnoreQuality);

            float scale = 1.2f;

            m_warningText1 = new MyGuiControlMultilineText(
                this,
                new Vector2(0.245f, -0.09f),
                new Vector2(1.0f, 0.5f),
                Vector4.Zero,
                MyGuiManager.GetFontMinerWarsWhite(), scale,
                MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                MyTextsWrapper.Get(MyTextsWrapperEnum.PerfWarning1_0), false, true);


            m_warningText2 = new MyGuiControlMultilineText(
                this,
                new Vector2(0.215f, -0.04f),
                new Vector2(1.0f, 0.5f),
                Vector4.Zero,
                MyGuiManager.GetFontMinerWarsWhite(), scale,
                MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                new StringBuilder(), false, true);
            m_warningText2.AppendText(MyTextsWrapper.Get(MyTextsWrapperEnum.PerfWarning2_0), MyGuiManager.GetFontMinerWarsBlue(), scale, Vector4.One);



            m_warningText3 = new MyGuiControlMultilineText(
                this,
                new Vector2(0.225f, 0.12f),
                new Vector2(1.0f, 0.5f),
                Vector4.Zero,
                MyGuiManager.GetFontMinerWarsWhite(), scale,
                MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                MyTextsWrapper.Get(MyTextsWrapperEnum.PerfWarning3_0), false, true);

            m_warningText4 = new MyGuiControlMultilineText(
                this,
                new Vector2(0.335f, 0.17f),
                new Vector2(1.0f, 0.5f),
                Vector4.Zero,
                MyGuiManager.GetFontMinerWarsWhite(), scale,
                MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                MyTextsWrapper.Get(MyTextsWrapperEnum.PerfWarning4_0).Append(" "), false, true);
            m_warningText4.AppendText(MyTextsWrapper.Get(MyTextsWrapperEnum.PerfWarning4_1).Append(" "), MyGuiManager.GetFontMinerWarsBlue(), scale, Vector4.One);
            m_warningText4.AppendText(MyTextsWrapper.Get(MyTextsWrapperEnum.PerfWarning4_2).Append(": "), MyGuiManager.GetFontMinerWarsWhite(), scale, Vector4.One);
            m_warningText4.AppendText(new StringBuilder("VRAGE"), MyGuiManager.GetFontMinerWarsBlue(), scale, Vector4.One);



            m_warningText5 = new MyGuiControlMultilineText(
                this,
                new Vector2(0.26f, 0.33f),
                new Vector2(1.0f, 0.5f),
                Vector4.Zero,
                MyGuiManager.GetFontMinerWarsWhite(), scale,
                MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                MyTextsWrapper.Get(MyTextsWrapperEnum.PerfWarning5_0), false, true);

            m_warningText6 = new MyGuiControlMultilineText(
                this,
                new Vector2(0.363f, 0.38f),
                new Vector2(1.0f, 0.5f),
                Vector4.Zero,
                MyGuiManager.GetFontMinerWarsWhite(), scale,
                MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                MyTextsWrapper.Get(MyTextsWrapperEnum.PerfWarning6_0), false, true);



            m_button = new MyGuiControlButton(this,
                                              new Vector2(0, 0.3f),
                                              new Vector2(0.25f, 0.09f),
                                              new Vector4(0.8f, 0.8f, 0.8f, 1),
                                              new StringBuilder("I UNDERSTAND"),
                                              null,
                                              Vector4.One,
                                              1,
                                              OnButtonClick,
                                              MyGuiControlButtonTextAlignment.CENTERED,
                                              true,
                                              MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_TOP,
                                              true);

            Controls.Add(m_button);

            OnEnterCallback += delegate
            {
                CloseScreen();
            };

            base.LoadContent();
        }