Ejemplo n.º 1
0
        private void Server_CreateCollection()
        {
            if (!PhotonNetwork.LocalPlayer.IsMasterClient)
            {
                return;
            }

            if (_isPlayerCollection)
            {
                var bridge = GetComponent <PUN2ActionsBridge>();
                if (bridge == null)
                {
                    _logger.Error($"Trying to sync collection to client, but no {nameof(PUN2ActionsBridge)} found on object!", this);
                    return;
                }

                var guid = System.Guid.NewGuid();
                bridge.Server_AddCurrencyCollectionToServerAndClient(
                    //owner: this.photonView,
                    collectionName: _collectionName,
                    collectionGuid: guid
                    );

                bridge.Server_SetCollectionPermissionOnServerAndClient(
                    collectionGuid: guid,
                    permission: _permission
                    );
            }
            else
            {
                collection = PUN2CurrencyCollectionUtility.CreateServerCurrencyCollection(_collectionName, System.Guid.NewGuid(), this.photonView);
            }
        }
Ejemplo n.º 2
0
        public void TargetRpc_AddCurrencyCollection(PhotonView owner, string collectionName, Guid collectionGuid)
        {
            var col = PUN2ActionsBridge.collectionFinder.GetClientCurrencyCollection(collectionGuid);

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