コード例 #1
0
        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();
        }
コード例 #2
0
        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();
        }
コード例 #3
0
        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;
        }
コード例 #4
0
        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");
        }
コード例 #5
0
 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);
     }
 }
コード例 #6
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
        }
コード例 #7
0
        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;
                }
            }
        }