public void ExposeData()
        {
            string             label     = this.Label;
            object             value     = this.Value;
            Def                def       = this.Def;
            List <object>      values    = this.Values;
            ColonistHistoryDef parent    = this.Parent;
            Type               valueType = this.ValueType;
            Type               defType   = this.DefType;

            Scribe_Values.Look <Type>(ref valueType, "valueType");
            Scribe_Values.Look <Type>(ref defType, "defType");
            Scribe_Values.Look <string>(ref label, "label");
            Scribe_Defs.Look <ColonistHistoryDef>(ref parent, "parent");
            Utils.ScribeObjectValue(ref value, "value", valueType);
            Utils.ScribeObjectsValue(ref values, "values", valueType);
            Scribe_Values.Look <bool>(ref isNull, "isNull", false);
            Scribe_Values.Look <bool>(ref isUnrecorded, "isUnrecorded", false);

            if (defType != null)
            {
                Utils.ScribeDefValue(ref def, "def", defType, true);
            }

            this.Label     = label;
            this.Value     = value;
            this.Values    = values;
            this.Parent    = parent;
            this.ValueType = valueType;
            this.Def       = def;
            this.DefType   = defType;
        }
        public bool CanOutput(ColonistHistoryDef def)
        {
            bool result = false;

            if (!this.ColonistHistoryOutput.TryGetValue(def.defName, out result))
            {
                this.ColonistHistoryOutput[def.defName] = def.defaultOutput;
            }
            return(result);
        }
 public ColonistHistoryRecord(string label, List <object> values, ColonistHistoryDef parent)
 {
     Def       = null;
     Label     = label;
     Value     = null;
     Values    = values;
     Parent    = parent;
     ValueType = Parent.valueType;
     DefType   = null;
 }
        public Dialog_ColonistHistoryOutputDetailed(ColonistHistoryDef def)
        {
            this.def = def;

            this.forcePause = true;
            this.absorbInputAroundWindow = true;
            this.closeOnClickedOutside   = true;
            this.closeOnAccept           = false;
            this.optionalTitle           = def.LabelCap;
            this.doCloseX = true;
        }
 public ColonistHistoryRecord(string label, object value, ColonistHistoryDef parent)
 {
     Def       = null;
     Label     = label;
     Value     = value;
     Values    = null;
     Parent    = parent;
     ValueType = Parent.valueType;
     DefType   = null;
     if (Value == null)
     {
         Value       = "ColonistHistory.NullValue".Translate();
         this.isNull = true;
     }
 }
예제 #6
0
 public RecordIdentifier(ColonistHistoryDef colonistHistoryDef, Def def)
 {
     this.colonistHistoryDef = colonistHistoryDef;
     this.def = def;
 }
예제 #7
0
        public override void DoSettingsWindowContents(Rect inRect)
        {
            Text.Font = GameFont.Small;

            Listing_Standard listing_Standard = new Listing_Standard();

            listing_Standard.ColumnWidth = inRect.width;
            listing_Standard.Begin(inRect);

            listing_Standard.Label("ColonistHistory.SettingsTitleGeneral".Translate());

            indexRecordingIntervalHours = RecordingIntervalHoursItems.IndexOf(Settings.recordingIntervalHours);
            if (indexRecordingIntervalHours == -1)
            {
                indexRecordingIntervalHours = 0;
            }
            listing_Standard.Label("ColonistHistory.SettingsRecordingIntervalHours".Translate(RecordingIntervalHoursItems[indexRecordingIntervalHours].HoursToString()));
            indexRecordingIntervalHours     = (int)listing_Standard.Slider(indexRecordingIntervalHours, 0, RecordingIntervalHoursItems.Count - 1);
            Settings.recordingIntervalHours = RecordingIntervalHoursItems[indexRecordingIntervalHours];

            listing_Standard.CheckboxLabeled("ColonistHistory.SettingsSaveNullOrEmpty".Translate(), ref settings.saveNullOrEmpty);

            listing_Standard.Label("ColonistHistory.SettingsSaveFolderPath".Translate());
            Settings.saveFolderPath = listing_Standard.TextEntry(Settings.saveFolderPath);

            listing_Standard.CheckboxLabeled("ColonistHistory.SettingsRecordOtherFactionPawn".Translate(), ref settings.recordOtherFactionPawn);

            bool previousShowOtherFactionPawn = settings.showOtherFactionPawn;

            listing_Standard.CheckboxLabeled("ColonistHistory.SettingsShowOtherFactionPawn".Translate(), ref settings.showOtherFactionPawn);
            if (previousShowOtherFactionPawn != settings.showOtherFactionPawn)
            {
                RecordGroup.ForceRedraw();
            }

            listing_Standard.CheckboxLabeled("ColonistHistory.SettingsLightWeightSaveMode".Translate(), ref settings.lightWeightSaveMode, "ColonistHistory.SettingsLightWeightSaveModeDesc".Translate());

            listing_Standard.GapLine();

            listing_Standard.Label("ColonistHistory.SettingsTitleGraph".Translate());

            listing_Standard.TextFieldNumericLabeled <float>("ColonistHistory.SettingsHighlightedCurveWidth".Translate(), ref settings.highlightedCurveWidth, ref this.highlightedCurveWidthBuf);
            bool previousTreatingUnrecordedAsZero = settings.treatingUnrecordedAsZero;

            listing_Standard.CheckboxLabeled("ColonistHistory.SettingsTreatingUnrecordedAsZero".Translate(), ref settings.treatingUnrecordedAsZero);
            if (previousTreatingUnrecordedAsZero != settings.treatingUnrecordedAsZero)
            {
                RecordGroup.ForceRedraw();
            }
            bool previousAddZeroBeforeFirst = settings.addZeroBeforeFirst;

            listing_Standard.CheckboxLabeled("ColonistHistory.SettingsAddZeroBeforeFirst".Translate(), ref settings.addZeroBeforeFirst);
            if (previousAddZeroBeforeFirst != settings.addZeroBeforeFirst)
            {
                RecordGroup.ForceRedraw();
            }

            listing_Standard.GapLine();

            listing_Standard.Label("ColonistHistory.SettingsTitleOutputRecords".Translate());

            listing_Standard.End();

            float rowHeight = 28f;
            Rect  outRect   = new Rect(inRect.x, inRect.y + listing_Standard.CurHeight, listing_Standard.ColumnWidth, inRect.height - listing_Standard.CurHeight);
            Rect  viewRect  = new Rect(0f, 0f, inRect.width - 16f, rowHeight * settings.ColonistHistorysOrder.Count);

            //Log.Message("rect:" + rect);
            Widgets.BeginScrollView(outRect, ref this.scrollPosition, viewRect);
            float num = 0f;
            int   indexColonistHistoryDef = 0;
            int   indexReorderDown        = -1;

            foreach (ColonistHistoryDef def in settings.ColonistHistorysOrder)
            {
                bool value   = Settings.CanOutput(def);
                Rect rectRow = new Rect(0f, num, viewRect.width - 20f, rowHeight);
                if (indexColonistHistoryDef > 0 && Widgets.ButtonImage(new Rect(0f, num + (rowHeight - 24f) / 2f, 24f, 24f), MyTex.ReorderUp, Color.white, true))
                {
                    indexReorderDown = indexColonistHistoryDef - 1;
                    SoundDefOf.Tick_High.PlayOneShotOnCamera(null);
                }
                if (indexColonistHistoryDef < settings.ColonistHistorysOrder.Count - 1 && Widgets.ButtonImage(new Rect(28f, num + (rowHeight - 24f) / 2f, 24f, 24f), MyTex.ReorderDown, Color.white, true))
                {
                    indexReorderDown = indexColonistHistoryDef;
                    SoundDefOf.Tick_High.PlayOneShotOnCamera(null);
                }

                Rect rectCheckbox = new Rect(56f, num, rectRow.width - 90f, rowHeight);
                //Log.Message("rectCheckbox:" + rectCheckbox);
                Widgets.CheckboxLabeled(rectCheckbox, def.LabelCap, ref value);
                if (Mouse.IsOver(rectRow))
                {
                    Widgets.DrawHighlight(rectRow);
                }
                TooltipHandler.TipRegion(rectRow, def.description);
                Settings.ColonistHistoryOutput[def.defName] = value;

                if (def.RecordIDs.Count() >= 2 && Widgets.ButtonText(new Rect(rectCheckbox.xMax + 4f, num, 30f, rowHeight), "..."))
                {
                    Find.WindowStack.Add(new Dialog_ColonistHistoryOutputDetailed(def));
                }

                num += rectCheckbox.height;
                indexColonistHistoryDef++;
            }
            if (indexReorderDown != -1)
            {
                ColonistHistoryDef def = this.settings.ColonistHistorysOrder[indexReorderDown];
                this.settings.ColonistHistorysOrder.Remove(def);
                this.settings.ColonistHistorysOrder.Insert(indexReorderDown + 1, def);
            }
            Widgets.EndScrollView();

            Text.Font = GameFont.Medium;
        }