asadm / playroom-unity

9 stars 1 forks source link

Non-Upstream Functions Private #73

Closed momintlh closed 1 month ago

momintlh commented 1 month ago
SaadBazaz commented 1 month ago

Removed GetStateFloat in Player class, because there already is GetStateDict

I don't seem to understand how Float and Dict are related 😅

momintlh commented 1 month ago

Removed GetStateFloat in Player class, because there already is GetStateDict

I don't seem to understand how Float and Dict are related 😅

Both functions are doing the same thing, if you check the code GetFloatDict was only for Dictionary<string, float> The other function has generic return type, so it supports that type as well.

momintlh commented 1 month ago

Here's a list of functions which I think might need to be private:

  1. https://github.com/asadm/playroom-unity/blob/647af7bdf0b97cbcbc1a38b849c5b589f65fe7b4/Assets/PlayroomKit/PlayroomKit.cs#L288
  2. https://github.com/asadm/playroom-unity/blob/647af7bdf0b97cbcbc1a38b849c5b589f65fe7b4/Assets/PlayroomKit/PlayroomKit.cs#L302
  3. https://github.com/asadm/playroom-unity/blob/647af7bdf0b97cbcbc1a38b849c5b589f65fe7b4/Assets/PlayroomKit/PlayroomKit.cs#L771
  4. https://github.com/asadm/playroom-unity/blob/647af7bdf0b97cbcbc1a38b849c5b589f65fe7b4/Assets/PlayroomKit/PlayroomKit.cs#L925
  5. https://github.com/asadm/playroom-unity/blob/647af7bdf0b97cbcbc1a38b849c5b589f65fe7b4/Assets/PlayroomKit/PlayroomKit.cs#L1248
  6. https://github.com/asadm/playroom-unity/blob/647af7bdf0b97cbcbc1a38b849c5b589f65fe7b4/Assets/PlayroomKit/PlayroomKit.cs#L1300
  7. https://github.com/asadm/playroom-unity/blob/647af7bdf0b97cbcbc1a38b849c5b589f65fe7b4/Assets/PlayroomKit/PlayroomKit.cs#L1335

Can you check these out and confirm?

GetPlayer() is quite useful with RPC, GetStateDict is for dictionaries (these are not overloaded with GetState<>), and OnQuitWrapperCallback() is inside the player class and it is being used inside the Playroom class so this needs to be public.

SaadBazaz commented 1 month ago

GetPlayer() is quite useful with RPC

Okay that works.

GetStateDict is for dictionaries (these are not overloaded with GetState<>)

Is there a way we can overload it somehow?

OnQuitWrapperCallback() is inside the player class and it is being used inside the Playroom class so this needs to be public.

Is there a way we can hide such functions from end-user (developers) but not from between classes? Maybe there's another access method other than private and public?