Exemplo n.º 1
0
        public static void PurchaseSlectedGrid(IMyTerminalBlock block)
        {
            if (SelectedGrid != null)
            {
                MyLog.Default.WriteLineAndConsole("Purchase selected grid!");
                Message      message = new Message();
                GridsForSale grid    = new GridsForSale();
                grid.SellerSteamid = SelectedGrid.Steamid;
                grid.name          = SelectedGrid.Name;
                grid.BuyerSteamid  = MyAPIGateway.Session.LocalHumanPlayer.SteamUserId;


                if (SelectedGrid.Steamid == grid.BuyerSteamid)
                {
                    return;
                }


                MyLog.Default.WriteLineAndConsole("BuyerID: " + grid.BuyerSteamid);


                message.GridDefinitions = grid;
                message.Type            = MessageType.PurchasedGrid;

                //Check players price etc. if they dont have enough dont let them buy. Perhaps grey out button?


                Comms.SendMessageToServer(message);


                //remove item from list or force update etc.

                return;
            }
        }
Exemplo n.º 2
0
        public override void UpdateAfterSimulation()
        {
            if (MyAPIGateway.Session != null)
            {
                if (!_init)
                {
                    _init = true;

                    MyAPIGateway.Multiplayer.RegisterMessageHandler(NETWORK_ID, MessageHandler);
                    Debug.Write("Creating message handler!");

                    //Need to request all data!

                    Message Message = new Message();
                    Message.Type = MessageType.RequestAllItems;

                    Comms.SendMessageToServer(Message);
                }
            }
        }