2024-12-18 19:58:14 +08:00
|
|
|
|
using System.Collections;
|
2024-12-16 14:07:41 +08:00
|
|
|
|
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-18 19:58:14 +08:00
|
|
|
|
using cfg.SkillCfg;
|
|
|
|
|
|
using Gameplay;
|
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-31 14:31:16 +08:00
|
|
|
|
//private bool EnterPartTree;
|
2024-12-30 16:13:58 +08:00
|
|
|
|
private Action m_ReleaseCallback;
|
2024-12-17 13:26:31 +08:00
|
|
|
|
|
2024-12-18 19:58:14 +08:00
|
|
|
|
class InitData
|
2024-12-16 14:07:41 +08:00
|
|
|
|
{
|
2024-12-18 19:58:14 +08:00
|
|
|
|
public long ID;
|
|
|
|
|
|
public bool EnterPartTree;
|
2024-12-30 16:13:58 +08:00
|
|
|
|
public Action callback;
|
2024-12-18 19:58:14 +08:00
|
|
|
|
|
2024-12-30 16:13:58 +08:00
|
|
|
|
public InitData(long id, bool enterPartTree,Action onReleaseCallback)
|
2024-12-18 19:58:14 +08:00
|
|
|
|
{
|
|
|
|
|
|
ID = id;
|
|
|
|
|
|
EnterPartTree = enterPartTree;
|
2024-12-30 16:13:58 +08:00
|
|
|
|
callback = onReleaseCallback;
|
2024-12-18 19:58:14 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-12-30 16:13:58 +08:00
|
|
|
|
public async static UniTask<UIWindow> Open(long TreeNodeID, bool EnterPartTree = false, Action OnReleaseCallback = null)
|
2024-12-18 19:58:14 +08:00
|
|
|
|
{
|
2024-12-30 16:13:58 +08:00
|
|
|
|
var initdata = new InitData(TreeNodeID, EnterPartTree, OnReleaseCallback);
|
2024-12-18 19:58:14 +08:00
|
|
|
|
return await UIManager.Instance.CreateAndOpenWindow(UINameConst.UI_VehiclePartTreeDetail, initdata);
|
2024-12-16 14:07:41 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-12-17 13:26:31 +08:00
|
|
|
|
// deal with input data
|
|
|
|
|
|
public override void PreLoad(object data = null)
|
|
|
|
|
|
{
|
2024-12-18 19:58:14 +08:00
|
|
|
|
var input = data as InitData;
|
|
|
|
|
|
ID = input.ID;
|
2024-12-30 16:13:58 +08:00
|
|
|
|
m_ReleaseCallback = input.callback;
|
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 19:58:14 +08:00
|
|
|
|
BindButton(Button_Check, OnCheckButtonClick);
|
2024-12-18 14:39:01 +08:00
|
|
|
|
|
2024-12-18 19:58:14 +08:00
|
|
|
|
bool canUpgrade = false; // = Actor.Instance.Character.GetVehicleDevelopment(ID);
|
2024-12-25 12:40:51 +08:00
|
|
|
|
VehicleCultivateData vehicleData;
|
2024-12-18 14:39:01 +08:00
|
|
|
|
var node = VehicleCultivateManager.Instance.Get(ID);
|
|
|
|
|
|
if (node is VehicleTreeNode vehicle)
|
|
|
|
|
|
{
|
|
|
|
|
|
Text_Name.text = VehicleDataHelper.GetVehicleLocalizeName((int)ID);
|
2024-12-25 12:40:51 +08:00
|
|
|
|
vehicleData = VehicleCultivateDataManager.Instance.GetVehicleCultivateData(ID);
|
2024-12-18 14:39:01 +08:00
|
|
|
|
if(vehicleData == null)
|
|
|
|
|
|
{
|
2024-12-25 12:40:51 +08:00
|
|
|
|
vehicleData = new VehicleCultivateData((int)ID);
|
2024-12-18 14:39:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
SetVehicleData(vehicleData);
|
|
|
|
|
|
|
|
|
|
|
|
canUpgrade = Actor.Instance.Character.GetVehicleDevelopment(ID) == null;
|
2024-12-18 19:58:14 +08:00
|
|
|
|
|
|
|
|
|
|
if (TableManager.Instance.Tables.VehicleConfig.Get((int)ID).UnlockType == UnlockType.Buy)
|
|
|
|
|
|
{
|
|
|
|
|
|
Button_Equipment.GetComponentInChildren<TMP_Text>().text = "直购";
|
|
|
|
|
|
}
|
2024-12-18 14:39:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
else if (node is VehicleComponentTreeNode comp)
|
|
|
|
|
|
{
|
|
|
|
|
|
var compCfg = TableManager.Instance.Tables.VehicleComponent.Get(ID);
|
2024-12-26 14:53:11 +08:00
|
|
|
|
Text_Name.text = CommonUtils.GetLocalizeText("vehicleCultivate_Upgrade") + ":" + CommonUtils.GetLocalizeText("Vehicle_CompName_" + ID);
|
2024-12-18 14:39:01 +08:00
|
|
|
|
|
|
|
|
|
|
var vehicleID = compCfg.VehicleID;
|
2024-12-25 12:40:51 +08:00
|
|
|
|
vehicleData = VehicleCultivateDataManager.Instance.GetVehicleCultivateData(vehicleID);
|
2024-12-18 14:39:01 +08:00
|
|
|
|
if (vehicleData == null)
|
|
|
|
|
|
{
|
2024-12-25 12:40:51 +08:00
|
|
|
|
vehicleData = new VehicleCultivateData(vehicleID);
|
2024-12-18 14:39:01 +08:00
|
|
|
|
}
|
2024-12-18 19:58:14 +08:00
|
|
|
|
if (vehicleData.UpgradedComponents.Contains((uint)ID))//组件已经强化
|
2024-12-18 14:39:01 +08:00
|
|
|
|
{
|
|
|
|
|
|
SetVehicleData(vehicleData);
|
|
|
|
|
|
canUpgrade = false;
|
|
|
|
|
|
}
|
2024-12-18 19:58:14 +08:00
|
|
|
|
else//组件未强化,显示提升数值
|
2024-12-18 14:39:01 +08:00
|
|
|
|
{
|
|
|
|
|
|
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 19:58:14 +08:00
|
|
|
|
void OnCheckButtonClick()
|
|
|
|
|
|
{
|
2024-12-31 14:31:16 +08:00
|
|
|
|
//CloseWindow();
|
|
|
|
|
|
//UI_VehiclePartTreeController.Open(ID).Forget();
|
|
|
|
|
|
DebugUtil.Log("查看详细属性");
|
2024-12-18 19:58:14 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-12-25 12:40:51 +08:00
|
|
|
|
async void SetVehicleData(VehicleCultivateData data, DataVehicleComponent config = null)
|
2024-12-18 14:39:01 +08:00
|
|
|
|
{
|
2024-12-18 19:58:14 +08:00
|
|
|
|
#region 属性值
|
|
|
|
|
|
HideAllUpSign();
|
2024-12-18 14:39:01 +08:00
|
|
|
|
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);
|
2024-12-18 19:58:14 +08:00
|
|
|
|
Text_UpTitle_Hp.color = highLight;
|
2024-12-18 14:39:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Text_Value_MemberCount.text = data.SeatCount().ToString();
|
|
|
|
|
|
|
|
|
|
|
|
Text_Value_Def.text = (data.Defense() + config.Defense).ToString();
|
|
|
|
|
|
if (config.Defense > 0)
|
2024-12-18 19:58:14 +08:00
|
|
|
|
{
|
|
|
|
|
|
Image_UpBg_Def.gameObject.SetActive(true);
|
|
|
|
|
|
Image_UpSign_Def.gameObject.SetActive(true);
|
|
|
|
|
|
Text_UpTitle_Def.color = highLight;
|
|
|
|
|
|
}
|
2024-12-18 14:39:01 +08:00
|
|
|
|
|
|
|
|
|
|
if (config.ComponentType != ComponentType.Component_2)
|
|
|
|
|
|
{
|
|
|
|
|
|
Text_Value_Atk.text = (data.Attack()).ToString();
|
2024-12-18 19:58:14 +08:00
|
|
|
|
Text_Value_BulletCount.text = (data.BulletCapacity()).ToString();
|
|
|
|
|
|
}
|
2024-12-18 14:39:01 +08:00
|
|
|
|
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();
|
|
|
|
|
|
}
|
2024-12-18 19:58:14 +08:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region 适应性
|
|
|
|
|
|
Text_Value_Ground.text = data.GetTerrainAdapt(BonusType.TerrainPlain).ToString();
|
|
|
|
|
|
Text_Value_Mountain.text = data.GetTerrainAdapt(BonusType.TerrainMountain).ToString();
|
|
|
|
|
|
Text_Value_Snow.text = data.GetTerrainAdapt(BonusType.TerrainSnow).ToString();
|
|
|
|
|
|
Text_Value_Wood.text = data.GetTerrainAdapt(BonusType.TerrainForest).ToString();
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region 技能
|
|
|
|
|
|
DataSkill nowSkillCfg = TableManager.Instance.Tables.SkillConfig.Get(VehicleDataHelper.GetVehicleSkillId(data));
|
|
|
|
|
|
if (nowSkillCfg == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
nowSkillCfg = TableManager.Instance.Tables.SkillConfig.DataList[0];
|
|
|
|
|
|
DebugUtil.LogError("载具技能配置未能找到!载具ID为{0},技能ID为{1}\n>>请检查相关配置表:VehicleSkllUpgrade/SkillConfig_Vehicle", data.Cfg.ID, VehicleDataHelper.GetVehicleSkillId(data.Cfg.ID));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-12-30 12:23:00 +08:00
|
|
|
|
Text_SkillCoolingTimeValue.text = nowSkillCfg.ChargeParam.ToString() + "s";
|
2024-12-18 19:58:14 +08:00
|
|
|
|
Text_SkillName.text = CommonUtils.GetLocalizeText(E_LocalizePrefix.skill, nowSkillCfg.ID);
|
|
|
|
|
|
|
|
|
|
|
|
var skillIcon = await LoadAssetAsync<Sprite>(Framework.Constants.UI_Cultivata_skillIconFolder + nowSkillCfg.IconPath);
|
|
|
|
|
|
Image_SkillIcon.sprite = skillIcon;
|
|
|
|
|
|
|
|
|
|
|
|
Text_SkillInfo.text = CommonUtils.GetLocalizeText(E_LocalizePrefix.skill_desc, nowSkillCfg.ID);
|
|
|
|
|
|
#endregion
|
2024-12-18 14:39:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-12-18 19:58:14 +08:00
|
|
|
|
void HideAllUpSign()
|
2024-12-18 14:39:01 +08:00
|
|
|
|
{
|
|
|
|
|
|
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()
|
|
|
|
|
|
{
|
2024-12-30 16:13:58 +08:00
|
|
|
|
m_ReleaseCallback?.Invoke();
|
2024-12-16 14:07:41 +08:00
|
|
|
|
base.OnRelease();
|
|
|
|
|
|
}
|
2024-12-17 15:00:40 +08:00
|
|
|
|
|
|
|
|
|
|
void OnUpgradeClick()
|
|
|
|
|
|
{
|
2024-12-19 16:09:04 +08:00
|
|
|
|
var node = VehicleCultivateManager.Instance.Get(ID);
|
|
|
|
|
|
if (node == null)
|
|
|
|
|
|
{
|
2024-12-30 12:41:33 +08:00
|
|
|
|
DebugUtil.Log("Vehicle Part Tree Detail ID: " + ID + " not found");
|
2024-12-19 16:09:04 +08:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
2025-01-03 19:30:27 +08:00
|
|
|
|
foreach (var parent in node.ParentID)
|
|
|
|
|
|
{
|
|
|
|
|
|
TreeNodeBase parentNode = VehicleCultivateManager.Instance.Get(parent);
|
|
|
|
|
|
if (parentNode != null)
|
2024-12-19 16:09:04 +08:00
|
|
|
|
{
|
2025-01-03 19:30:27 +08:00
|
|
|
|
if (!parentNode.IsUpgraded())
|
|
|
|
|
|
{
|
|
|
|
|
|
CommonUtils.ShowMessageTips(CommonUtils.GetLocalizeText("vehicleCultivate_PreNodeLocked"));
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
DebugUtil.Log("Vehicle Part Tree Detail ID: " + ID + " parent not found");
|
2024-12-19 16:09:04 +08:00
|
|
|
|
}
|
2024-12-30 12:41:33 +08:00
|
|
|
|
}
|
2024-12-19 16:09:04 +08:00
|
|
|
|
|
2024-12-17 15:00:40 +08:00
|
|
|
|
if (VehicleCultivateManager.Instance.Get(ID).Upgrade())
|
|
|
|
|
|
CloseWindow();
|
|
|
|
|
|
}
|
2024-12-16 14:07:41 +08:00
|
|
|
|
}
|