예제 #1
0
 public History()
 {
     this.autoRecorderGroups = new List <HistoryAutoRecorderGroup>();
     foreach (HistoryAutoRecorderGroupDef allDef in DefDatabase <HistoryAutoRecorderGroupDef> .AllDefs)
     {
         HistoryAutoRecorderGroup historyAutoRecorderGroup = new HistoryAutoRecorderGroup();
         historyAutoRecorderGroup.def = allDef;
         historyAutoRecorderGroup.CreateRecorders();
         this.autoRecorderGroups.Add(historyAutoRecorderGroup);
     }
     this.curveDrawerStyle = new SimpleCurveDrawerStyle();
     this.curveDrawerStyle.DrawMeasures             = true;
     this.curveDrawerStyle.DrawPoints               = false;
     this.curveDrawerStyle.DrawBackground           = true;
     this.curveDrawerStyle.DrawBackgroundLines      = false;
     this.curveDrawerStyle.DrawLegend               = true;
     this.curveDrawerStyle.DrawCurveMousePoint      = true;
     this.curveDrawerStyle.OnlyPositiveValues       = true;
     this.curveDrawerStyle.UseFixedSection          = true;
     this.curveDrawerStyle.UseAntiAliasedLines      = true;
     this.curveDrawerStyle.PointsRemoveOptimization = true;
     this.curveDrawerStyle.MeasureLabelsXCount      = 10;
     this.curveDrawerStyle.MeasureLabelsYCount      = 5;
     this.curveDrawerStyle.XIntegersOnly            = true;
     this.curveDrawerStyle.LabelX = "Day".Translate();
 }
        private void DoGraphPage(Rect rect)
        {
            rect.yMin += 17f;
            GUI.BeginGroup(rect);
            Rect graphRect  = new Rect(0f, 0f, rect.width, 450f);
            Rect legendRect = new Rect(0f, graphRect.yMax, rect.width / 2f, 40f);
            Rect rect2      = new Rect(0f, legendRect.yMax, rect.width, 40f);

            if (this.historyAutoRecorderGroup != null)
            {
                MainTabWindow_History.marks.Clear();
                List <Tale> allTalesListForReading = Find.TaleManager.AllTalesListForReading;
                for (int i = 0; i < allTalesListForReading.Count; i++)
                {
                    Tale tale = allTalesListForReading[i];
                    if (tale.def.type == TaleType.PermanentHistorical)
                    {
                        float x = (float)GenDate.TickAbsToGame(tale.date) / 60000f;
                        MainTabWindow_History.marks.Add(new CurveMark(x, tale.ShortSummary, tale.def.historyGraphColor));
                    }
                }
                this.historyAutoRecorderGroup.DrawGraph(graphRect, legendRect, this.graphSection, MainTabWindow_History.marks);
            }
            Text.Font = GameFont.Small;
            float num = (float)Find.TickManager.TicksGame / 60000f;

            if (Widgets.ButtonText(new Rect(legendRect.xMin + legendRect.width, legendRect.yMin, 110f, 40f), "Last30Days".Translate(), true, false, true))
            {
                this.graphSection = new FloatRange(Mathf.Max(0f, num - 30f), num);
            }
            if (Widgets.ButtonText(new Rect(legendRect.xMin + legendRect.width + 110f + 4f, legendRect.yMin, 110f, 40f), "Last100Days".Translate(), true, false, true))
            {
                this.graphSection = new FloatRange(Mathf.Max(0f, num - 100f), num);
            }
            if (Widgets.ButtonText(new Rect(legendRect.xMin + legendRect.width + 228f, legendRect.yMin, 110f, 40f), "Last300Days".Translate(), true, false, true))
            {
                this.graphSection = new FloatRange(Mathf.Max(0f, num - 300f), num);
            }
            if (Widgets.ButtonText(new Rect(legendRect.xMin + legendRect.width + 342f, legendRect.yMin, 110f, 40f), "AllDays".Translate(), true, false, true))
            {
                this.graphSection = new FloatRange(0f, num);
            }
            if (Widgets.ButtonText(new Rect(rect2.x, rect2.y, 110f, 40f), "SelectGraph".Translate(), true, false, true))
            {
                List <FloatMenuOption>          list  = new List <FloatMenuOption>();
                List <HistoryAutoRecorderGroup> list2 = Find.History.Groups();
                for (int j = 0; j < list2.Count; j++)
                {
                    HistoryAutoRecorderGroup groupLocal = list2[j];
                    list.Add(new FloatMenuOption(groupLocal.def.LabelCap, delegate()
                    {
                        this.historyAutoRecorderGroup = groupLocal;
                    }, MenuOptionPriority.Default, null, null, 0f, null, null));
                }
                FloatMenu window = new FloatMenu(list, "SelectGraph".Translate(), false);
                Find.WindowStack.Add(window);
                PlayerKnowledgeDatabase.KnowledgeDemonstrated(ConceptDefOf.HistoryTab, KnowledgeAmount.Total);
            }
            GUI.EndGroup();
        }
예제 #3
0
        public override void PreOpen()
        {
            base.PreOpen();
            tabs.Clear();
            tabs.Add(new TabRecord("Graph".Translate(), delegate
            {
                curTab = HistoryTab.Graph;
            }, () => curTab == HistoryTab.Graph));
            tabs.Add(new TabRecord("Messages".Translate(), delegate
            {
                curTab = HistoryTab.Messages;
            }, () => curTab == HistoryTab.Messages));
            tabs.Add(new TabRecord("Statistics".Translate(), delegate
            {
                curTab = HistoryTab.Statistics;
            }, () => curTab == HistoryTab.Statistics));
            historyAutoRecorderGroup = Find.History.Groups().FirstOrDefault();
            if (historyAutoRecorderGroup != null)
            {
                graphSection = new FloatRange(0f, (float)Find.TickManager.TicksGame / 60000f);
            }
            List <Map> maps = Find.Maps;

            for (int i = 0; i < maps.Count; i++)
            {
                maps[i].wealthWatcher.ForceRecount();
            }
        }
        public override void PreOpen()
        {
            base.PreOpen();
            this.historyAutoRecorderGroup = Find.History.Groups().FirstOrDefault <HistoryAutoRecorderGroup>();
            if (this.historyAutoRecorderGroup != null)
            {
                this.graphSection = new FloatRange(0f, (float)Find.TickManager.TicksGame / 60000f);
            }
            List <Map> maps = Find.Maps;

            for (int i = 0; i < maps.Count; i++)
            {
                maps[i].wealthWatcher.ForceRecount(false);
            }
        }
예제 #5
0
 private void AddOrRemoveHistoryRecorderGroups()
 {
     if (autoRecorderGroups.RemoveAll((HistoryAutoRecorderGroup x) => x == null) != 0)
     {
         Log.Warning("Some history auto recorder groups were null.");
     }
     foreach (HistoryAutoRecorderGroupDef def in DefDatabase <HistoryAutoRecorderGroupDef> .AllDefs)
     {
         if (!autoRecorderGroups.Any((HistoryAutoRecorderGroup x) => x.def == def))
         {
             HistoryAutoRecorderGroup historyAutoRecorderGroup = new HistoryAutoRecorderGroup();
             historyAutoRecorderGroup.def = def;
             historyAutoRecorderGroup.AddOrRemoveHistoryRecorders();
             autoRecorderGroups.Add(historyAutoRecorderGroup);
         }
     }
     autoRecorderGroups.RemoveAll((HistoryAutoRecorderGroup x) => x.def == null);
 }
예제 #6
0
 private void AddOrRemoveHistoryRecorderGroups()
 {
     if (this.autoRecorderGroups.RemoveAll((HistoryAutoRecorderGroup x) => x == null) != 0)
     {
         Log.Warning("Some history auto recorder groups were null.", false);
     }
     using (IEnumerator <HistoryAutoRecorderGroupDef> enumerator = DefDatabase <HistoryAutoRecorderGroupDef> .AllDefs.GetEnumerator())
     {
         while (enumerator.MoveNext())
         {
             HistoryAutoRecorderGroupDef def = enumerator.Current;
             if (!this.autoRecorderGroups.Any((HistoryAutoRecorderGroup x) => x.def == def))
             {
                 HistoryAutoRecorderGroup historyAutoRecorderGroup = new HistoryAutoRecorderGroup();
                 historyAutoRecorderGroup.def = def;
                 historyAutoRecorderGroup.AddOrRemoveHistoryRecorders();
                 this.autoRecorderGroups.Add(historyAutoRecorderGroup);
             }
         }
     }
     this.autoRecorderGroups.RemoveAll((HistoryAutoRecorderGroup x) => x.def == null);
 }
 internal void <> m__0()
 {
     this.$this.historyAutoRecorderGroup = this.groupLocal;
 }
예제 #8
0
 private static bool <AddOrRemoveHistoryRecorderGroups> m__1(HistoryAutoRecorderGroup x)
 {
     return(x.def == null);
 }
예제 #9
0
 internal bool <> m__0(HistoryAutoRecorderGroup x)
 {
     return(x.def == this.def);
 }