123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- /// #pkgName FGUI包名
- /// #panelName UIPanel名字
- /// #UIName = $"{#pkgName}{#panelName}" UIKey名字
- /// 该脚本由模板创建
- /// created by cb 2024
- using System.Collections.Generic;
- using FairyGUI;
- using FL.Data;
- using FL.Data.Items;
- using XGame.Database;
- using XGame.Framework.UI;
- namespace FL.FGUI
- {
- /// <summary>
- /// UI逻辑处理类
- /// </summary>
- /// <typeparam name=""></typeparam>
- public partial class PartnerBookDetailListItemCtrl : UIController<PartnerBookDetailListItemVM>
- {
- protected override void OnEnable(object intent)
- {
- AddUIListenres();
- }
- protected override void OnDisable()
- {
- RemoveUIListenres();
- }
- #region UI事件
- private void AddUIListenres()
- {
- VM.GotoBtn.onClick.Add(OnClickGotoBtn);
- VM.GetBtn.onClick.Add(OnClickGetBtn);
- }
- private void RemoveUIListenres()
- {
- VM.GotoBtn.onClick.Remove(OnClickGotoBtn);
- VM.GetBtn.onClick.Remove(OnClickGetBtn);
- }
- private void OnClickGotoBtn(EventContext context) { }
- private void OnClickGetBtn(EventContext context)
- {
- PartnersService.Instance.RequestJibanRwdGet(_id);
- }
- #endregion
- private int _id;
- public void OnRefresh(int index, collect_rewardTable table)
- {
- _id = table.Id;
- VM.DescLabel.text = table.Name;
- var item = new ItemBase();
- item.Init(table.Reward[0], table.Reward[1]);
- VM.ItemBtn.Ctrl.ShowUI(item);
- var list = new List<PartnerBookTextParam>();
- for (int i = 0; i < table.Attribute.Length; i += 2)
- {
- list.Add(
- new PartnerBookTextParam()
- {
- attrId = table.Attribute[i],
- val = table.Attribute[i + 1],
- }
- );
- }
- VM.List.BindDatas(list);
- var collect = collectTableRepo.Get(table.CollectId);
- XGame.Framework.Assert.IsNotNull(collect);
- var starLv = 0;
- foreach (var id in collect.Param)
- {
- if (
- collect.Type == 1
- && PartnersData.Instance.TryGetPartnerAttrByTableId(id, out var attr)
- )
- {
- starLv += attr.RisingStarLv;
- }
- else if (
- collect.Type == 2
- && EpigraphData.Instance.TryGetEpigraphAttrByTableId(id, out var epi)
- )
- {
- starLv += epi.StarLv;
- }
- }
- if (starLv >= table.Unlock)
- {
- if (collect.Type == 1)
- {
- if (PartnersData.Instance.GetJibaIsActive(table.CollectId, table.Level))
- {
- VM.State.selectedIndex = 2;
- }
- else
- {
- VM.State.selectedIndex = 1;
- }
- }
- else if (collect.Type == 2)
- {
- if (EpigraphData.Instance.GetJibaIsActive(table.CollectId, table.Level))
- {
- VM.State.selectedIndex = 2;
- }
- else
- {
- VM.State.selectedIndex = 1;
- }
- }
- }
- else
- {
- VM.State.selectedIndex = 0;
- }
- }
- }
- }
|