备份CatanBuilding瘦身独立工程
This commit is contained in:
47
Assets/Scripts/UI/Shop/FishingShopSelectMapPopupPanel.cs
Normal file
47
Assets/Scripts/UI/Shop/FishingShopSelectMapPopupPanel.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
using asap.core;
|
||||
using cfg;
|
||||
using GameCore;
|
||||
using UniRx;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class FishingShopSelectMapPopupPanel : MonoBehaviour
|
||||
{
|
||||
#region Field
|
||||
[SerializeField]
|
||||
Transform
|
||||
tran_mapParent;
|
||||
[SerializeField]
|
||||
GameObject
|
||||
go_mapSlot;
|
||||
[SerializeField]
|
||||
Button
|
||||
btn_confirm,
|
||||
btn_close;
|
||||
private int curMapID;
|
||||
#endregion
|
||||
|
||||
#region Func
|
||||
public void Init(int mapID)
|
||||
{
|
||||
curMapID = mapID;
|
||||
go_mapSlot.SetActive(false);
|
||||
var mapDatas = GContext.container.Resolve<Tables>().TbMapData.DataMap;
|
||||
btn_close.onClick.AddListener(() => UIManager.Instance.DestroyUI(UITypes.FishingShopSelectMapPopupPanel));
|
||||
int requireLevel = 0;
|
||||
foreach ( var mapData in mapDatas.Values )
|
||||
{
|
||||
Instantiate(go_mapSlot, tran_mapParent).GetComponent<FishCardMapSelectSlot>().SetData(mapData, requireLevel);
|
||||
requireLevel = mapData.LevelRequired;
|
||||
}
|
||||
GContext.Publish(new FishCardShopSlot.SChangeFishCardMapEvent { MapData = mapDatas[curMapID] });
|
||||
btn_confirm.onClick.AddListener(() => {
|
||||
GContext.Publish(new FishCardShopSlot.SChangeFishCardMapEvent { IsConfirm = true, MapData = mapDatas[curMapID] });
|
||||
UIManager.Instance.DestroyUI(UITypes.FishingShopSelectMapPopupPanel);
|
||||
});
|
||||
GContext.OnEvent<FishCardShopSlot.SChangeFishCardMapEvent>().Where(x => !x.IsConfirm).Subscribe(x => curMapID = x.MapData.ID).AddTo(this);
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
Reference in New Issue
Block a user