using cfg.ActorCfg;
using cfg.LevelCfg;
using Cysharp.Threading.Tasks;
using Framework;
using Gameplay;
using Gameplay.Common;
using Gameplay.Level;
using PhxhSDK;
using System;
using System.Collections.Generic;
using System.Linq;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
using Button = UnityEngine.UI.Button;
using Image = UnityEngine.UI.Image;
using Object = UnityEngine.Object;
public class UI_LevelDetailController : UIWindow
{
//UI GameObj
///Auto Gen Start///
public Image Image_BG;
public Button Button_Close;
public TMP_Text Text_LevelNum;
public TMP_Text Text_LevelName;
public Image Image_Shadow;
public Image Image_Misson;
public Image Image_Weather;
public Image Image_DayOrNight;
public TMP_Text Text_DayOrNight;
public Image Image_Seperate;
public Image Image_weather;
public TMP_Text Text_WeatherAndLand01;
public Image Image_environment;
public TMP_Text Text_WeatherAndLand02;
public Image Image_Buff;
public TMP_Text Text_Buff;
public TMP_Text Text_GetReward;
public TMP_Text Text_AlreadyGet;
public TMP_Text Text_Sweep;
public Image Image_SweepNum;
public TMP_Text Text_Num;
public Button Button_Minus;
public Button Button_Plus;
public Button Button_StartSweep;
public Image Image_physicalBG;
public Image Image_Physical;
public TMP_Text Text_PhysicalNum;
public TMP_Text Text_StartSweep;
public Button Button_Cancel;
public TMP_Text Text_Cancel;
public Image Image_StartFight;
public TMP_Text Text_StartFight;
///Auto Gen End///
///
/// 打开关卡详情界面
///
public static async UniTask Open(LevelInfo levelInfo)
{
CommonUtils.CaptureScreenshot();
return await UIManager.Instance.OpenWindow(UINameConst.UI_LevelDetail, levelInfo);
}
///
/// 高斯模糊遮罩
///
private RawImage rawImageGaussianBlurMask;
private UnityEngine.UI.ScrollRect _numScrollView;
private UIScrollFocusHelper _scrollFocusCmp;
private GameObject _numItem;
private GameObject _maskObj;
private const int MAX_SWEEPNUM = 10;
private const int SWEEP_NUM_CONST = 3; //扫荡列表前后默认item数量
private class RewardShowItem
{
public RewardItem rewardItem;
public ERewardType rewardType;
public bool hasGet;
public RewardShowItem(RewardItem rewardItem, ERewardType rewardType, bool hasGet)
{
this.rewardItem = rewardItem;
this.rewardType = rewardType;
this.hasGet = hasGet;
}
}
private LevelInfo _currLevelInfo;
PhxhScrollView _mCurrentScrollView = null;
private Button _fightBtn;
private int _sweepNum = -1;
private int SweepNum
{
get => _sweepNum;
set
{
if (_sweepNum != value)
{
_sweepNum = value;
if (_sweepNum < 0)
_sweepNum = 0;
//Text_Num.text = _sweepNum.ToString();
_SetCostEnergyItemCount();
}
}
}
private List _allRewards = new();
//private int _currTeamIndex = -1;
private Team _currTeam;
private int _teamIndexMax;
// deal with input data
public override void PreLoad(object data)
{
_currLevelInfo = data != null?data as LevelInfo : _currLevelInfo;
CommonUtils.PreLoadOrUnloadEnvironmentWeatherDayNightIcon(true);
}
// Use this for initialization
public override void OnInit()
{
//bind UI GameObj
UI_LevelDetailBinder.GetComponents(this);
rawImageGaussianBlurMask = GetComponent("GaussianBlurMask");
_mCurrentScrollView = GetComponent("Image_BG/RewardAndSweep/Text_GetReward/PhxhScrollView");
_fightBtn = GetComponent