示例#1
0
        void UpdateHUDStats()
        {
            bool hudStatsVisible = false;

            if (Program.Settings.DisplayUnitsHUDStats == HudStats.All)
            {
                hudStatsVisible = true;
            }
            else if (Program.Settings.DisplayUnitsHUDStats == HudStats.NPCs && !(this is Units.MainCharacter))
            {
                hudStatsVisible = true;
            }
            else if (Program.Settings.DisplayUnitsHUDStats == HudStats.MainCharacter && (this is Units.MainCharacter))
            {
                hudStatsVisible = true;
            }
            if (hudStatsVisible)
            {
                if (hudStats == null)
                {
                    hudStats = new Graphics.Interface.Label
                    {
                        Background = null,
                        Size       = new Vector2(300, 100),
                        Clickable  = false,
                        Overflow   = global::Graphics.TextOverflow.Ignore,
                    };
                    Game.Instance.Interface.IngameInterfaceContainer.AddChild(hudStats);
                }
                hudStats.Position =
                    Common.Math.ToVector2(Game.Instance.Scene.Camera.Project(AbsoluteTranslation, Scene.Viewport))
                    - new Vector2(hudStats.Size.X / 2, 0);
                StringBuilder s = new StringBuilder();
                GenerateHUDStatsText(s);
                hudStats.Text = s.ToString();
            }
            else
            {
                if (hudStats != null)
                {
                    hudStats.Remove();
                    hudStats = null;
                }
            }
        }
示例#2
0
 void UpdateHUDStats()
 {
     bool hudStatsVisible = false;
     if(Program.Settings.DisplayUnitsHUDStats == HudStats.All) hudStatsVisible = true;
     else if(Program.Settings.DisplayUnitsHUDStats == HudStats.NPCs && !(this is Units.MainCharacter))  hudStatsVisible = true;
     else if(Program.Settings.DisplayUnitsHUDStats == HudStats.MainCharacter && (this is Units.MainCharacter))  hudStatsVisible = true;
     if (hudStatsVisible)
     {
         if (hudStats == null)
         {
             hudStats = new Graphics.Interface.Label
             {
                 Background = null,
                 Size = new Vector2(300, 100),
                 Clickable = false,
                 Overflow = global::Graphics.TextOverflow.Ignore,
             };
             Game.Instance.Interface.IngameInterfaceContainer.AddChild(hudStats);
         }
         hudStats.Position =
             Common.Math.ToVector2(Game.Instance.Scene.Camera.Project(AbsoluteTranslation, Scene.Viewport))
             - new Vector2(hudStats.Size.X / 2, 0);
         StringBuilder s = new StringBuilder();
         GenerateHUDStatsText(s);
         hudStats.Text = s.ToString();
     }
     else
     {
         if (hudStats != null)
         {
             hudStats.Remove();
             hudStats = null;
         }
     }
 }