【签到】签到UI功能提交
parent
2d334fc875
commit
9b434631f2
File diff suppressed because it is too large
Load Diff
|
|
@ -76,6 +76,7 @@ public partial class UIManager
|
|||
_WindowMeta(UINameConst.UI_Patio, UIWindowLayer.Normal);
|
||||
_WindowMeta(UINameConst.UI_BuyDiamond, UIWindowLayer.Normal);
|
||||
_WindowMeta(UINameConst.UI_LevelDetail, UIWindowLayer.Normal);
|
||||
_WindowMeta(UINameConst.UI_DailyBonus, UIWindowLayer.Normal);
|
||||
|
||||
_WindowMeta(UINameConst.UINoticeTwo, UIWindowLayer.Waiting);
|
||||
|
||||
|
|
@ -175,4 +176,5 @@ public static class UINameConst
|
|||
public static readonly string UI_LevelDetail = "LevelSelect/UI_LevelDetail";
|
||||
public static readonly string UI_CommandSkill = "CommandSkill/CommandSkill_Cultivate";
|
||||
|
||||
public static readonly string UI_DailyBonus = "Interface/UI_DailyBonus";
|
||||
}
|
||||
|
|
@ -28,12 +28,16 @@ public class SignObjAccumulate : SignObjBase
|
|||
private int _cycleCount; //每次循环总次数
|
||||
private readonly List<ItemCount> _itemList; //奖励道具表
|
||||
private bool _isNeedShowSign;
|
||||
private int _totalCount; //总次数
|
||||
|
||||
public DataSign Cfg => _cfg;
|
||||
public List<ItemCount> ItemList => _itemList;
|
||||
public int AccumulateCount => _accumulateCount;
|
||||
public bool IsNeedToShow => _isNeedShowSign;
|
||||
|
||||
public int CycleCount => _cycleCount;
|
||||
public int TotalCount => _totalCount;
|
||||
|
||||
private SignObjAccumulate(DataSign data)
|
||||
{
|
||||
_itemList = new List<ItemCount>();
|
||||
|
|
@ -41,6 +45,7 @@ public class SignObjAccumulate : SignObjBase
|
|||
_cfg = data;
|
||||
var uIntCount = Actor.Instance.Logic.GetCount((uint)data.CountID);
|
||||
_accumulateCount = _ParseCount(uIntCount, out _isNeedShowSign);
|
||||
_totalCount = data.Rewards.Count;
|
||||
|
||||
for (int i = 0; i < data.Rewards.Count; i++)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -48,5 +48,21 @@ public class SignUpManager: Singlenton<SignUpManager>, IInitable
|
|||
private void _OnCheckShowSignUp()
|
||||
{
|
||||
_CreateSignObjs();
|
||||
|
||||
if (_accumulateDic[1].IsNeedToShow)
|
||||
{
|
||||
DebugUtil.LogError("----- OpenWindow -----");
|
||||
UIManager.Instance.OpenWindow(UINameConst.UI_DailyBonus, 1);
|
||||
}
|
||||
}
|
||||
|
||||
public SignObjAccumulate GetAccumulateSignObj(int signId)
|
||||
{
|
||||
if (_accumulateDic.TryGetValue(signId, out var obj))
|
||||
{
|
||||
return obj;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: d8a6b3ff8ee44da6a6e90aecda7fdde7
|
||||
timeCreated: 1709028010
|
||||
|
|
@ -0,0 +1,181 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.UIElements;
|
||||
using Button = UnityEngine.UI.Button;
|
||||
using Image = UnityEngine.UI.Image;
|
||||
using Toggle = UnityEngine.UI.Toggle;
|
||||
using ScrollView = PhxhSDK.PhxhScrollView;
|
||||
using Framework;
|
||||
using Gameplay;
|
||||
using PhxhSDK;
|
||||
|
||||
public class UI_DailyBonusController : UIWindow
|
||||
{
|
||||
//UI GameObj
|
||||
///Auto Gen Start///
|
||||
public Image Image_Title;
|
||||
public TMP_Text Text_DailyBonus;
|
||||
public Image Image_S;
|
||||
public ScrollView ScrollView_Reward;
|
||||
public Image Image_Poster;
|
||||
public Image Image_TalkBG;
|
||||
public TMP_Text Text_Talk;
|
||||
|
||||
///Auto Gen End///
|
||||
|
||||
private SignObjAccumulate _signObj;
|
||||
|
||||
private int _signObjIdx;
|
||||
|
||||
// deal with input data
|
||||
public override void PreLoad(object data = null)
|
||||
{
|
||||
if (data == null)
|
||||
{
|
||||
_signObjIdx = 1;
|
||||
return;
|
||||
}
|
||||
_signObjIdx = (int)data;
|
||||
}
|
||||
|
||||
// Use this for initialization
|
||||
public override void OnInit()
|
||||
{
|
||||
//bind UI GameObj
|
||||
UI_DailyBonusBinder.GetComponents(this);
|
||||
|
||||
BindButton("ImageBG/Button_Close", _OnClickClose);
|
||||
}
|
||||
|
||||
//invoke when open window
|
||||
protected override void OnShowWindow(object data = null)
|
||||
{
|
||||
_CreateScrollView();
|
||||
_Refresh();
|
||||
}
|
||||
|
||||
//invoke when reload window
|
||||
protected override void OnReloadWindow(object data = null)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//invoke when close window
|
||||
protected override void OnHideWindow()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//invoke when destroy
|
||||
public override void OnRelease()
|
||||
{
|
||||
base.OnRelease();
|
||||
}
|
||||
|
||||
#region RefreshPanel
|
||||
|
||||
private void _Refresh()
|
||||
{
|
||||
_SetData();
|
||||
}
|
||||
|
||||
private void _SetData()
|
||||
{
|
||||
_signObj = SignUpManager.Instance.GetAccumulateSignObj(_signObjIdx);
|
||||
if (_signObj == null)
|
||||
{
|
||||
DebugUtil.LogError("----- 每日登录奖励签到Obj为空!!!-----");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ScrollView
|
||||
|
||||
private void _CreateScrollView()
|
||||
{
|
||||
var content = CommonUtils.GetGameObject(ScrollView_Reward.gameObject, "Viewport/Content");
|
||||
if (content)
|
||||
{
|
||||
CommonUtils.DestoryAllChildGameObject(content);
|
||||
}
|
||||
|
||||
_RefreshScrollView();
|
||||
}
|
||||
|
||||
private void _RefreshScrollView()
|
||||
{
|
||||
ScrollView_Reward.SetUpdateFunc(_RefreshItem);
|
||||
ScrollView_Reward.SetItemCountFunc(_GetCountFunc);
|
||||
ScrollView_Reward.UpdateData(false);
|
||||
ScrollView_Reward.SetButton(_SetButton);
|
||||
}
|
||||
|
||||
private async void _RefreshItem(int idx, RectTransform item)
|
||||
{
|
||||
var go = item.gameObject;
|
||||
go.SetActive(true);
|
||||
|
||||
var notGetGo = CommonUtils.GetGameObject(go, "ItemReward/NotGet");
|
||||
var haveGot = CommonUtils.GetGameObject(go, "ItemReward/GotCover");
|
||||
|
||||
var img = CommonUtils.GetComponent<Image>(notGetGo, "ImageLogo");
|
||||
var txtDay = CommonUtils.GetComponent<TMP_Text>(notGetGo, "TextDayNum");
|
||||
var txtNum = CommonUtils.GetComponent<TMP_Text>(notGetGo, "TextRewardNum");
|
||||
|
||||
var itemInfo = _signObj.ItemList[idx];
|
||||
var itemId = itemInfo.Id;
|
||||
var itemCount = itemInfo.Count;
|
||||
var itemData = TableManager.Instance.Tables.Item.GetOrDefault(itemId);
|
||||
if (itemData != null)
|
||||
{
|
||||
var sprite = await AssetManager.Instance.LoadAssetAsync<Sprite>(itemData.IconPath);
|
||||
img.sprite = sprite;
|
||||
}
|
||||
|
||||
var dayStr = idx < 9 ? "0" + (idx + 1) : (idx + 1).ToString();
|
||||
txtDay.text = "Day " + dayStr;
|
||||
txtNum.text = "x" + itemCount;
|
||||
|
||||
//判断是否最新一次签到需要展示动画
|
||||
if (idx == _signObj.AccumulateCount - 1)
|
||||
{
|
||||
if (_signObj.IsNeedToShow)
|
||||
{
|
||||
//播放表现
|
||||
await UniTask.Delay(1000);
|
||||
}
|
||||
haveGot.SetActive(true);
|
||||
}
|
||||
else if(idx < _signObj.AccumulateCount - 1)
|
||||
{
|
||||
haveGot.SetActive(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
haveGot.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
private int _GetCountFunc()
|
||||
{
|
||||
return _signObj == null? 0 : _signObj.TotalCount;
|
||||
}
|
||||
|
||||
private void _SetButton(GameObject obj)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void _OnClickClose()
|
||||
{
|
||||
CloseWindow();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 831bdbea48c29154b8c2bc70c383b2ce
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using Framework;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.UIElements;
|
||||
using Button = UnityEngine.UI.Button;
|
||||
using Image = UnityEngine.UI.Image;
|
||||
using Toggle = UnityEngine.UI.Toggle;
|
||||
using ScrollView = PhxhSDK.PhxhScrollView;
|
||||
|
||||
public class UI_DailyBonusBinder
|
||||
{
|
||||
|
||||
public static void GetComponents(UI_DailyBonusController window)
|
||||
{
|
||||
window.Image_Title = window.GetComponent<Image>("ImageBG/Image_Title");
|
||||
window.Text_DailyBonus = window.GetComponent<TMP_Text>("ImageBG/Image_Title/Text_DailyBonus");
|
||||
window.Image_S = window.GetComponent<Image>("ImageBG/Image_Title/Image_S");
|
||||
window.ScrollView_Reward = window.GetComponent<ScrollView>("ImageBG/Reward/ScrollView_Reward");
|
||||
window.Image_Poster = window.GetComponent<Image>("ImageBG/Image_Poster");
|
||||
window.Image_TalkBG = window.GetComponent<Image>("ImageBG/Image_Poster/Image_TalkBG");
|
||||
window.Text_Talk = window.GetComponent<TMP_Text>("ImageBG/Image_Poster/Image_TalkBG/Text_Talk");
|
||||
|
||||
}
|
||||
|
||||
/****** 定义变量语句 ******
|
||||
public Image Image_Title;
|
||||
public TMP_Text Text_DailyBonus;
|
||||
public Image Image_S;
|
||||
public PhxhScrollView ScrollView_Reward;
|
||||
public Image Image_Poster;
|
||||
public Image Image_TalkBG;
|
||||
public TMP_Text Text_Talk;
|
||||
|
||||
****** End ******/
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 4abf43afaf2a981478b535426da22514
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -11,6 +11,7 @@ using MenuItem = UnityEditor.MenuItem;
|
|||
using Image = UnityEngine.UI.Image;
|
||||
using Slider = UnityEngine.UI.Slider;
|
||||
using Toggle = UnityEngine.UI.Toggle;
|
||||
using ScrollView = PhxhSDK.PhxhScrollView;
|
||||
|
||||
/*
|
||||
用于获取组件,写界面业务逻辑时直接拿到UGUI节点对应的对象
|
||||
|
|
@ -40,7 +41,7 @@ public class GetUIPath :Editor
|
|||
{"RawImage_",typeof(RawImage).Name },
|
||||
{"Slider_", typeof(Slider).Name },
|
||||
{"Scrollbar_", typeof(Scrollbar).Name },
|
||||
{"ScrollView_", typeof(PhxhScrollView).Name },
|
||||
{"ScrollView_", typeof(ScrollView).Name },
|
||||
{"ScrollRect_", typeof(ScrollRect).Name },
|
||||
{"Toggle_", typeof(Toggle).Name },
|
||||
{"Dropdown_", typeof(Dropdown).Name },
|
||||
|
|
@ -292,7 +293,7 @@ public class GetUIPath :Editor
|
|||
_uiBInderInfos.Add(uinf);
|
||||
if (!_isAdmitRepeat)
|
||||
{
|
||||
if (!_isAdmitRepeat)
|
||||
if (_uiCmpNameDic.ContainsKey(tfChild.name))
|
||||
{
|
||||
DebugUtil.LogError("有重名节点!!!节点名:" + tfChild.name);
|
||||
_isSuc = false;
|
||||
|
|
|
|||
Loading…
Reference in New Issue