using System.Collections.Generic; 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 UnityEngine.SceneManagement; using UnityEngine.Serialization; using Utils; using Button = UnityEngine.UI.Button; using Constants = PhxhSDK.Constants; 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 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 PhxhScrollView _levelGroupScrollView; private PhxhScrollView _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; public override void OnAwake() { //bind UI GameObj UI_LevelSelectBinder.GetComponents(this); BindProperty(); BindEvent(); RegisterSignal(); } private void BindProperty() { UI_ModeChoose = transform.Find("UI_ModeChoose") as RectTransform; UI_LevelGroupChoose = transform.Find("UI_LevelGroupChoose") as RectTransform; UI_LevelChoose = transform.Find("UI_LevelChoose") as RectTransform; _modeParent = UI_ModeChoose.Find("Scroll View/Viewport/Content") as RectTransform; _levelGroupScrollView = UI_LevelGroupChoose.Find("Image_ChapterBG/Scroll View") .GetComponent(); _levelScrollView = UI_LevelChoose.Find("Image_LevelBG/Scroll View").GetComponent(); _starRewardsParent = Image_ProcessBar.transform as RectTransform; _levelGroupScrollView.SetUpdateFunc(OnRenderChapter); _levelGroupScrollView.SetItemCountFunc(GetLevelGroupCount); //_levelGroupScrollView.SetButton(SetOnLevelGroupClick); _levelScrollView.SetUpdateFunc(OnRenderLevelInfo); _levelScrollView.SetItemCountFunc(GetLevelCount); //_levelScrollView.SetButton(SetOnLevelClick); _easyLevelGroupRedPointUI = Button_Easy.transform.Find("UI_RedPoint").GetComponent(); _hardLevelGroupRedPointUI = Button_Hard.transform.Find("UI_RedPoint").GetComponent(); _plotLevelGroupRedPointUI = Button_Plot.transform.Find("UI_RedPoint").GetComponent(); _animation = GetComponent(); } private void BindEvent() { BindButton(Button_Back, OnClickBack); BindButton(Button_Home, OnClickHome); BindButton(Button_Easy, OnClickEasy); BindButton(Button_Hard, OnClickHard); BindButton(Button_Plot, OnClickPlot); BindButton(Button_GetAll, OnClickStarReward); var modeButtonCount = _modeParent.childCount; for (int i = 0; i < modeButtonCount; i++) { var modeButton = _modeParent.GetChild(i).GetComponent