protected void RefreshTextField()
        {
            if (m_textField == null)
            {
                return;
            }
            var displayName = m_blueprintName;

            if (displayName.Length > 25)
            {
                displayName = displayName.Substring(0, 25) + "...";
            }
            m_textField.Clear();
            m_textField.AppendText("Name: " + displayName);
            m_textField.AppendLine();

            var type = m_loadedPrefab.ShipBlueprints[0].CubeGrids[0].GridSizeEnum.ToString();

            if (m_loadedPrefab.ShipBlueprints[0].CubeGrids[0].IsStatic && type == "Large")
            {
                m_textField.AppendText("Type: " + "Station");
            }
            else
            {
                m_textField.AppendText("Type: " + type + " Ship");
            }

            m_textField.AppendLine();
            m_textField.AppendText("Number of blocks: " + GetNumberOfBlocks());
            m_textField.AppendLine();
            m_textField.AppendText("Author: " + m_loadedPrefab.ShipBlueprints[0].DisplayName);
            m_textField.AppendLine();
        }
Example #2
0
        public override bool Draw()
        {
            Havok.HkBaseSystem.GetMemoryStatistics(m_buffer);
            m_havokStatsMultiline.Clear();
            m_havokStatsMultiline.AppendText(m_buffer);
            m_buffer.Clear();

            return(base.Draw());
        }
 protected void RefreshDescriptionField()
 {
     if (m_descriptionField == null)
     {
         return;
     }
     m_descriptionField.Clear();
     if (m_selectedItem.Description != null)
     {
         m_descriptionField.AppendText(m_selectedItem.Description);
     }
 }
        protected void RefreshTextField()
        {
            if (m_textField == null)
            {
                return;
            }
            var displayName = m_blueprintName;

            if (displayName.Length > 25)
            {
                displayName = displayName.Substring(0, 25) + "...";
            }
            m_textField.Clear();
            m_textField.AppendText("Name: " + displayName);//zxc translate
            m_textField.AppendLine();

            MyCubeSize type = m_loadedPrefab.ShipBlueprints[0].CubeGrids[0].GridSizeEnum;

            m_textField.AppendText(MyTexts.GetString(MyCommonTexts.BlockPropertiesText_Type));
            if (m_loadedPrefab.ShipBlueprints[0].CubeGrids[0].IsStatic && type == MyCubeSize.Large)
            {
                m_textField.AppendText(MyTexts.GetString(MyCommonTexts.DetailStaticGrid));
            }
            else
            {
                if (type == MyCubeSize.Small)
                {
                    m_textField.AppendText(MyTexts.GetString(MyCommonTexts.DetailSmallGrid));
                }
                else
                {
                    m_textField.AppendText(MyTexts.GetString(MyCommonTexts.DetailLargeGrid));
                }
            }

            m_textField.AppendLine();
            m_textField.AppendText("Number of blocks: " + GetNumberOfBlocks());//zxc translate
            m_textField.AppendLine();

            if (MyFakes.ENABLE_BATTLE_SYSTEM)
            {
                int battlePoints = GetNumberOfBattlePoints();
                if (battlePoints != 0)
                {
                    m_textField.AppendText("Castle siege points: " + battlePoints);//zxc translate
                    m_textField.AppendLine();
                }
            }

            m_textField.AppendText("Author: " + m_loadedPrefab.ShipBlueprints[0].DisplayName);//zxc translate
            m_textField.AppendLine();
        }
        private void RefreshPlayerChatHistory(MyIdentity playerIdentity)
        {
            m_chatHistory.Clear();
            var history = MyChatSystem.GetChatHistory(MySession.Static.LocalPlayerId);

            var playerId = playerIdentity.IdentityId;
            MyPlayerChatHistory playerChat;

            if (history.PlayerChatHistory.TryGetValue(playerId, out playerChat))
            {
                var chat = playerChat.Chat;
                foreach (var text in chat)
                {
                    var identity = MySession.Static.Players.TryGetIdentity(text.IdentityId);

                    if (identity == null)
                    {
                        continue;
                    }
                    bool isPlayer = identity.IdentityId == MySession.Static.LocalPlayerId;

                    m_chatHistory.AppendText(identity.DisplayName, isPlayer ? MyFontEnum.DarkBlue : MyFontEnum.Blue, m_chatHistory.TextScale, Vector4.One);
                    if (!text.Sent)
                    {
                        m_tempStringBuilder.Clear();
                        m_tempStringBuilder.Append(" (");
                        m_tempStringBuilder.Append(MyTexts.GetString(MySpaceTexts.TerminalTab_Chat_Pending));
                        m_tempStringBuilder.Append(")");
                        m_chatHistory.AppendText(m_tempStringBuilder, MyFontEnum.Red, m_chatHistory.TextScale, Vector4.One);
                    }
                    m_chatHistory.AppendText(": ", isPlayer ? MyFontEnum.DarkBlue : MyFontEnum.Blue, m_chatHistory.TextScale, Vector4.One);
                    m_chatHistory.AppendText(text.Text, MyFontEnum.White, m_chatHistory.TextScale, Vector4.One);
                    m_chatHistory.AppendLine();
                }
            }

            m_factionList.SelectedItems.Clear();
            m_chatHistory.ScrollbarOffset = 1.0f;
        }
Example #6
0
        protected void RefreshDescriptionField()
        {
            if (m_descriptionField == null)
            {
                return;
            }
            m_descriptionField.Clear();
            var description = m_loadedPrefab.ShipBlueprints[0].Description;

            if (description != null)
            {
                m_descriptionField.AppendText(description);
            }
        }
        public void Draw(MyGuiControlMultilineText control)
        {
            if (Visible)
            {
                if (IsDirty)
                {
                    control.Clear();
                    control.AppendText(CameraName);
                    control.AppendLine();
                    control.AppendText(ShipName);

                    IsDirty = false;
                }
            }
            else
            {
                if (IsDirty)
                {
                    control.Clear();
                    IsDirty = false;
                }
            }
        }
        protected void RefreshTextField()
        {
            if (m_textField == null)
            {
                return;
            }
            var displayName = m_selectedItem.ScriptName;

            if (displayName.Length > 25)
            {
                displayName = displayName.Substring(0, 25) + "...";
            }
            m_textField.Clear();
            m_textField.AppendText("Name: " + displayName);
            m_textField.AppendLine();

            m_textField.AppendText("Type: IngameScript");
        }
 private void RefreshShownEntry()
 {
     m_textNewsEntry.Clear();
     if (m_news.IsValidIndex(m_currentEntryIndex))
     {
         var entry = m_news[m_currentEntryIndex];
         m_labelTitle.Text = entry.Title;
         m_labelDate.Text  = entry.Date;
         MyWikiMarkupParser.ParseText(entry.Text, ref m_textNewsEntry);
         //We need append some empty space because of pages label overlap
         m_textNewsEntry.AppendLine();
         m_labelPages.UpdateFormatParams(m_currentEntryIndex + 1, m_news.Count);
     }
     else
     {
         m_labelTitle.Text = null;
         m_labelDate.Text  = null;
         m_labelPages.UpdateFormatParams(0, 0);
     }
 }
Example #10
0
        public void UpdateChat(MyHudChat chat)
        {
            if (MyHud.Chat.Dirty)
            {
                m_chatMultilineControl.Clear();

                foreach (var message in MyHud.Chat.MessagesQueue)
                {
                    bool isMe = Sandbox.Engine.Networking.MySteam.UserName == message.Item1;

                    m_chatMultilineControl.AppendText(new StringBuilder(message.Item1), isMe ? MyFontEnum.Blue : MyFontEnum.White, m_chatMultilineControl.TextScale, Vector4.One);
                    m_chatMultilineControl.AppendText(new StringBuilder(": "));
                    m_chatMultilineControl.AppendText(new StringBuilder(message.Item2));
                    m_chatMultilineControl.AppendLine();
                }

                MyHud.Chat.Dirty = false;
            }
            //m_chatMultilineControl.BackgroundTexture
        }
Example #11
0
        public virtual void GetDescriptionText(MyGuiControlMultilineText textbox)
        {
            textbox.Visible = true;
            textbox.Clear();
            if (string.IsNullOrEmpty(Description))
            {
                if (string.IsNullOrEmpty(Tooltip))
                {
                    textbox.AppendText("No description");
                }
                else
                {
                    textbox.AppendText(CapLength(Tooltip, 1000));
                }
                return;
            }
            else
            {
                string text      = CapLength(Description, 1000);
                int    textStart = 0;
                foreach (Match m in Regex.Matches(text, @"https?:\/\/(www\.)?[\w-.]{2,256}\.[a-z]{2,4}\b[\w-.@:%\+~#?&//=]*"))
                {
                    int textLen = m.Index - textStart;
                    if (textLen > 0)
                    {
                        textbox.AppendText(text.Substring(textStart, textLen));
                    }

                    textbox.AppendLink(m.Value, m.Value);
                    textStart = m.Index + m.Length;
                }

                if (textStart < text.Length)
                {
                    textbox.AppendText(text.Substring(textStart));
                }
            }
        }
Example #12
0
 public override void GetDescriptionText(MyGuiControlMultilineText textbox)
 {
     textbox.Visible = false;
     textbox.Clear();
 }
 public void SetDescription(string desc)
 {
     m_description = desc;
     m_descriptionBox.Clear();
     m_descriptionBox.Text = new StringBuilder(m_description);
 }
        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;
            }
        }