Exemplo n.º 1
0
        public static void DoWindowContents(Rect fillRect, ref Vector2 scrollPosition, ref float scrollViewHeight)
        {
            Rect position = new Rect(0f, 0f, fillRect.width, fillRect.height);

            GUI.BeginGroup(position);
            Text.Font = GameFont.Small;
            GUI.color = Color.white;
            Rect outRect = new Rect(0f, 50f, position.width, position.height - 50f);
            Rect rect    = new Rect(0f, 0f, position.width - 16f, scrollViewHeight);

            Widgets.BeginScrollView(outRect, ref scrollPosition, rect, true);
            float num = 0f;

            foreach (Faction current in Find.FactionManager.AllFactionsInViewOrder)
            {
                if (!current.IsPlayer)
                {
                    GUI.color = new Color(1f, 1f, 1f, 0.2f);
                    Widgets.DrawLineHorizontal(0f, num, rect.width);
                    GUI.color = Color.white;
                    num      += FactionUIUtility.DrawFactionRow(current, num, rect);
                }
            }
            if (Event.current.type == EventType.Layout)
            {
                scrollViewHeight = num;
            }
            Widgets.EndScrollView();
            GUI.EndGroup();
        }
Exemplo n.º 2
0
        public static void DoWindowContents(Rect fillRect, ref Vector2 scrollPosition, ref float scrollViewHeight)
        {
            Rect position = new Rect(0f, 0f, fillRect.width, fillRect.height);

            GUI.BeginGroup(position);
            Text.Font = GameFont.Small;
            GUI.color = Color.white;
            if (Prefs.DevMode)
            {
                Widgets.CheckboxLabeled(new Rect(position.width - 120f, 0f, 120f, 24f), "Dev: Show all", ref FactionUIUtility.showAll, false, null, null, false);
            }
            else
            {
                FactionUIUtility.showAll = false;
            }
            Rect outRect = new Rect(0f, 50f, position.width, position.height - 50f);
            Rect rect    = new Rect(0f, 0f, position.width - 16f, scrollViewHeight);

            Widgets.BeginScrollView(outRect, ref scrollPosition, rect, true);
            float num = 0f;

            foreach (Faction current in Find.FactionManager.AllFactionsInViewOrder)
            {
                if ((!current.IsPlayer && !current.def.hidden) || FactionUIUtility.showAll)
                {
                    GUI.color = new Color(1f, 1f, 1f, 0.2f);
                    Widgets.DrawLineHorizontal(0f, num, rect.width);
                    GUI.color = Color.white;
                    num      += FactionUIUtility.DrawFactionRow(current, num, rect);
                }
            }
            if (Event.current.type == EventType.Layout)
            {
                scrollViewHeight = num;
            }
            Widgets.EndScrollView();
            GUI.EndGroup();
        }