예제 #1
0
        public void DrawTradeableRow(Rect rect, Tradeable trad, int index)
        {
            if (index == 1)
            {
                Widgets.DrawLightHighlight(rect);
            }
            Text.Font = GameFont.Small;
            GUI.BeginGroup(rect);
            float width = rect.width;
            int   num   = trad.CountHeldBy(Transactor.Trader);

            if (num != 0)
            {
                Rect rect2 = new Rect(width - 75f, 0f, 75f, rect.height);
                if (Mouse.IsOver(rect2))
                {
                    Widgets.DrawHighlight(rect2);
                }
                Text.Anchor = TextAnchor.MiddleRight;
                Rect rect3 = rect2;
                rect3.xMin += 5f;
                rect3.xMax -= 5f;
                Widgets.Label(rect3, num.ToStringCached());
                TooltipHandler.TipRegion(rect2, "TraderCount".Translate());
            }
            width -= 85f;
            Rect rect4 = new Rect(width - 240f, 0f, 240f, rect.height);

            if (index == 2 && notesTradeable.CountHeldBy(Transactor.Colony) == 0 && notesTradeable.CountHeldBy(Transactor.Trader) == 0)
            {
                Text.Anchor = TextAnchor.MiddleCenter;
                Color color = GUI.color;
                GUI.color = Color.gray;
                Widgets.Label(rect4, "NoNotes".Translate());
                GUI.color = color;
            }
            else if (index == 1 && isVirtual && VirtualTrader.SilverAlsoAdjustable)
            {
                ExtUtil.DoCountAdjustInterfaceForSilver(rect4, trad, index, -trad.CountHeldBy(Transactor.Colony), trad.CountHeldBy(Transactor.Trader), flash: false);
            }
            else
            {
                TransferableUIUtility.DoCountAdjustInterface(rect4, trad, index, -trad.CountHeldBy(Transactor.Colony), trad.CountHeldBy(Transactor.Trader));
            }
            width -= 240f;
            int num2 = trad.CountHeldBy(Transactor.Colony);

            if (num2 != 0)
            {
                Rect rect5 = new Rect(width - 75f - 10f, 0f, 75f, rect.height);
                if (Mouse.IsOver(rect5))
                {
                    Widgets.DrawHighlight(rect5);
                }
                Text.Anchor = TextAnchor.MiddleLeft;
                Rect rect6 = rect5;
                rect6.xMin += 5f;
                rect6.xMax -= 5f;
                Widgets.Label(rect6, num2.ToStringCached());
                TooltipHandler.TipRegion(rect5, "ColonyCount".Translate());
            }
            GenUI.ResetLabelAlign();
            GUI.EndGroup();
        }