Exemplo n.º 1
0
        public static string ToId(this HudTarget self)
        {
            if (self == HudTarget.All)
            {
                return(null);
            }

            var value = "";

            if (self.HasTarget(HudTarget.PlayerColonist))
            {
                value += HudTarget.PlayerColonist.GetId();
            }
            if (self.HasTarget(HudTarget.PlayerAnimal))
            {
                value += HudTarget.PlayerAnimal.GetId();
            }
            if (self.HasTarget(HudTarget.OtherColonist))
            {
                value += HudTarget.OtherColonist.GetId();
            }
            if (self.HasTarget(HudTarget.OtherAnimal))
            {
                value += HudTarget.OtherAnimal.GetId();
            }

            return(value.Length > 0 ? value : null);
        }
Exemplo n.º 2
0
        public static string GetId(this HudTarget self)
        {
            if (self == HudTarget.PlayerColonist)
            {
                return("C");
            }
            if (self == HudTarget.PlayerAnimal)
            {
                return("N");
            }
            if (self == HudTarget.OtherColonist)
            {
                return("c");
            }
            if (self == HudTarget.OtherAnimal)
            {
                return("n");
            }
            if (self == HudTarget.All)
            {
                return(null);
            }

            throw new Mod.Exception("Invalid HUD target type");
        }
Exemplo n.º 3
0
        public static string ToId(this HudTarget self)
        {
            if (self == HudTarget.All)
            {
                return(null);
            }

            var value = "";

            if (self.HasTarget(HudTarget.PlayerHumanlike))
            {
                value += HudTarget.PlayerHumanlike.GetId();
            }
            if (self.HasTarget(HudTarget.PlayerCreature))
            {
                value += HudTarget.PlayerCreature.GetId();
            }
            if (self.HasTarget(HudTarget.OtherHumanlike))
            {
                value += HudTarget.OtherHumanlike.GetId();
            }
            if (self.HasTarget(HudTarget.OtherCreature))
            {
                value += HudTarget.OtherCreature.GetId();
            }

            return(value.Length > 0 ? value : null);
        }
Exemplo n.º 4
0
        public static string GetId(this HudTarget self)
        {
            if (self == HudTarget.PlayerHumanlike)
            {
                return("H");
            }
            if (self == HudTarget.PlayerCreature)
            {
                return("C");
            }
            if (self == HudTarget.OtherHumanlike)
            {
                return("h");
            }
            if (self == HudTarget.OtherCreature)
            {
                return("c");
            }
            if (self == HudTarget.All)
            {
                return(null);
            }

            throw new Mod.Exception("Invalid HUD target type");
        }
Exemplo n.º 5
0
        private HudElement(string elementType, string defName, HudTarget targets)
        {
            _elementType = elementType;
            DefName      = defName;
            Targets      = targets;

            HudTimings.Add(this);
        }
Exemplo n.º 6
0
        public HudPanel(XElement xe, bool?fillHeight)
        {
            Targets = TargetsFromXml(xe);

            var rows = new List <HudRow>();

            foreach (var element in xe.Elements())
            {
                if (element.Name != HudRow.Name)
                {
                    Mod.Error($"Invalid HUD container element '{element.Name}' instead of '{HudRow.Name}'");
                    continue;
                }

                rows.Add(new HudRow(element));
            }

            FillHeight = fillHeight ?? false;

            _rows = rows.ToArray();
        }
Exemplo n.º 7
0
 public HudRow(XElement xe)
 {
     Targets   = TargetsFromXml(xe);
     _elements = xe.Elements().Select(HudElement.FromXml).Where(element => element != null).ToArray();
 }
Exemplo n.º 8
0
        public static bool HasTarget(this HudTarget self, HudTarget target)
        {
            var targettedInt = (int)target;

            return(((int)self & targettedInt) == targettedInt);
        }
Exemplo n.º 9
0
 private HudElement(string type, string defName, HudTarget target)
 {
     _type    = type;
     _defName = defName;
     Targets  = target;
 }
Exemplo n.º 10
0
 private HudElement(string elementType, string defName, HudTarget targets)
 {
     _elementType = elementType;
     DefName      = defName;
     Targets      = targets;
 }