예제 #1
0
 public ChatView(WormholeClient owner)
 {
     //
     // Required for Windows Form Designer support
     //
     InitializeComponent();
     _owner = owner;
 }
예제 #2
0
        /// <summary>
        /// call this to accept a trade message from another player
        /// Keep in mind this will be closed as a Modal dialog and will be returned
        /// as soon as an accept button is pressed. This will block this Players ability
        /// to accept other messages. hmmm, this could cause problem.. possible discon-
        /// nections?
        /// </summary>
        /// <param name="trade"></param>
        /// <param name="gameData"></param>
        /// <param name="client"></param>
        /// <param name="thisPlayerID"></param>

        public TradeDialog(MsgTrade tradeMsg, GameData gameData, WormholeClient client, int thisPlayerID)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            this._tradeMsg = tradeMsg;
            Trade trade = tradeMsg.Trade;

            this._gameData     = gameData;
            this._client       = client;
            this._thisPlayerID = thisPlayerID;
            if (this._thisPlayerID == tradeMsg.Trade.OfferingPartyID)
            {
                this._targetPlayerID = tradeMsg.Trade.AskedPartyID;
            }
            else
            {
                this._targetPlayerID = tradeMsg.Trade.OfferingPartyID;
            }
            this.Text += _gameData.PlayerList[_targetPlayerID].Name;

            this.offerMineral.Value = trade.AskedMineral;
            this.offerOrganic.Value = trade.AskedOrganic;
            this.offerEnergy.Value  = trade.AskedEnergy;

            this.returnMineral.Value = trade.OfferedMineral;
            this.returnOrganic.Value = trade.OfferedOrganic;
            this.returnEnergy.Value  = trade.OfferedEnergy;

            this._exMin = _gameData.PlayerList[_thisPlayerID].Fleet.ExMineral - trade.AskedMineral + trade.OfferedMineral;
            this._exOrg = _gameData.PlayerList[_thisPlayerID].Fleet.ExOrganic - trade.AskedOrganic + trade.OfferedOrganic;
            this._exEng = _gameData.PlayerList[_thisPlayerID].Fleet.ExEnergy - trade.AskedEnergy + trade.OfferedEnergy;

            this.surplusMineral.Text = _exMin.ToString();
            this.surplusOrganic.Text = _exOrg.ToString();
            this.surplusEnergy.Text  = _exEng.ToString();

            if (tradeMsg.Type == MsgTrade.TradeMsgType.Offer)
            {
                this.bnCancel.Enabled = false;
                this.bnOffer.Enabled  = false;
                this.bnReject.Enabled = true;
                this.bnAccept.Enabled = true;
                this.bnIgnore.Enabled = true;
                this.bnIgnore.Text    = "Busy, Try Later";
            }
            if (_exMin < 0 || _exOrg < 0 || _exEng < 0)
            {
                this.bnAccept.Enabled = false;
            }
        }
예제 #3
0
        /// <summary>
        /// call this to open a dialog to formulate a new trade
        /// </summary>
        /// <param name="gameData"></param>
        /// <param name="client"></param>
        /// <param name="ID"></param>
        /// <param name="targetID"></param>
        public TradeDialog(GameData gameData, WormholeClient client, int ID, int targetID)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            this._gameData       = gameData;
            this._client         = client;
            this._thisPlayerID   = ID;
            this._targetPlayerID = targetID;
            this.Text           += _gameData.PlayerList[targetID].Name;

            this._exMin = _gameData.PlayerList[ID].Fleet.ExMineral;
            this._exOrg = _gameData.PlayerList[ID].Fleet.ExOrganic;
            this._exEng = _gameData.PlayerList[ID].Fleet.ExEnergy;

            this.surplusMineral.Text = _exMin.ToString();
            this.surplusOrganic.Text = _exOrg.ToString();
            this.surplusEnergy.Text  = _exEng.ToString();

            //this.offerMineral.Maximum = _exMin;
            //this.offerOrganic.Maximum = _exOrg;
            //this.offerEnergy.Maximum = _exEng;

            this.AcceptButton     = this.bnOffer;
            this.bnAccept.Enabled = false;
            this.bnReject.Enabled = false;

            Fleet fleet = _gameData.PlayerList[ID].Fleet;

            for (int i = 0; i < fleet.Count; i++)
            {
                if (fleet[i].Type == Ship.ShipType.Trader)
                {
                    Trader trader = (Trader)fleet[i];
                    this.listBox1.Items.Add(trader.Trade);
                }
            }
        }