public float GetValue(RecordDef def)
        {
            float num = records[def];

            if (def.type == RecordType.Int || def.type == RecordType.Time)
            {
                return(Mathf.Round(num));
            }
            return(num);
        }
Beispiel #2
0
 public void Increment(RecordDef def)
 {
     if (def.type != RecordType.Int)
     {
         Log.Error("Tried to increment record \"" + def.defName + "\" whose record type is \"" + def.type + "\".");
     }
     else
     {
         records[def] = Mathf.Round(records[def] + 1f);
     }
 }
Beispiel #3
0
 public void AddTo(RecordDef def, float value)
 {
     if (def.type == RecordType.Int)
     {
         records[def] = Mathf.Round(records[def] + Mathf.Round(value));
         return;
     }
     if (def.type == RecordType.Float)
     {
         records[def] += value;
         return;
     }
     Log.Error(string.Concat("Tried to add value to record \"", def.defName, "\" whose record type is \"", def.type, "\"."));
 }
        public float GetValue(RecordDef def)
        {
            float num = this.records[def];
            float result;

            if (def.type == RecordType.Int || def.type == RecordType.Time)
            {
                result = Mathf.Round(num);
            }
            else
            {
                result = num;
            }
            return(result);
        }
 public void AddTo(RecordDef def, float value)
 {
     if (def.type == RecordType.Int)
     {
         records[def] = Mathf.Round(records[def] + Mathf.Round(value));
     }
     else if (def.type == RecordType.Float)
     {
         records[def] += value;
     }
     else
     {
         Log.Error("Tried to add value to record \"" + def.defName + "\" whose record type is \"" + def.type + "\".");
     }
 }
 public void Increment(RecordDef def)
 {
     if (def.type != RecordType.Int)
     {
         Log.Error(string.Concat(new object[]
         {
             "Tried to increment record \"",
             def.defName,
             "\" whose record type is \"",
             def.type,
             "\"."
         }));
         return;
     }
     this.records[def] = Mathf.Round(this.records[def] + 1f);
 }
 public void AddTo(RecordDef def, float value)
 {
     if (def.type == RecordType.Int)
     {
         this.records[def] = Mathf.Round(this.records[def] + Mathf.Round(value));
     }
     else if (def.type == RecordType.Float)
     {
         DefMap <RecordDef, float> defMap;
         RecordDef def2;
         (defMap = this.records)[def2 = def] = defMap[def2] + value;
     }
     else
     {
         Log.Error("Tried to add value to record \"" + def.defName + "\" whose record type is \"" + def.type + "\".");
     }
 }
Beispiel #8
0
        private static float DrawRecord(float x, float y, float width, RecordDef record, Pawn pawn)
        {
            float  num  = width * 0.45f;
            string text = (record.type != 0) ? pawn.records.GetValue(record).ToString("0.##") : pawn.records.GetAsInt(record).ToStringTicksToPeriod();
            Rect   rect = new Rect(8f, y, width, Text.CalcHeight(text, num));

            if (Mouse.IsOver(rect))
            {
                Widgets.DrawHighlight(rect);
            }
            Rect rect2 = rect;

            rect2.width -= num;
            Widgets.Label(rect2, record.LabelCap);
            Rect rect3 = rect;

            rect3.x     = rect2.xMax;
            rect3.width = num;
            Widgets.Label(rect3, text);
            TooltipHandler.TipRegion(rect, new TipSignal(() => record.description, record.GetHashCode()));
            return(rect.height);
        }
 public void AddTo(RecordDef def, float value)
 {
     if (def.type == RecordType.Int)
     {
         this.records[def] = Mathf.Round(this.records[def] + Mathf.Round(value));
     }
     else if (def.type == RecordType.Float)
     {
         DefMap <RecordDef, float> defMap;
         (defMap = this.records)[def] = defMap[def] + value;
     }
     else
     {
         Log.Error(string.Concat(new object[]
         {
             "Tried to add value to record \"",
             def.defName,
             "\" whose record type is \"",
             def.type,
             "\"."
         }), false);
     }
 }
 public int GetAsInt(RecordDef def)
 {
     return(Mathf.RoundToInt(this.records[def]));
 }