Files
Fishing2/Assets/Scripts/UI/Common/ModelTexture.cs
2025-06-23 18:08:03 +08:00

38 lines
1.2 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;
namespace NBF
{
public partial class ModelTexture : GComponent
{
ModelRenderImage _renderImage;
private void OnInited()
{
_renderImage = new ModelRenderImage(ModelHolder.asGraph);
//RenderImage是不透明的可以设置最多两张图片作为背景图
// _renderImage.SetBackground(contentPane.GetChild("frame").asCom.GetChild("n0"), contentPane.GetChild("n20"));
}
public void LoadModel(string model)
{
_renderImage.LoadModel("Role/npc");
_renderImage.modelRoot.localPosition = new Vector3(0, -1.0f, 5f);
_renderImage.modelRoot.localScale = new Vector3(1, 1, 1);
_renderImage.modelRoot.localRotation = Quaternion.Euler(0, 120, 0);
}
public void SetBackground(GObject image1)
{
_renderImage.SetBackground(image1);
}
public void SetBackground(GObject image1, GObject image2)
{
_renderImage.SetBackground(image1, image2);
}
}
}