Exemplo n.º 1
0
        public void BeginTrade(TradeEnvoy Envoy, Faction PlayerFaction)
        {
            PlayerFaction.World.Tutorial("trade_screen");
            TradePanel = GuiRoot.ConstructWidget(new Gui.Widgets.TradePanel
            {
                Rect   = GuiRoot.RenderData.VirtualScreen,
                Envoy  = Envoy.OwnerFaction.ParentFaction.CreateTradeEntity(Envoy),
                Player = new Trade.PlayerTradeEntity(PlayerFaction),
            }) as Gui.Widgets.TradePanel;

            TradePanel.Layout();

            GuiRoot.ShowDialog(TradePanel);
            GuiRoot.RootItem.SendToBack(TradePanel);

            AutoHideBubble = true;

            SpeakerBorder.Rect = new Rectangle(16, GuiRoot.RenderData.VirtualScreen.Height - (256 - 16), 256 - 32, 256 - 32);
            SpeakerRectangle   = Gui.Mesh.Quad().Scale(256, 256).Translate(0, GuiRoot.RenderData.VirtualScreen.Height - 256);
            _Output.Rect       = new Rectangle(256, GuiRoot.RenderData.VirtualScreen.Height - 260, global::System.Math.Min(GuiRoot.RenderData.VirtualScreen.Width - 256, 550), 260);

            SpeakerBorder.Invalidate();
            _Output.Invalidate();
            GuiRoot.RootItem.Invalidate();
        }
Exemplo n.º 2
0
        private void PositionItems()
        {
            int w = global::System.Math.Min(GuiRoot.RenderData.VirtualScreen.Width - 256, 550);
            int h = global::System.Math.Min(GuiRoot.RenderData.VirtualScreen.Height - 256, 300);
            int x = GuiRoot.RenderData.VirtualScreen.Width / 2 - w / 2;
            int y = global::System.Math.Max(GuiRoot.RenderData.VirtualScreen.Height / 2 - h / 2, 280);

            _Output.Rect     = new Rectangle(x, y - 260, w, 260);
            ChoicePanel.Rect = new Rectangle(x, y, w, h);

            int inset = 32;

            SpeakerBorder.Rect = new Rectangle(x - w / 2 + inset / 2, y - 260 + inset, 256 - inset, 256 - inset);

            if (SpeakerBorder.Rect.X < 0)
            {
                _Output.Rect.X      += -SpeakerBorder.Rect.X;
                SpeakerBorder.Rect.X = 0;
            }

            SpeakerRectangle = Gui.Mesh.Quad().Scale(SpeakerBorder.Rect.Width, SpeakerBorder.Rect.Height).Translate(SpeakerBorder.Rect.X, SpeakerBorder.Rect.Y);

            _Output.Invalidate();
            SpeakerBorder.Invalidate();
        }