This commit is contained in:
李浩 2025-03-06 15:04:00 +08:00
commit 381a15b4ab
16 changed files with 252 additions and 63 deletions

View File

@ -338,7 +338,7 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
m_Material: {fileID: 0} m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1} m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1 m_RaycastTarget: 0
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1 m_Maskable: 1
m_OnCullStateChanged: m_OnCullStateChanged:
@ -378,6 +378,7 @@ GameObject:
- component: {fileID: 1915876869541640623} - component: {fileID: 1915876869541640623}
- component: {fileID: 7277770534815806214} - component: {fileID: 7277770534815806214}
- component: {fileID: 5964642934946449171} - component: {fileID: 5964642934946449171}
- component: {fileID: 5887092968505518654}
m_Layer: 0 m_Layer: 0
m_Name: Right m_Name: Right
m_TagString: Untagged m_TagString: Untagged
@ -443,6 +444,22 @@ MonoBehaviour:
m_FillOrigin: 0 m_FillOrigin: 0
m_UseSpriteMesh: 0 m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1 m_PixelsPerUnitMultiplier: 1
--- !u!114 &5887092968505518654
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1587529206278800681}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0d51f3a7c41ab0346b49ae50d456bece, type: 3}
m_Name:
m_EditorClassIdentifier:
MarkType: 0
CustomComponentName:
CustomComment:
mComponentName: UnityEngine.UI.Image
--- !u!1 &3408871029033640143 --- !u!1 &3408871029033640143
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -743,8 +760,9 @@ GameObject:
- component: {fileID: 826586917723392204} - component: {fileID: 826586917723392204}
- component: {fileID: 1954549762747143972} - component: {fileID: 1954549762747143972}
- component: {fileID: 2228057524689582266} - component: {fileID: 2228057524689582266}
- component: {fileID: 4892270682288098217}
m_Layer: 0 m_Layer: 0
m_Name: Bg m_Name: ObjBg
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
@ -791,7 +809,7 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
m_Material: {fileID: 0} m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1} m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1 m_RaycastTarget: 0
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1 m_Maskable: 1
m_OnCullStateChanged: m_OnCullStateChanged:
@ -804,6 +822,22 @@ MonoBehaviour:
y: 0 y: 0
width: 1 width: 1
height: 1 height: 1
--- !u!114 &4892270682288098217
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6704188004419676826}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0d51f3a7c41ab0346b49ae50d456bece, type: 3}
m_Name:
m_EditorClassIdentifier:
MarkType: 0
CustomComponentName:
CustomComment:
mComponentName: UnityEngine.UI.RawImage
--- !u!1 &6831573971870136393 --- !u!1 &6831573971870136393
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -967,8 +1001,10 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 2922fa71b7d60e942b5b06b785dc37c0, type: 3} m_Script: {fileID: 11500000, guid: 2922fa71b7d60e942b5b06b785dc37c0, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
Right: {fileID: 5964642934946449171}
Scroll: {fileID: 4147329925826600491} Scroll: {fileID: 4147329925826600491}
Content: {fileID: 7417210800730282872} Content: {fileID: 7417210800730282872}
ObjBg: {fileID: 2228057524689582266}
DeviceRawImage: {fileID: 7397484820841873523} DeviceRawImage: {fileID: 7397484820841873523}
ItemPrefab: {fileID: 1826394720132835709} ItemPrefab: {fileID: 1826394720132835709}
--- !u!1 &7986150287571393044 --- !u!1 &7986150287571393044

Binary file not shown.

Before

Width:  |  Height:  |  Size: 65 KiB

After

Width:  |  Height:  |  Size: 80 KiB

View File

@ -303,15 +303,22 @@ namespace HighlightPlus {
} }
void OnMouseEnter() { void OnMouseEnter() {
if (isActiveAndEnabled && triggerMode == TriggerMode.ColliderEventsOnlyOnThisObject) { if (isActiveAndEnabled && triggerMode == TriggerMode.ColliderEventsOnlyOnThisObject) {
if (!CanInteract()) return; if (!CanInteract()) return;
Debug.Log("进入");
hb.outline = 1;
Highlight(true); Highlight(true);
} }
} }
void OnMouseExit() { void OnMouseExit() {
if (isActiveAndEnabled && triggerMode == TriggerMode.ColliderEventsOnlyOnThisObject) { if (isActiveAndEnabled && triggerMode == TriggerMode.ColliderEventsOnlyOnThisObject) {
if (!CanInteract()) return; if (!CanInteract()) return;
Debug.Log("退出");
hb.outline = 1;
Highlight(false); Highlight(false);
} }
} }

View File

@ -1,33 +0,0 @@
fileFormatVersion: 2
guid: 82549cd4bc10d654d876aaf0f7f4b64d
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 1
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
Windows Store Apps: WindowsStoreApps
second:
enabled: 0
settings:
CPU: AnyCPU
userData:
assetBundleName:
assetBundleVariant:

View File

@ -79,8 +79,9 @@ namespace QFramework
int.TryParse(frame, out curFrame); int.TryParse(frame, out curFrame);
anim.clip = anim[animName].clip; anim.clip = anim[animName].clip;
anim[animName].time = curFrame / anim.clip.frameRate; anim[animName].time = curFrame / anim.clip.frameRate;
anim[animName].speed = 0;
anim.Play(animName); anim.Play(animName);
anim[animName].speed = 0;
anim.Sample();
this.Finish(); this.Finish();
} }
else else

View File

@ -64,6 +64,7 @@ public class TimeLineAction : IAction
{ {
play.Stop(); play.Stop();
play.time = curEndFrame / 24; play.time = curEndFrame / 24;
play.Evaluate();
} }
if (play.state != PlayState.Playing) if (play.state != PlayState.Playing)
{ {
@ -109,17 +110,31 @@ public class TimeLineAction : IAction
{ {
curSpeed = 1; curSpeed = 1;
} }
if (!play.playableGraph.IsValid())
{
play.RebuildGraph();
}
play.playableGraph.GetRootPlayable(0).SetSpeed(curSpeed);
play.Play();
if (string.IsNullOrEmpty(endFrame) == false) if (string.IsNullOrEmpty(endFrame) == false)
{ {
float.TryParse(endFrame, out curEndFrame); float.TryParse(endFrame, out curEndFrame);
} }
if (!play.playableGraph.IsValid())
{
play.RebuildGraph();
}
if (curFrame == curEndFrame)
{
play.time = curEndFrame / 24;
play.Evaluate();
Finished();
}
else
{
play.playableGraph.GetRootPlayable(0).SetSpeed(curSpeed);
play.Play();
}
bool iswait = true; bool iswait = true;
bool.TryParse(isWait, out iswait); bool.TryParse(isWait, out iswait);
if (iswait == false) if (iswait == false)

View File

@ -18,7 +18,8 @@ public class DeviceItem : MonoBehaviour
{ {
var effect = gameObject.GetOrAddComponent<HighlightEffect>(); var effect = gameObject.GetOrAddComponent<HighlightEffect>();
gameObject.GetOrAddComponent<HighlightTrigger>(); gameObject.GetOrAddComponent<HighlightTrigger>();
effect.outlineColor = Color.green; //śÁČĄxmlŃŐÉŤ˛˘×ŞťŻ
effect.outlineColor = Utility.ToColor(device.HighColor);
StringEventSystem.Global.Register<string[]>(Global.HighLightTrigger, OnHighLightTriggerEvent); StringEventSystem.Global.Register<string[]>(Global.HighLightTrigger, OnHighLightTriggerEvent);
TypeEventSystem.Global.Register<StepStatusOnChange>(OnStepChanged); TypeEventSystem.Global.Register<StepStatusOnChange>(OnStepChanged);
} }

View File

@ -1,17 +1,15 @@
using Aspose.Words; using Aspose.Words;
using Aspose.Words.Replacing; using Aspose.Words.Replacing;
using QFramework;
using System.IO;
using UnityEngine; using UnityEngine;
using System.Windows.Forms;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using System; using System;
using System.IO;
public class AsposeHelper : MonoBehaviour public class AsposeHelper : MonoBehaviour
{ {
public static void Writer(string json, Action<DialogResult> callback = null) public static void Writer(string json, Action callback = null)
{ {
// 加载Word文档 // 加载Word文档
Document doc = new Document(Global.reportDemoPath); Document doc = new Document(Global.reportDemoPath);
@ -24,25 +22,32 @@ public class AsposeHelper : MonoBehaviour
string value = property.Value.ToString(); string value = property.Value.ToString();
doc.Range.Replace($"{{{key}}}", $"{value}", new FindReplaceOptions()); doc.Range.Replace($"{{{key}}}", $"{value}", new FindReplaceOptions());
} }
string filePath = ChinarFileController.SaveProject(Path.GetFileName(Global.reportDemoPath).Split('.')[1]);
if (string.IsNullOrEmpty(filePath) == false)
{
doc.Save(filePath);
}
callback?.Invoke();
// 替换文本 // 替换文本
SaveWithDialog(doc, callback); //SaveWithDialog(doc, callback);
//Debug.Log("文档处理完成,新文档已保存到: " + outputFilePath); //Debug.Log("文档处理完成,新文档已保存到: " + outputFilePath);
} }
private static void SaveWithDialog(Document doc, Action<DialogResult> callback) //private static void SaveWithDialog(Document doc, Action<DialogResult> callback)
{ //{
SaveFileDialog dialog = new SaveFileDialog(); // SaveFileDialog dialog = new SaveFileDialog();
dialog.Filter = "WordÎĵµ|*.docx"; // dialog.Filter = "WordÎĵµ|*.docx";
var result = dialog.ShowDialog(); // var result = dialog.ShowDialog();
if (result == DialogResult.OK) // if (result == DialogResult.OK)
{ // {
doc.Save(dialog.FileName); // doc.Save(dialog.FileName);
} // }
callback?.Invoke(result); // callback?.Invoke(result);
} //}
} }

View File

@ -0,0 +1,65 @@
using UnityEngine;
using System.Runtime.InteropServices;
using System;
/// <summary>
/// 文件控制脚本
/// </summary>
public class ChinarFileController : MonoBehaviour
{
/// <summary>
/// 打开项目
/// </summary>
public static string OpenProject()
{
string originalDir = Environment.CurrentDirectory;
string filepath = string.Empty;
OpenFileDlg pth = new OpenFileDlg();
pth.structSize = Marshal.SizeOf(pth);
// 修正过滤器格式(移除末尾多余的竖线)
//pth.filter = @"All Files (*.*)|*.jpg";
pth.file = new string(new char[256]);
pth.maxFile = pth.file.Length;
pth.fileTitle = new string(new char[64]);
pth.maxFileTitle = pth.fileTitle.Length;
pth.initialDir = Application.dataPath.Replace("/", "\\") + "\\Resources";
pth.title = "打开项目";
pth.defExt = "dat";
// 简化Flags设置保留关键选项
pth.flags = 0x00080000 | 0x00001000 | 0x00000800; // OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST
if (OpenFileDialog.GetOpenFileName(pth))
{
filepath = pth.file;
}
Environment.CurrentDirectory = originalDir;
return filepath;
}
/// <summary>
/// 保存文件项目
/// </summary>
public static string SaveProject(string ext)
{
string filepath = string.Empty;
SaveFileDlg pth = new SaveFileDlg();
pth.structSize = Marshal.SizeOf(pth);
pth.filter = "All files (*.*)|*.*";
pth.file = new string(new char[256]);
pth.maxFile = pth.file.Length;
pth.fileTitle = new string(new char[64]);
pth.maxFileTitle = pth.fileTitle.Length;
pth.initialDir = Application.dataPath; //默认路径
pth.title = "保存项目";
pth.defExt = ext;
pth.flags = 0x00080000 | 0x00001000 | 0x00000800 | 0x00000200 | 0x00000008;
if (SaveFileDialog.GetSaveFileName(pth))
{
filepath = pth.file; //选择的文件路径;
}
return filepath;
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6ff1bbdf3a991ec45bbf4e8be1ca5b91
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,57 @@
using System.Runtime.InteropServices;
using System;
/// <summary>
/// 文件日志类
/// </summary>
// [特性(布局种类.有序,字符集=字符集.自动)]
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
public class ChinarFileDlog
{
public int structSize = 0;
public IntPtr dlgOwner = IntPtr.Zero;
public IntPtr instance = IntPtr.Zero;
public String filter = null;
public String customFilter = null;
public int maxCustFilter = 0;
public int filterIndex = 0;
public String file = null;
public int maxFile = 0;
public String fileTitle = null;
public int maxFileTitle = 0;
public String initialDir = null;
public String title = null;
public int flags = 0;
public short fileOffset = 0;
public short fileExtension = 0;
public String defExt = null;
public IntPtr custData = IntPtr.Zero;
public IntPtr hook = IntPtr.Zero;
public String templateName = null;
public IntPtr reservedPtr = IntPtr.Zero;
public int reservedInt = 0;
public int flagsEx = 0;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
public class OpenFileDlg : ChinarFileDlog
{
}
public class OpenFileDialog
{
[DllImport("Comdlg32.dll", SetLastError = true, ThrowOnUnmappableChar = true, CharSet = CharSet.Auto)]
public static extern bool GetOpenFileName([In, Out] OpenFileDlg ofd);
}
public class SaveFileDialog
{
[DllImport("Comdlg32.dll", SetLastError = true, ThrowOnUnmappableChar = true, CharSet = CharSet.Auto)]
public static extern bool GetSaveFileName([In, Out] SaveFileDlg ofd);
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
public class SaveFileDlg : ChinarFileDlog
{
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9824f58b2cf6cc64ab2ef5d8ec6153b3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -5,16 +5,20 @@ using QFramework;
namespace QFramework.Example namespace QFramework.Example
{ {
// Generate Id:5590b0b6-d056-4a95-a14d-4e5b14aedaac // Generate Id:1419ca94-de6c-4a9d-9a3d-b2f838aea3ba
public partial class UI3DObjShow public partial class UI3DObjShow
{ {
public const string Name = "UI3DObjShow"; public const string Name = "UI3DObjShow";
[SerializeField]
public UnityEngine.UI.Image Right;
[SerializeField] [SerializeField]
public UnityEngine.UI.ScrollRect Scroll; public UnityEngine.UI.ScrollRect Scroll;
[SerializeField] [SerializeField]
public RectTransform Content; public RectTransform Content;
[SerializeField] [SerializeField]
public UnityEngine.UI.RawImage ObjBg;
[SerializeField]
public UnityEngine.UI.RawImage DeviceRawImage; public UnityEngine.UI.RawImage DeviceRawImage;
[SerializeField] [SerializeField]
public UnityEngine.UI.Image ItemPrefab; public UnityEngine.UI.Image ItemPrefab;
@ -23,8 +27,10 @@ namespace QFramework.Example
protected override void ClearUIComponents() protected override void ClearUIComponents()
{ {
Right = null;
Scroll = null; Scroll = null;
Content = null; Content = null;
ObjBg = null;
DeviceRawImage = null; DeviceRawImage = null;
ItemPrefab = null; ItemPrefab = null;

View File

@ -6,6 +6,7 @@ using System.Collections.Generic;
using TMPro; using TMPro;
using GCSeries.Core; using GCSeries.Core;
using UnityEngine.EventSystems; using UnityEngine.EventSystems;
using System;
namespace QFramework.Example namespace QFramework.Example
{ {
@ -82,8 +83,14 @@ namespace QFramework.Example
}); });
} }
loader.LoadAsync(); loader.LoadAsync(() =>
{
Right.gameObject.SetActive(mData.datas.Count > 1);
Content.GetChild(0).GetComponent<Toggle>().isOn = true;
});
} }
protected override void OnShow() protected override void OnShow()
{ {
} }

View File

@ -40,7 +40,7 @@ namespace QFramework.Example
loader.LoadAsync(); loader.LoadAsync();
#elif UNITY_STANDALONE_WIN #elif UNITY_STANDALONE_WIN
DownLoad.interactable = false; DownLoad.interactable = false;
AsposeHelper.Writer(GetScoreDataJson(), result => AsposeHelper.Writer(GetScoreDataJson(), () =>
{ {
DownLoad.interactable = true; DownLoad.interactable = true;
}); });