コード例 #1
0
        private void RefreshTableFactions()
        {
            m_tableFactions.Clear();

            foreach (var entry in MySession.Static.Factions)
            {
                var faction = entry.Value;

                Color?color = null;
                MyGuiHighlightTexture?icon = null;
                String iconToolTip         = null;

                if (m_userFaction == null)
                {
                    color = COLOR_CUSTOM_RED;

                    if (faction.JoinRequests.ContainsKey(MySession.LocalPlayerId))
                    {
                        icon        = MyGuiConstants.TEXTURE_ICON_SENT_JOIN_REQUEST;
                        iconToolTip = MyTexts.GetString(MySpaceTexts.TerminalTab_Factions_SentJoinToolTip);
                    }
                }
                else
                {
                    if (m_userFaction.FactionId == faction.FactionId)
                    {
                        color = COLOR_CUSTOM_GREEN;
                    }
                    else if (MySession.Static.Factions.AreFactionsEnemies(m_userFaction.FactionId, faction.FactionId))
                    {
                        color = COLOR_CUSTOM_RED;
                    }

                    if (MySession.Static.Factions.IsPeaceRequestStateSent(m_userFaction.FactionId, faction.FactionId))
                    {
                        icon        = MyGuiConstants.TEXTURE_ICON_SENT_WHITE_FLAG;
                        iconToolTip = MyTexts.GetString(MySpaceTexts.TerminalTab_Factions_SentPeace);
                    }
                    else if (MySession.Static.Factions.IsPeaceRequestStatePending(m_userFaction.FactionId, faction.FactionId))
                    {
                        icon        = MyGuiConstants.TEXTURE_ICON_WHITE_FLAG;
                        iconToolTip = MyTexts.GetString(MySpaceTexts.TerminalTab_Factions_PendingPeace);
                    }
                }
                AddFaction(faction, color, icon, iconToolTip);
            }
            m_tableFactions.Sort(false);
        }
コード例 #2
0
 public Cell(StringBuilder text, object userData = null, String toolTip                     = null, Color?textColor = null,
             MyGuiHighlightTexture?icon          = null, MyGuiDrawAlignEnum iconOriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP)
 {
     if (text != null)
     {
         Text = new StringBuilder().AppendStringBuilder(text);
     }
     if (toolTip != null)
     {
         ToolTip = new MyToolTips(toolTip);
     }
     UserData        = userData;
     Icon            = icon;
     IconOriginAlign = iconOriginAlign;
     TextColor       = textColor;
 }
コード例 #3
0
        private void AddFaction(IMyFaction faction, Color?color = null, MyGuiHighlightTexture?icon = null, String iconToolTip = null)
        {
            System.Diagnostics.Debug.Assert(m_tableFactions != null);
            if (m_tableFactions == null)
            {
                return;
            }

            var row  = new MyGuiControlTable.Row(faction);
            var tag  = new StringBuilder(faction.Tag);
            var name = new StringBuilder(faction.Name);

            row.AddCell(new MyGuiControlTable.Cell(text: tag, userData: tag, textColor: color));
            row.AddCell(new MyGuiControlTable.Cell(text: name, userData: name, textColor: color, toolTip: faction.Name));
            row.AddCell(new MyGuiControlTable.Cell(text: new StringBuilder(), icon: icon, toolTip: iconToolTip));
            m_tableFactions.Add(row);
        }
コード例 #4
0
        private void AddMod(bool active, StringBuilder title, StringBuilder toolTip, StringBuilder modState, MyGuiHighlightTexture?icon, MyObjectBuilder_Checkpoint.ModItem mod, Color?textColor = null)
        {
            var row = new MyGuiControlTable.Row(mod);

            row.AddCell(new MyGuiControlTable.Cell(text: String.Empty, toolTip: modState.ToString(), icon: icon));
            row.AddCell(new MyGuiControlTable.Cell(text: title, toolTip: toolTip.ToString(), textColor: textColor));

            if (active)
            {
                m_modsTableEnabled.Insert(0, row);
            }
            else
            {
                m_modsTableDisabled.Insert(0, row);
            }
        }
コード例 #5
0
 public Cell(StringBuilder text, object userData = null, String toolTip = null, Color? textColor = null,
             MyGuiHighlightTexture? icon = null, MyGuiDrawAlignEnum iconOriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP)
 {
     if (text != null)
         Text = new StringBuilder().AppendStringBuilder(text);
     if (toolTip != null)
         ToolTip = new MyToolTips(toolTip);
     UserData = userData;
     Icon = icon;
     IconOriginAlign = iconOriginAlign;
     TextColor = textColor;
 }