Esempio n. 1
0
        protected override void FillTab()
        {
            if (tabDef == null)
            {
                Log.Error(DebugLog.GetMethodName() + "tabDef is null");
                return;
            }

            Rect tabRect = new Rect(0f, 0f, ITab_Restrict.tabDef.areaSize.x, ITab_Restrict.tabDef.areaSize.y).ContractedBy(10f);

            GUI.BeginGroup(tabRect);
            Text.Font = GameFont.Small;

            Vector2 curPos    = new Vector2(0f, ITab_Restrict.tabDef.topMargine);
            float   listWidth = (tabRect.width - ITab_Restrict.tabDef.centerMargine) / tabDef.listNumber;
            int     count     = 0;

            foreach (var comp in SelectedEntityList)
            {
                Rect baseRect = new Rect(curPos.x, curPos.y, listWidth, tabRect.height - ITab_Restrict.tabDef.topMargine);
                TabRestrictUI.DrawEntityListWindow(comp.filter, comp.entityCategoryRoot, comp.LabelCap, comp.Description, baseRect, ref this.scrollPosition[count], count);
                curPos.x += (listWidth + ITab_Restrict.tabDef.centerMargine);
                count++;
            }
            GUI.EndGroup();
        }
Esempio n. 2
0
        public static void DrawEntityListWindow(IEntityFilter filter, EntityCategory root, string label, string description, Rect baseRect, ref Vector2 scrollPosition, int count)
        {
            Widgets.DrawMenuSection(baseRect, true);

            TabRestrictUI.DrawDefaultSettingButton(filter, ref baseRect);
            TabRestrictUI.DrawHeadingCheckBox(filter, label, description, ref baseRect);

            Text.Font = GameFont.Tiny;

            float num         = baseRect.width - 2f;
            Rect  buttonRect1 = new Rect(baseRect.x + 1f, baseRect.y + 1f, num / 2f, 24f);

            if (Widgets.ButtonText(buttonRect1, "ClearAll".Translate(), true, false, true))
            {
                filter.SetAllowAll(root, false);
            }
            Rect buttonRect2 = new Rect(buttonRect1.xMax + 1f, buttonRect1.y, baseRect.xMax - 1f - (buttonRect1.xMax + 1f), 24f);

            if (Widgets.ButtonText(buttonRect2, "AllowAll".Translate(), true, false, true))
            {
                filter.SetAllowAll(root);
            }
            baseRect.yMin = buttonRect1.yMax;

            Text.Font = GameFont.Small;

            Rect viewRect = new Rect(0f, 0f, baseRect.width - 16f, TabRestrictUI.viewHeight[count]);

            Widgets.BeginScrollView(baseRect, ref scrollPosition, viewRect, true);
            float num2     = 2f;
            float num3     = num2;
            Rect  listRect = new Rect(0f, num2, viewRect.width, 9999f);

            Listing_EntityListUI entityListUI = new Listing_EntityListUI(filter);

            entityListUI.Begin(listRect);
            entityListUI.CreateCheckBoxUI(root, 8, 0);
            entityListUI.End();

            if (Event.current.type == EventType.Layout)
            {
                TabRestrictUI.viewHeight[count] = num3 + entityListUI.CurHeight + 90f;
            }
            Widgets.EndScrollView();
        }