Ejemplo 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();
        }
 public override void DoWindowContents(Rect fillRect)
 {
     base.DoWindowContents(fillRect);
     FactionUIUtility.DoWindowContents_NewTemp(fillRect, ref scrollPosition, ref scrollViewHeight, scrollToFaction);
     if (scrollToFaction != null)
     {
         scrollToFaction = null;
     }
 }
 public override void DoWindowContents(Rect inRect)
 {
     base.DoWindowContents(inRect);
     if (faction != null)
     {
         float curY = inRect.height - 79f;
         FactionUIUtility.DrawRelatedFactionInfo(inRect, faction, ref curY);
     }
 }
Ejemplo n.º 4
0
        public override void DoWindowContents(Rect inRect)
        {
            float   x            = inRect.x;
            float   y            = inRect.y;
            float   width        = inRect.width;
            float   height       = inRect.height;
            Vector2 closeButSize = CloseButSize;

            FactionUIUtility.DoWindowContents(new Rect(x, y, width, height - closeButSize.y), ref scrollPosition, ref scrollViewHeight);
        }
        private float DrawTechprintInfo(Rect rect, ResearchProjectDef project)
        {
            if (selectedProject.TechprintCount == 0)
            {
                return(0f);
            }
            float  xMin = rect.xMin;
            float  yMin = rect.yMin;
            string text = "ResearchTechprintsFromFactions".Translate();
            float  num  = Text.CalcHeight(text, rect.width);

            Widgets.Label(new Rect(rect.x, yMin, rect.width, num), text);
            rect.x += 6f;
            if (selectedProject.heldByFactionCategoryTags != null)
            {
                foreach (string heldByFactionCategoryTag in selectedProject.heldByFactionCategoryTags)
                {
                    foreach (Faction item in Find.FactionManager.AllFactionsInViewOrder)
                    {
                        if (item.def.categoryTag == heldByFactionCategoryTag)
                        {
                            string name     = item.Name;
                            Rect   position = new Rect(rect.x, yMin + num, rect.width, Mathf.Max(24f, Text.CalcHeight(name, rect.width - 24f - 6f)));
                            GUI.BeginGroup(position);
                            Rect r = new Rect(0f, 0f, 24f, 24f).ContractedBy(2f);
                            FactionUIUtility.DrawFactionIconWithTooltip(r, item);
                            Rect rect2 = new Rect(r.xMax + 6f, 0f, position.width - r.width - 6f, position.height);
                            Text.Anchor   = TextAnchor.MiddleLeft;
                            Text.WordWrap = false;
                            Widgets.Label(rect2, item.Name);
                            Text.Anchor   = TextAnchor.UpperLeft;
                            Text.WordWrap = true;
                            GUI.EndGroup();
                            num += position.height;
                        }
                    }
                }
            }
            rect.xMin = xMin;
            return(num);
        }
        private void DoFactionInfo(Rect rect, Faction faction, ref float curX, ref float curY, ref int index)
        {
            if (index % 2 == 1)
            {
                Widgets.DrawLightHighlight(new Rect(curX, curY, rect.width, 45f));
            }
            FactionUIUtility.DrawFactionIconWithTooltip(new Rect(curX, curY + 5f, 35f, 35f), faction);
            curX += 45f;
            Rect rect2 = new Rect(curX, curY, 250f, 45f);

            Text.Anchor = TextAnchor.MiddleLeft;
            Widgets.Label(rect2, faction.Name);
            Text.Anchor = TextAnchor.UpperLeft;
            curX       += 250f;
            if (Mouse.IsOver(rect2))
            {
                TipSignal tip = new TipSignal(() => faction.Name + "\n\n" + faction.def.description + "\n\n" + faction.PlayerRelationKind.GetLabel().Colorize(faction.PlayerRelationKind.GetColor()), faction.loadID ^ 0x4468077);
                TooltipHandler.TipRegion(rect2, tip);
                Widgets.DrawHighlight(rect2);
            }
            index++;
        }
Ejemplo n.º 7
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();
        }
 public override void DoWindowContents(Rect inRect)
 {
     FactionUIUtility.DoWindowContents(new Rect(inRect.x, inRect.y, inRect.width, inRect.height - this.CloseButSize.y), ref this.scrollPosition, ref this.scrollViewHeight);
 }
 public override void DoWindowContents(Rect fillRect)
 {
     base.DoWindowContents(fillRect);
     FactionUIUtility.DoWindowContents(fillRect, ref this.scrollPosition, ref this.scrollViewHeight);
 }