예제 #1
0
        public static bool Prefix(ref bool __result, RimWorld.ColonistBarDrawLocsFinder __instance)
        {
            __result = true;
            ((List <int>)_horGroup.GetValue(__instance)).Clear();

            return(Find.ColonistBar.Entries.Any());
        }
예제 #2
0
        private float FindBestScale(out bool onlyOneRow, out int maxPerGlobalRow)
        {
            float num = 1f;
            List <ColonistBar.Entry> entries = this.ColonistBar.Entries;
            int num2 = this.CalculateGroupsCount();

            while (true)
            {
                Vector2 baseSize = ColonistBar.BaseSize;
                float   num3     = (float)((baseSize.x + 24.0) * num);
                float   num4     = (float)(ColonistBarDrawLocsFinder.MaxColonistBarWidth - (float)(num2 - 1) * 25.0 * num);
                maxPerGlobalRow = Mathf.FloorToInt(num4 / num3);
                onlyOneRow      = true;
                if (this.TryDistributeHorizontalSlotsBetweenGroups(maxPerGlobalRow))
                {
                    int  allowedRowsCountForScale = ColonistBarDrawLocsFinder.GetAllowedRowsCountForScale(num);
                    bool flag = true;
                    int  num5 = -1;
                    for (int i = 0; i < entries.Count; i++)
                    {
                        int num6 = num5;
                        ColonistBar.Entry entry = entries[i];
                        if (num6 != entry.group)
                        {
                            ColonistBar.Entry entry2 = entries[i];
                            num5 = entry2.group;
                            List <int>        list   = this.entriesInGroup;
                            ColonistBar.Entry entry3 = entries[i];
                            float             num7   = (float)list[entry3.group];
                            List <int>        list2  = this.horizontalSlotsPerGroup;
                            ColonistBar.Entry entry4 = entries[i];
                            int num8 = Mathf.CeilToInt(num7 / (float)list2[entry4.group]);
                            if (num8 > 1)
                            {
                                onlyOneRow = false;
                            }
                            if (num8 > allowedRowsCountForScale)
                            {
                                flag = false;
                                break;
                            }
                        }
                    }
                    if (flag)
                    {
                        break;
                    }
                }
                num = (float)(num * 0.949999988079071);
            }
            return(num);
        }
예제 #3
0
        private float FindBestScale(out bool onlyOneRow, out int maxPerGlobalRow)
        {
            float num = 1f;
            List <ColonistBar.Entry> entries = this.ColonistBar.Entries;
            int num2 = this.CalculateGroupsCount();

            for (;;)
            {
                float num3 = (ColonistBar.BaseSize.x + 24f) * num;
                float num4 = ColonistBarDrawLocsFinder.MaxColonistBarWidth - (float)(num2 - 1) * 25f * num;
                maxPerGlobalRow = Mathf.FloorToInt(num4 / num3);
                onlyOneRow      = true;
                if (this.TryDistributeHorizontalSlotsBetweenGroups(maxPerGlobalRow))
                {
                    int  allowedRowsCountForScale = ColonistBarDrawLocsFinder.GetAllowedRowsCountForScale(num);
                    bool flag = true;
                    int  num5 = -1;
                    for (int i = 0; i < entries.Count; i++)
                    {
                        if (num5 != entries[i].group)
                        {
                            num5 = entries[i].group;
                            int num6 = Mathf.CeilToInt((float)this.entriesInGroup[entries[i].group] / (float)this.horizontalSlotsPerGroup[entries[i].group]);
                            if (num6 > 1)
                            {
                                onlyOneRow = false;
                            }
                            if (num6 > allowedRowsCountForScale)
                            {
                                flag = false;
                                break;
                            }
                        }
                    }
                    if (flag)
                    {
                        break;
                    }
                }
                num *= 0.95f;
            }
            return(num);
        }