# Conflicts:
#	UserSettings/EditorUserSettings.asset
This commit is contained in:
2025-06-24 20:41:21 +08:00
43 changed files with 818 additions and 2845 deletions

View File

@@ -162,8 +162,8 @@ public class RenderImage
float vh = imageRect.height - (sourceH - gridRect.height);
uvRect = Rect.MinMaxRect(Mathf.Lerp(uvRect.xMin, uvRect.xMax, (bound.x - gridRect.x) / vw),
Mathf.Lerp(uvRect.yMin, uvRect.yMax, (imageRect.height - bound.yMax - (sourceH - gridRect.yMax)) / vh),
Mathf.Lerp(uvRect.xMin, uvRect.xMax, (bound.xMax - gridRect.x) / vw),
Mathf.Lerp(uvRect.yMin, uvRect.yMax, (imageRect.height - bound.yMin - gridRect.y) / vh));
Mathf.Lerp(uvRect.xMin, uvRect.xMax, (bound.xMax - gridRect.x) / vw),
Mathf.Lerp(uvRect.yMin, uvRect.yMax, (imageRect.height - bound.yMin - gridRect.y) / vh));
}
else
{
@@ -201,6 +201,7 @@ public class RenderImage
Object.Destroy(_model.gameObject);
_model = null;
}
_rotating = 0;
}

View File

@@ -3,12 +3,14 @@
--- !u!1 &100000
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 5
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 400000}
- component: {fileID: 2000000}
- component: {fileID: -8157094741309571032}
m_Layer: 5
m_Name: RenderImageCamera
m_TagString: Untagged
@@ -18,27 +20,44 @@ GameObject:
m_IsActive: 1
--- !u!4 &400000
Transform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 100000}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: -0.41}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!20 &2000000
Camera:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 100000}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 2
m_BackGroundColor: {r: 0, g: 0, b: 0, a: 0}
m_projectionMatrixMode: 1
m_GateFitMode: 2
m_FOVAxisMode: 0
m_Iso: 200
m_ShutterSpeed: 0.005
m_Aperture: 16
m_FocusDistance: 10
m_FocalLength: 50
m_BladeCount: 5
m_Curvature: {x: 2, y: 11}
m_BarrelClipping: 0.25
m_Anamorphism: 0
m_SensorSize: {x: 36, y: 24}
m_LensShift: {x: 0, y: 0}
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
@@ -60,18 +79,52 @@ Camera:
m_TargetEye: 3
m_HDR: 0
m_AllowMSAA: 1
m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!1001 &100100000
Prefab:
m_ObjectHideFlags: 1
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications: []
m_RemovedComponents: []
m_ParentPrefab: {fileID: 0}
m_RootGameObject: {fileID: 100000}
m_IsPrefabParent: 1
--- !u!114 &-8157094741309571032
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 100000}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a79441f348de89743a2939f4d699eac1, type: 3}
m_Name:
m_EditorClassIdentifier:
m_RenderShadows: 1
m_RequiresDepthTextureOption: 2
m_RequiresOpaqueTextureOption: 2
m_CameraType: 0
m_Cameras: []
m_RendererIndex: -1
m_VolumeLayerMask:
serializedVersion: 2
m_Bits: 1
m_VolumeTrigger: {fileID: 0}
m_VolumeFrameworkUpdateModeOption: 2
m_RenderPostProcessing: 0
m_Antialiasing: 0
m_AntialiasingQuality: 2
m_StopNaN: 0
m_Dithering: 0
m_ClearDepth: 1
m_AllowXRRendering: 1
m_AllowHDROutput: 1
m_UseScreenCoordOverride: 0
m_ScreenSizeOverride: {x: 0, y: 0, z: 0, w: 0}
m_ScreenCoordScaleBias: {x: 0, y: 0, z: 0, w: 0}
m_RequiresDepthTexture: 0
m_RequiresColorTexture: 0
m_Version: 2
m_TaaSettings:
m_Quality: 3
m_FrameInfluence: 0.1
m_JitterScale: 1
m_MipBias: 0
m_VarianceClampScale: 0.9
m_ContrastAdaptiveSharpening: 0

View File

@@ -13,8 +13,6 @@ Material:
m_ModifiedSerializedProperties: 0
m_ValidKeywords:
- _EMISSION
- _GLOSSINESS_FROM_BASE_ALPHA
- _SPECULAR_COLOR
m_InvalidKeywords: []
m_LightmapFlags: 1
m_EnableInstancingVariants: 0
@@ -53,7 +51,7 @@ Material:
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Texture: {fileID: 2800000, guid: 3c3eb5b459fd6d241afe2698a33268d9, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:

File diff suppressed because it is too large Load Diff

View File

@@ -1,10 +1,7 @@
fileFormatVersion: 2
guid: 5044755b433cf354eb6f4e2f9f2173b9
timeCreated: 1540944203
licenseType: Free
NativeFormatImporter:
PrefabImporter:
externalObjects: {}
mainObjectFileID: 100100000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -850,7 +850,6 @@ MonoBehaviour:
videoPlayer: {fileID: 1810378423}
startCanvas: {fileID: 386239068}
playVideo: 0
audioMixer: {fileID: 24100000, guid: 66dbad8598d60494fab0927844c88cc0, type: 2}
controllerType: 1
--- !u!81 &2487858301405542861
AudioListener:

View File

@@ -25,8 +25,8 @@ namespace NBF.Setting
public override void Apply()
{
// 保存绑定
PlayerPrefs.SetString(SaveKey, InputAction.SaveBindingOverridesAsJson());
SaveValue = Value;
InputSaveValue = InputAction.SaveBindingOverridesAsJson();
PlayerPrefs.SetString(SaveKey, InputSaveValue);
OnApply();
}
@@ -66,6 +66,18 @@ namespace NBF.Setting
}
}
public override void Cancel()
{
if (!string.IsNullOrEmpty(InputSaveValue))
{
InputAction.LoadBindingOverridesFromJson(InputSaveValue);
}
else
{
Reset();
}
}
public override string GetDisplayString()
{
if (InputAction != null)

View File

@@ -83,6 +83,12 @@ namespace NBF.Setting
Value = DefaultValue;
}
public virtual void Cancel()
{
}
public virtual string GetDisplayString()
{
return GetValue().ToString();

View File

@@ -5,7 +5,7 @@ namespace NBF
/// <summary>
/// 鱼饵
/// </summary>
public class BaitAsset : MonoBehaviour
public class BaitAsset : PreviewableAsset
{
public Transform hook;
}

View File

@@ -5,7 +5,7 @@ namespace NBF
/// <summary>
/// 浮漂资产
/// </summary>
public class BobberAsset : MonoBehaviour
public class BobberAsset : PreviewableAsset
{
public Transform body;
public Transform stick;

View File

@@ -2,7 +2,7 @@
namespace NBF
{
public class FishAsset : MonoBehaviour
public class FishAsset : PreviewableAsset
{
public Transform root;

View File

@@ -2,7 +2,7 @@
namespace NBF
{
public class HookAsset : MonoBehaviour
public class HookAsset : PreviewableAsset
{
/// <summary>
/// 鱼饵挂点

View File

@@ -2,7 +2,7 @@
namespace NBF
{
public class LineAsset : MonoBehaviour
public class LineAsset : PreviewableAsset
{
}
}

View File

@@ -2,7 +2,7 @@
namespace NBF
{
public class LureAsset : MonoBehaviour
public class LureAsset : PreviewableAsset
{
/// <summary>
/// 鱼钩挂点

View File

@@ -0,0 +1,38 @@
using System;
using UnityEngine;
namespace NBF
{
/// <summary>
/// 模型拉近拉远配置
/// </summary>
[Serializable]
public class ModelZoomConfig
{
[Tooltip("是否可以放大缩小")] public bool canZoom;
[Tooltip("默认值")] public float zoom;
[Tooltip("最小值")] public float zoomMin;
[Tooltip("最大值")] public float zoomMax;
}
/// <summary>
/// 模型平移配置
/// </summary>
[Serializable]
public class ModelPanConfig
{
[Tooltip("是否可以平移")] public bool canPan;
[Tooltip("水平可移动值")] public float x = 0;
[Tooltip("垂直可移动值")] public float y = 0;
}
/// <summary>
/// 可以3D预览的资产
/// </summary>
public class PreviewableAsset : MonoBehaviour
{
[Tooltip("放大缩小配置")] public ModelZoomConfig zoom;
[Tooltip("平移配置")] public ModelPanConfig pan;
[Tooltip("默认旋转")] public Vector3 rotation;
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: a000ba87cd97499eb23feecf39521ecb
timeCreated: 1750736840

View File

@@ -2,7 +2,7 @@
namespace NBF
{
public class PropAsset : MonoBehaviour
public class PropAsset : PreviewableAsset
{
}
}

View File

@@ -5,7 +5,7 @@ namespace NBF
/// <summary>
/// 线轴资产配置
/// </summary>
public class ReelAsset : MonoBehaviour
public class ReelAsset : PreviewableAsset
{
// "previewRotationEnabled": 1,
// "previewRotation": {

View File

@@ -6,7 +6,7 @@ namespace NBF
/// <summary>
/// 鱼竿资产配置
/// </summary>
public class RodAsset : MonoBehaviour
public class RodAsset : PreviewableAsset
{
/// <summary>
/// 根节点

View File

@@ -2,7 +2,7 @@
namespace NBF
{
public class SpinnerLureAsset : MonoBehaviour
public class SpinnerLureAsset : PreviewableAsset
{
}
}

View File

@@ -9,6 +9,7 @@ namespace NBF
public static void BindAll()
{
UIObjectFactory.SetPackageItemExtension(SelectPages.URL, typeof(SelectPages));
UIObjectFactory.SetPackageItemExtension(ModelTexture.URL, typeof(ModelTexture));
UIObjectFactory.SetPackageItemExtension(BottomMenu.URL, typeof(BottomMenu));
UIObjectFactory.SetPackageItemExtension(ClassifyList.URL, typeof(ClassifyList));
UIObjectFactory.SetPackageItemExtension(CommonMenu.URL, typeof(CommonMenu));

View File

@@ -0,0 +1,327 @@
using FairyGUI;
using FairyGUI.Utils;
using System.Collections;
using UnityEngine;
namespace NBF
{
public class ModelRenderImage
{
public Transform modelRoot { get; private set; }
Camera _camera;
Image _image;
Transform _root;
Transform _background;
Transform _model;
RenderTexture _renderTexture;
int _width;
int _height;
bool _cacheTexture;
Vector3 _rotating;
const int RENDER_LAYER = 0;
const int HIDDEN_LAYER = 10;
public ModelRenderImage(GGraph holder)
{
_width = (int)holder.width;
_height = (int)holder.height;
_cacheTexture = true;
this._image = new Image();
holder.SetNativeObject(this._image);
Object prefab = Resources.Load("RenderTexture/RenderImageCamera");
GameObject go = (GameObject)Object.Instantiate(prefab);
_camera = go.GetComponent<Camera>();
_camera.transform.position = new Vector3(0, 1000, 0);
_camera.cullingMask = 1 << RENDER_LAYER;
_camera.enabled = false;
Object.DontDestroyOnLoad(_camera.gameObject);
this._root = new GameObject("RenderImage").transform;
this._root.SetParent(_camera.transform, false);
SetLayer(this._root.gameObject, HIDDEN_LAYER);
this.modelRoot = new GameObject("model_root").transform;
this.modelRoot.SetParent(this._root, false);
this._background = new GameObject("background").transform;
this._background.SetParent(this._root, false);
this._image.onAddedToStage.Add(OnAddedToStage);
this._image.onRemovedFromStage.Add(OnRemoveFromStage);
if (this._image.stage != null)
OnAddedToStage();
else
_camera.gameObject.SetActive(false);
}
public void Dispose()
{
Object.Destroy(_camera.gameObject);
DestroyTexture();
this._image.Dispose();
this._image = null;
}
/// <summary>
/// The rendertexture is not transparent. So if you want to the UI elements can be seen in the back of the models/particles in rendertexture,
/// you can set a maximunm two images for background.
/// Be careful if your image is 9 grid scaling, you must make sure the place holder is inside the middle box(dont cover from border to middle).
/// </summary>
/// <param name="image"></param>
public void SetBackground(GObject image)
{
SetBackground(image, null);
}
/// <summary>
/// The rendertexture is not transparent. So if you want to the UI elements can be seen in the back of the models/particles in rendertexture,
/// you can set a maximunm two images for background.
/// </summary>
/// <param name="image1"></param>
/// <param name="image2"></param>
public void SetBackground(GObject image1, GObject image2)
{
Image source1 = (Image)image1.displayObject;
Image source2 = image2 != null ? (Image)image2.displayObject : null;
Vector3 pos = _background.position;
pos.z = _camera.farClipPlane;
_background.position = pos;
Vector2[] uv = new Vector2[4];
Vector2[] uv2 = null;
Rect rect = _image.TransformRect(new Rect(0, 0, this._width, this._height), source1);
Rect uvRect = GetImageUVRect(source1, rect, uv);
if (source2 != null)
{
rect = _image.TransformRect(new Rect(0, 0, this._width, this._height), source2);
uv2 = new Vector2[4];
GetImageUVRect(source2, rect, uv2);
}
Vector3[] vertices = new Vector3[4];
for (int i = 0; i < 4; i++)
{
Vector2 v = uv[i];
vertices[i] = new Vector3((v.x - uvRect.x) / uvRect.width * 2 - 1,
(v.y - uvRect.y) / uvRect.height * 2 - 1, 0);
}
Mesh mesh = new Mesh();
mesh.vertices = vertices;
mesh.uv = uv;
if (uv2 != null)
mesh.uv2 = uv2;
mesh.colors32 = new Color32[] { Color.white, Color.white, Color.white, Color.white };
mesh.triangles = new int[] { 0, 1, 2, 2, 3, 0 };
MeshFilter meshFilter = this._background.gameObject.GetComponent<MeshFilter>();
if (meshFilter == null)
meshFilter = this._background.gameObject.AddComponent<MeshFilter>();
meshFilter.mesh = mesh;
MeshRenderer meshRenderer = this._background.gameObject.GetComponent<MeshRenderer>();
if (meshRenderer == null)
meshRenderer = this._background.gameObject.AddComponent<MeshRenderer>();
#if (UNITY_5 || UNITY_5_3_OR_NEWER)
meshRenderer.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off;
#else
meshRenderer.castShadows = false;
#endif
meshRenderer.receiveShadows = false;
Shader shader = Shader.Find("Game/FullScreen");
Material mat = new Material(shader);
mat.mainTexture = source1.texture.nativeTexture;
if (source2 != null)
mat.SetTexture("_Tex2", source2.texture.nativeTexture);
meshRenderer.material = mat;
}
Rect GetImageUVRect(Image image, Rect localRect, Vector2[] uv)
{
Rect imageRect = new Rect(0, 0, image.size.x, image.size.y);
Rect bound = ToolSet.Intersection(ref imageRect, ref localRect);
Rect uvRect = image.texture.uvRect;
if (image.scale9Grid != null)
{
Rect gridRect = (Rect)image.scale9Grid;
float sourceW = image.texture.width;
float sourceH = image.texture.height;
uvRect = Rect.MinMaxRect(Mathf.Lerp(uvRect.xMin, uvRect.xMax, gridRect.xMin / sourceW),
Mathf.Lerp(uvRect.yMin, uvRect.yMax, (sourceH - gridRect.yMax) / sourceH),
Mathf.Lerp(uvRect.xMin, uvRect.xMax, gridRect.xMax / sourceW),
Mathf.Lerp(uvRect.yMin, uvRect.yMax, (sourceH - gridRect.yMin) / sourceH));
float vw = imageRect.width - (sourceW - gridRect.width);
float vh = imageRect.height - (sourceH - gridRect.height);
uvRect = Rect.MinMaxRect(Mathf.Lerp(uvRect.xMin, uvRect.xMax, (bound.x - gridRect.x) / vw),
Mathf.Lerp(uvRect.yMin, uvRect.yMax,
(imageRect.height - bound.yMax - (sourceH - gridRect.yMax)) / vh),
Mathf.Lerp(uvRect.xMin, uvRect.xMax, (bound.xMax - gridRect.x) / vw),
Mathf.Lerp(uvRect.yMin, uvRect.yMax, (imageRect.height - bound.yMin - gridRect.y) / vh));
}
else
{
uvRect = Rect.MinMaxRect(Mathf.Lerp(uvRect.xMin, uvRect.xMax, bound.xMin / imageRect.width),
Mathf.Lerp(uvRect.yMin, uvRect.yMax, (imageRect.height - bound.yMax) / imageRect.height),
Mathf.Lerp(uvRect.xMin, uvRect.xMax, bound.xMax / imageRect.width),
Mathf.Lerp(uvRect.yMin, uvRect.yMax, (imageRect.height - bound.yMin) / imageRect.height));
}
uv[0] = uvRect.position;
uv[1] = new Vector2(uvRect.xMin, uvRect.yMax);
uv[2] = new Vector2(uvRect.xMax, uvRect.yMax);
uv[3] = new Vector2(uvRect.xMax, uvRect.yMin);
if (image.texture.rotated)
ToolSet.RotateUV(uv, ref image.texture.uvRect);
return uvRect;
}
public GameObject LoadModel(string model)
{
this.UnloadModel();
Object prefab = Resources.Load(model);
GameObject go = ((GameObject)Object.Instantiate(prefab));
_model = go.transform;
_model.SetParent(this.modelRoot, false);
var h = CalculateModelHeight(go); //计算包围盒高度
var pos = _model.localPosition;
_model.localPosition = new Vector3(pos.x, pos.y - h * 0.5f, pos.z);
return go;
}
public void UnloadModel()
{
if (_model != null)
{
Object.Destroy(_model.gameObject);
_model = null;
}
_rotating = Vector3.zero;
}
public void StartRotate(Vector3 delta)
{
_rotating = delta;
}
public void StopRotate()
{
_rotating = Vector3.zero;
}
// 获取模型的高度
private float CalculateModelHeight(GameObject model)
{
// 获取模型的所有Renderer组件包括MeshRenderer和SkinnedMeshRenderer
Renderer[] renderers = model.GetComponentsInChildren<Renderer>();
if (renderers.Length == 0)
{
Debug.LogWarning("模型没有Renderer组件");
return 0f;
}
// 初始化包围盒
Bounds bounds = renderers[0].bounds;
// 合并所有Renderer的包围盒
for (int i = 1; i < renderers.Length; i++)
{
bounds.Encapsulate(renderers[i].bounds);
}
// 返回高度Y轴尺寸
return bounds.size.y;
}
void CreateTexture()
{
if (_renderTexture != null)
return;
_renderTexture = new RenderTexture(_width, _height, 24, RenderTextureFormat.ARGB32)
{
antiAliasing = 1,
filterMode = FilterMode.Bilinear,
anisoLevel = 0,
useMipMap = false
};
this._image.texture = new NTexture(_renderTexture);
// this._image.blendMode = BlendMode.Off;
}
void DestroyTexture()
{
if (_renderTexture != null)
{
Object.Destroy(_renderTexture);
_renderTexture = null;
this._image.texture = null;
}
}
void OnAddedToStage()
{
if (_renderTexture == null)
CreateTexture();
Timers.inst.AddUpdate(this.Render);
_camera.gameObject.SetActive(true);
Render();
}
void OnRemoveFromStage()
{
if (!_cacheTexture)
DestroyTexture();
Timers.inst.Remove(this.Render);
_camera.gameObject.SetActive(false);
}
void Render(object param = null)
{
if (_rotating != Vector3.zero && this.modelRoot != null)
{
Vector3 localRotation = this.modelRoot.localRotation.eulerAngles;
localRotation += _rotating;
this.modelRoot.localRotation = Quaternion.Euler(localRotation);
}
SetLayer(this._root.gameObject, RENDER_LAYER);
_camera.targetTexture = this._renderTexture;
RenderTexture old = RenderTexture.active;
RenderTexture.active = this._renderTexture;
GL.Clear(true, true, Color.clear);
_camera.Render();
RenderTexture.active = old;
SetLayer(this._root.gameObject, HIDDEN_LAYER);
}
void SetLayer(GameObject go, int layer)
{
Transform[] transforms = go.GetComponentsInChildren<Transform>(true);
foreach (Transform t in transforms)
{
t.gameObject.layer = layer;
}
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 82ec71c75abc4b739fb8e75078dd718b
timeCreated: 1750673117

View File

@@ -0,0 +1,27 @@
/**本脚本为自动生成每次生成会覆盖请勿手动修改生成插件文档及项目地址https://git.whoot.com/whoot-games/whoot.fguieditorplugin**/
using FairyGUI;
using FairyGUI.Utils;
using NBC;
namespace NBF
{
public partial class ModelTexture
{
public const string URL = "ui://6hgkvlau5dtxm9";
public GGraph ModelHolder;
public GGraph TouchHolder;
public override void ConstructFromXML(XML xml)
{
base.ConstructFromXML(xml);
ModelHolder = (GGraph)GetChild("ModelHolder");
TouchHolder = (GGraph)GetChild("TouchHolder");
OnInited();
UILanguage.TrySetComponentLanguage(this);
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: db45948262d06f64299721282226d4f2

View File

@@ -0,0 +1,148 @@
// 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖
using System;
using UnityEngine;
using FairyGUI;
using NBC;
namespace NBF
{
public partial class ModelTexture : GComponent
{
ModelRenderImage _renderImage;
private Vector2 _startPos;
private Vector3 _startRot;
private SwipeGesture _swipeGesture;
private bool _focus;
private void OnInited()
{
SetRotateListening();
// Stage.inst.on
TouchHolder.onRollOver.Set(OnFocusIn);
TouchHolder.onRollOut.Set(OnFocusOut);
Stage.inst.onMouseWheel.Add(OnMouseWheel);
// TouchHolder.onm
}
public override void Dispose()
{
Stage.inst.onMouseWheel.Remove(OnMouseWheel);
base.Dispose();
}
/// <summary>
/// 加载资产模型
/// </summary>
/// <param name="configId"></param>
public void LoadAsset(int configId)
{
if (_renderImage == null)
{
_renderImage = new ModelRenderImage(ModelHolder.asGraph);
}
var model = _renderImage.LoadModel("Role/npc");
_renderImage.modelRoot.localScale = Vector3.one;
var previewableAsset = model.GetComponent<PreviewableAsset>();
if (previewableAsset != null)
{
_renderImage.modelRoot.localPosition = new Vector3(0, 0, previewableAsset.zoom.zoom);
_renderImage.modelRoot.localRotation = Quaternion.Euler(previewableAsset.rotation);
}
else
{
_renderImage.modelRoot.localPosition = new Vector3(0, 0, 3);
_renderImage.modelRoot.localRotation = Quaternion.Euler(Vector3.zero);
}
}
/// <summary>
/// 加载角色模型
/// </summary>
public void LoadRole()
{
}
private void SetRotateListening()
{
var dragObj = TouchHolder;
var gesture1 = new SwipeGesture(dragObj);
gesture1.onMove.Set(OnSwipeMove);
gesture1.onEnd.Set(OnSwipeEnd);
}
#region
private void OnSwipeMove(EventContext context)
{
var gesture = context.sender as SwipeGesture;
if (gesture == null) return;
var v = Vector3.zero;
if (context.inputEvent.button == 0)
{
v.y = -gesture.delta.x * 0.2f;
v.z = -gesture.delta.y * 0.2f;
if (!gesture.snapping)
{
v.y = 0;
v.z = 0;
}
if (Mathf.Abs(v.y) < 1) //消除手抖影响
v.y = 0;
if (Mathf.Abs(v.z) < 1) //消除手抖影响
v.z = 0;
_renderImage.StartRotate(v);
}
else
{
v.y = -gesture.delta.y * 0.005f;
v.x = gesture.delta.x * 0.005f;
//平移
var pos = _renderImage.modelRoot.localPosition;
_renderImage.modelRoot.localPosition = new Vector3(pos.x + v.x, pos.y + v.y, pos.z);
}
}
private void OnSwipeEnd(EventContext context)
{
_renderImage.StopRotate();
}
#endregion
#region Zoom
private void OnFocusIn()
{
_focus = true;
Log.Info("focus true");
}
private void OnFocusOut()
{
_focus = false;
Log.Info("focus false");
}
private void OnMouseWheel(EventContext context)
{
if (!_focus) return;
float delta = context.inputEvent.mouseWheelDelta / Stage.devicePixelRatio;
SetZoom(delta * 0.2f);
}
private void SetZoom(float delta)
{
var pos = _renderImage.modelRoot.localPosition;
_renderImage.modelRoot.localPosition = new Vector3(pos.x, pos.y, pos.z + delta);
}
#endregion
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 6b09786333c422145abf84aaa2750425

View File

@@ -11,6 +11,8 @@ namespace NBF
public partial class HomePanel
{
public GObject this[string aKey] => ContentPane.GetChild(aKey);
[AutoFind(Name = "Back")]
public GLabel Back;
[AutoFind(Name = "Pages")]
public GComponent Pages;
[AutoFind(Name = "Menu")]

View File

@@ -11,6 +11,7 @@ namespace NBF
{
public const string URL = "ui://hxr7rc7plvql10";
public ModelTexture Model;
public HomeButtonGroups OpGroup;
public BottomMenu BottomMenu;
@@ -18,6 +19,7 @@ namespace NBF
{
base.ConstructFromXML(xml);
Model = (ModelTexture)GetChild("Model");
OpGroup = (HomeButtonGroups)GetChild("OpGroup");
BottomMenu = (BottomMenu)GetChild("BottomMenu");
OnInited();

View File

@@ -31,6 +31,10 @@ namespace NBF
{
InputManager.OnUICanceled += OnUICanceled;
UseBottomMenu();
Model.LoadAsset(0);
// Model.SetBackground(Panel.Back.GetChild("back"));//, Panel.Back.GetChild("icon")
}
@@ -73,7 +77,7 @@ namespace NBF
private void UseBottomMenu()
{
BottomMenu.Use(Panel);
BottomMenu.AddRightButton(InputDef.UI.Enter);
BottomMenu.AddRightButton(InputDef.UI.Back);
}

View File

@@ -131,6 +131,7 @@ namespace NBF
{
option.Apply();
}
Notices.Success("TEXT_OP_SUCCESS");
}
private void OnResetSettings()
@@ -143,6 +144,8 @@ namespace NBF
}
ResetSettingList();
Notices.Success("TEXT_OP_SUCCESS");
}
private void OnUICanceled(string action)
@@ -240,6 +243,7 @@ namespace NBF
{
if (b)
{
CancelAndBack();
Hide();
}
});
@@ -250,6 +254,23 @@ namespace NBF
}
}
private void CancelAndBack()
{
var groupNames = Settings.Instance.GetAllTabs();
foreach (var group in groupNames)
{
var options = Settings.Instance.GetOptionsByTab(group);
foreach (var option in options)
{
if (option.HaveNotApple())
{
option.Cancel();
}
}
}
}
protected override void OnHide()
{
base.OnHide();

View File

@@ -2,14 +2,20 @@
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Roboto-Bold SDF - HDRP Unlit
m_Shader: {fileID: -6465566751694194690, guid: f63d574838ccfb44f84acc05fed0af48, type: 3}
m_ShaderKeywords: _ALPHATEST_ON _ENABLE_FOG_ON_TRANSPARENT _SURFACE_TYPE_TRANSPARENT
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords:
- _ALPHATEST_ON
- _ENABLE_FOG_ON_TRANSPARENT
- _SURFACE_TYPE_TRANSPARENT
m_InvalidKeywords: []
m_LightmapFlags: 1
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
@@ -22,6 +28,7 @@ Material:
- TransparentDepthPostpass
- TransparentBackface
- MOTIONVECTORS
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
@@ -57,6 +64,7 @@ Material:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _AddPrecomputedVelocity: 0
- _AlphaCutoffEnable: 1
@@ -76,15 +84,19 @@ Material:
- _BumpFace: 0
- _BumpOutline: 0
- _ColorMask: 15
- _ConservativeDepthOffsetEnable: 0
- _CullMode: 2
- _CullModeForward: 2
- _DepthOffsetEnable: 0
- _Diffuse: 0.5
- _DoubleSidedEnable: 0
- _DoubleSidedGIMode: 0
- _DoubleSidedNormalMode: 2
- _DstBlend: 10
- _DstBlend2: 10
- _EnableBlendModePreserveSpecularLighting: 0
- _EnableFogOnTransparent: 1
- _ExcludeFromTUAndAA: 0
- _FaceDilate: 0
- _FaceUVSpeedX: 0
- _FaceUVSpeedY: 0
@@ -102,6 +114,7 @@ Material:
- _OutlineUVSpeedX: 0
- _OutlineUVSpeedY: 0
- _OutlineWidth: 0
- _PerPixelSorting: 0
- _PerspectiveFilter: 0.875
- _Reflectivity: 10
- _RenderQueueType: 3
@@ -119,15 +132,15 @@ Material:
- _StencilOp: 0
- _StencilReadMask: 255
- _StencilRef: 0
- _StencilRefDepth: 0
- _StencilRefDepth: 1
- _StencilRefDistortionVec: 4
- _StencilRefGBuffer: 2
- _StencilRefMV: 32
- _StencilRefMV: 33
- _StencilWriteMask: 6
- _StencilWriteMaskDepth: 8
- _StencilWriteMaskDepth: 9
- _StencilWriteMaskDistortionVec: 4
- _StencilWriteMaskGBuffer: 14
- _StencilWriteMaskMV: 40
- _StencilWriteMaskMV: 43
- _SurfaceType: 1
- _TextureHeight: 1024
- _TextureWidth: 1024
@@ -176,6 +189,7 @@ Material:
- _UnderlayColor: {r: 0, g: 0, b: 0, a: 0.5}
- _UnderlayOffset: {r: 0, g: 0, b: 0, a: 0}
m_BuildTextureStacks: []
m_AllowLocking: 1
--- !u!114 &8695414737614723888
MonoBehaviour:
m_ObjectHideFlags: 11
@@ -188,4 +202,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: da692e001514ec24dbc4cca1949ff7e8, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 11
version: 13
hdPluginSubTargetMaterialVersions:
m_Keys: []
m_Values:

Binary file not shown.

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<component size="600,600" opaque="false">
<displayList>
<graph id="n0_5dtx" name="ModelHolder" xy="0,0" size="600,600" type="rect" lineColor="#ffffffff">
<relation target="" sidePair="width-width,height-height"/>
</graph>
<graph id="n1_5dtx" name="TouchHolder" xy="0,0" size="600,600" alpha="0" type="rect" lineColor="#ffffffff">
<relation target="" sidePair="width-width,height-height"/>
</graph>
</displayList>
</component>

View File

@@ -220,10 +220,7 @@
<image id="8hy8m7" name="ControllerY.png" path="/Icon/控制图标/" exported="true"/>
<component id="5dtx19" name="SelectPageItem.xml" path="/Com/"/>
<component id="5dtx1a" name="SelectPages.xml" path="/Com/" exported="true"/>
<image id="9n0dm8" name="GlowBtn.png" path="/Images/button/2/" exported="true" scale="9grid" scale9grid="4,4,56,56"/>
<image id="9n0dm9" name="GlowBtnDisabled.png" path="/Images/button/2/" exported="true" scale="9grid" scale9grid="4,4,56,56"/>
<image id="9n0dma" name="GlowBtnHighlighted.png" path="/Images/button/2/" exported="true" scale="9grid" scale9grid="4,4,56,56"/>
<image id="9n0dmb" name="GlowBtnOver.png" path="/Images/button/2/" exported="true" scale="9grid" scale9grid="4,4,56,56"/>
<component id="5dtxm9" name="ModelTexture.xml" path="/Com/" exported="true"/>
</resources>
<publish name="" path="../Assets/Resources/Fgui/Common" packageCount="2" genCode="true"/>
</packageDescription>

View File

@@ -1,8 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<component size="1920,1080">
<displayList>
<component id="n0_lvql" name="OpGroup" src="lvqln" fileName="Com/Home/HomeButtonGroups.xml" xy="79,179">
<relation target="" sidePair="middle-middle,left-left"/>
<component id="n2_5dtx" name="Model" src="5dtxm9" fileName="Com/ModelTexture.xml" pkg="6hgkvlau" xy="1268,181" size="620,758">
<relation target="" sidePair="center-center,middle-middle"/>
</component>
<component id="n0_lvql" name="OpGroup" src="lvqln" fileName="Com/Home/HomeButtonGroups.xml" xy="59,179">
<relation target="" sidePair="center-center,middle-middle"/>
</component>
<component id="n1_lvql" name="BottomMenu" src="9mf1z" fileName="Com/Menu/BottomMenu.xml" pkg="6hgkvlau" xy="0,992">
<relation target="" sidePair="center-center,bottom-bottom"/>

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<component size="1920,1080" designImage="ui://hxr7rc7pnmzbd" designImageAlpha="0">
<displayList>
<component id="n33_gii7" name="n33" src="8hy8la" fileName="Com/Back/Back1.xml" pkg="6hgkvlau" xy="0,0">
<component id="n33_gii7" name="Back" src="8hy8la" fileName="Com/Back/Back1.xml" pkg="6hgkvlau" xy="0,0">
<relation target="" sidePair="width-width,height-height"/>
</component>
<component id="n32_lvql" name="Pages" src="lvqll7" fileName="Com/CommonContainer.xml" pkg="6hgkvlau" xy="0,0" size="1920,1080">

View File

@@ -0,0 +1 @@
{"url":"ui://6hgkvlau5dtxm9","name":"ModelTexture","scriptType":"component","isCustomName":false,"customName":"","annotation":"","member":{}}

View File

@@ -76,7 +76,7 @@ QualitySettings:
globalTextureMipmapLimit: 0
textureMipmapLimitSettings: []
anisotropicTextures: 2
antiAliasing: 8
antiAliasing: 2
softParticles: 0
softVegetation: 1
realtimeReflectionProbes: 1