商店除发放和货币扣除,其余部分完毕。加入药水icon免费包

This commit is contained in:
FloatGaming
2026-03-14 05:02:53 +08:00
parent 9e1755f752
commit 416190b23e
194 changed files with 78455 additions and 51967 deletions
File diff suppressed because it is too large Load Diff
+7
View File
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: f0454316491ad294d834d0f219dff6ff
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,25 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 74be3a451e4df4c4ab7060c54c58d0d2, type: 3}
m_Name: storeItemDefaultSO
m_EditorClassIdentifier:
itemName:
itemIcon: {fileID: 0}
itemDescription:
itemType: 0
associatedPlayer: {fileID: 0}
associatedSong: {fileID: 0}
associatedStoryPassage: {fileID: 0}
costRequirements:
- currencyType: 0
amount: 0
unlockRequirements: []
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 1d5717191aa3cfe4482ab7913ca418c4
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
+213
View File
@@ -0,0 +1,213 @@
using System;
using System.Collections;
using DG.Tweening;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
public class storeItemPrefab : MonoBehaviour, IPointerClickHandler, IPointerEnterHandler, IPointerExitHandler
{
[Header("so")]
public storeItemSO thisItemSO;
[Header("basics")]
public Image thisItem_iconImage;
public Text thisItem_nameText;
public Text thisItem_amountAndLimitationText;
public Image thisPrice_iconImage;
public Text thisItem_priceText;
[Header("other")]
public GameObject rightCorner_statusImage; //这个是用来显示限量或新品等状态的图标
public GameObject leftCorner_statusImage; //这个是用来显示售罄等状态的图标
public GameObject lock_cannotClickImage; //这个是用来显示无法点击的锁图标的
[Header("texts")]
public Text why_cannot_buy;
[Header("descriptions")]
public GameObject descriptionObject;
public Text itemTitle;
public Text itemDescription;
public Action<storeItemPrefab> onItemClicked;
private const float ShowDelay = 0.5f;
private const float HideDelay = 0.25f;
private const float FadeDuration = 0.2f;
private CanvasGroup descriptionCanvasGroup;
private Coroutine pendingShowCoroutine;
private Coroutine pendingHideCoroutine;
private int lastNotifyFrame = -1;
private void Awake()
{
PrepareDescriptionPanel();
}
private void OnDisable()
{
StopPendingDescriptionCoroutines();
if (descriptionCanvasGroup != null)
{
descriptionCanvasGroup.DOKill();
descriptionCanvasGroup.alpha = 0f;
descriptionCanvasGroup.interactable = false;
descriptionCanvasGroup.blocksRaycasts = false;
}
if (descriptionObject != null)
{
descriptionObject.SetActive(false);
}
}
public void OnPointerClick(PointerEventData eventData)
{
NotifyClicked();
}
public void OnPointerEnter(PointerEventData eventData)
{
if (descriptionObject == null) return;
if (pendingHideCoroutine != null)
{
StopCoroutine(pendingHideCoroutine);
pendingHideCoroutine = null;
}
if (pendingShowCoroutine == null)
{
pendingShowCoroutine = StartCoroutine(ShowDescriptionWithDelay());
}
}
public void OnPointerExit(PointerEventData eventData)
{
if (descriptionObject == null) return;
if (pendingShowCoroutine != null)
{
StopCoroutine(pendingShowCoroutine);
pendingShowCoroutine = null;
}
if (pendingHideCoroutine == null)
{
pendingHideCoroutine = StartCoroutine(HideDescriptionWithDelay());
}
}
public void NotifyClicked()
{
if (lastNotifyFrame == Time.frameCount)
{
return;
}
lastNotifyFrame = Time.frameCount;
if (onItemClicked != null)
{
onItemClicked(this);
}
}
public void SetDescriptionContent(string title, string description)
{
if (itemTitle != null)
{
itemTitle.text = title ?? string.Empty;
}
if (itemDescription != null)
{
itemDescription.text = string.IsNullOrWhiteSpace(description) ? "暂无描述信息" : description;
}
}
private void PrepareDescriptionPanel()
{
if (descriptionObject == null)
{
return;
}
descriptionCanvasGroup = descriptionObject.GetComponent<CanvasGroup>();
if (descriptionCanvasGroup == null)
{
descriptionCanvasGroup = descriptionObject.AddComponent<CanvasGroup>();
}
descriptionCanvasGroup.DOKill();
descriptionCanvasGroup.alpha = 0f;
descriptionCanvasGroup.interactable = false;
descriptionCanvasGroup.blocksRaycasts = false;
descriptionObject.SetActive(false);
}
private IEnumerator ShowDescriptionWithDelay()
{
yield return new WaitForSeconds(ShowDelay);
pendingShowCoroutine = null;
ShowDescriptionPanel();
}
private IEnumerator HideDescriptionWithDelay()
{
yield return new WaitForSeconds(HideDelay);
pendingHideCoroutine = null;
HideDescriptionPanel();
}
private void ShowDescriptionPanel()
{
if (descriptionObject == null || descriptionCanvasGroup == null)
{
return;
}
descriptionCanvasGroup.DOKill();
descriptionObject.SetActive(true);
descriptionCanvasGroup.interactable = true;
descriptionCanvasGroup.blocksRaycasts = true;
descriptionCanvasGroup.DOFade(1f, FadeDuration).SetEase(Ease.OutQuad);
}
private void HideDescriptionPanel()
{
if (descriptionObject == null || descriptionCanvasGroup == null)
{
return;
}
descriptionCanvasGroup.DOKill();
descriptionCanvasGroup.interactable = false;
descriptionCanvasGroup.blocksRaycasts = false;
descriptionCanvasGroup.DOFade(0f, FadeDuration)
.SetEase(Ease.OutQuad)
.OnComplete(() =>
{
if (descriptionObject != null)
{
descriptionObject.SetActive(false);
}
});
}
private void StopPendingDescriptionCoroutines()
{
if (pendingShowCoroutine != null)
{
StopCoroutine(pendingShowCoroutine);
pendingShowCoroutine = null;
}
if (pendingHideCoroutine != null)
{
StopCoroutine(pendingHideCoroutine);
pendingHideCoroutine = null;
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 833fc1029e338b144be8a699dae12958
+71
View File
@@ -0,0 +1,71 @@
using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu(fileName = "77xxx_storeItem", menuName = "Store/StoreItem")]
public class storeItemSO : ScriptableObject
{
[Header("Basic Info")]
public string itemName;
public Sprite itemIcon;
public int itemID; // Unique identifier for the item
public int itemSinglePurchaseQty; // 物品单次购买数量
public int itemPurchaseQuota; // 物品限购配额,-1为不限购
[TextArea(3, 3)] public string itemDescription;
[TextArea(3, 10)] public string itemDetailedDescription; // 这个是用来在物品详情界面显示的更详细的描述文本的
[Header("Item Type")]
public bool isOnShelf = true; // Indicates if the item is currently available for purchase
public bool canbepurchased = true; // Indicates if the item can be purchased with coins
public bool isHot = false; // Indicates if the item is a hot item (for promotional purposes)
public bool user_has_read = false; // 用户是否已经查看过这个物品
public ItemType itemType;
public Player_SO associatedPlayer; // Only used if itemType is character
public SongData associatedSong; // Only used if itemType is song
public notebook_faterType associatedStoryPassage; // Only used if itemType is storyPassage
[Header("Purchase Cost")]
public List<CostRequirement> costRequirements = new List<CostRequirement>();
[Header("Unlock Conditions")]
public List<UnlockRequirement> unlockRequirements = new List<UnlockRequirement>();
[Header("Runtime Save Data")]
public int purchasedCount; // 已购数量,会参与持久化
public enum ItemType
{
character,
song,
storyPassage,
consumable,
otherType
}
public enum CurrencyType
{
coins,
}
public enum RequirementType
{
none,
level,
clearSong,
storyProgress
}
[System.Serializable]
public class CostRequirement
{
public CurrencyType currencyType;
public int amount;
}
[System.Serializable]
public class UnlockRequirement
{
public RequirementType requirementType;
public int value;
}
}
+2
View File
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 74be3a451e4df4c4ab7060c54c58d0d2
File diff suppressed because it is too large Load Diff
+2
View File
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: ffacf55d20847954cb5188aa9cc41bab