UI HUGE UPDATE
This commit is contained in:
+3634
-1156
File diff suppressed because it is too large
Load Diff
@@ -67,7 +67,7 @@ MonoBehaviour:
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 21300000, guid: 9ebd9ce7600225b48a92c3900b8188fc, type: 3}
|
||||
m_Sprite: {fileID: 21300000, guid: 1db9c5e742decc64d90388cdf42a2ddd, type: 3}
|
||||
m_Type: 1
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
@@ -386,6 +386,9 @@ MonoBehaviour:
|
||||
songScore: {fileID: 7919000474169282653}
|
||||
songRankImg: {fileID: 122816322594050325}
|
||||
rc: {fileID: 11400000, guid: 951debb97a9b89f48885c82bb601533a, type: 2}
|
||||
unreadableScoreColor: {r: 1, g: 0.3254717, b: 0.3254717, a: 1}
|
||||
earlySettlementScoreColor: {r: 0.8490566, g: 0.39716104, b: 0.0040049935, a: 1}
|
||||
normalReadableScoreColor: {r: 0.4074214, g: 0.990566, b: 0.3317462, a: 1}
|
||||
--- !u!1 &6079840058504322514
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -603,7 +606,7 @@ MonoBehaviour:
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6988015895875826385}
|
||||
m_Enabled: 1
|
||||
m_Enabled: 0
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
@@ -683,7 +686,7 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Material: {fileID: 2100000, guid: 89d2e49d1a4e8c54bad205978c63a672, type: 2}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
|
||||
@@ -15,8 +15,11 @@ public class ghPrefab : MonoBehaviour
|
||||
[Header("rank config")]
|
||||
public RankConfig rc;
|
||||
|
||||
private static readonly Color EarlySettlementColor = new Color32(204, 51, 51, 255);
|
||||
private static readonly Color BrightScoreColor = new Color32(124, 255, 107, 255);
|
||||
[Header("song score colors")]
|
||||
[SerializeField] private Color unreadableScoreColor = Color.black;
|
||||
[SerializeField] private Color earlySettlementScoreColor = new Color32(204, 51, 51, 255);
|
||||
[SerializeField] private Color normalReadableScoreColor = new Color32(124, 255, 107, 255);
|
||||
|
||||
private const string UnreadableText = "\u65e0\u6cd5\u8bfb\u53d6";
|
||||
|
||||
public void Setup(RecentPlayRecord record, SongData songData)
|
||||
@@ -59,18 +62,18 @@ public class ghPrefab : MonoBehaviour
|
||||
if (!record.scoreReadable)
|
||||
{
|
||||
songScore.text = UnreadableText;
|
||||
songScore.color = Color.black;
|
||||
songScore.color = unreadableScoreColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
songScore.text = record.totalScore.ToString();
|
||||
if (record.wasEarlySettlement)
|
||||
{
|
||||
songScore.color = EarlySettlementColor;
|
||||
songScore.color = earlySettlementScoreColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
songScore.color = BrightScoreColor;
|
||||
songScore.color = normalReadableScoreColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -104,7 +107,7 @@ public class ghPrefab : MonoBehaviour
|
||||
if (songScore != null)
|
||||
{
|
||||
songScore.text = UnreadableText;
|
||||
songScore.color = Color.black;
|
||||
songScore.color = unreadableScoreColor;
|
||||
}
|
||||
|
||||
if (songRankImg != null)
|
||||
|
||||
@@ -2,5 +2,90 @@ using UnityEngine;
|
||||
|
||||
public class uHonor : MonoBehaviour
|
||||
{
|
||||
|
||||
public enum HonorPrefabType
|
||||
{
|
||||
Normal,
|
||||
Bronze,
|
||||
Silver,
|
||||
Gold
|
||||
}
|
||||
|
||||
[Header("Honor Prefabs")]
|
||||
[SerializeField] private GameObject normalHonorPrefab;
|
||||
[SerializeField] private GameObject bronzeHonorPrefab;
|
||||
[SerializeField] private GameObject silverHonorPrefab;
|
||||
[SerializeField] private GameObject goldHonorPrefab;
|
||||
|
||||
[Header("Honor Parent")]
|
||||
[SerializeField] private Transform honorParent;
|
||||
|
||||
public Transform HonorParent => honorParent;
|
||||
|
||||
public void ClearHonors()
|
||||
{
|
||||
if (honorParent == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = honorParent.childCount - 1; i >= 0; i--)
|
||||
{
|
||||
Transform child = honorParent.GetChild(i);
|
||||
if (child != null)
|
||||
{
|
||||
Destroy(child.gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public GameObject SpawnHonor(HonorPrefabType prefabType)
|
||||
{
|
||||
if (honorParent == null)
|
||||
{
|
||||
Debug.LogWarning("[uHonor] honorParent is not assigned.");
|
||||
return null;
|
||||
}
|
||||
|
||||
GameObject prefab = GetHonorPrefab(prefabType);
|
||||
if (prefab == null)
|
||||
{
|
||||
Debug.LogWarning($"[uHonor] Honor prefab for type {prefabType} is not assigned.");
|
||||
return null;
|
||||
}
|
||||
|
||||
return Instantiate(prefab, honorParent);
|
||||
}
|
||||
|
||||
public GameObject SpawnHonor(GameObject prefab)
|
||||
{
|
||||
if (honorParent == null)
|
||||
{
|
||||
Debug.LogWarning("[uHonor] honorParent is not assigned.");
|
||||
return null;
|
||||
}
|
||||
|
||||
if (prefab == null)
|
||||
{
|
||||
Debug.LogWarning("[uHonor] Requested prefab is null.");
|
||||
return null;
|
||||
}
|
||||
|
||||
return Instantiate(prefab, honorParent);
|
||||
}
|
||||
|
||||
public GameObject GetHonorPrefab(HonorPrefabType prefabType)
|
||||
{
|
||||
switch (prefabType)
|
||||
{
|
||||
case HonorPrefabType.Gold:
|
||||
return goldHonorPrefab != null ? goldHonorPrefab : normalHonorPrefab;
|
||||
case HonorPrefabType.Silver:
|
||||
return silverHonorPrefab != null ? silverHonorPrefab : normalHonorPrefab;
|
||||
case HonorPrefabType.Bronze:
|
||||
return bronzeHonorPrefab != null ? bronzeHonorPrefab : normalHonorPrefab;
|
||||
case HonorPrefabType.Normal:
|
||||
default:
|
||||
return normalHonorPrefab;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,13 +20,16 @@ public class uLevel : MonoBehaviour
|
||||
[Header("so")]
|
||||
public Player_SO pso;
|
||||
|
||||
private GameObject resolvedLevelPanelRoot;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
if (pso == null)
|
||||
pso = Resources.Load<Player_SO>("playerdata/playerData_uniqueData");
|
||||
|
||||
if (uLevelPanel != null)
|
||||
uLevelPanel.SetActive(false);
|
||||
resolvedLevelPanelRoot = ResolveLevelPanelRoot();
|
||||
if (resolvedLevelPanelRoot != null)
|
||||
resolvedLevelPanelRoot.SetActive(false);
|
||||
|
||||
if (uls != null && pso != null)
|
||||
uls.SetPlayerSo(pso);
|
||||
@@ -46,18 +49,42 @@ public class uLevel : MonoBehaviour
|
||||
|
||||
private void OpenLevelDetailPanel()
|
||||
{
|
||||
if (uLevelPanel == null)
|
||||
GameObject panelRoot = ResolveLevelPanelRoot();
|
||||
if (panelRoot == null)
|
||||
return;
|
||||
|
||||
if (uls != null && pso != null)
|
||||
uls.SetPlayerSo(pso);
|
||||
|
||||
uLevelPanel.SetActive(true);
|
||||
panelRoot.SetActive(true);
|
||||
}
|
||||
|
||||
private void CloseLevelDetailPanel()
|
||||
{
|
||||
if (uLevelPanel != null)
|
||||
uLevelPanel.SetActive(false);
|
||||
GameObject panelRoot = ResolveLevelPanelRoot();
|
||||
if (panelRoot != null)
|
||||
panelRoot.SetActive(false);
|
||||
}
|
||||
|
||||
private GameObject ResolveLevelPanelRoot()
|
||||
{
|
||||
if (uLevelPanel == null)
|
||||
return null;
|
||||
|
||||
Transform current = uLevelPanel.transform;
|
||||
GameObject highestInactiveAncestor = null;
|
||||
|
||||
while (current != null)
|
||||
{
|
||||
if (!current.gameObject.activeSelf)
|
||||
{
|
||||
highestInactiveAncestor = current.gameObject;
|
||||
}
|
||||
|
||||
current = current.parent;
|
||||
}
|
||||
|
||||
resolvedLevelPanelRoot = highestInactiveAncestor != null ? highestInactiveAncestor : uLevelPanel;
|
||||
return resolvedLevelPanelRoot;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -230,7 +230,26 @@ public class uBehaviourRaderController : MonoBehaviour
|
||||
return;
|
||||
}
|
||||
|
||||
uRaderObj.SetActive(!hideWhenOverlayVisible || !overlayVisible);
|
||||
bool shouldShow = !hideWhenOverlayVisible || !overlayVisible;
|
||||
bool wasActive = uRaderObj.activeSelf;
|
||||
uRaderObj.SetActive(shouldShow);
|
||||
|
||||
if (shouldShow && !wasActive)
|
||||
{
|
||||
ForceRefreshChartBridge();
|
||||
}
|
||||
}
|
||||
|
||||
private void ForceRefreshChartBridge()
|
||||
{
|
||||
if (chartBridge == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
chartBridge.enabled = false;
|
||||
chartBridge.enabled = true;
|
||||
chartBridge.Refresh();
|
||||
}
|
||||
|
||||
private void ApplySummary(BehaviourRadarSummary summary)
|
||||
|
||||
@@ -6,6 +6,7 @@ public class uRecentGameHistory : MonoBehaviour
|
||||
{
|
||||
private const string SongResourcesPath = "song_songIndex";
|
||||
private const int MaxVisibleRecordCount = 5;
|
||||
private const float DefaultPrefabScaleRatio = 1.25f;
|
||||
|
||||
[Header("gameobjects")]
|
||||
public GameObject gameHistoryPrefab;
|
||||
@@ -13,6 +14,9 @@ public class uRecentGameHistory : MonoBehaviour
|
||||
public Transform dGameHistoryParent;
|
||||
public GameObject more_gameHistory;
|
||||
|
||||
[Header("layout")]
|
||||
public float prefabScaleRatio = DefaultPrefabScaleRatio;
|
||||
|
||||
[Header("buttons")]
|
||||
public Button more_gameHistoryButton;
|
||||
public Button shut_gameHistoryButton;
|
||||
@@ -71,6 +75,7 @@ public class uRecentGameHistory : MonoBehaviour
|
||||
}
|
||||
|
||||
GameObject instance = Instantiate(gameHistoryPrefab, gameHistoryParent);
|
||||
instance.transform.localScale *= prefabScaleRatio;
|
||||
previewEntries.Add(instance);
|
||||
ghPrefab controller = instance.GetComponent<ghPrefab>();
|
||||
if (controller == null)
|
||||
|
||||
@@ -23,6 +23,7 @@ public class uServerStatus : MonoBehaviour
|
||||
{
|
||||
Good,
|
||||
Fair,
|
||||
Maintenance,
|
||||
Unreachable,
|
||||
Unknown,
|
||||
Offline,
|
||||
@@ -42,4 +43,4 @@ public class uServerStatus : MonoBehaviour
|
||||
}
|
||||
Debug.LogWarning($"No configuration found for status {newStatus}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,16 +25,16 @@ RectTransform:
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2099462153568767799}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 9152270112823009895}
|
||||
m_Father: {fileID: 950592153268522309}
|
||||
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: -107.33, y: 0}
|
||||
m_AnchoredPosition: {x: 0.000076293945, y: 0}
|
||||
m_SizeDelta: {x: 25.792, y: 30}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &3192217589302937993
|
||||
@@ -110,13 +110,13 @@ RectTransform:
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 2290428063649654242}
|
||||
- {fileID: 665396819362690529}
|
||||
- {fileID: 950592153268522309}
|
||||
m_Father: {fileID: 2460305581810160109}
|
||||
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: 0, y: 1.438}
|
||||
m_SizeDelta: {x: 250, y: 41.908}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 112, y: 78}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &4801688296739999581
|
||||
CanvasRenderer:
|
||||
@@ -139,14 +139,14 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 0.20784314, g: 0.20784314, b: 0.20784314, 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_Sprite: {fileID: 2431842851596413817, guid: 1c44c4ee89bcfec498a4d658400f208a, type: 3}
|
||||
m_Type: 1
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
@@ -155,7 +155,7 @@ MonoBehaviour:
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 2
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!1 &3339470438795980614
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -190,8 +190,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: 1.4, y: 0}
|
||||
m_SizeDelta: {x: 187.733, y: 30}
|
||||
m_AnchoredPosition: {x: 0, y: 10.5513}
|
||||
m_SizeDelta: {x: 100, y: 51.1027}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &4129409205783608839
|
||||
CanvasRenderer:
|
||||
@@ -214,7 +214,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_Color: {r: 0.60784316, g: 0.32941177, b: 0.003921569, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
@@ -270,7 +270,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: 450, y: 30}
|
||||
m_SizeDelta: {x: 112, y: 78}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &7517620086478948793
|
||||
MonoBehaviour:
|
||||
@@ -284,13 +284,90 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 427d68583c7d9ab4588888b68dc7a8d2, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
enableSprite: {fileID: -52179173452712981, guid: be120bf969ae2c84fa997ecca6dd28e6, type: 3}
|
||||
availableSprite: {fileID: 2561534620446350566, guid: 23a48ca1e983a4c47971fcf7eab26b89, type: 3}
|
||||
lockedSprite: {fileID: -1936355827857895663, guid: fa360ec6245a3dd43bfbae1ac1093a6e, type: 3}
|
||||
unknownSprite: {fileID: 21300000, guid: 931f6455943555649a61ed7f1c76cbf6, type: 3}
|
||||
preSelectSprite: {fileID: 7919194353434859991, guid: b35fcaa46fa9f3e49b71c103f69df698, type: 3}
|
||||
levelName: {fileID: 5556623676502886536}
|
||||
levelid_btm: {fileID: 1797368805590350891}
|
||||
statusImg: {fileID: 4501378674247754304}
|
||||
thisSkillName: {fileID: 534678815217464394}
|
||||
lockedStatusSprite: {fileID: 21300000, guid: 1db9c5e742decc64d90388cdf42a2ddd, type: 3}
|
||||
selectableSkillNameColor: {r: 0.60784316, g: 0.32941177, b: 0.003921569, a: 1}
|
||||
unavailableSkillNameColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
descriptionPrefab: {fileID: 2219571326304505587, guid: bde76837f913f3943836d4f83292618b, type: 3}
|
||||
descriptionOffsetX: 150
|
||||
grayScale_mtr: {fileID: 2100000, guid: 7701c15f96b443d408ac83222c9b869a, type: 2}
|
||||
preselectPulseDuration: 0.8
|
||||
--- !u!1 &6679998157231271007
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 950592153268522309}
|
||||
- component: {fileID: 3326397657410343546}
|
||||
- component: {fileID: 1797368805590350891}
|
||||
m_Layer: 5
|
||||
m_Name: btm
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &950592153268522309
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6679998157231271007}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 665396819362690529}
|
||||
m_Father: {fileID: 9152270112823009895}
|
||||
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: -0.000045776, y: -23.9}
|
||||
m_SizeDelta: {x: 27, y: 27}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &3326397657410343546
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6679998157231271007}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &1797368805590350891
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6679998157231271007}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
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: 2982543398555147169, guid: d5a84007aeafd7541bec38343df979ac, type: 3}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
|
||||
@@ -5,32 +5,44 @@ using System.Collections;
|
||||
|
||||
public class lrPrefab : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler, IPointerClickHandler
|
||||
{
|
||||
[Header("sprite")]
|
||||
public Sprite enableSprite;
|
||||
public Sprite availableSprite;
|
||||
public Sprite lockedSprite;
|
||||
public Sprite unknownSprite;
|
||||
public Sprite preSelectSprite;
|
||||
|
||||
[Header("uis")]
|
||||
public Text levelName;
|
||||
public Image levelid_btm;
|
||||
public Image statusImg;
|
||||
public Text thisSkillName;
|
||||
|
||||
[Header("state visuals")]
|
||||
public Sprite lockedStatusSprite;
|
||||
public Color selectableSkillNameColor = Color.white;
|
||||
public Color unavailableSkillNameColor = Color.gray;
|
||||
|
||||
[Header("desOBJ")]
|
||||
public GameObject descriptionPrefab;
|
||||
public float descriptionOffsetX = 80f;
|
||||
|
||||
[Header("material")]
|
||||
public Material grayScale_mtr;
|
||||
|
||||
[Header("preselect pulse")]
|
||||
public float preselectPulseDuration = 0.8f;
|
||||
|
||||
private uLevel_skills owner;
|
||||
private userLevel_skills_SO ownerSo;
|
||||
private userLevel_skills_SO.UserLevelSkillEntry boundEntry;
|
||||
private int boundIndex = -1;
|
||||
private bool isUnlocked = false;
|
||||
private Coroutine hoverCoroutine;
|
||||
private Coroutine preselectPulseCoroutine;
|
||||
private GameObject spawnedDescription;
|
||||
private bool visualDefaultsCached = false;
|
||||
private Sprite defaultStatusSprite;
|
||||
private Material defaultStatusMaterial;
|
||||
private Material defaultLevelIdMaterial;
|
||||
|
||||
public void Bind(uLevel_skills ownerController, userLevel_skills_SO sourceSo, int index, userLevel_skills_SO.UserLevelSkillEntry entry, bool unlocked)
|
||||
{
|
||||
CacheVisualDefaults();
|
||||
|
||||
owner = ownerController;
|
||||
ownerSo = sourceSo;
|
||||
boundIndex = index;
|
||||
@@ -59,21 +71,129 @@ public class lrPrefab : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler
|
||||
thisSkillName.text = shouldHideLockedSkillInfo
|
||||
? "?????"
|
||||
: (boundEntry.skillName ?? string.Empty);
|
||||
thisSkillName.color = isUnlocked ? selectableSkillNameColor : unavailableSkillNameColor;
|
||||
}
|
||||
|
||||
if (statusImg == null)
|
||||
return;
|
||||
|
||||
if (owner != null && owner.IsSkillPreselected(boundIndex))
|
||||
statusImg.sprite = preSelectSprite != null ? preSelectSprite : availableSprite;
|
||||
else if (boundEntry.isEnabled)
|
||||
statusImg.sprite = enableSprite;
|
||||
else if (isUnlocked)
|
||||
statusImg.sprite = availableSprite;
|
||||
else if (shouldHideLockedSkillInfo)
|
||||
statusImg.sprite = unknownSprite != null ? unknownSprite : lockedSprite;
|
||||
else
|
||||
statusImg.sprite = lockedSprite;
|
||||
bool isPreselected = owner != null && owner.IsSkillPreselected(boundIndex);
|
||||
ApplyStatusState(isPreselected);
|
||||
}
|
||||
|
||||
private void ApplyStatusState(bool isPreselected)
|
||||
{
|
||||
if (statusImg == null)
|
||||
return;
|
||||
|
||||
StopPreselectPulse();
|
||||
|
||||
if (!isUnlocked)
|
||||
{
|
||||
SetStatusSprite(lockedStatusSprite != null ? lockedStatusSprite : defaultStatusSprite);
|
||||
SetStatusMaterial(defaultStatusMaterial);
|
||||
SetLevelIdMaterial(grayScale_mtr);
|
||||
SetStatusAlpha(1f);
|
||||
return;
|
||||
}
|
||||
|
||||
SetStatusSprite(defaultStatusSprite);
|
||||
|
||||
if (isPreselected)
|
||||
{
|
||||
SetStatusMaterial(defaultStatusMaterial);
|
||||
SetLevelIdMaterial(defaultLevelIdMaterial);
|
||||
StartPreselectPulse();
|
||||
return;
|
||||
}
|
||||
|
||||
if (boundEntry != null && boundEntry.isEnabled)
|
||||
{
|
||||
SetStatusMaterial(defaultStatusMaterial);
|
||||
SetLevelIdMaterial(defaultLevelIdMaterial);
|
||||
SetStatusAlpha(1f);
|
||||
return;
|
||||
}
|
||||
|
||||
SetStatusMaterial(grayScale_mtr);
|
||||
SetLevelIdMaterial(defaultLevelIdMaterial);
|
||||
SetStatusAlpha(1f);
|
||||
}
|
||||
|
||||
private void CacheVisualDefaults()
|
||||
{
|
||||
if (visualDefaultsCached)
|
||||
return;
|
||||
|
||||
visualDefaultsCached = true;
|
||||
defaultStatusSprite = statusImg != null ? statusImg.sprite : null;
|
||||
defaultStatusMaterial = statusImg != null ? statusImg.material : null;
|
||||
defaultLevelIdMaterial = levelid_btm != null ? levelid_btm.material : null;
|
||||
}
|
||||
|
||||
private void SetStatusSprite(Sprite spriteToApply)
|
||||
{
|
||||
if (statusImg == null)
|
||||
return;
|
||||
|
||||
statusImg.sprite = spriteToApply;
|
||||
}
|
||||
|
||||
private void SetStatusMaterial(Material materialToApply)
|
||||
{
|
||||
if (statusImg == null)
|
||||
return;
|
||||
|
||||
statusImg.material = materialToApply;
|
||||
}
|
||||
|
||||
private void SetLevelIdMaterial(Material materialToApply)
|
||||
{
|
||||
if (levelid_btm == null)
|
||||
return;
|
||||
|
||||
levelid_btm.material = materialToApply;
|
||||
}
|
||||
|
||||
private void SetStatusAlpha(float alpha)
|
||||
{
|
||||
if (statusImg == null)
|
||||
return;
|
||||
|
||||
Color color = statusImg.color;
|
||||
color.a = Mathf.Clamp01(alpha);
|
||||
statusImg.color = color;
|
||||
}
|
||||
|
||||
private void StartPreselectPulse()
|
||||
{
|
||||
if (!isActiveAndEnabled || statusImg == null)
|
||||
return;
|
||||
|
||||
preselectPulseCoroutine = StartCoroutine(PreselectPulseRoutine());
|
||||
}
|
||||
|
||||
private void StopPreselectPulse()
|
||||
{
|
||||
if (preselectPulseCoroutine != null)
|
||||
{
|
||||
StopCoroutine(preselectPulseCoroutine);
|
||||
preselectPulseCoroutine = null;
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerator PreselectPulseRoutine()
|
||||
{
|
||||
float duration = Mathf.Max(0.05f, preselectPulseDuration);
|
||||
float elapsed = 0f;
|
||||
|
||||
while (true)
|
||||
{
|
||||
elapsed += Time.unscaledDeltaTime;
|
||||
float normalizedTime = Mathf.PingPong(elapsed / duration, 1f);
|
||||
SetStatusAlpha(Mathf.Lerp(0.5f, 1f, normalizedTime));
|
||||
yield return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void OnPointerEnter(PointerEventData eventData)
|
||||
@@ -173,6 +293,8 @@ public class lrPrefab : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
StopPreselectPulse();
|
||||
|
||||
if (hoverCoroutine != null)
|
||||
{
|
||||
StopCoroutine(hoverCoroutine);
|
||||
|
||||
@@ -164,11 +164,6 @@ public class uLevel_skills : MonoBehaviour
|
||||
|
||||
private void SetDetailPanel(userLevel_skills_SO.UserLevelSkillEntry entry)
|
||||
{
|
||||
if (btm_skillImage != null)
|
||||
{
|
||||
btm_skillImage.sprite = entry != null ? entry.skillIcon : null;
|
||||
}
|
||||
|
||||
if (skillIcon_Profile != null)
|
||||
{
|
||||
skillIcon_Profile.sprite = entry != null ? entry.skillIcon : null;
|
||||
|
||||
Reference in New Issue
Block a user