private void NotifyOnCurrencyChanged(object sender, CurrencyChangedResult <double> currencyChangedResult) { if (PhotonNetwork.IsMasterClient /*base.owner.IsServer() /*owner.isServer*/) { var clients = PUN2PermissionsRegistry.collections.GetAllIdentitiesWithPermission(this); foreach (var client in clients) { var actionBridge = client.GetComponent <PUN2ActionsBridge>(); if (actionBridge != null) { logger.LogVerbose($"[Server] PUN2ServerCurrencyCollection - Notify client with ViewID: {actionBridge.photonView.ViewID} of changed currency {currencyChangedResult.currency} on collection: {collectionName}", this); actionBridge.Server_SetCurrencyOnClient( collectionGuid: ID, currencyGuid: currencyChangedResult.currency.ID, amount: currencyChangedResult.amountAfter ); } } } }
private void NotifyOnCurrencyChanged(object sender, CurrencyChangedResult <double> currencyChangedResult) { if (owner.isServer) { var clients = UNetPermissionsRegistry.collections.GetAllIdentitiesWithPermission(this); foreach (var client in clients) { var actionBridge = client.GetComponent <UNetActionsBridge>(); if (actionBridge != null) { logger.LogVerbose($"[Server] Notify client with NetID: {actionBridge.identity.netId} of changed currency {currencyChangedResult.currency} on collection: {collectionName}", this); actionBridge.Server_SetCurrencyOnClient(new CurrencyAmountMessage() { collectionGuid = ID, currencyGuid = currencyChangedResult.currency.ID, amount = currencyChangedResult.amountAfter, }); } } } }