UI HUGE UPDATE
This commit is contained in:
@@ -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