Skip to content

Commit c005c8c

Browse files
committed
feat: social login button prefabs
1 parent 13c9390 commit c005c8c

File tree

9 files changed

+264
-25
lines changed

9 files changed

+264
-25
lines changed

src/Packages/Passport/Samples~/PassportManagerPrefab/PassportManager.cs.meta

Lines changed: 0 additions & 11 deletions
This file was deleted.

src/Packages/Passport/Samples~/PassportManagerPrefab/PassportManager.prefab.meta

Lines changed: 0 additions & 7 deletions
This file was deleted.

src/Packages/Passport/Samples~/PassportManagerPrefab/PassportManagerComplete.prefab.meta

Lines changed: 0 additions & 7 deletions
This file was deleted.
Lines changed: 210 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,210 @@
1+
%YAML 1.1
2+
%TAG !u! tag:unity3d.com,2011:
3+
--- !u!1 &3030878977147371574
4+
GameObject:
5+
m_ObjectHideFlags: 0
6+
m_CorrespondingSourceObject: {fileID: 0}
7+
m_PrefabInstance: {fileID: 0}
8+
m_PrefabAsset: {fileID: 0}
9+
serializedVersion: 6
10+
m_Component:
11+
- component: {fileID: 5383469254285912294}
12+
- component: {fileID: 8118120034820219969}
13+
m_Layer: 0
14+
m_Name: SocialLoginButton
15+
m_TagString: Untagged
16+
m_Icon: {fileID: 0}
17+
m_NavMeshLayer: 0
18+
m_StaticEditorFlags: 0
19+
m_IsActive: 1
20+
--- !u!224 &5383469254285912294
21+
RectTransform:
22+
m_ObjectHideFlags: 0
23+
m_CorrespondingSourceObject: {fileID: 0}
24+
m_PrefabInstance: {fileID: 0}
25+
m_PrefabAsset: {fileID: 0}
26+
m_GameObject: {fileID: 3030878977147371574}
27+
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
28+
m_LocalPosition: {x: 0, y: 0, z: 0}
29+
m_LocalScale: {x: 1, y: 1, z: 1}
30+
m_ConstrainProportionsScale: 0
31+
m_Children:
32+
- {fileID: 5396834757310942789}
33+
- {fileID: 6350029784125664550}
34+
m_Father: {fileID: 0}
35+
m_RootOrder: 0
36+
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
37+
m_AnchorMin: {x: 0.5, y: 0.5}
38+
m_AnchorMax: {x: 0.5, y: 0.5}
39+
m_AnchoredPosition: {x: 0, y: 0}
40+
m_SizeDelta: {x: 100, y: 100}
41+
m_Pivot: {x: 0.5, y: 0.5}
42+
--- !u!114 &8118120034820219969
43+
MonoBehaviour:
44+
m_ObjectHideFlags: 0
45+
m_CorrespondingSourceObject: {fileID: 0}
46+
m_PrefabInstance: {fileID: 0}
47+
m_PrefabAsset: {fileID: 0}
48+
m_GameObject: {fileID: 3030878977147371574}
49+
m_Enabled: 1
50+
m_EditorHideFlags: 0
51+
m_Script: {fileID: 11500000, guid: 538c000c14ccc408ab48fb01c60f7e92, type: 3}
52+
m_Name:
53+
m_EditorClassIdentifier:
54+
provider: 0
55+
iconImage: {fileID: 7285277858836171973}
56+
googleSprite: {fileID: 21300000, guid: d1aa43965074849a2b578ca45194bee4, type: 3}
57+
appleSprite: {fileID: 21300000, guid: 84cd431084f7941fdaee1e5f9115c379, type: 3}
58+
facebookSprite: {fileID: 21300000, guid: 049d78af8f1b1467e905403fb922d6f9, type: 3}
59+
--- !u!1 &3068968175445339070
60+
GameObject:
61+
m_ObjectHideFlags: 0
62+
m_CorrespondingSourceObject: {fileID: 0}
63+
m_PrefabInstance: {fileID: 0}
64+
m_PrefabAsset: {fileID: 0}
65+
serializedVersion: 6
66+
m_Component:
67+
- component: {fileID: 6350029784125664550}
68+
- component: {fileID: 5198070280916859840}
69+
- component: {fileID: 7285277858836171973}
70+
m_Layer: 0
71+
m_Name: Icon
72+
m_TagString: Untagged
73+
m_Icon: {fileID: 0}
74+
m_NavMeshLayer: 0
75+
m_StaticEditorFlags: 0
76+
m_IsActive: 1
77+
--- !u!224 &6350029784125664550
78+
RectTransform:
79+
m_ObjectHideFlags: 0
80+
m_CorrespondingSourceObject: {fileID: 0}
81+
m_PrefabInstance: {fileID: 0}
82+
m_PrefabAsset: {fileID: 0}
83+
m_GameObject: {fileID: 3068968175445339070}
84+
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
85+
m_LocalPosition: {x: 0, y: 0, z: 0}
86+
m_LocalScale: {x: 1, y: 1, z: 1}
87+
m_ConstrainProportionsScale: 0
88+
m_Children: []
89+
m_Father: {fileID: 5383469254285912294}
90+
m_RootOrder: 1
91+
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
92+
m_AnchorMin: {x: 0.5, y: 0.5}
93+
m_AnchorMax: {x: 0.5, y: 0.5}
94+
m_AnchoredPosition: {x: 0, y: 0}
95+
m_SizeDelta: {x: 50, y: 50}
96+
m_Pivot: {x: 0.5, y: 0.5}
97+
--- !u!222 &5198070280916859840
98+
CanvasRenderer:
99+
m_ObjectHideFlags: 0
100+
m_CorrespondingSourceObject: {fileID: 0}
101+
m_PrefabInstance: {fileID: 0}
102+
m_PrefabAsset: {fileID: 0}
103+
m_GameObject: {fileID: 3068968175445339070}
104+
m_CullTransparentMesh: 1
105+
--- !u!114 &7285277858836171973
106+
MonoBehaviour:
107+
m_ObjectHideFlags: 0
108+
m_CorrespondingSourceObject: {fileID: 0}
109+
m_PrefabInstance: {fileID: 0}
110+
m_PrefabAsset: {fileID: 0}
111+
m_GameObject: {fileID: 3068968175445339070}
112+
m_Enabled: 1
113+
m_EditorHideFlags: 0
114+
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
115+
m_Name:
116+
m_EditorClassIdentifier:
117+
m_Material: {fileID: 0}
118+
m_Color: {r: 1, g: 1, b: 1, a: 1}
119+
m_RaycastTarget: 1
120+
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
121+
m_Maskable: 1
122+
m_OnCullStateChanged:
123+
m_PersistentCalls:
124+
m_Calls: []
125+
m_Sprite: {fileID: 21300000, guid: d1aa43965074849a2b578ca45194bee4, type: 3}
126+
m_Type: 0
127+
m_PreserveAspect: 0
128+
m_FillCenter: 1
129+
m_FillMethod: 4
130+
m_FillAmount: 1
131+
m_FillClockwise: 1
132+
m_FillOrigin: 0
133+
m_UseSpriteMesh: 0
134+
m_PixelsPerUnitMultiplier: 1
135+
--- !u!1 &3709145038994036843
136+
GameObject:
137+
m_ObjectHideFlags: 0
138+
m_CorrespondingSourceObject: {fileID: 0}
139+
m_PrefabInstance: {fileID: 0}
140+
m_PrefabAsset: {fileID: 0}
141+
serializedVersion: 6
142+
m_Component:
143+
- component: {fileID: 5396834757310942789}
144+
- component: {fileID: 4807831953047332492}
145+
- component: {fileID: 6082279727818069953}
146+
m_Layer: 0
147+
m_Name: Background
148+
m_TagString: Untagged
149+
m_Icon: {fileID: 0}
150+
m_NavMeshLayer: 0
151+
m_StaticEditorFlags: 0
152+
m_IsActive: 1
153+
--- !u!224 &5396834757310942789
154+
RectTransform:
155+
m_ObjectHideFlags: 0
156+
m_CorrespondingSourceObject: {fileID: 0}
157+
m_PrefabInstance: {fileID: 0}
158+
m_PrefabAsset: {fileID: 0}
159+
m_GameObject: {fileID: 3709145038994036843}
160+
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
161+
m_LocalPosition: {x: 0, y: 0, z: 0}
162+
m_LocalScale: {x: 1, y: 1, z: 1}
163+
m_ConstrainProportionsScale: 0
164+
m_Children: []
165+
m_Father: {fileID: 5383469254285912294}
166+
m_RootOrder: 0
167+
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
168+
m_AnchorMin: {x: 0.5, y: 0.5}
169+
m_AnchorMax: {x: 0.5, y: 0.5}
170+
m_AnchoredPosition: {x: 0, y: 0}
171+
m_SizeDelta: {x: 100, y: 100}
172+
m_Pivot: {x: 0.5, y: 0.5}
173+
--- !u!222 &4807831953047332492
174+
CanvasRenderer:
175+
m_ObjectHideFlags: 0
176+
m_CorrespondingSourceObject: {fileID: 0}
177+
m_PrefabInstance: {fileID: 0}
178+
m_PrefabAsset: {fileID: 0}
179+
m_GameObject: {fileID: 3709145038994036843}
180+
m_CullTransparentMesh: 1
181+
--- !u!114 &6082279727818069953
182+
MonoBehaviour:
183+
m_ObjectHideFlags: 0
184+
m_CorrespondingSourceObject: {fileID: 0}
185+
m_PrefabInstance: {fileID: 0}
186+
m_PrefabAsset: {fileID: 0}
187+
m_GameObject: {fileID: 3709145038994036843}
188+
m_Enabled: 1
189+
m_EditorHideFlags: 0
190+
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
191+
m_Name:
192+
m_EditorClassIdentifier:
193+
m_Material: {fileID: 0}
194+
m_Color: {r: 1, g: 1, b: 1, a: 1}
195+
m_RaycastTarget: 1
196+
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
197+
m_Maskable: 1
198+
m_OnCullStateChanged:
199+
m_PersistentCalls:
200+
m_Calls: []
201+
m_Sprite: {fileID: 21300000, guid: c15a9d198a82242258ec15053a89175f, type: 3}
202+
m_Type: 0
203+
m_PreserveAspect: 0
204+
m_FillCenter: 1
205+
m_FillMethod: 4
206+
m_FillAmount: 1
207+
m_FillClockwise: 1
208+
m_FillOrigin: 0
209+
m_UseSpriteMesh: 0
210+
m_PixelsPerUnitMultiplier: 1
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
using System.Collections;
2+
using System.Collections.Generic;
3+
using UnityEngine;
4+
using UnityEngine.UI;
5+
6+
public class SocialLoginButton : MonoBehaviour
7+
{
8+
9+
public enum Provider
10+
{
11+
Google,
12+
Apple,
13+
Facebook
14+
}
15+
16+
[Header("Select the social provider")]
17+
public Provider provider;
18+
19+
[Header("Reference to the icon Image on the button")]
20+
public Image iconImage;
21+
22+
[Header("Sprites for providers")]
23+
public Sprite googleSprite;
24+
public Sprite appleSprite;
25+
public Sprite facebookSprite;
26+
27+
private void OnValidate()
28+
{
29+
UpdateIcon();
30+
}
31+
32+
private void Awake()
33+
{
34+
UpdateIcon();
35+
}
36+
37+
private void UpdateIcon()
38+
{
39+
if (iconImage == null) return;
40+
41+
switch (provider)
42+
{
43+
case Provider.Google:
44+
iconImage.sprite = googleSprite;
45+
break;
46+
case Provider.Apple:
47+
iconImage.sprite = appleSprite;
48+
break;
49+
case Provider.Facebook:
50+
iconImage.sprite = facebookSprite;
51+
break;
52+
}
53+
}
54+
}
3.26 KB
Loading
7.25 KB
Loading
4.82 KB
Loading
6.1 KB
Loading

0 commit comments

Comments
 (0)