Accessing Property Bags

Hi, I have implemented a new operation in Hive room and I am able to Get a custom property however I am seemingly not able to set a custom property through the server. I am not sure why. I am using the method Set() passing the property Key and then Value.
Thanks

Comments

  • Hi, @LeonPS

    why did you decide that value is not set?

    you may see how we update properties in HiveGame.SetProperties which should be called from HandleSetPropertiesOperation method if I remember right

    best,
    ilya
  • Hi Chvetsov, thanks for the response. So I have managed to Get custom properties on the sever and when I set the I can get them on the server however they are not updated on the client. Really not sure why this is?
    Thanks again
  • It's very strange as I can get the values set by the client on the server and if I set them on the server I can get them on the server however the client seems unable to get the value/it isn't changing on the client.
  • probably because you do not trigger an update of properties on clients
    take a look at HiveGame.SetProperties. from there we call PublishResultsAndSetGameProperties method to publish changes

    best,
    ilya
  • LeonPS
    LeonPS
    edited June 2018
    Had quite a bit of thought about using it, I was not sure about it though as I am updating the properties via the server therefore how can I send a Peer. PublishResultsAndSetGameProperties(propertiesUpdateResult, errorMsg, request, peer, sendParameters);

    Also I'm not all that sure about using the SetPropertiesRequest -- I really can't find any documentation about any of it.
    Thanks again,
  • Probably implementation of IPluginHost.SetProperties method will help you. you may find it in HiveHostGame.cs.

    Probably you may use it instead of your implementation

    best,
    ilya
  • Thanks so much, got it working. Just wanted to clarify one thing, if I send an Actor number of 0 for the property request will it be updated on all clients. Also if that actor leaves does the new actor become 0?
  • Hi, @LeonPs

    > if I send an Actor number of 0 for the property request will it be updated on all clients.
    yes, it should be updated. but you should broadcast property change for that.

    >Also if that actor leaves does the new actor become 0?
    no, 0 is reserved. Actor numbers starting from 1

    best,
    ilya