當前位置: 首頁>>代碼示例>>C#>>正文


C# MyGuiControlMultilineText.AppendText方法代碼示例

本文整理匯總了C#中Sandbox.Graphics.GUI.MyGuiControlMultilineText.AppendText方法的典型用法代碼示例。如果您正苦於以下問題:C# MyGuiControlMultilineText.AppendText方法的具體用法?C# MyGuiControlMultilineText.AppendText怎麽用?C# MyGuiControlMultilineText.AppendText使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Sandbox.Graphics.GUI.MyGuiControlMultilineText的用法示例。


在下文中一共展示了MyGuiControlMultilineText.AppendText方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: ParseText

 //implementation without RegularExpressions
 public static void ParseText(string text, ref MyGuiControlMultilineText label)
 {
     try
     {
         var substrings = text.Split(']');
         foreach (var substring in substrings)
         {
             var textAndMarkup = substring.Split('[');
             if (textAndMarkup.Length == 2)
             {
                 label.AppendText(textAndMarkup[0]);
                 var indexOfSpace = textAndMarkup[1].IndexOf(' ');
                 if (indexOfSpace != -1) 
                 {
                     label.AppendLink(textAndMarkup[1].Substring(0, indexOfSpace), textAndMarkup[1].Substring(indexOfSpace + 1));
                 }
                 else
                 {
                     System.Diagnostics.Debug.Assert(false);
                     label.AppendText(textAndMarkup[1]);
                 }
             } else {
                 label.AppendText(substring);
             }
         }
     }
     catch
     {
     }
 }
開發者ID:2asoft,項目名稱:SpaceEngineers,代碼行數:31,代碼來源:MyWikiMarkupParser.cs

示例2: Draw

        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;
                }
            }
        }
開發者ID:ChristianHeinz71,項目名稱:SpaceEngineers,代碼行數:23,代碼來源:MyHudCameraInfo.cs

示例3: ParseText

 public static void ParseText(string text, ref MyGuiControlMultilineText label)
 {
     try
     {
         var texts = m_splitRegex.Split(text);
         var matches = m_splitRegex.Matches(text);
         for (int i = 0; i < matches.Count || i < texts.Count(); i++)
         {
             if (i < texts.Count())
                 label.AppendText(m_stringCache.Clear().Append(texts[i]));
             if (i < matches.Count)
                 ParseMarkup(label, matches[i].Value);
         }
     }
     catch
     {
     }
 }
開發者ID:fluxit,項目名稱:SpaceEngineers,代碼行數:18,代碼來源:MyWikiMarkupParser.cs

示例4: ComputeLineDataFromString

 private MultilineData ComputeLineDataFromString(string value)
 {
     MultilineData ret;
     ret.data = value;
     
     MyGuiControlMultilineText textBox = new MyGuiControlMultilineText(size: new Vector2(QuestlogSize.X * 0.92f, 1), drawScrollbar: false);
     textBox.Visible = false;
     textBox.TextScale = 0.9f;
     textBox.AppendText(value);
     
     ret.lines = textBox.NumberOfRows;
     return ret;
 }
開發者ID:2asoft,項目名稱:SpaceEngineers,代碼行數:13,代碼來源:MyHudQuestlog.cs

示例5: GenerateSizeNotAvailableText

 /// <summary>
 /// Generates multiline text control indicating that block is not available.
 /// </summary>
 /// <param name="blockSizeLarge">Is block size large.</param>
 /// <returns>Multiline text control with block not available info.</returns>
 private MyGuiControlMultilineText GenerateSizeNotAvailableText(bool blockSizeLarge)
 {
     MyGuiControlMultilineText textControl = new MyGuiControlMultilineText(size: new Vector2(0.2f, 0.1f), font: MyFontEnum.Red, showTextShadow: true, textAlign: MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);
     string blockTypeLabelText = MyTexts.GetString(!blockSizeLarge ? MySpaceTexts.HudBlockInfo_LargeShip_Station : MySpaceTexts.HudBlockInfo_SmallShip);
     textControl.AppendText(string.Format(MyTexts.GetString(MySpaceTexts.BlockSize_NotAvailable), blockTypeLabelText));
     return textControl;
 }
開發者ID:2asoft,項目名稱:SpaceEngineers,代碼行數:12,代碼來源:MyGuiScreenCubeBuilder.cs

示例6: RecreateControls

        public void RecreateControls()
        {
            if (QuestInfo == null || Elements == null)
                return;
            Elements.Clear();

            Vector2 topleft = -this.Size / 2;
            Vector2 textOffset = new Vector2(0.015f, 0.015f);

            // Title
            MyGuiControlLabel title = new MyGuiControlLabel();
            title.Text = QuestInfo.QuestTitle;
            title.Position = topleft + textOffset;
            title.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
            title.Visible = true;
            Elements.Add(title);

            // Pages
            if (QuestInfo.MaxPages != 0)
            {
                MyGuiControlLabel numbers = new MyGuiControlLabel();
                numbers.Text = QuestInfo.Page + "/" + QuestInfo.MaxPages;
                numbers.Position = topleft + Vector2.UnitX * this.Size - textOffset * new Vector2(1, -1);
                numbers.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP;
                Elements.Add(numbers);
            }

            // Separator
            MyGuiControlSeparatorList m_separator;
            m_separator = new MyGuiControlSeparatorList();
            m_separator.AddHorizontal(topleft + textOffset + new Vector2(0, 0.03f), this.Size.X - 2 * textOffset.X, 0.003f); // Title separator
            m_separator.Visible = true;
            Elements.Add(m_separator);

            // Details
            var rowOffset = new Vector2(0, 0.025f);
            string[] details = QuestInfo.GetQuestGetails();
            int idx = 0;
            for (int i = 0; i < details.Length; i++)
            {
                if (details[i] == null)
                    continue;
                MyGuiControlMultilineText textBox = new MyGuiControlMultilineText(
                    size: new Vector2(Size.X * 0.92f, rowOffset.Y * 5),
                    position: topleft + textOffset + new Vector2(0, 0.04f) + rowOffset * idx,
                    textAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                    textBoxAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                    //Debug purpose
                    //backgroundColor: Vector4.One,
                    //backgroundTexture: BackgroundTexture,
                    drawScrollbar: false
                    );
                textBox.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
                textBox.TextScale = 0.9f;
                textBox.AppendText(details[i]);
                textBox.Visible = true;
                idx += textBox.NumberOfRows;
                Elements.Add(textBox);
            }
        }
開發者ID:2asoft,項目名稱:SpaceEngineers,代碼行數:60,代碼來源:MyGuiControlQuestlog.cs


注:本文中的Sandbox.Graphics.GUI.MyGuiControlMultilineText.AppendText方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。