2024-12-09 17:02:39 +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 PhxhSDK;
|
|
|
|
|
|
using Framework;
|
2024-12-11 11:16:11 +08:00
|
|
|
|
using Cysharp.Threading.Tasks;
|
|
|
|
|
|
using Gameplay;
|
|
|
|
|
|
using Gameplay.Common;
|
2024-12-12 19:11:59 +08:00
|
|
|
|
using Gameplay.Net;
|
|
|
|
|
|
using Gameplay.Utils;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using System;
|
|
|
|
|
|
using cfg.SkillCfg;
|
|
|
|
|
|
using cfg.VihecleCultivateCfg;
|
2024-12-09 17:02:39 +08:00
|
|
|
|
|
|
|
|
|
|
public class UI_VehicleCultivateProController : UIWindow
|
|
|
|
|
|
{
|
2024-12-11 11:16:11 +08:00
|
|
|
|
#region UI Bind
|
|
|
|
|
|
|
|
|
|
|
|
//UI GameObj
|
|
|
|
|
|
///Auto Gen Start///
|
|
|
|
|
|
//public Button Button_Back;
|
|
|
|
|
|
public Button Button_back;
|
2024-12-09 17:02:39 +08:00
|
|
|
|
public TMP_Text Text_Back;
|
|
|
|
|
|
public Button Button_Home;
|
|
|
|
|
|
public Image Image_DarkLeft;
|
|
|
|
|
|
public Image Image_DarkLeftTop;
|
|
|
|
|
|
public Image Image_DarkTop;
|
|
|
|
|
|
public Image Image_DarkBottom;
|
|
|
|
|
|
public Image Image_OrganizatioFlag;
|
|
|
|
|
|
public Image Image_AngularShape0;
|
|
|
|
|
|
public TMP_Text Text_VehicleType;
|
|
|
|
|
|
public Image Image_AngularShape1;
|
|
|
|
|
|
public TMP_Text Text_Level;
|
|
|
|
|
|
public Image Image_AngularShape2;
|
|
|
|
|
|
public TMP_Text Text_Organization;
|
|
|
|
|
|
public TMP_Text Text_VehicleName;
|
|
|
|
|
|
public Button Button_Look;
|
|
|
|
|
|
public Image Image_Attributes;
|
|
|
|
|
|
public TMP_Text Text_TitleAttri;
|
|
|
|
|
|
public TMP_Text Text_EnAttri;
|
|
|
|
|
|
public Image Image_Hp;
|
|
|
|
|
|
public TMP_Text Text_HpTitle;
|
|
|
|
|
|
public TMP_Text Text_HpValue;
|
|
|
|
|
|
public Image Image_Def;
|
|
|
|
|
|
public TMP_Text Text_DefTitle;
|
|
|
|
|
|
public TMP_Text Text_DefValue;
|
|
|
|
|
|
public Image Image_BulletCount;
|
|
|
|
|
|
public TMP_Text Text_BulletCountTitle;
|
|
|
|
|
|
public TMP_Text Text_BulletCountValue;
|
|
|
|
|
|
public Image Image_MemberCount;
|
|
|
|
|
|
public TMP_Text Text_MemberCountTitle;
|
|
|
|
|
|
public TMP_Text Text_MemberCountValue;
|
|
|
|
|
|
public Image Image_Atk;
|
|
|
|
|
|
public TMP_Text Text_AtkTitle;
|
|
|
|
|
|
public TMP_Text Text_AtkValue;
|
|
|
|
|
|
public Image Image_Speed;
|
|
|
|
|
|
public TMP_Text Text_SpeedTitle;
|
|
|
|
|
|
public TMP_Text Text_SpeedValue;
|
|
|
|
|
|
public Image Image_Terrain;
|
|
|
|
|
|
public TMP_Text Text_TitleTerrain;
|
|
|
|
|
|
public TMP_Text Text_EnTerrain;
|
|
|
|
|
|
public Image Image_Ground;
|
|
|
|
|
|
public TMP_Text Text_GroundTitle;
|
|
|
|
|
|
public TMP_Text Text_GroundAdapt;
|
|
|
|
|
|
public Image Image_Snow;
|
|
|
|
|
|
public TMP_Text Text_SnowTitle;
|
|
|
|
|
|
public TMP_Text Text_SnowAdapt;
|
|
|
|
|
|
public Image Image_Mountain;
|
|
|
|
|
|
public TMP_Text Text_MountainTitle;
|
|
|
|
|
|
public TMP_Text Text_MountainAdapt;
|
|
|
|
|
|
public Image Image_Wood;
|
|
|
|
|
|
public TMP_Text Text_WoodTitle;
|
|
|
|
|
|
public TMP_Text Text_WoodAdapt;
|
|
|
|
|
|
public Button Button_Dev;
|
|
|
|
|
|
public Button Button_Paint;
|
|
|
|
|
|
public Image Image_VehicleSkill;
|
|
|
|
|
|
public TMP_Text Text_TitleSkill;
|
|
|
|
|
|
public TMP_Text Text_SkillName;
|
|
|
|
|
|
public Image Image_SkillIcon;
|
|
|
|
|
|
public Image Image_SkillCoolingTimeBg;
|
|
|
|
|
|
public TMP_Text Text_SkillCoolingTimeValue;
|
|
|
|
|
|
public TMP_Text Text_ClassTitle;
|
|
|
|
|
|
public TMP_Text Text_SkillLevel;
|
|
|
|
|
|
public TMP_Text Text_SkillInfo;
|
|
|
|
|
|
public Button Button_TechTree;
|
|
|
|
|
|
public PhxhScrollView ScrollView_VehicleList;
|
2024-12-11 11:16:11 +08:00
|
|
|
|
|
2024-12-12 19:11:59 +08:00
|
|
|
|
///Auto Gen End///
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
private long m_selectedVehicleID = 0;
|
|
|
|
|
|
private long SelectedVehicleID
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
return m_selectedVehicleID;
|
|
|
|
|
|
}
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
m_selectedVehicleID = value;
|
|
|
|
|
|
DebugUtil.Log("SelectedVehicleID: " + m_selectedVehicleID.ToString());
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-12-11 11:16:11 +08:00
|
|
|
|
|
2024-12-18 19:58:14 +08:00
|
|
|
|
private bool m_isVehicleUIShow = false;
|
2024-12-19 16:52:49 +08:00
|
|
|
|
private int AudioID = -1;
|
2024-12-12 19:11:59 +08:00
|
|
|
|
|
|
|
|
|
|
private List<VehicleCultivateDataPro> m_unlockedVehicles = new();
|
2024-12-11 11:16:11 +08:00
|
|
|
|
|
|
|
|
|
|
public async static UniTask<UIWindow> Open()
|
2024-12-12 19:11:59 +08:00
|
|
|
|
{
|
2024-12-11 11:16:11 +08:00
|
|
|
|
UIWindow uiWindow = await UIManager.Instance.CreateAndOpenWindow(UINameConst.UI_VehicleCultivatePro);
|
|
|
|
|
|
CommonUtils.ChangeUIScene(Framework.Constants.UI_VEHICLE_CHOOSE_SCENE_PATH);
|
2024-12-12 19:11:59 +08:00
|
|
|
|
var wind = uiWindow as UI_VehicleCultivateProController;
|
|
|
|
|
|
wind.BindScene();
|
2024-12-11 11:16:11 +08:00
|
|
|
|
|
2024-12-12 19:11:59 +08:00
|
|
|
|
CameraManager.Instance.SetMainCameraActive(true);
|
2024-12-11 11:16:11 +08:00
|
|
|
|
return uiWindow;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-12-09 17:02:39 +08:00
|
|
|
|
// deal with input data
|
|
|
|
|
|
public override void PreLoad(object data = null)
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Use this for initialization
|
|
|
|
|
|
public override void OnInit()
|
|
|
|
|
|
{
|
|
|
|
|
|
//bind UI GameObj
|
|
|
|
|
|
UI_VehicleCultivateProBinder.GetComponents(this);
|
2024-12-11 11:16:11 +08:00
|
|
|
|
|
2024-12-19 16:52:49 +08:00
|
|
|
|
m_isVehicleUIShow = true;
|
|
|
|
|
|
|
2024-12-11 11:16:11 +08:00
|
|
|
|
var currencyList = GetComponent<UI_CurrencyList>("UI_CurrencyList");
|
2024-12-18 14:39:01 +08:00
|
|
|
|
currencyList.SetData();//GLConfig.Inst.data.DiamondItemId, GLConfig.Inst.data.GoldItemId
|
2024-12-11 11:16:11 +08:00
|
|
|
|
|
|
|
|
|
|
BindButton(Button_TechTree, OnButton_TreeClick);
|
2024-12-12 19:11:59 +08:00
|
|
|
|
BindButton(Button_Dev, OnButton_DevClick);
|
2024-12-13 14:56:43 +08:00
|
|
|
|
BindButton(Button_Paint, OnButton_PaintClick);
|
2024-12-11 11:16:11 +08:00
|
|
|
|
BindButton(Button_back, OnButton_backClick);
|
|
|
|
|
|
BindButton(Button_Home, OnButton_HomeClick);
|
2024-12-18 19:58:14 +08:00
|
|
|
|
BindButton(Button_Look,()=> { HideUI(false); });
|
2024-12-09 17:02:39 +08:00
|
|
|
|
|
2024-12-12 19:11:59 +08:00
|
|
|
|
LoadVehicleList();
|
|
|
|
|
|
if(m_unlockedVehicles.Count > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
SelectedVehicleID = m_unlockedVehicles[0].Cfg.ID;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
DebugUtil.LogWarning("None Vehicle");
|
2024-12-12 19:57:07 +08:00
|
|
|
|
|
|
|
|
|
|
FindObj("UI_LiuHaiLeft/Attributes").gameObject.SetActive(false);
|
|
|
|
|
|
FindObj("UI_LiuHaiLeft/Terrain").gameObject.SetActive(false);
|
|
|
|
|
|
Button_Dev.gameObject.SetActive(false);
|
|
|
|
|
|
Button_Paint.gameObject.SetActive(false);
|
|
|
|
|
|
Image_VehicleSkill.gameObject.SetActive(false);
|
2024-12-12 19:11:59 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
VehicleInfoRefresh();
|
|
|
|
|
|
|
|
|
|
|
|
ScrollView_VehicleList.SetItemCountFunc(() => m_unlockedVehicles.Count);
|
|
|
|
|
|
ScrollView_VehicleList.SetItemSizeFunc((index) => new Vector2(264, 96));
|
|
|
|
|
|
ScrollView_VehicleList.SetUpdateFunc(UpdateScrollViewItem);
|
|
|
|
|
|
ScrollView_VehicleList.UpdateData();
|
|
|
|
|
|
|
2024-12-19 16:52:49 +08:00
|
|
|
|
AudioManager.Instance.StopAllMusic();
|
|
|
|
|
|
AudioID = AudioManager.Instance.PlayAudio(Framework.Constants.Sound.TEAM_VEHICLE, AudioCriManager.EPlayType.Sound, null, loop: true, isFade: true);
|
|
|
|
|
|
|
2024-12-12 19:11:59 +08:00
|
|
|
|
EventManager.Instance.Register(EventManager.EventName.EN_UIControllCultivateMainInput, (Action<bool>)ControllInput);
|
2024-12-16 13:20:15 +08:00
|
|
|
|
EventManager.Instance.Register(EventManager.EventName.VehecleUpgrade, OnVehicleInfoUpdate);
|
2024-12-12 19:11:59 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//invoke when open window
|
|
|
|
|
|
protected override void OnShowWindow(object data = null)
|
2024-12-09 17:02:39 +08:00
|
|
|
|
{
|
2024-12-11 11:16:11 +08:00
|
|
|
|
var currencyList = GetComponent<UI_CurrencyList>("UI_CurrencyList");
|
|
|
|
|
|
currencyList.Refresh();
|
2024-12-12 19:11:59 +08:00
|
|
|
|
|
|
|
|
|
|
ControllInput(true);
|
2024-12-11 11:16:11 +08:00
|
|
|
|
}
|
2024-12-09 17:02:39 +08:00
|
|
|
|
|
|
|
|
|
|
//invoke when reload window
|
|
|
|
|
|
protected override void OnReloadWindow(object data = null)
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//invoke when close window
|
|
|
|
|
|
protected override void OnHideWindow()
|
|
|
|
|
|
{
|
2024-12-12 19:11:59 +08:00
|
|
|
|
ControllInput(false);
|
|
|
|
|
|
}
|
2024-12-09 17:02:39 +08:00
|
|
|
|
|
|
|
|
|
|
//invoke when destroy
|
|
|
|
|
|
public override void OnRelease()
|
|
|
|
|
|
{
|
|
|
|
|
|
base.OnRelease();
|
2024-12-19 16:52:49 +08:00
|
|
|
|
|
|
|
|
|
|
AudioManager.Instance.StopSoundById(AudioID);
|
|
|
|
|
|
|
2024-12-12 19:11:59 +08:00
|
|
|
|
EventManager.Instance.Unregister(EventManager.EventName.EN_UIControllCultivateMainInput, (Action<bool>)ControllInput);
|
2024-12-16 13:20:15 +08:00
|
|
|
|
EventManager.Instance.Unregister(EventManager.EventName.VehecleUpgrade, OnVehicleInfoUpdate);
|
2024-12-12 19:11:59 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
GameObject vRoot = null;//<2F>ؾ߸<D8BE><DFB8>ڵ<EFBFBD>
|
|
|
|
|
|
Transform _rotateTrans;//<2F><>ת<EFBFBD><D7AA>ͷ<EFBFBD><CDB7>Transform
|
|
|
|
|
|
GameObject _vehicleGo = null;
|
|
|
|
|
|
Dictionary<string, GameObject> _assetsLoadDic = new Dictionary<string, GameObject>();
|
|
|
|
|
|
|
|
|
|
|
|
void BindScene()
|
|
|
|
|
|
{
|
|
|
|
|
|
PhxhSDK.Res.SceneHandle sceneHandle = GameSceneHelper.Instance.GetCurrentUIViewScene();
|
|
|
|
|
|
if (sceneHandle != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
DebugUtil.Log("scene name is:" + sceneHandle.Scene.name);
|
|
|
|
|
|
var gos = sceneHandle.Scene.GetRootGameObjects();
|
|
|
|
|
|
foreach (var go in gos)
|
|
|
|
|
|
{
|
|
|
|
|
|
DebugUtil.Log("check go name: " + go.name);
|
|
|
|
|
|
if (go.name.Equals("Vehicle_Root"))
|
|
|
|
|
|
{
|
|
|
|
|
|
vRoot = go;
|
|
|
|
|
|
if (vRoot.transform.childCount > 0)//<2F>ؾ߸<D8BE><DFB8>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>壬˵<E5A3AC><CBB5><EFBFBD>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD>ع<EFBFBD><D8B9>ˣ<EFBFBD><CBA3><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
{
|
|
|
|
|
|
if (_vehicleGo != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (vRoot.transform.GetChild(0).GetInstanceID() != _vehicleGo.GetInstanceID())
|
|
|
|
|
|
{
|
|
|
|
|
|
foreach (Transform child in vRoot.transform)
|
|
|
|
|
|
{
|
|
|
|
|
|
Destroy(child.gameObject);
|
|
|
|
|
|
}
|
|
|
|
|
|
SetVehicleRoot();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
foreach (Transform child in vRoot.transform)
|
|
|
|
|
|
{
|
|
|
|
|
|
Destroy(child.gameObject);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
{
|
|
|
|
|
|
if (_vehicleGo != null)
|
|
|
|
|
|
SetVehicleRoot();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (go.name.Equals("Rotate_Axis"))
|
|
|
|
|
|
{
|
|
|
|
|
|
_rotateTrans = go.transform;
|
|
|
|
|
|
DebugUtil.Log("find Rotate_Axis");
|
|
|
|
|
|
//break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
DebugUtil.LogWarning("sceneHandle is null");
|
|
|
|
|
|
}
|
|
|
|
|
|
if (_vehicleGo != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
_vehicleGo.transform.SetParent(vRoot.transform);
|
|
|
|
|
|
_vehicleGo.transform.localPosition = Vector3.zero;
|
|
|
|
|
|
_vehicleGo.transform.localRotation = Quaternion.identity;
|
|
|
|
|
|
_vehicleGo.transform.localScale = Vector3.one;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-12-16 13:20:15 +08:00
|
|
|
|
void OnVehicleInfoUpdate()
|
|
|
|
|
|
{
|
|
|
|
|
|
LoadVehicleList();
|
2024-12-17 15:00:40 +08:00
|
|
|
|
VehicleInfoRefresh();
|
2024-12-16 13:20:15 +08:00
|
|
|
|
ScrollView_VehicleList.UpdateData();
|
|
|
|
|
|
VehicleInfoRefresh();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-12-12 19:57:07 +08:00
|
|
|
|
async void VehicleInfoRefresh()
|
2024-12-12 19:11:59 +08:00
|
|
|
|
{
|
|
|
|
|
|
var curShownVehicleData = VehicleCultivateDataManager.Instance.GetVehicleCultivateDataPro((uint)SelectedVehicleID);
|
|
|
|
|
|
if (curShownVehicleData == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
DebugUtil.Log("mCurVehicles.Count = 0,<2C>ؾ<EFBFBD><D8BE><EFBFBD><EFBFBD><EFBFBD>Ϊ0<CEAA><30><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ؾ߽<D8BE><DFBD><EFBFBD>");
|
|
|
|
|
|
Text_VehicleName.text = CommonUtils.GetLocalizeText("vehicle_none");
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
2024-12-12 19:57:07 +08:00
|
|
|
|
LoadVehicleModel(SelectedVehicleID);
|
|
|
|
|
|
|
2024-12-16 12:04:37 +08:00
|
|
|
|
Text_VehicleName.text = VehicleDataHelper.GetVehicleLocalizeName((int)SelectedVehicleID);
|
2024-12-12 19:11:59 +08:00
|
|
|
|
//Text_Name.text = curShownVehicleData.Name;
|
|
|
|
|
|
string imgPath = VehicleDataHelper.GetVehiclePicPath(curShownVehicleData.Cfg.ID);
|
|
|
|
|
|
//Image_HeadPic.sprite = AssetManager.Instance.GetPreLoadResult<Sprite>(imgPath);
|
|
|
|
|
|
|
|
|
|
|
|
//#region <20>ȼ<EFBFBD>
|
|
|
|
|
|
//Text_Level_Max.text = curShownVehicleData.SumPowerMaxLevel().ToString();
|
|
|
|
|
|
//Text_Max.text = curShownVehicleData.SumPowerMaxLevel().ToString();
|
|
|
|
|
|
//Text_Level_Now.text = curShownVehicleData.SumPowerLevel().ToString();
|
|
|
|
|
|
//Text_Current.text = curShownVehicleData.SumPowerLevel().ToString();
|
|
|
|
|
|
//#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region <20><><EFBFBD><EFBFBD>
|
2024-12-19 15:25:35 +08:00
|
|
|
|
Text_Level.text = CommonUtils.GetRomanCode(curShownVehicleData.Cfg.VehicleLevel);
|
2024-12-16 12:04:37 +08:00
|
|
|
|
Text_Organization.text = VehicleDataHelper.GetVehicleOrganization((int)SelectedVehicleID);
|
|
|
|
|
|
|
2024-12-12 19:11:59 +08:00
|
|
|
|
Text_HpValue.text = curShownVehicleData.Hp().ToString();
|
|
|
|
|
|
Text_MemberCountValue.text = curShownVehicleData.SeatCount().ToString();
|
|
|
|
|
|
Text_DefValue.text = curShownVehicleData.Defense().ToString();
|
|
|
|
|
|
Text_SpeedValue.text = curShownVehicleData.MoveSpeed().ToString();
|
|
|
|
|
|
Text_AtkValue.text = curShownVehicleData.Attack().ToString();
|
|
|
|
|
|
Text_BulletCountValue.text = curShownVehicleData.BulletCapacity().ToString();
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region <20><>Ӧ<EFBFBD><D3A6>
|
|
|
|
|
|
Text_GroundAdapt.text = curShownVehicleData.GetTerrainAdapt(BonusType.TerrainPlain);
|
|
|
|
|
|
Text_SnowAdapt.text = curShownVehicleData.GetTerrainAdapt(BonusType.TerrainSnow);
|
|
|
|
|
|
Text_MountainAdapt.text = curShownVehicleData.GetTerrainAdapt(BonusType.TerrainMountain);
|
|
|
|
|
|
Text_WoodAdapt.text = curShownVehicleData.GetTerrainAdapt(BonusType.TerrainForest);
|
|
|
|
|
|
#endregion
|
2024-12-11 11:16:11 +08:00
|
|
|
|
|
2024-12-12 19:11:59 +08:00
|
|
|
|
#region <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
DataSkill nowSkillCfg = TableManager.Instance.Tables.SkillConfig.Get(VehicleDataHelper.GetVehicleSkillId(curShownVehicleData.Cfg.ID, true));
|
|
|
|
|
|
if (nowSkillCfg == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
nowSkillCfg = TableManager.Instance.Tables.SkillConfig.DataList[0];
|
|
|
|
|
|
DebugUtil.LogError("<22>ؾ<D8BE><DFBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>δ<EFBFBD><CEB4><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD>ؾ<EFBFBD>IDΪ{0}<7D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IDΪ{1}\n>><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ñ<EFBFBD><C3B1><EFBFBD>VehicleSkllUpgrade/SkillConfig_Vehicle", curShownVehicleData.Cfg.ID, VehicleDataHelper.GetVehicleSkillId(curShownVehicleData.Cfg.ID));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-12-12 19:57:07 +08:00
|
|
|
|
Text_SkillCoolingTimeValue.text = nowSkillCfg.CDTime.ToString() + "s";
|
2024-12-12 19:11:59 +08:00
|
|
|
|
Text_SkillName.text = CommonUtils.GetLocalizeText(E_LocalizePrefix.skill, nowSkillCfg.ID);
|
|
|
|
|
|
|
2024-12-12 19:57:07 +08:00
|
|
|
|
var skillIcon = await LoadAssetAsync<Sprite>(Framework.Constants.UI_Cultivata_skillIconFolder + nowSkillCfg.IconPath);
|
2024-12-12 19:11:59 +08:00
|
|
|
|
Image_SkillIcon.sprite = skillIcon;
|
|
|
|
|
|
//Text_Class_Value.text = CommonUtils.GetRomanCode((int)curShownVehicleData.SumBonus(BonusType.SkillLv) + 1);//δǿ<CEB4><C7BF>ʱ<EFBFBD>ȼ<EFBFBD>Ϊ1
|
|
|
|
|
|
|
|
|
|
|
|
Text_SkillInfo.text = CommonUtils.GetLocalizeText(E_LocalizePrefix.skill_desc, nowSkillCfg.ID);
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
async void LoadVehicleModel(long id)
|
|
|
|
|
|
{
|
|
|
|
|
|
//var id = (uint)curShownVehicleData.Cfg.ID;
|
|
|
|
|
|
var config = TableManager.Instance.Tables.VehicleConfig.GetOrDefault((int)id);
|
|
|
|
|
|
|
|
|
|
|
|
var vehicleDataDic = VehicleCultivateDataManager.Instance.DevelopVehicleDic;
|
|
|
|
|
|
if (vehicleDataDic.TryGetValue(id, out var vehicleData))
|
|
|
|
|
|
{
|
|
|
|
|
|
if (vehicleData != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
var prefabPath = PathEx.GetVehicleGameModelPath(vehicleData.Cfg.ID);
|
|
|
|
|
|
GameObject go = null;
|
|
|
|
|
|
if (_assetsLoadDic.ContainsKey(prefabPath))//<2F>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD>ع<EFBFBD>
|
|
|
|
|
|
{
|
|
|
|
|
|
go = _assetsLoadDic[prefabPath];
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
var prefab = await AssetManager.Instance.LoadAssetAsync<GameObject>(prefabPath);
|
|
|
|
|
|
go = Instantiate(prefab);
|
|
|
|
|
|
}
|
|
|
|
|
|
if (go)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (_vehicleGo != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
_vehicleGo.SetActive(false);
|
|
|
|
|
|
}
|
|
|
|
|
|
_vehicleGo = go;
|
|
|
|
|
|
_vehicleGo.SetActive(true);
|
|
|
|
|
|
_assetsLoadDic.TryAdd(prefabPath, go);
|
|
|
|
|
|
go.SetLayerEx(LayerDefine.UIView);
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̨<EFBFBD><CCA8><EFBFBD><EFBFBD>
|
|
|
|
|
|
// <20>ҵ<EFBFBD><D2B5><EFBFBD>̨<EFBFBD>ҵ<EFBFBD>
|
|
|
|
|
|
var allTrans = go.GetComponentsInChildren<Transform>();
|
|
|
|
|
|
var pointName = "Battery_point01";
|
|
|
|
|
|
var fireTrans = allTrans.First(t => t.name == pointName);
|
|
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̨ģ<CCA8><C4A3>
|
|
|
|
|
|
var rawConfig = TableManager.Instance.Tables.BatteryConfig.GetOrDefault(config.WeaponId);
|
|
|
|
|
|
var batteryPath = PathEx.GetBatteryModelPath(rawConfig.ModelPath);
|
|
|
|
|
|
var sampleObj = await AssetManager.Instance.LoadAssetAsync<GameObject>(batteryPath);
|
|
|
|
|
|
if (sampleObj != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
sampleObj.SetLayerEx(LayerDefine.UIView);
|
|
|
|
|
|
|
|
|
|
|
|
//<2F><>װ<EFBFBD><D7B0>̨
|
|
|
|
|
|
var rootObj = UnityEngine.Object.Instantiate(sampleObj, fireTrans);
|
|
|
|
|
|
rootObj.transform.ResetLocals();
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
DebugUtil.LogError("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̨ʧ<CCA8><CAA7>: {0}", batteryPath);
|
|
|
|
|
|
|
|
|
|
|
|
SetVehicleRoot();
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
DebugUtil.LogError("<22>ؾ<EFBFBD>ģ<EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD><DCA3>ؾ<EFBFBD>IDΪ{0}", id);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
DebugUtil.LogError(id + "<22>ؾ<EFBFBD><D8BE><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
DebugUtil.LogError("<22>ؾ<EFBFBD><D8BE><EFBFBD><EFBFBD><EFBFBD>δ<EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD>ؾ<EFBFBD>IDΪ{0}", id);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void SetVehicleRoot()
|
|
|
|
|
|
{
|
|
|
|
|
|
if (vRoot != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
_vehicleGo.transform.SetParent(vRoot.transform);
|
|
|
|
|
|
_vehicleGo.transform.localPosition = Vector3.zero;
|
|
|
|
|
|
_vehicleGo.transform.localRotation = Quaternion.identity;
|
|
|
|
|
|
_vehicleGo.transform.localScale = Vector3.one;
|
|
|
|
|
|
DebugUtil.Log("<22>ؾ<EFBFBD><D8BE>ѹ<EFBFBD><D1B9>ص<EFBFBD>vRoot");
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
DebugUtil.Log("vRoot<6F><74>δ<EFBFBD><CEB4><EFBFBD><EFBFBD>");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void LoadVehicleList()
|
|
|
|
|
|
{
|
|
|
|
|
|
m_unlockedVehicles = VehicleCultivateDataManager.Instance.DevelopVehicleIDs;
|
|
|
|
|
|
foreach (var vehicle in m_unlockedVehicles)
|
|
|
|
|
|
{
|
|
|
|
|
|
//var item = ScrollView_VehicleList.AddItem();
|
|
|
|
|
|
//item.GetComponent<UI_VehicleItem>("UI_VehicleItem").SetData(vehicle);
|
|
|
|
|
|
|
|
|
|
|
|
DebugUtil.Log("LoadVehicleList: " + vehicle.ToString());
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-12-18 19:58:14 +08:00
|
|
|
|
|
|
|
|
|
|
void HideUI(bool show)
|
|
|
|
|
|
{
|
|
|
|
|
|
m_isVehicleUIShow = show;
|
|
|
|
|
|
FindObj("UI_CurrencyList").SetActive(show);
|
|
|
|
|
|
FindObj("UI_LiuHaiLeft").SetActive(show);
|
|
|
|
|
|
FindObj("UI_LiuHaiRight").SetActive(show);
|
|
|
|
|
|
Button_TechTree.gameObject.SetActive(show);
|
|
|
|
|
|
FindObj("VehicleList").SetActive(show);
|
|
|
|
|
|
}
|
2024-12-11 11:16:11 +08:00
|
|
|
|
#region Button Click Event
|
2024-12-18 19:58:14 +08:00
|
|
|
|
public void OnButton_backClick()
|
|
|
|
|
|
{
|
|
|
|
|
|
if (m_isVehicleUIShow)
|
|
|
|
|
|
{
|
|
|
|
|
|
CommonUtils.ChangeUIScene(Framework.Constants.MAIN_SCENE_PATH);
|
|
|
|
|
|
CloseWindow();
|
|
|
|
|
|
UIManager.Instance.ShowAllUI();
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
HideUI(true);
|
|
|
|
|
|
}
|
2024-12-11 11:16:11 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void OnButton_HomeClick()
|
|
|
|
|
|
{
|
|
|
|
|
|
CommonUtils.ChangeUIScene(Framework.Constants.MAIN_SCENE_PATH);
|
|
|
|
|
|
UIManager.Instance.CloseAllNormalExcept(UINameConst.UI_MainPanel);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void OnButton_TreeClick()
|
|
|
|
|
|
{
|
|
|
|
|
|
UI_VehicleTechTreeController.Open().Forget();
|
|
|
|
|
|
}
|
2024-12-12 19:11:59 +08:00
|
|
|
|
|
|
|
|
|
|
public void OnButton_DevClick()
|
|
|
|
|
|
{
|
|
|
|
|
|
UI_VehiclePartTreeController.Open(SelectedVehicleID).Forget();
|
|
|
|
|
|
}
|
2024-12-13 14:56:43 +08:00
|
|
|
|
|
|
|
|
|
|
public void OnButton_PaintClick()
|
|
|
|
|
|
{
|
|
|
|
|
|
UI_VehicleSkinController.Open(SelectedVehicleID).Forget();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-12-12 19:11:59 +08:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region scrollView
|
|
|
|
|
|
|
2024-12-16 12:04:37 +08:00
|
|
|
|
async void UpdateScrollViewItem(int index, RectTransform item)
|
2024-12-12 19:57:07 +08:00
|
|
|
|
{
|
|
|
|
|
|
item.gameObject.SetActive(true);
|
|
|
|
|
|
|
|
|
|
|
|
var vehicle = m_unlockedVehicles[index];
|
|
|
|
|
|
var vehicleCfg = vehicle.Cfg;
|
|
|
|
|
|
string name = vehicle.Name;
|
2024-12-16 12:04:37 +08:00
|
|
|
|
var levelStr = CommonUtils.GetRomanCode(vehicle.Cfg.VehicleLevel);
|
2024-12-12 19:57:07 +08:00
|
|
|
|
|
|
|
|
|
|
CommonUtils.GetComponent<TMP_Text>(item.gameObject, "Text_VehicleName").text = name;
|
2024-12-16 12:04:37 +08:00
|
|
|
|
CommonUtils.GetComponent<TMP_Text>(item.gameObject, "Text_Level").text = levelStr;
|
|
|
|
|
|
|
2024-12-16 13:20:15 +08:00
|
|
|
|
GameObject highLight = CommonUtils.GetGameObject(item.gameObject, "Image_CurrentSelection");
|
|
|
|
|
|
highLight.SetActive(SelectedVehicleID == vehicleCfg.ID);
|
|
|
|
|
|
|
|
|
|
|
|
var button = CommonUtils.GetComponent<Button>(item.gameObject);
|
|
|
|
|
|
if(button != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
button.onClick.RemoveAllListeners();
|
|
|
|
|
|
CommonUtils.BindButton(button, () => OnVehicleSelected(vehicleCfg.ID));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-12-16 12:04:37 +08:00
|
|
|
|
var sprite = await AssetManager.Instance.LoadAssetAsync<Sprite>(VehicleDataHelper.GetVehiclePicPath(vehicleCfg.ID));
|
|
|
|
|
|
CommonUtils.GetComponent<Image>(item.gameObject, "Image_VehicleIcon").sprite = sprite;
|
2024-12-12 19:57:07 +08:00
|
|
|
|
}
|
2024-12-16 13:20:15 +08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// <20><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>Item<65><6D><EFBFBD><EFBFBD>
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="id"></param>
|
|
|
|
|
|
void OnVehicleSelected(long id)
|
|
|
|
|
|
{
|
|
|
|
|
|
SelectedVehicleID = id;
|
|
|
|
|
|
ScrollView_VehicleList.UpdateData();
|
|
|
|
|
|
VehicleInfoRefresh();
|
|
|
|
|
|
}
|
2024-12-12 19:11:59 +08:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region rotation
|
|
|
|
|
|
bool isRegisterInput = false;
|
|
|
|
|
|
private void ControllInput(bool isRegister)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (isRegisterInput == isRegister)
|
|
|
|
|
|
{
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
isRegisterInput = isRegister;
|
2024-12-13 14:56:43 +08:00
|
|
|
|
DebugUtil.Log("vehicle rotate input register: " + isRegister.ToString());
|
2024-12-12 19:11:59 +08:00
|
|
|
|
//<2F><>UI<55><49><EFBFBD><EFBFBD><EFBFBD>ſ<EFBFBD><C5BF><EFBFBD>ק
|
|
|
|
|
|
if (isRegister)
|
|
|
|
|
|
{
|
|
|
|
|
|
InputManager.Instance.OnFingerMove += OnFingleSwipe;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
InputManager.Instance.OnFingerMove -= OnFingleSwipe;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
private void OnFingleSwipe(Vector2 delta)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (delta == Vector2.zero) return;
|
|
|
|
|
|
if (_rotateTrans != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
_rotateTrans.Rotate(Vector3.up, .3f * delta.x);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
DebugUtil.LogError("Rotate_Axis is null");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-12-11 11:16:11 +08:00
|
|
|
|
#endregion
|
2024-12-09 17:02:39 +08:00
|
|
|
|
}
|