using System.Collections.Generic;
using System.Linq;
using System.Threading;
using cfg.LevelCfg;
using Cysharp.Threading.Tasks;
using Framework;
using Gameplay;
using Gameplay.Level;
using Gameplay.SubSystems;
using PhxhSDK;
using TMPro;
using UnityEngine;
using Button = UnityEngine.UI.Button;
using Image = UnityEngine.UI.Image;
public class UI_LevelSelectController : UIWindow
{
//UI GameObj
///Auto Gen Start///
public Button Button_Back;
public TMP_Text Text_Back;
public Button Button_Home;
public Button Button_MainLevel;
public Image Image_MainlevelLogo;
public Button Button_DungeonlEVEL;
public Image Image_TextBG;
public TMP_Text Text_MainLevel;
public TMP_Text Text_Campaignnode;
public Image Image_BlackBar;
public TMP_Text Text_MainLevelProcess;
public TMP_Text Text_MainLevelNum;
public TMP_Text Text_MainLevelName;
public Image Image_Seperate;
public Image Image_LastRect;
public TMP_Text Text_LastLevel;
public TMP_Text Text_LastLevelNum;
public TMP_Text Text_LastLevelName;
public Button Button_BranchLevel;
public Image Image_ChapterBG;
public TMP_Text Text_Title;
public Image Image_FractionlLogo;
public Image Image_LevelBG;
public TMP_Text Text_ChapterName;
public TMP_Text Text_ChapterNum;
public Image Image_ProcessBG;
public Image Image_ProcessBar;
public Image Image_Reward01;
public Image Image_Reward02;
public Image Image_Reward03;
public Button Button_GetAll;
public TMP_Text Text_StarNum;
public Image Image_Start;
public Image Image_ModeBG;
public Image Image_SelectBG;
public Button Button_Plot;
public TMP_Text Text_Read;
public Image Image_Pot;
public Button Button_Easy;
public TMP_Text Text_Simple;
public Button Button_Hard;
public TMP_Text Text_Hard;
public Image Image_pot;
public TMP_Text Text_Mode;
///Auto Gen End///
private const string IN_ANIMATION_NAME = "LS_MoveIn";
private const string OUT_ANIMATION_NAME = "LS_MoveOut";
///
/// 电池
///
private class Batterie : UIGameObjectWrapper
{
///
/// 电池电量
///
private readonly List listBatteryPower;
public Batterie(GameObject root) : base(root)
{
listBatteryPower = new(GoRoot.transform.childCount);
for (int i = 0; i < GoRoot.transform.childCount; ++i)
{
listBatteryPower.Add(GoRoot.transform.GetChild(i).gameObject);
}
}
///
/// 入口
///
///
public void SetInfo(float batteryPower)
{
int showCount = Mathf.CeilToInt(listBatteryPower.Count * batteryPower);
for (int i = 0; i < listBatteryPower.Count; ++i)
{
listBatteryPower[i].IsScaleShow(i + 1 == showCount);
}
}
}
///
/// WIFI
///
private class NetSignal : UIGameObjectWrapper
{
///
/// Wifi信号
///
private readonly List listWifi;
public NetSignal(GameObject root) : base(root)
{
listWifi = new(GoRoot.transform.childCount);
for (int i = 0; i < GoRoot.transform.childCount; ++i)
{
listWifi.Add(GoRoot.transform.GetChild(i).gameObject);
}
}
///
/// 入口
///
///
public void SetInfo(float networkSignal)
{
int showCount = Mathf.CeilToInt(listWifi.Count * networkSignal);
for (int i = 0; i < listWifi.Count; ++i)
{
listWifi[i].IsScaleShow(i + 1 == showCount);
}
}
}
private enum PageType
{
Mode = 1,
Chapter = 2,
Level = 3,
}
private Animation _animation;
private PageType _currPage = PageType.Mode;
private LevelChapterType _currChapterType;
private ChapterInfo _currChapterInfo;
private LevelGroupInfo _currEasyLevelGroupInfo;
private LevelGroupInfo _currHardLevelGroupInfo;
private LevelGroupInfo _currPlotLevelGroupInfo;
private LevelGroupInfo _currLevelGroupInfo;
private LevelInfo _currSelectLevelInfo;
private List _showChapterInfoList = new();
private List _showLevelInfoList = new();
private RectTransform UI_ModeChoose;
private RectTransform UI_LevelGroupChoose;
private RectTransform UI_LevelChoose;
private RectTransform _modeParent;
private RecycleView _levelGroupScrollView;
private RecycleView _levelScrollView;
private RectTransform _starRewardsParent;
private RedPointUIController _easyLevelGroupRedPointUI;
private RedPointUIController _hardLevelGroupRedPointUI;
private RedPointUIController _plotLevelGroupRedPointUI;
//private const string STAR_REWARD_PREFAB_PATH = "Assets/Art/UI/Prefab/LevelSelect/Button_StarReward.prefab";
// private List _starRewardPool = new();
// private List _showStarReward = new();
private float _progressmoveSpeed = 1f;
private CancellationTokenSource _cts;
///
/// 电量
///
private Batterie batterie;
///
/// 网络信号
///
private NetSignal netSignal;
///
/// 刷新计时
///
private float timer;
private List