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();
                bridge.Server_AddCurrencyCollectionToServerAndClient(new AddCurrencyCollectionMessage()
                {
                    owner          = _identity,
                    collectionName = _collectionName,
                    collectionGuid = guid,
                });

                bridge.Server_SetCollectionPermissionOnServerAndClient(new SetCollectionPermissionMessage()
                {
                    collectionGuid = guid,
                    permission     = _permission
                });
            }
            else
            {
                collection = UNetCurrencyCollectionUtility.CreateServerCurrencyCollection(_collectionName, System.Guid.NewGuid(), _identity);
            }
        }
Ejemplo n.º 2
0
        public void TargetRpc_AddCurrencyCollection(NetworkConnection target, AddCurrencyCollectionMessage data)
        {
            var col = UNetActionsBridge.collectionFinder.GetClientCurrencyCollection(data.collectionGuid);

            if (col == null)
            {
                col = UNetCurrencyCollectionUtility.CreateClientCurrencyCollection(data.collectionName, data.collectionGuid, data.owner, bridge);
            }
        }