2024-12-16 14:07:41 +08:00
|
|
|
|
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;
|
2024-12-17 15:00:40 +08:00
|
|
|
|
using Gameplay.Net;
|
2024-12-18 14:39:01 +08:00
|
|
|
|
using cfg.VihecleCultivateCfg;
|
2024-12-16 14:07:41 +08:00
|
|
|
|
|
|
|
|
|
|
public class UI_VehiclePartTreeDetailController : UIWindow
|
|
|
|
|
|
{
|
|
|
|
|
|
#region UI
|
|
|
|
|
|
//UI GameObj
|
|
|
|
|
|
///Auto Gen Start///
|
2024-12-17 15:00:40 +08:00
|
|
|
|
public Image Image_Bg;
|
2024-12-16 14:07:41 +08:00
|
|
|
|
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;
|
2024-12-17 15:00:40 +08:00
|
|
|
|
public Button Button_Equipment;
|
|
|
|
|
|
|
2024-12-16 14:07:41 +08:00
|
|
|
|
///Auto Gen End///
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-12-17 13:26:31 +08:00
|
|
|
|
private long ID;
|
|
|
|
|
|
|
2024-12-16 14:07:41 +08:00
|
|
|
|
public async static UniTask<UIWindow> Open(long TreeNodeID)
|
|
|
|
|
|
{
|
|
|
|
|
|
return await UIManager.Instance.CreateAndOpenWindow(UINameConst.UI_VehiclePartTreeDetail, TreeNodeID);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-12-17 13:26:31 +08:00
|
|
|
|
// deal with input data
|
|
|
|
|
|
public override void PreLoad(object data = null)
|
|
|
|
|
|
{
|
|
|
|
|
|
ID = (long)data;
|
2024-12-16 14:07:41 +08:00
|
|
|
|
DebugUtil.Log("Vehicle Part Tree Detail ID: " + ID);
|
2024-12-17 13:26:31 +08:00
|
|
|
|
}
|
2024-12-18 14:39:01 +08:00
|
|
|
|
|
2024-12-16 14:07:41 +08:00
|
|
|
|
// Use this for initialization
|
|
|
|
|
|
public override void OnInit()
|
|
|
|
|
|
{
|
|
|
|
|
|
//bind UI GameObj
|
|
|
|
|
|
UI_VehiclePartTreeDetailBinder.GetComponents(this);
|
|
|
|
|
|
|
2024-12-18 14:39:01 +08:00
|
|
|
|
bool canUpgrade = false; // = Actor.Instance.Character.GetVehicleDevelopment(ID);
|
|
|
|
|
|
|
|
|
|
|
|
VehicleCultivateDataPro vehicleData;
|
|
|
|
|
|
var node = VehicleCultivateManager.Instance.Get(ID);
|
|
|
|
|
|
if (node is VehicleTreeNode vehicle)
|
|
|
|
|
|
{
|
|
|
|
|
|
Text_Name.text = VehicleDataHelper.GetVehicleLocalizeName((int)ID);
|
|
|
|
|
|
vehicleData = VehicleCultivateDataManager.Instance.GetVehicleCultivateDataPro(ID);
|
|
|
|
|
|
if(vehicleData == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
vehicleData = new VehicleCultivateDataPro((int)ID);
|
|
|
|
|
|
}
|
|
|
|
|
|
SetVehicleData(vehicleData);
|
|
|
|
|
|
|
|
|
|
|
|
canUpgrade = Actor.Instance.Character.GetVehicleDevelopment(ID) == null;
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (node is VehicleComponentTreeNode comp)
|
|
|
|
|
|
{
|
|
|
|
|
|
var compCfg = TableManager.Instance.Tables.VehicleComponent.Get(ID);
|
|
|
|
|
|
DebugUtil.Log("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD>ñ<EFBFBD><C3B1>ػ<EFBFBD>");
|
|
|
|
|
|
Text_Name.text = "ǿ<><C7BF>:" + compCfg.ComponentName;
|
|
|
|
|
|
|
|
|
|
|
|
var vehicleID = compCfg.VehicleID;
|
|
|
|
|
|
vehicleData = VehicleCultivateDataManager.Instance.GetVehicleCultivateDataPro(vehicleID);
|
|
|
|
|
|
if (vehicleData == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
vehicleData = new VehicleCultivateDataPro(vehicleID);
|
|
|
|
|
|
}
|
|
|
|
|
|
if (vehicleData.UpgradedComponents.Contains((uint)ID))//<2F><><EFBFBD><EFBFBD><EFBFBD>Ѿ<EFBFBD>ǿ<EFBFBD><C7BF>
|
|
|
|
|
|
{
|
|
|
|
|
|
SetVehicleData(vehicleData);
|
|
|
|
|
|
canUpgrade = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
else//<2F><><EFBFBD><EFBFBD>δǿ<CEB4><C7BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
|
|
|
|
|
|
{
|
|
|
|
|
|
SetVehicleData(vehicleData, compCfg);
|
|
|
|
|
|
canUpgrade = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//canUpgrade = Actor.Instance.Character.GetVehicleDevelopment(vehicleID);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!canUpgrade)
|
2024-12-17 15:00:40 +08:00
|
|
|
|
{
|
|
|
|
|
|
Button_Equipment.gameObject.SetActive(false);
|
|
|
|
|
|
}
|
|
|
|
|
|
BindButton(Button_Equipment, OnUpgradeClick);
|
|
|
|
|
|
|
2024-12-16 14:07:41 +08:00
|
|
|
|
Image_Bg.GetComponent<RectTransform>().pivot = new Vector2(0, 0.5f);
|
|
|
|
|
|
OnSwitchAnim(true);
|
|
|
|
|
|
var BgClose = FindObj("Bg_Close");
|
|
|
|
|
|
BindButton(BgClose, () =>
|
|
|
|
|
|
{
|
|
|
|
|
|
OnSwitchAnim(false, () =>
|
|
|
|
|
|
{
|
|
|
|
|
|
CloseWindow();
|
|
|
|
|
|
});
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-12-18 14:39:01 +08:00
|
|
|
|
void SetVehicleData(VehicleCultivateDataPro data, DataVehicleComponent config = null)
|
|
|
|
|
|
{
|
|
|
|
|
|
HideAllUpSign();
|
|
|
|
|
|
Color highLight = new Color(221 / 255.0f, 223 / 255.0f, 52 / 255.0f);
|
|
|
|
|
|
if (config == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
Text_Value_Hp.text = data.Hp().ToString();
|
|
|
|
|
|
Text_Value_MemberCount.text = data.SeatCount().ToString();
|
|
|
|
|
|
Text_Value_Def.text = data.Defense().ToString();
|
|
|
|
|
|
Text_Value_Atk.text = data.Attack().ToString();
|
|
|
|
|
|
Text_Value_BulletCount.text = data.BulletCapacity().ToString();
|
|
|
|
|
|
Text_Value_Speed.text = data.MoveSpeed().ToString();
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
Text_Value_Hp.text = (data.Hp() + config.HP).ToString();
|
|
|
|
|
|
if (config.HP > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
Image_UpBg_Hp.gameObject.SetActive(true);
|
|
|
|
|
|
Image_UpSign_Hp.gameObject.SetActive(true);
|
|
|
|
|
|
Text_UpTitle_Hp.color = highLight;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Text_Value_MemberCount.text = data.SeatCount().ToString();
|
|
|
|
|
|
|
|
|
|
|
|
Text_Value_Def.text = (data.Defense() + config.Defense).ToString();
|
|
|
|
|
|
if (config.Defense > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
Image_UpBg_Def.gameObject.SetActive(true);
|
|
|
|
|
|
Image_UpSign_Def.gameObject.SetActive(true);
|
|
|
|
|
|
Text_UpTitle_Def.color = highLight;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (config.ComponentType != ComponentType.Component_2)
|
|
|
|
|
|
{
|
|
|
|
|
|
Text_Value_Atk.text = (data.Attack()).ToString();
|
|
|
|
|
|
Text_Value_BulletCount.text = (data.BulletCapacity()).ToString();
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
var batteryCfg = TableManager.Instance.Tables.BatteryConfig.Get(config.BatteryID);
|
|
|
|
|
|
var atk = batteryCfg.DamagePower;
|
|
|
|
|
|
var bulletCount = batteryCfg.MaxBulletCount;
|
|
|
|
|
|
Text_Value_Atk.text = atk.ToString();
|
|
|
|
|
|
Text_Value_BulletCount.text = bulletCount.ToString();
|
|
|
|
|
|
|
|
|
|
|
|
bool isHighLight = atk > data.Attack();
|
|
|
|
|
|
Image_UpBg_Atk.gameObject.SetActive(isHighLight);
|
|
|
|
|
|
Image_UpSign_Atk.gameObject.SetActive(isHighLight);
|
|
|
|
|
|
Text_UpTitle_Atk.color = isHighLight ? highLight : Color.white;
|
|
|
|
|
|
|
|
|
|
|
|
isHighLight = bulletCount > data.BulletCapacity();
|
|
|
|
|
|
Image_UpBg_BulletCount.gameObject.SetActive(isHighLight);
|
|
|
|
|
|
Image_UpSign_BulletCount.gameObject.SetActive(isHighLight);
|
|
|
|
|
|
Text_UpTitle_BulletCount.color = isHighLight ? highLight : Color.white;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Text_Value_Speed.text = (data.MoveSpeed()).ToString();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void HideAllUpSign()
|
|
|
|
|
|
{
|
|
|
|
|
|
Image_UpBg_Atk.gameObject.SetActive(false);
|
|
|
|
|
|
Image_UpBg_Def.gameObject.SetActive(false);
|
|
|
|
|
|
Image_UpBg_Hp.gameObject.SetActive(false);
|
|
|
|
|
|
Image_UpBg_MemberCount.gameObject.SetActive(false);
|
|
|
|
|
|
Image_UpBg_BulletCount.gameObject.SetActive(false);
|
|
|
|
|
|
Image_UpBg_Speed.gameObject.SetActive(false);
|
|
|
|
|
|
Image_UpSign_Atk.gameObject.SetActive(false);
|
|
|
|
|
|
Image_UpSign_Def.gameObject.SetActive(false);
|
|
|
|
|
|
Image_UpSign_Hp.gameObject.SetActive(false);
|
|
|
|
|
|
Image_UpSign_MemberCount.gameObject.SetActive(false);
|
|
|
|
|
|
Image_UpSign_BulletCount.gameObject.SetActive(false);
|
|
|
|
|
|
Image_UpSign_Speed.gameObject.SetActive(false);
|
|
|
|
|
|
|
|
|
|
|
|
Text_UpTitle_Hp.color = Color.white;
|
|
|
|
|
|
Text_UpTitle_MemberCount.color = Color.white;
|
|
|
|
|
|
Text_UpTitle_Def.color = Color.white;
|
|
|
|
|
|
Text_UpTitle_Atk.color = Color.white;
|
|
|
|
|
|
Text_UpTitle_BulletCount.color = Color.white;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-12-16 14:07:41 +08:00
|
|
|
|
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();
|
|
|
|
|
|
}
|
2024-12-17 15:00:40 +08:00
|
|
|
|
|
|
|
|
|
|
void OnUpgradeClick()
|
|
|
|
|
|
{
|
|
|
|
|
|
if (VehicleCultivateManager.Instance.Get(ID).Upgrade())
|
|
|
|
|
|
CloseWindow();
|
|
|
|
|
|
}
|
2024-12-16 14:07:41 +08:00
|
|
|
|
}
|