コード例 #1
0
        public static void Draw(Rect rect)
        {
            Rect rect2 = new Rect(rect);

            Text.Font = GameFont.Small;
            Rect viewRect = new Rect(0f, 0f, rect2.width - 16f, RecordReportUtility.listHeight);

            Widgets.BeginScrollView(rect2, ref RecordReportUtility.scrollPosition, viewRect, true);
            float  num = 0f;
            string b   = null;

            RecordReportUtility.mousedOverEntry = null;
            for (int i = 0; i < RecordReportUtility.cachedDrawEntries.Count; i++)
            {
                RecordDrawEntry ent = RecordReportUtility.cachedDrawEntries[i];
                if (ent.CanRender)
                {
                    if (ent.data.Parent.LabelCap != b)
                    {
                        Widgets.ListSeparator(ref num, viewRect.width, ent.data.Parent.LabelCap);
                        b = ent.data.Parent.LabelCap;
                    }
                    num += ent.Draw(8f, num, viewRect.width - 8f, RecordReportUtility.selectedEntry == ent, delegate {
                        RecordReportUtility.SelectEntry(ent, true);
                    }, delegate {
                        RecordReportUtility.mousedOverEntry = ent;
                    }, RecordReportUtility.scrollPosition, rect2);
                }
            }
            RecordReportUtility.listHeight = num + 100f;
            Widgets.EndScrollView();
        }
        public override void PreOpen()
        {
            base.PreOpen();
            this.tabs.Clear();
            this.tabs.Add(new TabRecord("ColonistHistory.TabHome".Translate(), delegate() {
                MainTabWindow_ColonistHistory.curTab = MainTabWindow_ColonistHistory.TabType.Home;
            }, () => MainTabWindow_ColonistHistory.curTab == MainTabWindow_ColonistHistory.TabType.Home));
            this.tabs.Add(new TabRecord("ColonistHistory.TabTable".Translate(), delegate() {
                MainTabWindow_ColonistHistory.curTab = MainTabWindow_ColonistHistory.TabType.Table;
                RefreshDrawEntries();
            }, () => MainTabWindow_ColonistHistory.curTab == MainTabWindow_ColonistHistory.TabType.Table));
            this.tabs.Add(new TabRecord("ColonistHistory.TabGraph".Translate(), delegate() {
                MainTabWindow_ColonistHistory.curTab = MainTabWindow_ColonistHistory.TabType.Graph;
                RefreshGraph();
            }, () => MainTabWindow_ColonistHistory.curTab == MainTabWindow_ColonistHistory.TabType.Graph));

            MainTabWindow_ColonistHistory.curPawn = CompRecorder.Colonists.First();
            RecordReportUtility.Reset();
            RefreshDrawEntries();
            RefreshGraph();

            Pawn pawn      = MainTabWindow_ColonistHistory.curPawn;
            int  lastIndex = CompRecorder.GetRecords(pawn).log.Count - 1;

            MainTabWindow_ColonistHistory.curDateIndex = Mathf.Clamp(MainTabWindow_ColonistHistory.curDateIndex, 0, lastIndex);
        }
 public void RefreshDrawEntries()
 {
     if (!CurRecords.log.NullOrEmpty())
     {
         RecordReportUtility.ResolveDrawEntries(this.CurData);
     }
     else
     {
         if (this.CompRecorder.Colonists.EnumerableNullOrEmpty())
         {
             RecordReportUtility.Reset();
         }
         else
         {
             MainTabWindow_ColonistHistory.curPawn = this.CompRecorder.Colonists.First();
             RecordReportUtility.ResolveDrawEntries(this.CurData);
         }
     }
 }
 private void DrawRecordInfoOnTable(Rect rect)
 {
     RecordReportUtility.Draw(rect);
 }