// [ServerCallback] private void Start() { if (isServer) { collection = UNetCollectionUtility.CreateServerVendorItemCollection(10, _vendorCollectionName, _vendorCollectionGuid.guid, _identity); foreach (var itemDef in _itemDefs) { if (itemDef == null) { continue; } var inst = ItemFactory.CreateInstance(itemDef, Guid.NewGuid()); var prod = new VendorProduct <IItemInstance>(inst, itemDef.buyPrice, itemDef.sellPrice); collection.Add(prod); } } _vendor = new UNetVendor <IItemInstance>(_vendorGuid.guid, _vendorCollectionName, _vendorCollectionGuid.guid, _identity, collection, new InfiniteCurrencyCollection()); // TODO: Make currency customizable if (isServer) { ServerVendorRegistry.itemVendors.Register(_vendorGuid.guid, _vendor); } if (isClient) { VendorRegistry.itemVendors.Register(_vendorGuid.guid, _vendor); } }
public IUNetCollection Server_AddVendorItemCollectionToServer(AddCollectionMessage data) { // NOTE: The collection might already exist server side on the target objects (for example, a trigger) var col = GetServerCollection(data.collectionGuid); if (col == null) { col = UNetCollectionUtility.CreateServerVendorItemCollection(data.slotCount, data.collectionName, data.collectionGuid, data.owner); } return(col); }