public static IEnumerable <PawnColumnDef> ImpliedPawnColumnDefs()
        {
            PawnTableDef animalsTable = PawnTableDefOf.Animals;

            foreach (TrainableDef item in DefDatabase <TrainableDef> .AllDefsListForReading.OrderByDescending((TrainableDef td) => td.listPriority))
            {
                PawnColumnDef pawnColumnDef = new PawnColumnDef();
                pawnColumnDef.defName        = "Trainable_" + item.defName;
                pawnColumnDef.trainable      = item;
                pawnColumnDef.headerIcon     = item.icon;
                pawnColumnDef.workerClass    = typeof(PawnColumnWorker_Trainable);
                pawnColumnDef.sortable       = true;
                pawnColumnDef.headerTip      = item.LabelCap;
                pawnColumnDef.paintable      = true;
                pawnColumnDef.modContentPack = item.modContentPack;
                animalsTable.columns.Insert(animalsTable.columns.FindIndex((PawnColumnDef x) => x.Worker is PawnColumnWorker_Checkbox) - 1, pawnColumnDef);
                yield return(pawnColumnDef);
            }
            PawnTableDef workTable             = PawnTableDefOf.Work;
            bool         moveWorkTypeLabelDown = false;

            foreach (WorkTypeDef item2 in WorkTypeDefsUtility.WorkTypeDefsInPriorityOrder.Where((WorkTypeDef d) => d.visible).Reverse())
            {
                moveWorkTypeLabelDown = !moveWorkTypeLabelDown;
                PawnColumnDef pawnColumnDef2 = new PawnColumnDef();
                pawnColumnDef2.defName  = "WorkPriority_" + item2.defName;
                pawnColumnDef2.workType = item2;
                pawnColumnDef2.moveWorkTypeLabelDown = moveWorkTypeLabelDown;
                pawnColumnDef2.workerClass           = typeof(PawnColumnWorker_WorkPriority);
                pawnColumnDef2.sortable       = true;
                pawnColumnDef2.modContentPack = item2.modContentPack;
                workTable.columns.Insert(workTable.columns.FindIndex((PawnColumnDef x) => x.Worker is PawnColumnWorker_CopyPasteWorkPriorities) + 1, pawnColumnDef2);
                yield return(pawnColumnDef2);
            }
        }
Ejemplo n.º 2
0
        public static IEnumerable <PawnColumnDef> ImpliedPawnColumnDefs()
        {
            PawnTableDef animalsTable = PawnTableDefOf.Animals;

            using (IEnumerator <TrainableDef> enumerator = (from td in DefDatabase <TrainableDef> .AllDefsListForReading
                                                            orderby td.listPriority descending
                                                            select td).GetEnumerator())
            {
                if (enumerator.MoveNext())
                {
                    TrainableDef  sourceDef = enumerator.Current;
                    PawnColumnDef d3        = new PawnColumnDef
                    {
                        defName        = "Trainable_" + sourceDef.defName,
                        trainable      = sourceDef,
                        headerIcon     = sourceDef.icon,
                        workerClass    = typeof(PawnColumnWorker_Trainable),
                        sortable       = true,
                        headerTip      = sourceDef.LabelCap,
                        paintable      = true,
                        modContentPack = sourceDef.modContentPack
                    };
                    animalsTable.columns.Insert(animalsTable.columns.FindIndex((PawnColumnDef x) => x.Worker is PawnColumnWorker_Checkbox) - 1, d3);
                    yield return(d3);

                    /*Error: Unable to find new state assignment for yield return*/;
                }
            }
            PawnTableDef workTable = PawnTableDefOf.Work;
            bool         moveWorkTypeLabelDown2 = false;

            using (IEnumerator <WorkTypeDef> enumerator2 = (from d in WorkTypeDefsUtility.WorkTypeDefsInPriorityOrder
                                                            where d.visible
                                                            select d).Reverse().GetEnumerator())
            {
                if (enumerator2.MoveNext())
                {
                    WorkTypeDef def = enumerator2.Current;
                    moveWorkTypeLabelDown2 = !moveWorkTypeLabelDown2;
                    PawnColumnDef d2 = new PawnColumnDef
                    {
                        defName  = "WorkPriority_" + def.defName,
                        workType = def,
                        moveWorkTypeLabelDown = moveWorkTypeLabelDown2,
                        workerClass           = typeof(PawnColumnWorker_WorkPriority),
                        sortable       = true,
                        modContentPack = def.modContentPack
                    };
                    workTable.columns.Insert(workTable.columns.FindIndex((PawnColumnDef x) => x.Worker is PawnColumnWorker_CopyPasteWorkPriorities) + 1, d2);
                    yield return(d2);

                    /*Error: Unable to find new state assignment for yield return*/;
                }
            }
            yield break;
IL_036c:
            /*Error near IL_036d: Unexpected return in MoveNext()*/;
        }
        public static IEnumerable <PawnColumnDef> ImpliedPawnColumnDefs()
        {
            PawnTableDef animalsTable = PawnTableDefOf.Animals;

            foreach (TrainableDef sourceDef in from td in DefDatabase <TrainableDef> .AllDefsListForReading
                     orderby td.listPriority descending
                     select td)
            {
                PawnColumnDef d3 = new PawnColumnDef();
                d3.defName        = "Trainable_" + sourceDef.defName;
                d3.trainable      = sourceDef;
                d3.headerIcon     = sourceDef.icon;
                d3.workerClass    = typeof(PawnColumnWorker_Trainable);
                d3.sortable       = true;
                d3.headerTip      = sourceDef.LabelCap;
                d3.paintable      = true;
                d3.modContentPack = sourceDef.modContentPack;
                animalsTable.columns.Insert(animalsTable.columns.FindIndex((PawnColumnDef x) => x.Worker is PawnColumnWorker_Checkbox) - 1, d3);
                yield return(d3);
            }
            PawnTableDef workTable             = PawnTableDefOf.Work;
            bool         moveWorkTypeLabelDown = false;

            foreach (WorkTypeDef def in (from d in WorkTypeDefsUtility.WorkTypeDefsInPriorityOrder
                                         where d.visible
                                         select d).Reverse <WorkTypeDef>())
            {
                moveWorkTypeLabelDown = !moveWorkTypeLabelDown;
                PawnColumnDef d2 = new PawnColumnDef();
                d2.defName  = "WorkPriority_" + def.defName;
                d2.workType = def;
                d2.moveWorkTypeLabelDown = moveWorkTypeLabelDown;
                d2.workerClass           = typeof(PawnColumnWorker_WorkPriority);
                d2.sortable       = true;
                d2.modContentPack = def.modContentPack;
                workTable.columns.Insert(workTable.columns.FindIndex((PawnColumnDef x) => x.Worker is PawnColumnWorker_CopyPasteWorkPriorities) + 1, d2);
                yield return(d2);
            }
            yield break;
        }
Ejemplo n.º 4
0
 private float GetMaxWidth(PawnColumnDef column)
 {
     return(Mathf.Max(column.Worker.GetMaxWidth(this), 0f));
 }
Ejemplo n.º 5
0
 public void SortBy(PawnColumnDef column, bool descending)
 {
     sortByColumn   = column;
     sortDescending = descending;
     SetDirty();
 }
Ejemplo n.º 6
0
 private float GetOptimalWidth(PawnColumnDef column)
 {
     return(Mathf.Max((float)column.Worker.GetOptimalWidth(this), 0f));
 }