Skip to content

Commit 0bc1203

Browse files
author
盧彥辰
committed
feat: 修改初始建置場景,按鈕狀態轉換
issue #6
1 parent b33f416 commit 0bc1203

File tree

3 files changed

+21
-19
lines changed

3 files changed

+21
-19
lines changed

Assets/Script/Model/GoogleSignIn/GoogleSignInHandler.cs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,6 @@ public class GoogleSignInHandler : MonoBehaviour
2626
/// </summary>
2727
void Awake()
2828
{
29-
//填入ClientID及可以取得id, token
30-
configuration = new GoogleSignInConfiguration
31-
{
32-
WebClientId = "303413321002-osmliudj71vc5e0lqjd8l6mb137v0clj.apps.googleusercontent.com",
33-
RequestIdToken = true
34-
};
35-
3629

3730
if (GameObject.Find("/Canvas/Content/Image/Message").TryGetComponent<Text>(out Text textSerialization))
3831
{
@@ -52,6 +45,16 @@ void Awake()
5245

5346
GoogleLoginButton.interactable = false;
5447
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+
5558
}
5659

5760
/// <summary>
@@ -63,6 +66,7 @@ public void OnSignIn()
6366
{
6467
Debug.Log("GoogleSignIn.Configuration != null");
6568
OnSignOut();
69+
6670
}
6771

6872
GoogleSignIn.Configuration = configuration;
@@ -84,6 +88,9 @@ public void OnSignOut()
8488
Debug.Log("Google Calling SignOut");
8589
GoogleMessageText.text = "Google Calling SignOut";
8690
GoogleSignIn.DefaultInstance.SignOut();
91+
92+
GoogleLoginButton.interactable = true;
93+
GoogleLogoutButton.interactable = false;
8794
}
8895

8996
/// <summary>
@@ -131,6 +138,9 @@ internal void OnAuthenticationFinished(Task<GoogleSignInUser> task)
131138
stringBuilder.Append("Google UserId: " + task.Result.UserId + "\n");
132139

133140
GoogleMessageText.text = stringBuilder.ToString();
141+
142+
GoogleLoginButton.interactable = false;
143+
GoogleLogoutButton.interactable = true;
134144
}
135145
}
136146

@@ -162,14 +172,4 @@ public void OnGamesSignIn()
162172
GoogleSignIn.DefaultInstance.SignIn().ContinueWith(
163173
OnAuthenticationFinished);
164174
}
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-
}
175175
}

ProjectSettings/EditorBuildSettings.asset

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ EditorBuildSettings:
1111
- enabled: 0
1212
path: Assets/Scenes/NewtonsoftDemo.unity
1313
guid: d57548a0db25d42dca4f4b95976c33b3
14-
- enabled: 1
14+
- enabled: 0
1515
path: Assets/Scenes/FbSignIn.unity
1616
guid: 742d6a6f4d2cd4ad4ad2108464e19eb5
17+
- enabled: 1
18+
path: Assets/Scenes/GoogleSignIn.unity
19+
guid: ec6e0f2b7449e4e0b88e4a78cc8bd7ae
1720
m_configObjects: {}

ProjectSettings/GraphicsSettings.asset

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ GraphicsSettings:
3434
- {fileID: 16000, guid: 0000000000000000f000000000000000, type: 0}
3535
- {fileID: 16001, guid: 0000000000000000f000000000000000, type: 0}
3636
- {fileID: 17000, guid: 0000000000000000f000000000000000, type: 0}
37-
- {fileID: 16003, guid: 0000000000000000f000000000000000, type: 0}
3837
m_PreloadedShaders: []
3938
m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000,
4039
type: 0}

0 commit comments

Comments
 (0)