Beispiel #1
0
        private void Server_CreateCollection()
        {
            if (_isPlayerCollection)
            {
                var bridge = GetComponent <UNetActionsBridge>();
                if (bridge == null)
                {
                    _logger.Error($"Trying to sync collection to client, but no {nameof(UNetActionsBridge)} found on object!", this);
                    return;
                }

                var guid = System.Guid.NewGuid();
                collection = bridge.Server_AddCollectionToServerAndClient(new AddCollectionMessage()
                {
                    owner          = _identity,
                    collectionName = _collectionName,
                    collectionGuid = guid,
                    slotCount      = (ushort)slotCount,
                });

                bridge.Server_SetCollectionPermissionOnServerAndClient(new SetCollectionPermissionMessage()
                {
                    collectionGuid = guid,
                    permission     = _permission
                });
            }
            else
            {
                collection = UNetCollectionUtility.CreateServerItemCollection(_slotCount, _collectionName, System.Guid.NewGuid(), _identity);
            }
        }