UI换了很多,spine主视觉停用
This commit is contained in:
@@ -245,7 +245,7 @@ public sealed class DailyTaskService : MonoBehaviour
|
||||
failureMessage = string.Empty;
|
||||
if (string.IsNullOrWhiteSpace(taskID))
|
||||
{
|
||||
failureMessage = "任务参数无效";
|
||||
failureMessage = LocalizationService.Get("daily.error.invalid_task_argument", "任务参数无效");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -255,19 +255,19 @@ public sealed class DailyTaskService : MonoBehaviour
|
||||
userTasksPool.TaskDefinition definition;
|
||||
if (!TryGetTaskPair(taskID, out runtimeEntry, out definition))
|
||||
{
|
||||
failureMessage = "未找到任务";
|
||||
failureMessage = LocalizationService.Get("daily.error.task_not_found", "未找到任务");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!runtimeEntry.isCompleted)
|
||||
{
|
||||
failureMessage = "任务尚未完成";
|
||||
failureMessage = LocalizationService.Get("daily.error.task_not_completed", "任务尚未完成");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (runtimeEntry.isClaimed)
|
||||
{
|
||||
failureMessage = "奖励已领取";
|
||||
failureMessage = LocalizationService.Get("daily.error.reward_already_claimed", "奖励已领取");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -319,7 +319,7 @@ public sealed class DailyTaskService : MonoBehaviour
|
||||
|
||||
if (claimedCount <= 0 && string.IsNullOrEmpty(failureMessage))
|
||||
{
|
||||
failureMessage = "暂无可领取奖励";
|
||||
failureMessage = LocalizationService.Get("daily.no_claimable_reward", "暂无可领取奖励");
|
||||
}
|
||||
|
||||
return claimedCount;
|
||||
@@ -828,13 +828,13 @@ public sealed class DailyTaskService : MonoBehaviour
|
||||
failureMessage = string.Empty;
|
||||
if (definition == null)
|
||||
{
|
||||
failureMessage = "任务定义无效";
|
||||
failureMessage = LocalizationService.Get("daily.error.invalid_definition", "任务定义无效");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (definition.rewardAmount <= 0)
|
||||
{
|
||||
failureMessage = "奖励数量无效";
|
||||
failureMessage = LocalizationService.Get("daily.error.invalid_reward_amount", "奖励数量无效");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -874,7 +874,7 @@ public sealed class DailyTaskService : MonoBehaviour
|
||||
return true;
|
||||
}
|
||||
default:
|
||||
failureMessage = "暂不支持该奖励类型";
|
||||
failureMessage = LocalizationService.Get("daily.error.unsupported_reward_type", "暂不支持该奖励类型");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,6 +36,9 @@ public class dailyTaskManager : MonoBehaviour
|
||||
[Header("reward sprites")]
|
||||
public Sprite coinRewardSprite;
|
||||
|
||||
[Header("reward availability visuals")]
|
||||
[SerializeField] private Material unavailableRewardMaterial;
|
||||
|
||||
private readonly List<GameObject> spawnedTaskItems = new List<GameObject>();
|
||||
private readonly Dictionary<int, Sprite> rewardSpriteByItemId = new Dictionary<int, Sprite>();
|
||||
private readonly Dictionary<int, storeItemSO> rewardStoreItemByItemId = new Dictionary<int, storeItemSO>();
|
||||
@@ -79,7 +82,7 @@ public class dailyTaskManager : MonoBehaviour
|
||||
if (notasksanymore != null)
|
||||
{
|
||||
notasksanymore.gameObject.SetActive(tasks.Count == 0);
|
||||
notasksanymore.text = tasks.Count == 0 ? "今日暂无任务" : string.Empty;
|
||||
notasksanymore.text = tasks.Count == 0 ? LocalizationService.Get("daily.no_tasks", "今日暂无任务") : string.Empty;
|
||||
}
|
||||
|
||||
int completedCount = 0;
|
||||
@@ -120,7 +123,12 @@ public class dailyTaskManager : MonoBehaviour
|
||||
return;
|
||||
}
|
||||
|
||||
controller.Setup(taskView, index + 1, ResolveRewardSprite(taskView.definition), () => OnSingleRewardClicked(taskView.runtimeEntry.taskID));
|
||||
controller.Setup(
|
||||
taskView,
|
||||
index + 1,
|
||||
ResolveRewardSprite(taskView.definition),
|
||||
() => OnSingleRewardClicked(taskView.runtimeEntry.taskID),
|
||||
unavailableRewardMaterial);
|
||||
}
|
||||
|
||||
private void UpdateTodayProgress(int totalTaskCount, int completedCount)
|
||||
@@ -218,7 +226,7 @@ public class dailyTaskManager : MonoBehaviour
|
||||
{
|
||||
if (string.IsNullOrEmpty(failureMessage))
|
||||
{
|
||||
failureMessage = "暂无可领取奖励";
|
||||
failureMessage = LocalizationService.Get("daily.no_claimable_reward", "暂无可领取奖励");
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(failureMessage))
|
||||
@@ -267,7 +275,7 @@ public class dailyTaskManager : MonoBehaviour
|
||||
{
|
||||
if (taskPool == null)
|
||||
{
|
||||
gNotice.warning.display("未配置任务池");
|
||||
gNotice.warning.display(LocalizationService.Get("daily.pool_missing", "未配置任务池"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -276,11 +284,11 @@ public class dailyTaskManager : MonoBehaviour
|
||||
{
|
||||
if (taskService.GetRemainingRefreshCount() <= 0)
|
||||
{
|
||||
gNotice.warning.display("已达到今日刷新上限");
|
||||
gNotice.warning.display(LocalizationService.Get("daily.refresh_limit_reached", "已达到今日刷新上限"));
|
||||
}
|
||||
else
|
||||
{
|
||||
gNotice.warning.display("刷新失败");
|
||||
gNotice.warning.display(LocalizationService.Get("daily.refresh_failed", "刷新失败"));
|
||||
}
|
||||
|
||||
RefreshTaskButtonState();
|
||||
@@ -383,7 +391,7 @@ public class dailyTaskManager : MonoBehaviour
|
||||
{
|
||||
if (definition == null)
|
||||
{
|
||||
return gItemGet.Create("未知奖励", null, 1, ItemRarity.None);
|
||||
return gItemGet.Create(LocalizationService.Get("item.unknown.reward", "未知奖励"), null, 1, ItemRarity.None);
|
||||
}
|
||||
|
||||
switch (definition.rewardType)
|
||||
@@ -424,7 +432,7 @@ public class dailyTaskManager : MonoBehaviour
|
||||
}
|
||||
|
||||
default:
|
||||
return gItemGet.Create("未知奖励", null, Mathf.Max(1, definition.rewardAmount), ItemRarity.None);
|
||||
return gItemGet.Create(LocalizationService.Get("item.unknown.reward", "未知奖励"), null, Mathf.Max(1, definition.rewardAmount), ItemRarity.None);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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: 233.09998, y: 256.80005}
|
||||
m_SizeDelta: {x: 100, y: 40}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 535, y: 44}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &8389013266594973227
|
||||
MonoBehaviour:
|
||||
@@ -211,6 +211,7 @@ MonoBehaviour:
|
||||
rewardButton: {fileID: 7330176074447484936}
|
||||
rewardImg: {fileID: 2110376433968674846}
|
||||
rewardAmmount: {fileID: 1221170490178438579}
|
||||
unavailableRewardMaterial: {fileID: 2100000, guid: 7701c15f96b443d408ac83222c9b869a, type: 2}
|
||||
--- !u!1 &3916418755595500206
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -245,8 +246,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: 12.13, y: 0}
|
||||
m_SizeDelta: {x: 34.1858, y: 20}
|
||||
m_AnchoredPosition: {x: 26.512, y: -0.142}
|
||||
m_SizeDelta: {x: 62.949, y: 27.119}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &602272132256342015
|
||||
CanvasRenderer:
|
||||
@@ -269,7 +270,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 0.24705882, g: 0.2901961, b: 0.3372549, a: 1}
|
||||
m_Color: {r: 0.6392157, g: 0.36078432, b: 0.14901961, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
@@ -278,7 +279,7 @@ MonoBehaviour:
|
||||
m_Calls: []
|
||||
m_FontData:
|
||||
m_Font: {fileID: 12800000, guid: dfa10de3e2846524089b5073175cd151, type: 3}
|
||||
m_FontSize: 18
|
||||
m_FontSize: 24
|
||||
m_FontStyle: 0
|
||||
m_BestFit: 0
|
||||
m_MinSize: 1
|
||||
@@ -324,8 +325,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: -19.4, y: 0.6}
|
||||
m_SizeDelta: {x: 18, y: 18}
|
||||
m_AnchoredPosition: {x: -30.1, y: -0.000016153}
|
||||
m_SizeDelta: {x: 35, y: 35}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &5147910286390164955
|
||||
CanvasRenderer:
|
||||
@@ -355,7 +356,7 @@ MonoBehaviour:
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 21300000, guid: 30f736af053d2094e9406aa272c0725b, type: 3}
|
||||
m_Sprite: {fileID: 8139719423079072813, guid: 16f0765cc15fce04f828ecd44d1dbf91, type: 3}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
@@ -402,8 +403,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: 171.90002, y: -0.3146}
|
||||
m_SizeDelta: {x: 110, y: 50.0289}
|
||||
m_AnchoredPosition: {x: 196.44, y: -0.15729}
|
||||
m_SizeDelta: {x: 142, y: 43.685}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &5599503168244631389
|
||||
CanvasRenderer:
|
||||
@@ -433,7 +434,7 @@ MonoBehaviour:
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 1552284476384703852, guid: 73e968cf84d24e740832bfcd468612b6, type: 3}
|
||||
m_Sprite: {fileID: 21300000, guid: 7f5ad78cb6d34ac498ba30d5755aacdf, type: 3}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
@@ -523,8 +524,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: 6.5, y: 0}
|
||||
m_SizeDelta: {x: 317, y: 30}
|
||||
m_AnchoredPosition: {x: -62.362, y: 0}
|
||||
m_SizeDelta: {x: 410.276, y: 44}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &4060125231613820467
|
||||
CanvasRenderer:
|
||||
@@ -554,7 +555,7 @@ MonoBehaviour:
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 21300000, guid: ad4148593b05d0f47980774815c325fe, type: 3}
|
||||
m_Sprite: {fileID: 21300000, guid: 120e6b502f9727a4c9b411e6cebc3969, type: 3}
|
||||
m_Type: 3
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
@@ -594,7 +595,7 @@ GameObject:
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
m_IsActive: 0
|
||||
--- !u!224 &8144451642442379881
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -836,8 +837,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.9906, y: 0}
|
||||
m_SizeDelta: {x: 267.0772, y: 30}
|
||||
m_AnchoredPosition: {x: -28.914, y: 0}
|
||||
m_SizeDelta: {x: 308.709, y: 36}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &3518498349447220834
|
||||
CanvasRenderer:
|
||||
@@ -868,12 +869,12 @@ MonoBehaviour:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_FontData:
|
||||
m_Font: {fileID: 12800000, guid: bc54bd51ea8b84448ba1b65311872862, type: 3}
|
||||
m_FontSize: 15
|
||||
m_Font: {fileID: 12800000, guid: dfa10de3e2846524089b5073175cd151, type: 3}
|
||||
m_FontSize: 22
|
||||
m_FontStyle: 0
|
||||
m_BestFit: 0
|
||||
m_MinSize: 1
|
||||
m_MaxSize: 40
|
||||
m_BestFit: 1
|
||||
m_MinSize: 18
|
||||
m_MaxSize: 22
|
||||
m_Alignment: 3
|
||||
m_AlignByGeometry: 0
|
||||
m_RichText: 1
|
||||
@@ -945,7 +946,7 @@ RectTransform:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7517194392253609194}
|
||||
m_LocalRotation: {x: 0.0032755262, y: -0, z: -0, w: 0.99999464}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalPosition: {x: 0, y: 0, z: -0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
@@ -953,8 +954,8 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0.375, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: -76.8, y: 12.584}
|
||||
m_SizeDelta: {x: 200, y: 50}
|
||||
m_AnchoredPosition: {x: -227.745, y: 10.6}
|
||||
m_SizeDelta: {x: 68.49, y: 44}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &2318309606455167046
|
||||
CanvasRenderer:
|
||||
@@ -984,7 +985,7 @@ MonoBehaviour:
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_text: 01
|
||||
m_text: 99
|
||||
m_isRightToLeft: 0
|
||||
m_fontAsset: {fileID: 11400000, guid: 452fa97492cae71479cf143f29930751, type: 2}
|
||||
m_sharedMaterial: {fileID: -346136068272202111, guid: 452fa97492cae71479cf143f29930751, type: 2}
|
||||
@@ -1011,15 +1012,15 @@ MonoBehaviour:
|
||||
m_faceColor:
|
||||
serializedVersion: 2
|
||||
rgba: 4294967295
|
||||
m_fontSize: 20
|
||||
m_fontSizeBase: 20
|
||||
m_fontSize: 50
|
||||
m_fontSizeBase: 50
|
||||
m_fontWeight: 400
|
||||
m_enableAutoSizing: 0
|
||||
m_fontSizeMin: 18
|
||||
m_fontSizeMax: 72
|
||||
m_fontStyle: 1
|
||||
m_HorizontalAlignment: 1
|
||||
m_VerticalAlignment: 256
|
||||
m_VerticalAlignment: 512
|
||||
m_textAlignment: 65535
|
||||
m_characterSpacing: -4.76
|
||||
m_wordSpacing: 0
|
||||
@@ -1049,7 +1050,7 @@ MonoBehaviour:
|
||||
m_VertexBufferAutoSizeReduction: 0
|
||||
m_useMaxVisibleDescender: 1
|
||||
m_pageToDisplay: 1
|
||||
m_margin: {x: 0, y: 6.5791626, z: 0, w: 0}
|
||||
m_margin: {x: 0, y: -0.0292816, z: 0, w: -0.00002098401}
|
||||
m_isUsingLegacyAnimationComponent: 0
|
||||
m_isVolumetricText: 0
|
||||
m_hasFontAssetChanged: 0
|
||||
@@ -1089,8 +1090,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: 6.5, y: 0}
|
||||
m_SizeDelta: {x: 317, y: 30}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 535, y: 44}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &8024881274196398679
|
||||
CanvasRenderer:
|
||||
@@ -1120,8 +1121,8 @@ MonoBehaviour:
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 0}
|
||||
m_Type: 1
|
||||
m_Sprite: {fileID: 21300000, guid: 9836c535c270c504b98c20852af0b8ca, type: 3}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
|
||||
@@ -15,13 +15,21 @@ public class taskPrefabController : MonoBehaviour
|
||||
public Image rewardImg;
|
||||
public Text rewardAmmount;
|
||||
|
||||
public void Setup(DailyTaskViewData taskView, int displayIndex, Sprite rewardSprite, UnityAction onRewardClicked)
|
||||
[Header("materials")]
|
||||
[SerializeField] private Material unavailableRewardMaterial;
|
||||
|
||||
public void Setup(DailyTaskViewData taskView, int displayIndex, Sprite rewardSprite, UnityAction onRewardClicked, Material overrideUnavailableRewardMaterial = null)
|
||||
{
|
||||
if (taskView == null || taskView.definition == null || taskView.runtimeEntry == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (overrideUnavailableRewardMaterial != null)
|
||||
{
|
||||
unavailableRewardMaterial = overrideUnavailableRewardMaterial;
|
||||
}
|
||||
|
||||
if (taskNumber != null)
|
||||
{
|
||||
taskNumber.text = displayIndex.ToString("00");
|
||||
@@ -61,6 +69,33 @@ public class taskPrefabController : MonoBehaviour
|
||||
rewardButton.onClick.AddListener(onRewardClicked);
|
||||
}
|
||||
|
||||
rewardButton.interactable = taskView.runtimeEntry.isCompleted && !taskView.runtimeEntry.isClaimed;
|
||||
bool canClaim = taskView.runtimeEntry.isCompleted && !taskView.runtimeEntry.isClaimed;
|
||||
rewardButton.interactable = canClaim;
|
||||
|
||||
ApplyRewardAvailabilityMaterial(taskView.runtimeEntry.isCompleted);
|
||||
}
|
||||
|
||||
private void ApplyRewardAvailabilityMaterial(bool isCompleted)
|
||||
{
|
||||
Material targetMaterial = isCompleted ? null : unavailableRewardMaterial;
|
||||
|
||||
if (rewardButton != null)
|
||||
{
|
||||
Graphic buttonGraphic = rewardButton.targetGraphic;
|
||||
if (buttonGraphic != null)
|
||||
{
|
||||
buttonGraphic.material = targetMaterial;
|
||||
}
|
||||
}
|
||||
|
||||
if (rewardImg != null)
|
||||
{
|
||||
rewardImg.material = targetMaterial;
|
||||
}
|
||||
|
||||
if (rewardAmmount != null)
|
||||
{
|
||||
rewardAmmount.material = targetMaterial;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user