示例#1
0
        private static void AddItemsInternal(AddItemsMsg msg)
        {
            IMyInventoryOwner owner = MyEntities.GetEntityById(msg.OwnerEntityId) as IMyInventoryOwner;
            MyInventory       inv   = owner.GetInventory(msg.InventoryIndex);

            inv.AddItemsInternal(msg.Amount, msg.Item, msg.itemIdx);
        }
示例#2
0
 static void OnAddItemsSuccess(ref AddItemsMsg msg, MyNetworkClient sender)
 {
     if (!MyEntities.EntityExists(msg.OwnerEntityId))
     {
         return;
     }
     AddItemsInternal(msg);
 }
示例#3
0
        static void OnAddItemsRequest(ref AddItemsMsg msg, MyNetworkClient sender)
        {
            if (!MyEntities.EntityExists(msg.OwnerEntityId))
            {
                return;
            }
            IMyInventoryOwner owner = MyEntities.GetEntityById(msg.OwnerEntityId) as IMyInventoryOwner;

            owner.GetInventory(msg.InventoryIndex).AddItems(msg.Amount, msg.Item, msg.itemIdx);
        }
示例#4
0
        public void SendAddItemsRequest(MyInventory inv, int index, MyFixedPoint amount, MyObjectBuilder_PhysicalObject objectBuilder)
        {
            Debug.Assert(inv.Owner != null, "Inventory must have owner to be able to add items synchronously!");
            var msg = new AddItemsMsg();

            msg.OwnerEntityId  = inv.Owner.EntityId;
            msg.InventoryIndex = inv.InventoryIdx;
            msg.itemIdx        = index;
            msg.Item           = objectBuilder;
            msg.Amount         = amount;

            Sync.Layer.SendMessageToServer(ref msg, MyTransportMessageEnum.Request);
        }
示例#5
0
 private static void AddItemsInternal(AddItemsMsg msg)
 {
     IMyInventoryOwner owner = MyEntities.GetEntityById(msg.OwnerEntityId) as IMyInventoryOwner;
     MyInventory inv = owner.GetInventory(msg.InventoryIndex);
     inv.AddItemsInternal(msg.Amount, msg.Item, msg.itemIdx);
 }
示例#6
0
 static void OnAddItemsSuccess(ref AddItemsMsg msg, MyNetworkClient sender)
 {
     if (!MyEntities.EntityExists(msg.OwnerEntityId)) return;
     AddItemsInternal(msg);
 }
示例#7
0
 static void OnAddItemsRequest(ref AddItemsMsg msg, MyNetworkClient sender)
 {
     if (!MyEntities.EntityExists(msg.OwnerEntityId))
         return;
     IMyInventoryOwner owner = MyEntities.GetEntityById(msg.OwnerEntityId) as IMyInventoryOwner;
     owner.GetInventory(msg.InventoryIndex).AddItems(msg.Amount, msg.Item, msg.itemIdx);
 }
示例#8
0
        public void SendAddItemsRequest(MyInventory inv, int index, MyFixedPoint amount, MyObjectBuilder_PhysicalObject objectBuilder)
        {
            Debug.Assert(inv.Owner != null, "Inventory must have owner to be able to add items synchronously!");
            var msg = new AddItemsMsg();
            msg.OwnerEntityId = inv.Owner.EntityId;
            msg.InventoryIndex = inv.InventoryIdx;
            msg.itemIdx = index;
            msg.Item = objectBuilder;
            msg.Amount = amount;

            Sync.Layer.SendMessageToServer(ref msg, MyTransportMessageEnum.Request);
        }