GameService - VirtueSky/sunflower GitHub Wiki
What
- Game service is tools support sign in
With Apple Id
and Google Play Game Service
Use
- Attach
GooglePlayGamesAuthentication
(for Android) and AppleAuthentication
(for iOS) to scene
- Open tab
GameService
in Magic Panel
to install library and add define symbols
public EventNoParam loginEvent;
public StatusLoginVariable statusLoginVariable;
public StringVariable serverCodeVariable;
private void OnEnable()
{
statusLoginVariable.AddListener(OnStatusLoginChange);
}
private void OnStatusLoginChange(StatusLogin obj)
{
switch (statusLoginVariable.Value)
{
case StatusLogin.Successful:
Debug.Log("login successful");
break;
case StatusLogin.Failed:
Debug.Log("login failed");
break;
}
}
[Button]
public void Login()
{
loginEvent.Raise();
}
- After calling
Login
, statusLoginVariable
changes value
Successful
: Login successful and serverCodeVariable
has value
Failed
: Login failed and serverCodeVariable
is empty