/// <summary> /// Apply a Property ,You Can Add or Edit A Property /// </summary> /// <param name="property">The Property You Want To Add or Edit</param> public static void SetProperty(Property property) { if (!IsAvailable) { throw new GameServiceException("GsLiveRealtime is Not Available"); } if (!FiroozehGameService.Core.GameService.GSLive.IsRealTimeAvailable()) { throw new GameServiceException("RealTime is Not Available"); } _propertyHandler.ApplyProperty(CurrentPlayerMemberId, property); var propertyData = new PropertyData(property.PropertyName, property.PropertyData); SenderUtil.NetworkProperty(propertyData, PropertyAction.Apply); }
private static void ApplyProperty(byte action, byte[] data, string ownerId, IPropertyHandler handler) { var actions = (PropertyAction)action; var property = new PropertyData(); GsSerializer.Object.CallReadStream(property, data); switch (actions) { case PropertyAction.Apply: handler.ApplyProperty(ownerId, new Property(property.Name, property.Data)); GsLiveRealtime.Callbacks.OnPropertyEvent?.Invoke(null, new OnPropertyEvent(property.Name, ownerId, actions, property.Data)); break; case PropertyAction.Remove: handler.RemoveProperty(ownerId, property.Name); GsLiveRealtime.Callbacks.OnPropertyEvent?.Invoke(null, new OnPropertyEvent(property.Name, ownerId, actions)); break; default: throw new ArgumentOutOfRangeException(); } }