public TradePanel(GameState state, int playerID, string name) : base(((int)MessagePanel.Instance.GetBodySize().X / 2) - 200, ((int)Renderer.GetResoultion().Y / 2) - 325, 400, 450, BarMode.Label, state) { if (Instance != null) { Instance.Close(); } Instance = this; _gameState = state; this.SetPanelLabel("Trading with " + name); _playerID = playerID; this.TradeRequest = new TradeRequest(MapComponent.Instance.GetLocalPlayerPacket().PlayerID, playerID); _cancelButton = new Button("Cancel", 10, GetContentHeight() - 50, (GetContentWidth() / 2) - 20, 40, state); _cancelButton.OnTrigger += Cancel; this.AddControl(_cancelButton); _acceptButton = new Button("Accept", (GetContentWidth() / 2) + 10, GetContentHeight() - 50, (GetContentWidth() / 2) - 20, 40, state); _acceptButton.OnTrigger += Accept; this.AddControl(_acceptButton); }
public override void Close() { Instance = null; base.Close(); }