UI HUGE UPDATE
This commit is contained in:
@@ -27,6 +27,10 @@ public class friendCardPrefab : MonoBehaviour
|
||||
[Header("offline heibai")]
|
||||
[SerializeField] private Material offline_material;
|
||||
|
||||
[Header("currently chatting")]
|
||||
[SerializeField] private Sprite chattingSprite;
|
||||
[SerializeField] private Sprite normalSprite;
|
||||
|
||||
private Material _profileBorderMaterial;
|
||||
private Material _friendProfileMaterial;
|
||||
private Coroutine _avatarLoadRoutine;
|
||||
@@ -39,11 +43,20 @@ public class friendCardPrefab : MonoBehaviour
|
||||
private Action<string> _openDetails;
|
||||
private Action<string> _openPrivateConversation;
|
||||
private bool _bindingToggle;
|
||||
private Sprite _defaultProfileBorderSprite;
|
||||
private bool _subscribedToChatState;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_profileBorderMaterial = profileBorder != null ? profileBorder.material : null;
|
||||
_friendProfileMaterial = friendProfile != null ? friendProfile.material : null;
|
||||
_defaultProfileBorderSprite = profileBorder != null ? profileBorder.sprite : null;
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
SubscribeChatState();
|
||||
RefreshChattingVisual();
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
@@ -55,6 +68,12 @@ public class friendCardPrefab : MonoBehaviour
|
||||
}
|
||||
|
||||
ReleaseRuntimeAvatarResources();
|
||||
UnsubscribeChatState();
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
UnsubscribeChatState();
|
||||
}
|
||||
|
||||
public void Bind(FriendCardViewData data, Action<string, bool> onStarChanged, Action<string> onOpenDetails, Action<string> onOpenPrivateConversation)
|
||||
@@ -102,6 +121,8 @@ public class friendCardPrefab : MonoBehaviour
|
||||
StopCoroutine(_avatarLoadRoutine);
|
||||
}
|
||||
_avatarLoadRoutine = StartCoroutine(LoadAvatarRoutine(data));
|
||||
|
||||
RefreshChattingVisual();
|
||||
}
|
||||
|
||||
private void HandleStarToggleChanged(bool isOn)
|
||||
@@ -143,6 +164,53 @@ public class friendCardPrefab : MonoBehaviour
|
||||
{
|
||||
friendProfile.material = profileMaterial;
|
||||
}
|
||||
|
||||
RefreshChattingVisual();
|
||||
}
|
||||
|
||||
private void SubscribeChatState()
|
||||
{
|
||||
if (_subscribedToChatState)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
globalChatSystem.ActivePrivateConversationChanged += HandleActivePrivateConversationChanged;
|
||||
_subscribedToChatState = true;
|
||||
}
|
||||
|
||||
private void UnsubscribeChatState()
|
||||
{
|
||||
if (!_subscribedToChatState)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
globalChatSystem.ActivePrivateConversationChanged -= HandleActivePrivateConversationChanged;
|
||||
_subscribedToChatState = false;
|
||||
}
|
||||
|
||||
private void HandleActivePrivateConversationChanged(string _)
|
||||
{
|
||||
RefreshChattingVisual();
|
||||
}
|
||||
|
||||
private void RefreshChattingVisual()
|
||||
{
|
||||
if (profileBorder == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
bool isCurrentPrivateTarget = globalChatSystem.IsViewingPrivateConversation(_steamId);
|
||||
Sprite targetSprite = isCurrentPrivateTarget
|
||||
? (chattingSprite != null ? chattingSprite : normalSprite)
|
||||
: (normalSprite != null ? normalSprite : _defaultProfileBorderSprite);
|
||||
|
||||
if (targetSprite != null)
|
||||
{
|
||||
profileBorder.sprite = targetSprite;
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerator LoadAvatarRoutine(FriendCardViewData data)
|
||||
|
||||
@@ -119,8 +119,8 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0.8834}
|
||||
m_SizeDelta: {x: 0, y: -1.7668}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &7327486215132614031
|
||||
CanvasRenderer:
|
||||
@@ -143,7 +143,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
|
||||
m_Color: {r: 0.54901963, g: 0.3529412, b: 0.09411765, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
@@ -151,8 +151,8 @@ MonoBehaviour:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_FontData:
|
||||
m_Font: {fileID: 12800000, guid: bc54bd51ea8b84448ba1b65311872862, type: 3}
|
||||
m_FontSize: 14
|
||||
m_Font: {fileID: 12800000, guid: d254d20d93651ae448ff13d10dff30ab, type: 3}
|
||||
m_FontSize: 15
|
||||
m_FontStyle: 0
|
||||
m_BestFit: 0
|
||||
m_MinSize: 1
|
||||
@@ -230,8 +230,8 @@ MonoBehaviour:
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 21300000, guid: e2c536559de04a84bae8d1e1752633e7, type: 3}
|
||||
m_Type: 0
|
||||
m_Sprite: {fileID: 21300000, guid: c11bc9633cbeb384498dffc7701810cd, type: 3}
|
||||
m_Type: 1
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
@@ -298,7 +298,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
@@ -453,6 +453,8 @@ MonoBehaviour:
|
||||
isStarFriend: {fileID: 6035437394128710287}
|
||||
friendOffline_blackMask: {fileID: 7553350037342771812}
|
||||
offline_material: {fileID: 2100000, guid: 7701c15f96b443d408ac83222c9b869a, type: 2}
|
||||
chattingSprite: {fileID: 21300000, guid: d21d271b6bfa1b14fbfe7f66f86336f7, type: 3}
|
||||
normalSprite: {fileID: 21300000, guid: 3da9887018b7160418ba2ffc7eb426d4, type: 3}
|
||||
--- !u!1 &2767911455405563055
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -489,8 +491,8 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 88.483, y: -27.128}
|
||||
m_SizeDelta: {x: 79.168, y: 25.744}
|
||||
m_AnchoredPosition: {x: 88.483, y: -28.206614}
|
||||
m_SizeDelta: {x: 79.168, y: 27.9011}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &5476373932116253543
|
||||
CanvasRenderer:
|
||||
@@ -520,8 +522,8 @@ MonoBehaviour:
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 21300000, guid: 9bc3fa56d039611458eeaa6637e47a1c, type: 3}
|
||||
m_Type: 1
|
||||
m_Sprite: {fileID: 21300000, guid: 9dcab5132d08efb4d981e8795f5b4bef, type: 3}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
@@ -608,8 +610,8 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0.6237}
|
||||
m_SizeDelta: {x: 0, y: -1.2472}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &4946082784691209714
|
||||
CanvasRenderer:
|
||||
@@ -632,7 +634,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
|
||||
m_Color: {r: 0.09803922, g: 0.32941177, b: 0.6, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
@@ -640,8 +642,8 @@ MonoBehaviour:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_FontData:
|
||||
m_Font: {fileID: 12800000, guid: bc54bd51ea8b84448ba1b65311872862, type: 3}
|
||||
m_FontSize: 14
|
||||
m_Font: {fileID: 12800000, guid: d254d20d93651ae448ff13d10dff30ab, type: 3}
|
||||
m_FontSize: 15
|
||||
m_FontStyle: 0
|
||||
m_BestFit: 0
|
||||
m_MinSize: 1
|
||||
@@ -921,8 +923,8 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 173, y: -27.128}
|
||||
m_SizeDelta: {x: 79.168, y: 25.744}
|
||||
m_AnchoredPosition: {x: 173, y: -27.789886}
|
||||
m_SizeDelta: {x: 79.168, y: 27.0669}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &5483242628005795134
|
||||
CanvasRenderer:
|
||||
@@ -952,7 +954,7 @@ MonoBehaviour:
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 21300000, guid: ecdc06bf2954ac64a9447a76825dd902, type: 3}
|
||||
m_Sprite: {fileID: 21300000, guid: 51e58a5536bbaac47bcc2942875d4b17, type: 3}
|
||||
m_Type: 1
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
@@ -1064,15 +1066,15 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 0, g: 0, b: 0, a: 0.78431374}
|
||||
m_Color: {r: 0, g: 0, b: 0, a: 0.19607843}
|
||||
m_RaycastTarget: 0
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 21300000, guid: e2c536559de04a84bae8d1e1752633e7, type: 3}
|
||||
m_Type: 0
|
||||
m_Sprite: {fileID: 21300000, guid: d21d271b6bfa1b14fbfe7f66f86336f7, type: 3}
|
||||
m_Type: 1
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
@@ -1139,7 +1141,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
|
||||
@@ -34,8 +34,8 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 30.39, y: -4}
|
||||
m_SizeDelta: {x: 143.18, y: 12.573}
|
||||
m_AnchoredPosition: {x: 30.39, y: -2.7}
|
||||
m_SizeDelta: {x: 143.18, y: 11.216}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &7766852143305575412
|
||||
CanvasRenderer:
|
||||
@@ -115,8 +115,8 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: -9.2046, y: -17.465}
|
||||
m_SizeDelta: {x: 63.9929, y: 17.071}
|
||||
m_AnchoredPosition: {x: -9.2046, y: -18.441}
|
||||
m_SizeDelta: {x: 63.9929, y: 19.0228}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &752898224887842841
|
||||
CanvasRenderer:
|
||||
@@ -139,15 +139,15 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 0.4198113, g: 1, b: 0.5353115, a: 1}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 21300000, guid: 7f3b1220317607e44bbb8f0e1998044a, type: 3}
|
||||
m_Type: 1
|
||||
m_Sprite: {fileID: 21300000, guid: 339aa1c69b6ac86429db52c478d9affc, type: 3}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
@@ -240,7 +240,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 220, y: 70}
|
||||
m_SizeDelta: {x: 220, y: 80}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &8398379083156494532
|
||||
CanvasRenderer:
|
||||
@@ -270,7 +270,7 @@ MonoBehaviour:
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 21300000, guid: 537c5cf3bf53c2f4a9404248acd2d336, type: 3}
|
||||
m_Sprite: {fileID: 21300000, guid: fdf9576f0470ca144ae19e6cd41ec750, type: 3}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
@@ -389,8 +389,8 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: -1.7067986, y: 1.0861998}
|
||||
m_SizeDelta: {x: -3.4136, y: -2.1722}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &4345137299206345491
|
||||
CanvasRenderer:
|
||||
@@ -413,7 +413,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
|
||||
m_Color: {r: 0.09803922, g: 0.32941177, b: 0.6, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
@@ -421,8 +421,8 @@ MonoBehaviour:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_FontData:
|
||||
m_Font: {fileID: 12800000, guid: bd4be44636ad6c24a9b117a7108a75e9, type: 3}
|
||||
m_FontSize: 10
|
||||
m_Font: {fileID: 12800000, guid: d254d20d93651ae448ff13d10dff30ab, type: 3}
|
||||
m_FontSize: 12
|
||||
m_FontStyle: 0
|
||||
m_BestFit: 0
|
||||
m_MinSize: 1
|
||||
@@ -469,7 +469,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 100, y: 100}
|
||||
m_SizeDelta: {x: 220, y: 80}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &2770649873537820046
|
||||
MonoBehaviour:
|
||||
@@ -522,7 +522,7 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 30.39, y: 14}
|
||||
m_AnchoredPosition: {x: 30.39, y: 14.9}
|
||||
m_SizeDelta: {x: 143.18, y: 26}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &3709975975265226361
|
||||
@@ -603,8 +603,8 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 63.383705, y: -17.465}
|
||||
m_SizeDelta: {x: 62.1074, y: 17.071}
|
||||
m_AnchoredPosition: {x: 63.383705, y: -18.441}
|
||||
m_SizeDelta: {x: 62.1074, y: 19.0228}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &9058361928411038020
|
||||
CanvasRenderer:
|
||||
@@ -627,15 +627,15 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 0.7684825, b: 0.759434, a: 1}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 21300000, guid: 7f3b1220317607e44bbb8f0e1998044a, type: 3}
|
||||
m_Type: 1
|
||||
m_Sprite: {fileID: 21300000, guid: 51e58a5536bbaac47bcc2942875d4b17, type: 3}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
@@ -722,8 +722,8 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: -1.7068, y: 1.0862}
|
||||
m_SizeDelta: {x: -3.4137, y: -2.1722}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &3245753848347248243
|
||||
CanvasRenderer:
|
||||
@@ -746,7 +746,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
|
||||
m_Color: {r: 0.54901963, g: 0.3529412, b: 0.09411765, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
@@ -754,8 +754,8 @@ MonoBehaviour:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_FontData:
|
||||
m_Font: {fileID: 12800000, guid: bd4be44636ad6c24a9b117a7108a75e9, type: 3}
|
||||
m_FontSize: 10
|
||||
m_Font: {fileID: 12800000, guid: d254d20d93651ae448ff13d10dff30ab, type: 3}
|
||||
m_FontSize: 12
|
||||
m_FontStyle: 0
|
||||
m_BestFit: 0
|
||||
m_MinSize: 1
|
||||
|
||||
@@ -64,6 +64,7 @@ public class friendSystem : MonoBehaviour
|
||||
|
||||
[Header("text")]
|
||||
public Text defaultText;
|
||||
public Text onlineFriendsCountText;
|
||||
|
||||
[Header("sync")]
|
||||
[SerializeField] private float steamFriendResyncIntervalSeconds = 8f;
|
||||
@@ -88,8 +89,10 @@ public class friendSystem : MonoBehaviour
|
||||
private bool _dropdownInitialized;
|
||||
private bool _isRefreshing;
|
||||
private bool _lastRefreshFailed;
|
||||
private bool _hasResolvedFriendCounts;
|
||||
private Coroutine _resyncCoroutine;
|
||||
private bool _languageSubscribed;
|
||||
private bool _chatStateSubscribed;
|
||||
private static List<string> _startupSteamFriendIds = new List<string>();
|
||||
|
||||
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
|
||||
@@ -102,9 +105,12 @@ public class friendSystem : MonoBehaviour
|
||||
{
|
||||
LocalizationService.EnsureInitialized();
|
||||
ClearDisplayedFriends();
|
||||
_hasResolvedFriendCounts = false;
|
||||
SetDefaultText(DefaultStatusLoading);
|
||||
UpdateOnlineFriendsCountText();
|
||||
InitializeDropdown();
|
||||
SubscribeLanguageChanged();
|
||||
SubscribeChatStateChanged();
|
||||
|
||||
if (ArenaRoomService.Instance != null)
|
||||
{
|
||||
@@ -122,6 +128,7 @@ public class friendSystem : MonoBehaviour
|
||||
private void OnDisable()
|
||||
{
|
||||
UnsubscribeLanguageChanged();
|
||||
UnsubscribeChatStateChanged();
|
||||
if (ArenaRoomService.Instance != null)
|
||||
{
|
||||
ArenaRoomService.Instance.OnFriendsListChanged -= HandleFriendsListChanged;
|
||||
@@ -199,6 +206,7 @@ public class friendSystem : MonoBehaviour
|
||||
&& friendsTask.Result != null
|
||||
&& friendsTask.Result.success)
|
||||
{
|
||||
_hasResolvedFriendCounts = true;
|
||||
ReplaceGameFriends(friendsTask.Result.friends);
|
||||
}
|
||||
else
|
||||
@@ -266,6 +274,7 @@ public class friendSystem : MonoBehaviour
|
||||
private void HandleFriendsListChanged(IReadOnlyList<SocialFriendEntry> friends)
|
||||
{
|
||||
_lastRefreshFailed = false;
|
||||
_hasResolvedFriendCounts = true;
|
||||
RefreshSteamFriendCache();
|
||||
ReplaceGameFriends(friends);
|
||||
Render();
|
||||
@@ -428,6 +437,7 @@ public class friendSystem : MonoBehaviour
|
||||
if (friendsDisplayContent == null || friendCardPrefab == null)
|
||||
{
|
||||
SetDefaultText(DefaultStatusServiceUnavailable);
|
||||
UpdateOnlineFriendsCountText();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -467,6 +477,7 @@ public class friendSystem : MonoBehaviour
|
||||
}
|
||||
|
||||
UpdateDefaultTextState(target.Count);
|
||||
UpdateOnlineFriendsCountText();
|
||||
}
|
||||
|
||||
private void UpdateDefaultTextState(int visibleCount)
|
||||
@@ -496,6 +507,32 @@ public class friendSystem : MonoBehaviour
|
||||
defaultText.text = message ?? string.Empty;
|
||||
}
|
||||
|
||||
private void UpdateOnlineFriendsCountText()
|
||||
{
|
||||
if (onlineFriendsCountText == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_hasResolvedFriendCounts)
|
||||
{
|
||||
onlineFriendsCountText.text = "-/-";
|
||||
return;
|
||||
}
|
||||
|
||||
int totalCount = _mergedFriends.Count;
|
||||
int onlineCount = 0;
|
||||
foreach (FriendCardViewData friend in _mergedFriends.Values)
|
||||
{
|
||||
if (friend != null && friend.IsOnline)
|
||||
{
|
||||
onlineCount++;
|
||||
}
|
||||
}
|
||||
|
||||
onlineFriendsCountText.text = $"{onlineCount}/{totalCount}";
|
||||
}
|
||||
|
||||
private IEnumerable<FriendCardViewData> ApplyFilter(IEnumerable<FriendCardViewData> source)
|
||||
{
|
||||
FriendFilterType filter = GetSelectedFilter();
|
||||
@@ -571,6 +608,38 @@ public class friendSystem : MonoBehaviour
|
||||
globalChatSystem.OpenPrivateConversation(steamId);
|
||||
}
|
||||
|
||||
private void SubscribeChatStateChanged()
|
||||
{
|
||||
if (_chatStateSubscribed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
globalChatSystem.ActivePrivateConversationChanged += HandleActivePrivateConversationChanged;
|
||||
_chatStateSubscribed = true;
|
||||
}
|
||||
|
||||
private void UnsubscribeChatStateChanged()
|
||||
{
|
||||
if (!_chatStateSubscribed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
globalChatSystem.ActivePrivateConversationChanged -= HandleActivePrivateConversationChanged;
|
||||
_chatStateSubscribed = false;
|
||||
}
|
||||
|
||||
private void HandleActivePrivateConversationChanged(string _)
|
||||
{
|
||||
if (!isActiveAndEnabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Render();
|
||||
}
|
||||
|
||||
private void SubscribeLanguageChanged()
|
||||
{
|
||||
if (_languageSubscribed)
|
||||
|
||||
Reference in New Issue
Block a user