@@ -26,13 +26,6 @@ public class GoogleSignInHandler : MonoBehaviour
26
26
/// </summary>
27
27
void Awake ( )
28
28
{
29
- //填入ClientID及可以取得id, token
30
- configuration = new GoogleSignInConfiguration
31
- {
32
- WebClientId = "303413321002-osmliudj71vc5e0lqjd8l6mb137v0clj.apps.googleusercontent.com" ,
33
- RequestIdToken = true
34
- } ;
35
-
36
29
37
30
if ( GameObject . Find ( "/Canvas/Content/Image/Message" ) . TryGetComponent < Text > ( out Text textSerialization ) )
38
31
{
@@ -52,6 +45,16 @@ void Awake()
52
45
53
46
GoogleLoginButton . interactable = false ;
54
47
GoogleLogoutButton . interactable = false ;
48
+
49
+ //填入ClientID及可以取得id, token
50
+ configuration = new GoogleSignInConfiguration
51
+ {
52
+ WebClientId = "303413321002-osmliudj71vc5e0lqjd8l6mb137v0clj.apps.googleusercontent.com" ,
53
+ RequestIdToken = true
54
+ } ;
55
+
56
+
57
+
55
58
}
56
59
57
60
/// <summary>
@@ -63,6 +66,7 @@ public void OnSignIn()
63
66
{
64
67
Debug . Log ( "GoogleSignIn.Configuration != null" ) ;
65
68
OnSignOut ( ) ;
69
+
66
70
}
67
71
68
72
GoogleSignIn . Configuration = configuration ;
@@ -84,6 +88,9 @@ public void OnSignOut()
84
88
Debug . Log ( "Google Calling SignOut" ) ;
85
89
GoogleMessageText . text = "Google Calling SignOut" ;
86
90
GoogleSignIn . DefaultInstance . SignOut ( ) ;
91
+
92
+ GoogleLoginButton . interactable = true ;
93
+ GoogleLogoutButton . interactable = false ;
87
94
}
88
95
89
96
/// <summary>
@@ -131,6 +138,9 @@ internal void OnAuthenticationFinished(Task<GoogleSignInUser> task)
131
138
stringBuilder . Append ( "Google UserId: " + task . Result . UserId + "\n " ) ;
132
139
133
140
GoogleMessageText . text = stringBuilder . ToString ( ) ;
141
+
142
+ GoogleLoginButton . interactable = false ;
143
+ GoogleLogoutButton . interactable = true ;
134
144
}
135
145
}
136
146
@@ -162,14 +172,4 @@ public void OnGamesSignIn()
162
172
GoogleSignIn . DefaultInstance . SignIn ( ) . ContinueWith (
163
173
OnAuthenticationFinished ) ;
164
174
}
165
-
166
- /// <summary>
167
- /// 更改按鍵可觸碰與否狀態(Google)
168
- /// </summary>
169
- /// <param name="isEnable"></param>
170
- private void UpdateButtonEnable ( bool _isEnable )
171
- {
172
- Debug . Log ( "Google UpdateButtonEnable: " + _isEnable ) ;
173
- GetComponent < Button > ( ) . enabled = _isEnable ;
174
- }
175
175
}
0 commit comments