NLDClient-yudde/ProjectNLD/Assets/Code/Scripts/Gameplay/UI/UI_CampController.cs

138 lines
3.5 KiB
C#
Raw Normal View History

2024-04-22 16:52:21 +08:00
using Gameplay;
2024-04-03 18:20:32 +08:00
using PhxhSDK.Res;
2024-01-12 14:38:11 +08:00
using System.Collections.Generic;
2024-08-20 16:41:25 +08:00
using Cysharp.Threading.Tasks;
2024-01-12 14:38:11 +08:00
using UnityEngine;
using Button = UnityEngine.UI.Button;
2024-10-09 13:29:27 +08:00
using Framework;
2024-01-12 14:38:11 +08:00
public class UI_CampController : UIWindow
{
2024-10-28 16:49:53 +08:00
#region UI
2024-04-03 18:20:32 +08:00
/// <summary>
/// 返回按钮
/// </summary>
private Button buttonBack;
/// <summary>
/// 主页按钮
/// </summary>
private Button buttonHome;
2024-03-06 17:36:51 +08:00
/// <summary>
2024-10-28 16:49:53 +08:00
/// 训练区按钮
2024-03-06 17:36:51 +08:00
/// </summary>
2024-10-28 16:49:53 +08:00
private Button buttonTraning;
2024-04-03 18:20:32 +08:00
/// <summary>
2024-10-28 16:49:53 +08:00
/// 训练区2按钮
2024-04-03 18:20:32 +08:00
/// </summary>
2024-10-28 16:49:53 +08:00
private Button buttonCommunicate;
2024-04-03 18:20:32 +08:00
/// <summary>
2024-10-28 16:49:53 +08:00
/// 生活区按钮
2024-04-03 18:20:32 +08:00
/// </summary>
2024-10-28 16:49:53 +08:00
private Button buttonLife;
/// <summary>
/// 准备按钮
/// </summary>
private Button buttonPrepar;
2024-04-03 18:20:32 +08:00
/// <summary>
2024-10-28 16:49:53 +08:00
/// 修理区
2024-04-03 18:20:32 +08:00
/// </summary>
2024-10-28 16:49:53 +08:00
private Button buttonRepair;
2024-04-03 18:20:32 +08:00
/// <summary>
2024-10-28 16:49:53 +08:00
/// 物资存放区
2024-04-03 18:20:32 +08:00
/// </summary>
2024-10-28 16:49:53 +08:00
private Button buttonStorage;
#endregion
2024-01-12 14:38:11 +08:00
2024-01-23 12:25:47 +08:00
public override void OnInit()
2024-01-12 14:38:11 +08:00
{
2024-04-03 18:20:32 +08:00
buttonBack = GetComponent<Button>("Button_Back/Button_back");
buttonHome = GetComponent<Button>("Button_Back/Button_Home");
2024-10-28 16:49:53 +08:00
buttonTraning = GetComponent<Button>("UI_AreaTraning/Button_AreaTraning");
buttonCommunicate = GetComponent<Button>("UI_AreaCommunicate/Button_AreaCommunicate");
buttonLife = GetComponent<Button>("UI_AreaLiving/Button_AreaLiving");
buttonPrepar = GetComponent<Button>("UI_AreaPreparation/Button_AreaPreparation");
buttonRepair = GetComponent<Button>("UI_AreaRepair/Button_AreaRepair");
buttonStorage = GetComponent<Button>("UI_AreaStorage/Button_AreaStorage");
2024-04-03 18:20:32 +08:00
BindButton(buttonBack, OnClickBack);
BindButton(buttonHome, OnClickBack);
2024-10-28 16:49:53 +08:00
BindButton(buttonTraning, OnTraning);
BindButton(buttonCommunicate, OnCommunicate);
BindButton(buttonLife, OnLife);
BindButton(buttonPrepar, OnPrepar);
BindButton(buttonRepair, OnRepair);
BindButton(buttonStorage, OnStorage);
2024-01-12 14:38:11 +08:00
}
2024-08-20 16:41:25 +08:00
public override async UniTask<bool> OnBack(object data = null)
{
return false;
}
2024-01-12 14:38:11 +08:00
2024-04-03 18:20:32 +08:00
#region 回调
/// <summary>
/// 点击退出
/// </summary>
2024-05-17 18:28:31 +08:00
private async void OnClickBack()
2024-01-12 14:38:11 +08:00
{
2024-05-17 18:28:31 +08:00
await CommonUtils.CloseUIWithScene(UINameConst.UI_Camp);
2024-04-26 15:43:29 +08:00
GameStateManager.Instance.ChangeState(new GameStateMainScene());
2024-01-12 14:38:11 +08:00
}
2024-03-06 17:36:51 +08:00
/// <summary>
2024-10-28 16:49:53 +08:00
/// 训练区
2024-03-06 17:36:51 +08:00
/// </summary>
2024-10-28 16:49:53 +08:00
private async void OnTraning()
2024-03-06 17:36:51 +08:00
{
2024-10-28 16:49:53 +08:00
await UI_Camp_SecondController.Open("训练区");
}
/// <summary>
/// 通讯区
/// </summary>
private async void OnCommunicate()
{
await UI_Camp_SecondController.Open("通讯区");
}
/// <summary>
/// 生活区
/// </summary>
private async void OnLife()
{
await UI_Camp_SecondController.Open("生活区");
2024-03-06 17:36:51 +08:00
}
2024-04-03 18:20:32 +08:00
/// <summary>
2024-10-28 16:49:53 +08:00
/// 整备区
2024-04-03 18:20:32 +08:00
/// </summary>
2024-10-28 16:49:53 +08:00
private async void OnPrepar()
2024-04-03 18:20:32 +08:00
{
2024-10-28 16:49:53 +08:00
await UI_Camp_SecondController.Open("整备区");
}
2024-04-03 18:20:32 +08:00
2024-10-28 16:49:53 +08:00
/// <summary>
/// 修理区
/// </summary>
private async void OnRepair()
{
await UI_Camp_SecondController.Open("修理区");
2024-04-03 18:20:32 +08:00
}
/// <summary>
2024-10-28 16:49:53 +08:00
/// 物资存放区
2024-04-03 18:20:32 +08:00
/// </summary>
2024-10-28 16:49:53 +08:00
private async void OnStorage()
2024-04-03 18:20:32 +08:00
{
2024-10-28 16:49:53 +08:00
await UI_Camp_SecondController.Open("物资存放区");
}
2024-04-03 18:20:32 +08:00
2024-10-28 16:49:53 +08:00
/// <summary>
/// 技能养成
/// </summary>
private async void OnSkill()
{
await UI_CommandSkillCultivateController.Open();
2024-04-03 18:20:32 +08:00
}
#endregion
2024-01-12 14:38:11 +08:00
}