先修复一下,错误的场景 删除不必要的钓场资产 修复into场景 update:更新meta文件,修复报错 update:修复资源 修复第一章节建造 修复建造第三章 update:删除多余内容 update:更新README.md update:还原图标 update:更新README update:更新配置
62 lines
1.8 KiB
C#
62 lines
1.8 KiB
C#
using asap.core;
|
||
using cfg;
|
||
using GameCore;
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using UnityEngine;
|
||
using UniRx;
|
||
public class GetCurSelectMapEvent
|
||
{
|
||
public int type;//0获得当前选中的地图,1更新当前选中的地图
|
||
public MapData selectMap;
|
||
}
|
||
public class PlayerGradeProgress : MonoBehaviour
|
||
{
|
||
GameObject item;
|
||
Transform content;
|
||
List<GradeMapItem> gradeMapItems = new List<GradeMapItem>();
|
||
GradeMapItem selectMap;
|
||
IDisposable disposable;
|
||
private void Awake()
|
||
{
|
||
disposable = GContext.OnEvent<GetCurSelectMapEvent>().Subscribe(GetCurSelectMap);
|
||
item = transform.Find("ScrollView/Viewport/Content/Item").gameObject;
|
||
content = transform.Find("ScrollView/Viewport/Content");
|
||
item.SetActive(false);
|
||
}
|
||
private void Start()
|
||
{
|
||
var DataMap = GContext.container.Resolve<Tables>().TbMapData.DataMap;
|
||
int requireLevel = 0;
|
||
foreach (var mapData in DataMap.Values)
|
||
{
|
||
GameObject go = Instantiate(item, content);
|
||
GradeMapItem gradeMapItem = go.GetComponent<GradeMapItem>();
|
||
gradeMapItems.Add(gradeMapItem);
|
||
gradeMapItem.GetComponent<GradeMapItem>().SetData(mapData, requireLevel, OnClickMap);
|
||
requireLevel = mapData.LevelRequired;
|
||
}
|
||
}
|
||
async void OnClickMap(GradeMapItem gradeMapItem)
|
||
{
|
||
selectMap = gradeMapItem;
|
||
await UIManager.Instance.ShowUI(UITypes.PlayerGradeAquariumPanel);
|
||
}
|
||
void GetCurSelectMap(GetCurSelectMapEvent getCurSelectMapEvent)
|
||
{
|
||
if (getCurSelectMapEvent.type == 0)
|
||
{
|
||
getCurSelectMapEvent.selectMap = selectMap.mapData;
|
||
}
|
||
else
|
||
{
|
||
selectMap.Refresh();
|
||
}
|
||
}
|
||
private void OnDestroy()
|
||
{
|
||
disposable?.Dispose();
|
||
disposable = null;
|
||
}
|
||
}
|