Files
Fishing2/Assets/Scripts/UI/Common/ModelViewer/ModelViewer.cs
2025-10-26 23:32:33 +08:00

78 lines
2.0 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖
using UnityEngine;
using FairyGUI;
using NBC;
using NBF.Fishing2;
namespace NBF
{
public partial class ModelViewer : GComponent
{
ModelViewRenderImage _renderImage;
private void OnInited()
{
_renderImage = new ModelViewRenderImage(ModelHolder.asGraph);
TouchHolder.onRollOver.Set(OnFocusIn);
TouchHolder.onRollOut.Set(OnFocusOut);
Stage.inst.onMouseWheel.Add(OnMouseWheel);
}
public override void Dispose()
{
Stage.inst.onMouseWheel.Remove(OnMouseWheel);
_renderImage.Dispose();
base.Dispose();
}
public void SetData(uint itemId)
{
SetData(ItemConfig.Get(itemId));
}
public void SetData(ItemConfig itemConfig)
{
//Assets/Resources/gfx/baits/worm_01/worm_01.prefab
// _renderImage.LoadModel("gfx/baits/worm_01/worm_01");
_renderImage.LoadModel("gfx/" + itemConfig.Model);
// var model = PrefabsHelper.CreatePrefab("gfx/baits/worm_01/worm_01");
}
#region ()
private void SetRotateListening()
{
var dragObj = TouchHolder;
var gesture1 = new SwipeGesture(dragObj);
gesture1.onMove.Set(OnSwipeMove);
gesture1.onEnd.Set(OnSwipeEnd);
}
private void OnSwipeMove(EventContext context)
{
}
private void OnSwipeEnd(EventContext context)
{
}
private void OnFocusIn()
{
// _focus = true;
Log.Info("focus true");
}
private void OnFocusOut()
{
// _focus = false;
Log.Info("focus false");
}
private void OnMouseWheel(EventContext context)
{
}
#endregion
}
}