2024-04-01 18:27:14 +08:00
|
|
|
|
using cfg.ActorCfg;
|
|
|
|
|
|
using Framework;
|
2024-06-13 15:05:32 +08:00
|
|
|
|
using Gameplay;
|
2024-04-01 18:27:14 +08:00
|
|
|
|
using PhxhSDK;
|
2024-04-01 18:38:35 +08:00
|
|
|
|
using System;
|
2024-04-01 18:27:14 +08:00
|
|
|
|
using TMPro;
|
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 通用道具
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public class GenericItem : UIGameObjectWrapper
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 置灰的灰度
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private const float GREY = 0.5f;
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 正常颜色
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private const float NORMAL = 1f;
|
|
|
|
|
|
|
|
|
|
|
|
#region UI
|
|
|
|
|
|
/// <summary>
|
2024-08-29 16:15:48 +08:00
|
|
|
|
/// 道具品质_蓝
|
2024-04-01 18:27:14 +08:00
|
|
|
|
/// </summary>
|
2024-08-29 16:15:48 +08:00
|
|
|
|
private Image imageQuality_blue;
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 道具品质_黄
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private Image imageQuality_yellow;
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 道具品质_红
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private Image imageQuality_red;
|
2024-04-01 18:27:14 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 道具图标
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private Image imageIcon;
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 道具数量背景
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private Image imageCount;
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 道具数量文本
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private TMP_Text textCount;
|
2024-04-01 18:38:35 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 道具按钮
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private Button button;
|
2024-04-01 18:27:14 +08:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 道具配置
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private DataItem dataItem;
|
2024-04-01 18:38:35 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 回调
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private Action callbackAction;
|
2024-04-01 18:27:14 +08:00
|
|
|
|
|
2024-04-02 14:40:33 +08:00
|
|
|
|
#region 属性
|
2024-04-01 18:27:14 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 是否显示道具数量
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public bool IsShowCount
|
|
|
|
|
|
{
|
2024-04-24 13:47:15 +08:00
|
|
|
|
set { imageCount.gameObject.IsScaleShow(value); }
|
2024-04-01 18:27:14 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 是否置灰
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public bool IsGrey
|
|
|
|
|
|
{
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
if (value)
|
|
|
|
|
|
{
|
2024-08-29 16:15:48 +08:00
|
|
|
|
//imageQuality.color = new Color(GREY, GREY, GREY, imageQuality.color.a);
|
2024-04-01 18:27:14 +08:00
|
|
|
|
imageIcon.color = new Color(GREY, GREY, GREY, imageIcon.color.a);
|
|
|
|
|
|
imageCount.color = new Color(GREY, GREY, GREY, imageCount.color.a);
|
|
|
|
|
|
textCount.color = new Color(GREY, GREY, GREY, textCount.color.a);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2024-08-29 16:15:48 +08:00
|
|
|
|
//imageQuality.color = new Color(NORMAL, NORMAL, NORMAL, imageQuality.color.a);
|
2024-04-01 18:27:14 +08:00
|
|
|
|
imageIcon.color = new Color(NORMAL, NORMAL, NORMAL, imageIcon.color.a);
|
|
|
|
|
|
imageCount.color = new Color(NORMAL, NORMAL, NORMAL, imageCount.color.a);
|
|
|
|
|
|
textCount.color = new Color(NORMAL, NORMAL, NORMAL, textCount.color.a);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-04-01 18:38:35 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 是否开启按钮
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public bool IsEnableButton
|
|
|
|
|
|
{
|
|
|
|
|
|
set { button.enabled = value; }
|
|
|
|
|
|
}
|
2024-04-02 14:40:33 +08:00
|
|
|
|
#endregion
|
2024-04-01 18:38:35 +08:00
|
|
|
|
|
2024-04-24 13:47:15 +08:00
|
|
|
|
#region 构造
|
2024-04-01 18:27:14 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 根据GameObject构造
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="root"></param>
|
2024-04-01 18:38:35 +08:00
|
|
|
|
public GenericItem(GameObject root, Action callback = null) : base(root, false)
|
2024-04-01 18:27:14 +08:00
|
|
|
|
{
|
2024-04-01 18:38:35 +08:00
|
|
|
|
Construct(callback);
|
2024-04-01 18:27:14 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 根据GameObject克隆并构造
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="root"></param>
|
|
|
|
|
|
/// <param name="i"></param>
|
2024-04-01 18:38:35 +08:00
|
|
|
|
public GenericItem(GameObject root, int i, Action callback = null) : base(root, i, false)
|
2024-04-01 18:27:14 +08:00
|
|
|
|
{
|
2024-04-01 18:38:35 +08:00
|
|
|
|
Construct(callback);
|
2024-04-01 18:27:14 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-04-01 18:38:35 +08:00
|
|
|
|
private void Construct(Action callback)
|
2024-04-01 18:27:14 +08:00
|
|
|
|
{
|
2024-08-29 16:15:48 +08:00
|
|
|
|
imageQuality_blue = GetComponent<Image>("BaseItem/Rarity/ItemQuality_blue");
|
|
|
|
|
|
imageQuality_yellow = GetComponent<Image>("BaseItem/Rarity/ItemQuality_yellow");
|
|
|
|
|
|
imageQuality_red = GetComponent<Image>("BaseItem/Rarity/ItemQuality_red");
|
|
|
|
|
|
|
2024-04-01 18:27:14 +08:00
|
|
|
|
imageIcon = GetComponent<Image>("BaseItem/ItemIcon");
|
2024-04-02 12:16:05 +08:00
|
|
|
|
imageCount = GetComponent<Image>("BaseItem/ImageCount");
|
|
|
|
|
|
textCount = GetComponent<TMP_Text>("BaseItem/ImageCount/TextCount");
|
2024-04-01 18:38:35 +08:00
|
|
|
|
button = GetComponent<Button>("BaseItem");
|
2024-04-01 18:27:14 +08:00
|
|
|
|
|
|
|
|
|
|
IsShowCount = false;
|
|
|
|
|
|
IsGrey = false;
|
2024-04-01 18:38:35 +08:00
|
|
|
|
|
2024-06-13 15:05:32 +08:00
|
|
|
|
SetCallback(callback);
|
|
|
|
|
|
|
|
|
|
|
|
CommonUtils.BindButton(button, OnClick);
|
2024-04-01 18:27:14 +08:00
|
|
|
|
}
|
2024-04-24 13:47:15 +08:00
|
|
|
|
#endregion
|
2024-04-01 18:27:14 +08:00
|
|
|
|
|
2024-04-24 13:47:15 +08:00
|
|
|
|
#region 入口
|
2024-04-01 18:27:14 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 设置道具数据
|
|
|
|
|
|
/// </summary>
|
2024-04-02 14:40:33 +08:00
|
|
|
|
/// <param name="data">道具配置</param>
|
|
|
|
|
|
/// <param name="count">道具数量,道具数量小于等于0时不显示道具数量</param>
|
2024-06-13 14:31:48 +08:00
|
|
|
|
public virtual async void SetInfo(DataItem data, int count = 0, Action callback = null)
|
2024-04-01 18:27:14 +08:00
|
|
|
|
{
|
|
|
|
|
|
dataItem = data;
|
|
|
|
|
|
if (dataItem == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
DebugUtil.LogError("空数据");
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SetCount(count);
|
2024-06-13 14:31:48 +08:00
|
|
|
|
SetCallback(callback);
|
2024-05-08 13:42:53 +08:00
|
|
|
|
imageIcon.sprite = await LoadAssetAsync<Sprite>(dataItem.IconPath);
|
2024-04-01 18:27:14 +08:00
|
|
|
|
|
2024-08-29 16:15:48 +08:00
|
|
|
|
imageQuality_red.gameObject.IsScaleShow(dataItem.Rarity == ItemRarity.Red);
|
|
|
|
|
|
imageQuality_yellow.gameObject.IsScaleShow(dataItem.Rarity == ItemRarity.Yellow);
|
|
|
|
|
|
imageQuality_blue.gameObject.IsScaleShow((int)dataItem.Rarity <= (int)ItemRarity.Blue);
|
|
|
|
|
|
|
2024-04-01 18:27:14 +08:00
|
|
|
|
IsScaleShow = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-04-02 14:40:33 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 设置道具数据
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="iconPath">图标路径</param>
|
|
|
|
|
|
/// <param name="count">道具数量,道具数量小于等于0时不显示道具数量</param>
|
|
|
|
|
|
/// <param name="callback">点击回调,回调是空时禁用点击</param>
|
2024-04-02 14:05:56 +08:00
|
|
|
|
public virtual async void SetInfo(string iconPath, int count = 0, Action callback = null)
|
2024-04-02 12:16:05 +08:00
|
|
|
|
{
|
|
|
|
|
|
SetCount(count);
|
2024-04-02 12:35:35 +08:00
|
|
|
|
SetCallback(callback);
|
2024-05-08 13:42:53 +08:00
|
|
|
|
imageIcon.sprite = await LoadAssetAsync<Sprite>(iconPath);
|
2024-04-02 12:16:05 +08:00
|
|
|
|
|
|
|
|
|
|
IsScaleShow = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-04-01 18:27:14 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 根据道具id设置道具数据
|
|
|
|
|
|
/// </summary>
|
2024-04-02 14:40:33 +08:00
|
|
|
|
/// <param name="itemID">道具配置id</param>
|
|
|
|
|
|
/// <param name="count">道具数量,道具数量小于等于0时不显示道具数量</param>
|
2024-06-13 14:31:48 +08:00
|
|
|
|
public virtual void SetInfo(int itemID, int count = 0, Action callback = null)
|
2024-04-01 18:27:14 +08:00
|
|
|
|
{
|
|
|
|
|
|
DataItem data = TableManager.Instance.Tables.Item.Get(itemID);
|
|
|
|
|
|
if (data == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
DebugUtil.LogError($"道具id错误,错误道具id{itemID}");
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-06-13 14:31:48 +08:00
|
|
|
|
SetInfo(data, count, callback);
|
2024-04-01 18:27:14 +08:00
|
|
|
|
}
|
2024-04-24 13:47:15 +08:00
|
|
|
|
#endregion
|
2024-04-02 12:35:35 +08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 设置回调
|
|
|
|
|
|
/// </summary>
|
2024-04-02 14:40:33 +08:00
|
|
|
|
/// <param name="callback"></param>
|
2024-04-24 13:47:15 +08:00
|
|
|
|
private void SetCallback(Action callback)
|
2024-04-02 12:35:35 +08:00
|
|
|
|
{
|
2024-08-29 16:15:48 +08:00
|
|
|
|
if (callback != null)
|
|
|
|
|
|
callbackAction = callback;
|
2024-04-02 12:35:35 +08:00
|
|
|
|
|
|
|
|
|
|
IsEnableButton = callbackAction != null;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-04-01 18:27:14 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 设置道具数量
|
|
|
|
|
|
/// </summary>
|
2024-04-24 13:47:15 +08:00
|
|
|
|
private void SetCount(int count)
|
2024-04-01 18:27:14 +08:00
|
|
|
|
{
|
2024-04-02 14:05:56 +08:00
|
|
|
|
if (count <= 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
IsShowCount = false;
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-04-01 18:27:14 +08:00
|
|
|
|
textCount.text = count.ToString();
|
2024-04-02 14:05:56 +08:00
|
|
|
|
IsShowCount = true;
|
2024-04-01 18:27:14 +08:00
|
|
|
|
}
|
2024-04-01 18:38:35 +08:00
|
|
|
|
|
|
|
|
|
|
private void OnClick()
|
|
|
|
|
|
{
|
|
|
|
|
|
callbackAction?.Invoke();
|
|
|
|
|
|
}
|
2024-08-29 16:15:48 +08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 含道具信息的点击事件
|
|
|
|
|
|
/// 该函数调用会清空之前的点击事件
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="action"></param>
|
|
|
|
|
|
public void BindDataItemClick(Action<DataItem> action)
|
|
|
|
|
|
{
|
|
|
|
|
|
callbackAction = () =>
|
|
|
|
|
|
{
|
|
|
|
|
|
if (dataItem == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
DebugUtil.LogError("道具数据为空");
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
action?.Invoke(dataItem);
|
|
|
|
|
|
};
|
|
|
|
|
|
}
|
2024-04-01 18:27:14 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 通用道具,通关奖励
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public class GenericItem_PassReward : GenericItem
|
|
|
|
|
|
{
|
2024-04-24 13:47:15 +08:00
|
|
|
|
#region UI
|
2024-04-01 18:27:14 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 已获取状态
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private GameObject goGet;
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 首次通关状态
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private GameObject goFirstPass;
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 重复通关状态
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private GameObject goNormalPass;
|
2024-04-24 13:47:15 +08:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region 属性
|
2024-04-01 18:27:14 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 是否已经获取
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public bool IsGet
|
|
|
|
|
|
{
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
goGet.IsScaleShow(value);
|
|
|
|
|
|
IsGrey = value;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 是否首次通关
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public bool IsFirstPass
|
|
|
|
|
|
{
|
|
|
|
|
|
set { goFirstPass.IsScaleShow(value); }
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 是否重复通关
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public bool IsNormalPass
|
|
|
|
|
|
{
|
|
|
|
|
|
set { goNormalPass.IsScaleShow(value); }
|
|
|
|
|
|
}
|
2024-04-24 13:47:15 +08:00
|
|
|
|
#endregion
|
2024-04-01 18:27:14 +08:00
|
|
|
|
|
2024-04-24 13:47:15 +08:00
|
|
|
|
#region 构造
|
2024-04-01 18:38:35 +08:00
|
|
|
|
public GenericItem_PassReward(GameObject root, Action callback = null) : base(root, callback)
|
2024-04-01 18:27:14 +08:00
|
|
|
|
{
|
|
|
|
|
|
Construct();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-04-01 18:38:35 +08:00
|
|
|
|
public GenericItem_PassReward(GameObject root, int i, Action callback = null) : base(root, i, callback)
|
2024-04-01 18:27:14 +08:00
|
|
|
|
{
|
|
|
|
|
|
Construct();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void Construct()
|
|
|
|
|
|
{
|
2024-04-02 13:10:37 +08:00
|
|
|
|
goGet = FindObj("BaseItem_PassReward/TextAlreadyGet");
|
2024-04-01 18:27:14 +08:00
|
|
|
|
goNormalPass = FindObj("BaseItem_PassReward/LevelNormalPass");
|
|
|
|
|
|
goFirstPass = FindObj("BaseItem_PassReward/LevelFirstPass");
|
|
|
|
|
|
|
|
|
|
|
|
IsGet = false;
|
|
|
|
|
|
IsFirstPass = false;
|
|
|
|
|
|
IsNormalPass = false;
|
|
|
|
|
|
}
|
2024-04-24 13:47:15 +08:00
|
|
|
|
#endregion
|
2024-04-01 18:27:14 +08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 设置奖励道具数据
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="rewardItem"></param>
|
|
|
|
|
|
/// <param name="isGet"></param>
|
|
|
|
|
|
/// <param name="rewardType"></param>
|
2024-06-13 14:31:48 +08:00
|
|
|
|
public void SetInfo(RewardItem rewardItem, bool isGet = false, ERewardType rewardType = ERewardType.None, Action callback = null)
|
2024-04-01 18:27:14 +08:00
|
|
|
|
{
|
2024-06-13 14:31:48 +08:00
|
|
|
|
base.SetInfo(rewardItem.Data, rewardItem.Count, callback);
|
2024-04-24 13:47:15 +08:00
|
|
|
|
|
2024-04-01 18:27:14 +08:00
|
|
|
|
IsGet = isGet;
|
|
|
|
|
|
IsFirstPass = rewardType == ERewardType.LevelFirstPassReward;
|
|
|
|
|
|
IsNormalPass = rewardType == ERewardType.LevelNormalPassReward;
|
|
|
|
|
|
}
|
2024-04-24 13:19:55 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 通用道具,背包
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public class GenericItem_Package : GenericItem
|
|
|
|
|
|
{
|
2024-04-24 13:47:15 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 倒计时状态分钟,显示白色文本
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private readonly Color TIME_MIN_COLOR = Color.white;
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 倒计时状态小时和天,显示黑色文本
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private readonly Color TIME_HOUR_DAY_COLOR = Color.black;
|
|
|
|
|
|
|
|
|
|
|
|
#region UI
|
2024-04-24 13:19:55 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 到期时间状态-分钟
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private GameObject goTimeMin;
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 到期时间状态-小时
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private GameObject goTimeHour;
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 到期时间状态-天
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private GameObject goTimeDay;
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 到期时间文本
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private TMP_Text textTime;
|
2024-04-24 13:47:15 +08:00
|
|
|
|
#endregion
|
2024-04-24 13:19:55 +08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 是否限时道具
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public bool IsLimiteTime
|
|
|
|
|
|
{
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
if (value)
|
|
|
|
|
|
textTime.gameObject.IsScaleShow(true);
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
goTimeMin.IsScaleShow(false);
|
|
|
|
|
|
goTimeHour.IsScaleShow(false);
|
|
|
|
|
|
goTimeDay.IsScaleShow(false);
|
|
|
|
|
|
textTime.gameObject.IsScaleShow(false);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-04-24 13:47:15 +08:00
|
|
|
|
#region 构造
|
2024-04-24 13:19:55 +08:00
|
|
|
|
public GenericItem_Package(GameObject root, Action callback = null) : base(root, callback)
|
|
|
|
|
|
{
|
|
|
|
|
|
Construct();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public GenericItem_Package(GameObject root, int i, Action callback = null) : base(root, i, callback)
|
|
|
|
|
|
{
|
|
|
|
|
|
Construct();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void Construct()
|
|
|
|
|
|
{
|
|
|
|
|
|
goTimeMin = FindObj("BaseItem_Package/Time/ImageMin");
|
|
|
|
|
|
goTimeHour = FindObj("BaseItem_Package/Time/ImageHour");
|
|
|
|
|
|
goTimeDay = FindObj("BaseItem_Package/Time/ImageDay");
|
|
|
|
|
|
textTime = GetComponent<TMP_Text>("BaseItem_Package/Time/TextTime");
|
|
|
|
|
|
}
|
2024-04-24 13:47:15 +08:00
|
|
|
|
#endregion
|
2024-04-24 13:19:55 +08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 设置背包道具数据
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="rewardItem"></param>
|
|
|
|
|
|
/// <param name="isGet"></param>
|
|
|
|
|
|
/// <param name="rewardType"></param>
|
|
|
|
|
|
public void SetInfo()
|
|
|
|
|
|
{
|
2024-04-24 13:47:15 +08:00
|
|
|
|
//base.SetInfo(rewardItem.Data, rewardItem.Count); // 传入指定类型数据
|
2024-04-24 13:19:55 +08:00
|
|
|
|
|
2024-04-24 13:47:15 +08:00
|
|
|
|
/*
|
|
|
|
|
|
if (是否限时)
|
|
|
|
|
|
{
|
|
|
|
|
|
IsLimiteTime = true;
|
|
|
|
|
|
// TODO
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
IsLimiteTime = false;
|
|
|
|
|
|
*/
|
2024-04-24 13:19:55 +08:00
|
|
|
|
}
|
2024-09-04 16:20:24 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 通用道具,关卡星级奖励
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public class GenericItem_LevelStarReward : UIGameObjectWrapper
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 已领取状态
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private GameObject goGet;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 通用道具
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private GenericItem genericItem;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 是否领取
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public bool IsGet
|
|
|
|
|
|
{
|
|
|
|
|
|
set { goGet.IsScaleShow(value); }
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public GenericItem_LevelStarReward(GameObject root) : base(root)
|
|
|
|
|
|
{
|
|
|
|
|
|
goGet = FindObj("BaseItem_LevelStarReward/TextAlreadyGet");
|
|
|
|
|
|
|
|
|
|
|
|
genericItem = new(root);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void SetInfo(RewardItem rewardItem, bool isGet = false, Action callback = null)
|
|
|
|
|
|
{
|
|
|
|
|
|
genericItem.SetInfo(rewardItem.Data, rewardItem.Count, callback);
|
2024-10-23 17:07:20 +08:00
|
|
|
|
foreach (Image image in GoRoot.transform.GetComponentsInChildren<Image>())
|
|
|
|
|
|
{
|
|
|
|
|
|
if (isGet)
|
|
|
|
|
|
image.color = new Color32(106, 106, 106, 255);
|
|
|
|
|
|
else
|
|
|
|
|
|
image.color = Color.white;
|
|
|
|
|
|
}
|
2024-09-04 16:20:24 +08:00
|
|
|
|
|
|
|
|
|
|
IsGet = isGet;
|
|
|
|
|
|
}
|
2024-10-23 12:46:54 +08:00
|
|
|
|
|
|
|
|
|
|
public void SetInfo(int itemId, int count, bool isGet = false, Action callback = null)
|
|
|
|
|
|
{
|
|
|
|
|
|
genericItem.SetInfo(itemId, count, callback);
|
2024-10-23 17:07:20 +08:00
|
|
|
|
foreach (Image image in GoRoot.transform.GetComponentsInChildren<Image>())
|
|
|
|
|
|
{
|
|
|
|
|
|
if (isGet)
|
|
|
|
|
|
image.color = new Color32(106, 106, 106, 255);
|
|
|
|
|
|
else
|
|
|
|
|
|
image.color = Color.white;
|
|
|
|
|
|
}
|
2024-10-23 12:46:54 +08:00
|
|
|
|
|
|
|
|
|
|
IsGet = isGet;
|
|
|
|
|
|
}
|
2024-04-01 18:27:14 +08:00
|
|
|
|
}
|