NLDClient-yudde/ProjectNLD/Assets/Code/Scripts/Gameplay/UI/UI_VehiclePartTreeDetailCon...

148 lines
3.8 KiB
C#

using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.UIElements;
using Button = UnityEngine.UI.Button;
using Image = UnityEngine.UI.Image;
using Toggle = UnityEngine.UI.Toggle;
using ScrollView = PhxhSDK.PhxhScrollView;
using Framework;
using Cysharp.Threading.Tasks;
using DG.Tweening;
using System;
public class UI_VehiclePartTreeDetailController : UIWindow
{
#region UI
//UI GameObj
///Auto Gen Start///
public Image Image_Bg;
public TMP_Text Text_Name;
public Button Button_Check;
public Image Image_Attributes;
public TMP_Text Text_AttributesTitle;
public Image Image_UpSign_Hp;
public Image Image_UpBg_Hp;
public TMP_Text Text_Title_Hp;
public TMP_Text Text_UpTitle_Hp;
public TMP_Text Text_Value_Hp;
public Image Image_UpSign_MemberCount;
public Image Image_UpBg_MemberCount;
public TMP_Text Text_Title_MemberCount;
public TMP_Text Text_UpTitle_MemberCount;
public TMP_Text Text_Value_MemberCount;
public Image Image_UpSign_Def;
public Image Image_UpBg_Def;
public TMP_Text Text_Title_Def;
public TMP_Text Text_UpTitle_Def;
public TMP_Text Text_Value_Def;
public Image Image_UpSign_Atk;
public Image Image_UpBg_Atk;
public TMP_Text Text_Title_Atk;
public TMP_Text Text_UpTitle_Atk;
public TMP_Text Text_Value_Atk;
public Image Image_UpSign_BulletCount;
public Image Image_UpBg_BulletCount;
public TMP_Text Text_Title_BulletCount;
public TMP_Text Text_UpTitle_BulletCount;
public TMP_Text Text_Value_BulletCount;
public Image Image_UpSign_Speed;
public Image Image_UpBg_Speed;
public TMP_Text Text_Title_Speed;
public TMP_Text Text_UpTitle_Speed;
public TMP_Text Text_Value_Speed;
public Image Image_Terrain;
public TMP_Text Text_TerrainTitle;
public TMP_Text Text_Title_Ground;
public TMP_Text Text_Value_Ground;
public TMP_Text Text_Title_Mountain;
public TMP_Text Text_Value_Mountain;
public TMP_Text Text_Title_Snow;
public TMP_Text Text_Value_Snow;
public TMP_Text Text_Title_Wood;
public TMP_Text Text_Value_Wood;
public Image Image_SkillBg;
public Image Image_VehicleSkill;
public TMP_Text Text_TitleSkill;
public TMP_Text Text_SkillName;
public TMP_Text Text_ClassTitle;
public TMP_Text Text_SkillLevel;
public Image Image_SkillIcon;
public Image Image_SkillCoolingTimeBg;
public TMP_Text Text_SkillCoolingTimeValue;
public TMP_Text Text_SkillInfo;
///Auto Gen End///
#endregion
public async static UniTask<UIWindow> Open(long TreeNodeID)
{
return await UIManager.Instance.CreateAndOpenWindow(UINameConst.UI_VehiclePartTreeDetail, TreeNodeID);
}
// deal with input data
public override void PreLoad(object data = null)
{
var ID = (long)data;
DebugUtil.Log("Vehicle Part Tree Detail ID: " + ID);
}
// Use this for initialization
public override void OnInit()
{
//bind UI GameObj
UI_VehiclePartTreeDetailBinder.GetComponents(this);
Image_Bg.GetComponent<RectTransform>().pivot = new Vector2(0, 0.5f);
OnSwitchAnim(true);
var BgClose = FindObj("Bg_Close");
BindButton(BgClose, () =>
{
OnSwitchAnim(false, () =>
{
CloseWindow();
});
});
}
void OnSwitchAnim(bool isShow, Action callback = null)
{
if (isShow)
{
//play show anim
Image_Bg.GetComponent<RectTransform>().DOPivotX(1f, 0.5f).SetEase(Ease.OutBack).OnComplete(() => callback?.Invoke());
}
else
{
Image_Bg.GetComponent<RectTransform>().DOPivotX(0f, 0.5f).OnComplete(() => callback?.Invoke());
}
}
//invoke when open window
protected override void OnShowWindow(object data = null)
{
}
//invoke when reload window
protected override void OnReloadWindow(object data = null)
{
}
//invoke when close window
protected override void OnHideWindow()
{
}
//invoke when destroy
public override void OnRelease()
{
base.OnRelease();
}
}