Exemplo n.º 1
0
        public static void DrawTradeableRow(Rect rect, Tradeable trad, int index)
        {
            if (index % 2 == 1)
            {
                GUI.DrawTexture(rect, TradeUI.TradeAlternativeBGTex);
            }
            Text.Font = GameFont.Small;
            GUI.BeginGroup(rect);
            float width = rect.width;
            int   num   = trad.CountHeldBy(Transactor.Trader);

            if (num != 0)
            {
                Rect rect2 = new Rect((float)(width - 75.0), 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());
                Rect rect4 = new Rect((float)(rect2.x - 100.0), 0f, 100f, rect.height);
                Text.Anchor = TextAnchor.MiddleRight;
                TradeUI.DrawPrice(rect4, trad, TradeAction.PlayerBuys);
            }
            width = (float)(width - 175.0);
            Rect rect5 = new Rect((float)(width - 240.0), 0f, 240f, rect.height);

            if (trad.TraderWillTrade)
            {
                bool flash = Time.time - Dialog_Trade.lastCurrencyFlashTime < 1.0 && trad.IsCurrency;
                TransferableUIUtility.DoCountAdjustInterface(rect5, trad, index, -trad.CountHeldBy(Transactor.Colony), trad.CountHeldBy(Transactor.Trader), flash, null);
            }
            else
            {
                TradeUI.DrawWillNotTradeIndication(rect, trad);
            }
            width = (float)(width - 240.0);
            int num2 = trad.CountHeldBy(Transactor.Colony);

            if (num2 != 0)
            {
                Rect rect6 = new Rect((float)(width - 100.0), 0f, 100f, rect.height);
                Text.Anchor = TextAnchor.MiddleLeft;
                TradeUI.DrawPrice(rect6, trad, TradeAction.PlayerSells);
                Rect rect7 = new Rect((float)(rect6.x - 75.0), 0f, 75f, rect.height);
                if (Mouse.IsOver(rect7))
                {
                    Widgets.DrawHighlight(rect7);
                }
                Text.Anchor = TextAnchor.MiddleLeft;
                Rect rect8 = rect7;
                rect8.xMin += 5f;
                rect8.xMax -= 5f;
                Widgets.Label(rect8, num2.ToStringCached());
                TooltipHandler.TipRegion(rect7, "ColonyCount".Translate());
            }
            width = (float)(width - 175.0);
            Rect idRect = new Rect(0f, 0f, width, rect.height);

            TransferableUIUtility.DrawTransferableInfo(trad, idRect, (!trad.TraderWillTrade) ? TradeUI.NoTradeColor : Color.white);
            GenUI.ResetLabelAlign();
            GUI.EndGroup();
        }
Exemplo n.º 2
0
        public static void DrawTradeableRow(Rect rect, Tradeable trad, int index)
        {
            if (index % 2 == 1)
            {
                Widgets.DrawLightHighlight(rect);
            }
            Text.Font = GameFont.Small;
            GUI.BeginGroup(rect);
            float width = rect.width;
            int   num   = trad.CountHeldBy(Transactor.Trader);

            if (num != 0 && trad.IsThing)
            {
                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.TipRegionByKey(rect2, "TraderCount");
                Rect rect4 = new Rect(rect2.x - 100f, 0f, 100f, rect.height);
                Text.Anchor = TextAnchor.MiddleRight;
                DrawPrice(rect4, trad, TradeAction.PlayerBuys);
            }
            width -= 175f;
            Rect rect5 = new Rect(width - 240f, 0f, 240f, rect.height);

            if (trad.TraderWillTrade)
            {
                bool flash = Time.time - Dialog_Trade.lastCurrencyFlashTime < 1f && trad.IsCurrency;
                TransferableUIUtility.DoCountAdjustInterface(rect5, trad, index, trad.GetMinimumToTransfer(), trad.GetMaximumToTransfer(), flash);
            }
            else
            {
                DrawWillNotTradeIndication(rect5, trad);
            }
            width -= 240f;
            int num2 = trad.CountHeldBy(Transactor.Colony);

            if (num2 != 0)
            {
                Rect rect6 = new Rect(width - 100f, 0f, 100f, rect.height);
                Text.Anchor = TextAnchor.MiddleLeft;
                DrawPrice(rect6, trad, TradeAction.PlayerSells);
                Rect rect7 = new Rect(rect6.x - 75f, 0f, 75f, rect.height);
                if (Mouse.IsOver(rect7))
                {
                    Widgets.DrawHighlight(rect7);
                }
                Text.Anchor = TextAnchor.MiddleLeft;
                Rect rect8 = rect7;
                rect8.xMin += 5f;
                rect8.xMax -= 5f;
                Widgets.Label(rect8, num2.ToStringCached());
                TooltipHandler.TipRegionByKey(rect7, "ColonyCount");
            }
            width -= 175f;
            TransferableUIUtility.DoExtraAnimalIcons(trad, rect, ref width);
            Rect idRect = new Rect(0f, 0f, width, rect.height);

            TransferableUIUtility.DrawTransferableInfo(trad, idRect, trad.TraderWillTrade ? Color.white : NoTradeColor);
            GenUI.ResetLabelAlign();
            GUI.EndGroup();
        }