Files
MinFt/Client/Assets/Scripts/UI/Home/SupplyDropInfoPopupPanel.cs
Liubing\LB 3d8d4d18f3 first commit
先修复一下,错误的场景

删除不必要的钓场资产

修复into场景

update:更新meta文件,修复报错

update:修复资源

修复第一章节建造

修复建造第三章

update:删除多余内容

update:更新README.md

update:还原图标

update:更新README

update:更新配置
2026-04-28 02:17:22 +08:00

95 lines
2.7 KiB
C#

using asap.core;
using cfg;
using GameCore;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class SupplyDropInfoPopupPanel : MonoBehaviour
{
Button _btnClose;
Button btnMask;
SupplyDropPopupPanel supplyDropPanel;
List<GameObject> selects;
int indexCurrent = 0;
int ShowSupplyDropIndex = 6;
int allCount = 0;
Button btn_right;
Button btn_left;
private void Awake()
{
_btnClose = transform.Find("btn_close").GetComponent<Button>();
btnMask = transform.Find("mask").GetComponent<Button>();
supplyDropPanel = transform.Find("root").GetComponent<SupplyDropPopupPanel>();
supplyDropPanel.Init();
selects = new List<GameObject>();
btn_right = transform.Find("root/btn_right").GetComponent<Button>();
btn_left = transform.Find("root/btn_left").GetComponent<Button>();
allCount = supplyDropPanel.detailsItems.Count;
Transform sliding = transform.Find("root/Sliding");
int count = sliding.childCount;
for (int i = 0; i < count; i++)
{
GameObject obj = sliding.GetChild(i).Find("Select").gameObject;
selects.Add(obj);
obj.SetActive(false);
}
var _tables = GContext.container.Resolve<Tables>();
var playerData = GContext.container.Resolve<PlayerData>();
var DataList = _tables.TbEnergyDef.DataList;
for (int i = 0; i < DataList.Count; i++)
{
if (DataList[i].SupplyDrop > 0)
{
ShowSupplyDropIndex = i;
break;
}
}
if (playerData.magnification >= ShowSupplyDropIndex && playerData.magnification < ShowSupplyDropIndex + allCount)
{
indexCurrent = playerData.magnification - ShowSupplyDropIndex;
}
Show();
}
private void Start()
{
_btnClose.onClick.AddListener(OnClickClose);
btnMask.onClick.AddListener(OnClickClose);
btn_right.onClick.AddListener(OnClickRight);
btn_left.onClick.AddListener(OnClickLeft);
}
void OnClickRight()
{
indexCurrent++;
if (indexCurrent >= allCount)
{
indexCurrent = 0;
}
Show();
}
void OnClickLeft()
{
indexCurrent--;
if (indexCurrent < 0)
{
indexCurrent = allCount - 1;
}
Show();
}
void Show()
{
supplyDropPanel.Show(indexCurrent);
for (int i = 0; i < selects.Count; i++)
{
selects[i].SetActive(i == indexCurrent);
}
}
void OnClickClose()
{
UIManager.Instance.DestroyUI(UITypes.SupplyDropInfoPopupPanel);
}
}