Files
MinFt/Client/Assets/Scripts/UI/Rod/FishingRodInfoPanel.cs
Liubing\LB 3d8d4d18f3 first commit
先修复一下,错误的场景

删除不必要的钓场资产

修复into场景

update:更新meta文件,修复报错

update:修复资源

修复第一章节建造

修复建造第三章

update:删除多余内容

update:更新README.md

update:还原图标

update:更新README

update:更新配置
2026-04-28 02:17:22 +08:00

89 lines
3.6 KiB
C#

using asap.core;
using cfg;
using DG.Tweening;
using GameCore;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
public class FishingRodInfoPanel : MonoBehaviour
{
Button btn_close;
TMP_Text text_special_peaks;
TMP_Text text_name;
UIDrag uiDrag;
RawImage rawImageRod;
private Transform _rotateTarget, _avatar;
TMP_Text text_info1;
TMP_Text text_info2;
TMP_Text text_info3;
GameObject loading;
Image mask_top;
string[] sp_rod_top_mask = { "sp_rod_top_mask_blue", "sp_rod_top_mask_blue", "sp_rod_top_mask_purple", "sp_rod_top_mask_yellow" };
private void Awake()
{
uiDrag = transform.Find("root/UIDrag").GetComponent<UIDrag>();
btn_close = transform.Find("root/btn_close").GetComponent<Button>();
text_special_peaks = transform.Find("root/bg_info/text_special_peaks").GetComponent<TMP_Text>();
text_name = transform.Find("root/bg_info/text_special_peaks/text_title").GetComponent<TMP_Text>();
rawImageRod = transform.Find("RawImageRod").GetComponent<RawImage>();
text_info1 = transform.Find("root/extra_info/text_info1").GetComponent<TMP_Text>();
text_info2 = transform.Find("root/extra_info/text_info2").GetComponent<TMP_Text>();
text_info3 = transform.Find("root/extra_info/text_info3").GetComponent<TMP_Text>();
mask_top = transform.Find("root/mask_top").GetComponent<Image>();
loading = transform.Find("root/loading").gameObject;
}
private void Start()
{
btn_close.onClick.AddListener(() => { UIManager.Instance.HideUI(UITypes.FishingRodInfoPanel); });
uiDrag.OnBeginDragCall = OnBeginDragCall;
uiDrag.OnDragCall = OnDragRod;
uiDrag.OnEndDragCall = StartDoRotate;
StartDoRotate();
}
public void Show(RodSkinData fishRodSkinData, RodData rodData, Transform avatar, Transform rotateTarget, RenderTexture rt, bool isShow)
{
avatar.DOLocalMove( new Vector3(0.7f, -0.5f, -2.5f),0.5f);
rawImageRod.texture = rt;
loading.SetActive(isShow);
_rotateTarget = rotateTarget;
_avatar = avatar;
text_name.text = LocalizationMgr.GetText(fishRodSkinData.Name_l10n_key);
text_special_peaks.text = LocalizationMgr.GetText(fishRodSkinData.Desc_l10n_key);
//string str = LocalizationMgr.GetFormatTextValue("UI_FishingPanel_101009", rodData.Length.ToString("F1"));
text_info1.text = $"{LocalizationMgr.GetText("RodConstStats_Length")}: {rodData.Length.ToString("F1")}";
text_info2.text = $"{LocalizationMgr.GetText("RodConstStats_Power")}: {rodData.Power}";
text_info3.text = $"{LocalizationMgr.GetText("RodConstStats_Action")}: {rodData.Action}";
GContext.container.Resolve<IUIService>().SetImageSprite(mask_top, sp_rod_top_mask[rodData.Quality - 1], BasePanel.PanelName);
}
public void SetLoading(bool isShow)
{
loading.SetActive(isShow);
}
void StartDoRotate()
{
if (_rotateTarget is null)
return;
var endRotation = _rotateTarget.localRotation.eulerAngles + new Vector3(0, 360, 0);
_rotateTarget.DOKill();
_rotateTarget.DOLocalRotate(endRotation, 10f, RotateMode.FastBeyond360).SetEase(Ease.Linear).SetLoops(-1);
}
void OnDragRod(PointerEventData eventData)
{
_rotateTarget?.Rotate(Vector3.up, -eventData.delta.x);
}
void OnBeginDragCall()
{
if (_rotateTarget != null)
{
_rotateTarget.DOKill();
}
}
private void OnDisable()
{
_avatar.transform.DOKill();
_avatar.DOLocalMove(new Vector3(0, 0, 0), 0.5f);
}
}