备份CatanBuilding瘦身独立工程
This commit is contained in:
71
Assets/Scripts/UI/CommunityGuidancePanel.cs
Normal file
71
Assets/Scripts/UI/CommunityGuidancePanel.cs
Normal file
@@ -0,0 +1,71 @@
|
||||
using asap.core;
|
||||
using cfg;
|
||||
using GameCore;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Assertions;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class CommunityGuidancePanel : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private Button btnClose;
|
||||
private Tables _tables;
|
||||
private TbJoinUs _tableJoin;
|
||||
private TbDrop _tableDrop;
|
||||
private TbItem _tableItem;
|
||||
private PlayerItemData _playerItemData;
|
||||
private IFootPrintService _footPrintService;
|
||||
|
||||
[SerializeField] private CommunityGuidanceSlot[] communityGuidanceSlots;
|
||||
|
||||
// Start is called before the first frame update
|
||||
private void Start()
|
||||
{
|
||||
btnClose.onClick.AddListener(OnClickClose);
|
||||
_tables = GContext.container.Resolve<Tables>();
|
||||
_tableDrop = _tables.TbDrop;
|
||||
_tableJoin = _tables.TbJoinUs;
|
||||
_tableItem = _tables.TbItem;
|
||||
_playerItemData = GContext.container.Resolve<PlayerItemData>();
|
||||
GContext.container.Resolve<FishingEventData>();
|
||||
_footPrintService = GContext.container.Resolve<IFootPrintService>();
|
||||
int tbCount = _tableJoin.DataList.Count, prefabCount = communityGuidanceSlots.Length;
|
||||
Assert.IsTrue(tbCount == prefabCount,
|
||||
$"Quantity mismatch: {tbCount} records found in table and {prefabCount} prefabs found in GameObject.");
|
||||
_footPrintService.UpdateFootPrint(EFootPrint.HasCommunityGuidancePanelBeenOpened);
|
||||
for (int i = 0; i < tbCount; i++)
|
||||
{
|
||||
communityGuidanceSlots[i].Init(new CommunityGuidanceCtx(_tableJoin.DataList[i].Url,
|
||||
_tableJoin.DataList[i].Reward, _tableDrop, _tableItem, _playerItemData,
|
||||
_footPrintService, i + 1, _tableJoin.DataList[i].Name));
|
||||
}
|
||||
}
|
||||
|
||||
private void OnClickClose()
|
||||
{
|
||||
UIManager.Instance.DestroyUI(UITypes.CommunityGuidancePanel);
|
||||
}
|
||||
|
||||
public class CommunityGuidanceCtx
|
||||
{
|
||||
public readonly string Url;
|
||||
public readonly int DropId, Index;
|
||||
public readonly TbDrop TableDrop;
|
||||
public readonly TbItem TableItem;
|
||||
public readonly PlayerItemData PlayerItemData;
|
||||
public readonly IFootPrintService FootPrintService;
|
||||
public readonly string Name;
|
||||
|
||||
public CommunityGuidanceCtx(string url, int dropId, TbDrop drop, TbItem item,
|
||||
PlayerItemData playerItemData, IFootPrintService footPrintService, int idx, string name)
|
||||
{
|
||||
Url = url;
|
||||
DropId = dropId;
|
||||
TableDrop = drop;
|
||||
TableItem = item;
|
||||
PlayerItemData = playerItemData;
|
||||
FootPrintService = footPrintService;
|
||||
Index = idx;
|
||||
Name = name;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user