using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Net.Sockets;
using System.Threading;
using cfg.FightCfg;
using cfg.LevelCfg;
using Cysharp.Threading.Tasks;
using Framework;
using Gameplay;
using Gameplay.Common;
using Gameplay.Level;
using Gameplay.Net;
using PhxhSDK;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
using Constants = Framework.Constants;
public class UI_LevelSelectController : UIWindow
{
///
/// 打开关卡选择界面
///
/// 有数据则跳转到对应关卡选项,没有数据则显示默认
///
public static async UniTask Open(LevelInfo levelInfo = null)
{
// 切换场景会有瞬间卡顿,先打开UI
UIWindow uiWindow = await UIManager.Instance.CreateAndOpenWindow(UINameConst.UI_LevelSelect, levelInfo);
CommonUtils.ChangeUIScene(Constants.UI_LEVEL_SELECTED_SCENE_PATH); // 切换到关卡选择场景
CameraManager.Instance.SetMainCameraActive(true);
return uiWindow;
}
#region 结构
///
/// 页签模式
///
private enum E_PageModeType
{
None,
///
/// 章节
///
Chapter,
///
/// 关卡
///
Level,
}
///
/// 模式按钮
///
private class ModeButton : UIGameObjectWrapper
{
#region UI
///
/// 章节按钮
///
private Button button;
///
/// 选中状态
///
private GameObject goSelect;
///
/// 未选中状态
///
private GameObject goUnSelect;
///
/// 选中箭头
///
private GameObject goTriangle;
#endregion
///
/// 选择模式
///
private readonly Action selectModeAction;
///
/// 章节类型
///
private readonly E_ChapterType chapterType;
public bool IsSelect
{
set
{
goSelect.IsScaleShow(value);
goTriangle.IsScaleShow(value);
goUnSelect.IsScaleShow(!value);
}
}
public ModeButton(GameObject root, E_ChapterType type, Action selectMode) : base(root, true)
{
chapterType = type;
selectModeAction = selectMode;
button = GoRoot.GetComponent