Exemplo n.º 1
0
        public static UNetClientCollection <IItemInstance> CreateClientItemCollection(int slotCount, string collectionName, System.Guid collectionGuid, NetworkIdentity owner, UNetActionsBridge playerBridge)
        {
            var collection = new UNetClientCollection <IItemInstance>(owner, playerBridge, slotCount)
            {
                collectionName = collectionName,
                ID             = collectionGuid
            };

            collection.Register();

            // Set permission for this client; If we own it it will be added to the registry list.
            UNetPermissionsRegistry.collections.SetPermission(collection, playerBridge.identity, ReadWritePermission.None);

            _logger.Log($"[Client] Created and registered collection with name {collection.collectionName} and guid {collection.ID} for netID: {owner.netId}", collection);
            return(collection);
        }
Exemplo n.º 2
0
        public static UNetClientCollection <IVendorProduct <IItemInstance> > CreateClientVendorItemCollection(int slotCount, string collectionName, System.Guid collectionGuid, NetworkIdentity owner, UNetActionsBridge playerBridge)
        {
            var collection = new UNetClientCollection <IVendorProduct <IItemInstance> >(owner, playerBridge, slotCount)
            {
                collectionName = collectionName,
                ID             = collectionGuid
            };

            collection.Register();

            // NOTE: Do not give the player read+write access to the vendor collection; That way the client could set items directly into the vendor collection.
            UNetPermissionsRegistry.collections.SetPermission(collection, owner, ReadWritePermission.Read);

            _logger.Log($"[Client] Created and registered vendor item collection with name {collectionName} and guid {collectionGuid} for netID: {owner.netId}", collection);
            return(collection);
        }