This commit is contained in:
李浩 2025-03-08 13:19:46 +08:00
commit c1e2fdeed4
35 changed files with 1990 additions and 69 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

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 310f51a2e0ce8db40b698f99e78ae145
PrefabImporter:
externalObjects: {}
userData:
assetBundleName: uibackpack_prefab
assetBundleVariant:

View File

@ -460,6 +460,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 5ed9b43aa6da2fd49af65b4ab0b85fc2, type: 3} m_Script: {fileID: 11500000, guid: 5ed9b43aa6da2fd49af65b4ab0b85fc2, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
Mask: {fileID: 1168405647267019539}
Title: {fileID: 3613689092755446169} Title: {fileID: 3613689092755446169}
Des: {fileID: 5150898215778594440} Des: {fileID: 5150898215778594440}
BtnContent: {fileID: 8598386973860236803} BtnContent: {fileID: 8598386973860236803}
@ -626,6 +627,7 @@ GameObject:
- component: {fileID: 7621766697555444520} - component: {fileID: 7621766697555444520}
- component: {fileID: 5831602004918006429} - component: {fileID: 5831602004918006429}
- component: {fileID: 1168405647267019539} - component: {fileID: 1168405647267019539}
- component: {fileID: 6844797422068731548}
m_Layer: 5 m_Layer: 5
m_Name: Mask m_Name: Mask
m_TagString: Untagged m_TagString: Untagged
@ -692,6 +694,22 @@ MonoBehaviour:
m_FillOrigin: 0 m_FillOrigin: 0
m_UseSpriteMesh: 0 m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1 m_PixelsPerUnitMultiplier: 1
--- !u!114 &6844797422068731548
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4085354983340029108}
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 &4287411951672065129 --- !u!1 &4287411951672065129
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -51,6 +51,7 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
answers: [] answers: []
bg: {fileID: 2575765536656914917}
Scroll: {fileID: 3666318679728618663} Scroll: {fileID: 3666318679728618663}
Content: {fileID: 8229723427790603414} Content: {fileID: 8229723427790603414}
ItemPrefab: {fileID: 3266964766418377106} ItemPrefab: {fileID: 3266964766418377106}
@ -870,6 +871,7 @@ GameObject:
- component: {fileID: 4604846658045866225} - component: {fileID: 4604846658045866225}
- component: {fileID: 7995524027316056123} - component: {fileID: 7995524027316056123}
- component: {fileID: 2575765536656914917} - component: {fileID: 2575765536656914917}
- component: {fileID: 7995406576721174090}
m_Layer: 0 m_Layer: 0
m_Name: bg m_Name: bg
m_TagString: Untagged m_TagString: Untagged
@ -892,10 +894,17 @@ RectTransform:
- {fileID: 9189599814967438796} - {fileID: 9189599814967438796}
m_Father: {fileID: 4477385101412774245} m_Father: {fileID: 4477385101412774245}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
<<<<<<< HEAD
m_AnchorMin: {x: 1, y: 0.5} m_AnchorMin: {x: 1, y: 0.5}
m_AnchorMax: {x: 1, y: 0.5} m_AnchorMax: {x: 1, y: 0.5}
m_AnchoredPosition: {x: -179.30054, y: 0} m_AnchoredPosition: {x: -179.30054, y: 0}
m_SizeDelta: {x: 315.6011, y: 653} m_SizeDelta: {x: 315.6011, y: 653}
=======
m_AnchorMin: {x: 0, y: 0.5}
m_AnchorMax: {x: 0, y: 0.5}
m_AnchoredPosition: {x: 111.5, y: 0}
m_SizeDelta: {x: 223, y: 653}
>>>>>>> origin/master
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &7995524027316056123 --- !u!222 &7995524027316056123
CanvasRenderer: CanvasRenderer:
@ -935,6 +944,22 @@ MonoBehaviour:
m_FillOrigin: 0 m_FillOrigin: 0
m_UseSpriteMesh: 0 m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1 m_PixelsPerUnitMultiplier: 1
--- !u!114 &7995406576721174090
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3256755621147846471}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0d51f3a7c41ab0346b49ae50d456bece, type: 3}
m_Name:
m_EditorClassIdentifier:
MarkType: 0
CustomComponentName: bg
CustomComment:
mComponentName: UnityEngine.UI.Image
--- !u!1 &3509989120642977392 --- !u!1 &3509989120642977392
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -306,8 +306,6 @@ namespace HighlightPlus {
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);
} }
} }
@ -317,8 +315,6 @@ namespace HighlightPlus {
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

@ -411,5 +411,16 @@ public class Utility
} }
} }
// 使用Unity的Random实现洗牌
public static void Shuffle<T>(IList<T> list)
{
int n = list.Count;
for (int i = n - 1; i > 0; i--)
{
int j = UnityEngine.Random.Range(0, i + 1);
T temp = list[i];
list[i] = list[j];
list[j] = temp;
}
}
} }

View File

@ -118,6 +118,11 @@ public class ActionHelper
var strAction = (XMLTool.DictionaryAction)act; var strAction = (XMLTool.DictionaryAction)act;
return UIToolsAction.Allocate(strAction.args); return UIToolsAction.Allocate(strAction.args);
} }
case "UIBackPack":
{
var strAction = (XMLTool.DictionaryAction)act;
return UIBackPackAction.Allocate(strAction.args);
}
case "PointQuestion": case "PointQuestion":
return PointQuestionAction.Allocate(act.Value); return PointQuestionAction.Allocate(act.Value);
case "Point3DQuestion": case "Point3DQuestion":

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

@ -53,6 +53,15 @@ public class TextTipAction : IAction
data.audio = datas.ContainsKey("audio") ? datas["audio"] : string.Empty; data.audio = datas.ContainsKey("audio") ? datas["audio"] : string.Empty;
data.title = datas.ContainsKey("title") ? datas["title"] : string.Empty; data.title = datas.ContainsKey("title") ? datas["title"] : string.Empty;
data.btns = datas.ContainsKey("btns") ? datas["btns"].Split(',').ToList() : null; data.btns = datas.ContainsKey("btns") ? datas["btns"].Split(',').ToList() : null;
if (datas.ContainsKey("alpha"))
{
if (float.TryParse(datas["alpha"], out data.alpha) == false)
{
data.alpha = 0;
}
}
UIKit.OpenPanelAsync<UITextTip>(uiData: data, canvasLevel: UILevel.PopUI).ToAction().StartGlobal(() => this.Finish()); UIKit.OpenPanelAsync<UITextTip>(uiData: data, canvasLevel: UILevel.PopUI).ToAction().StartGlobal(() => this.Finish());
} }

View File

@ -0,0 +1,74 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using QFramework;
using System;
using QFramework.Example;
using System.Linq;
public class UIBackPackAction : IAction
{
public ulong ActionID { get; set; }
public bool Deinited { get; set; }
public bool Paused { get; set; }
public ActionStatus Status { get; set; }
private static readonly SimpleObjectPool<UIBackPackAction> mPool =
new SimpleObjectPool<UIBackPackAction>(() => new UIBackPackAction(), null, 10);
string devices;
string random;
string scrollSpeed;
string position;
public static UIBackPackAction Allocate(Dictionary<string, string> datas, System.Action onDelayFinish = null)
{
var retNode = mPool.Allocate();
retNode.ActionID = ActionKit.ID_GENERATOR++;
retNode.Deinited = false;
retNode.Reset();
retNode.devices = datas.ContainsKey("devices") ? datas["devices"] : "";
retNode.random = datas.ContainsKey("random") ? datas["random"] : "";
retNode.scrollSpeed = datas.ContainsKey("scrollSpeed") ? datas["scrollSpeed"] : "";
retNode.position = datas.ContainsKey("position") ? datas["position"] : "";
return retNode;
}
public void Deinit()
{
if (!Deinited)
{
Deinited = true;
mPool.Recycle(this);
}
}
public void OnExecute(float dt)
{
}
public void OnFinish()
{
}
public void OnStart()
{
UIBackPackData data = new UIBackPackData();
data.devices = devices.Split(',').ToList();
if (bool.TryParse(random, out data.random) == false)
{
data.random = false;
}
if (float.TryParse(scrollSpeed, out data.scrollSpeed) == false)
{
data.scrollSpeed = 25;
}
data.position = position;
UIKit.OpenPanelAsync<UIBackPack>(uiData: data, canvasLevel: UILevel.PopUI).ToAction().StartGlobal(() => this.Finish());
}
public void Reset()
{
Status = ActionStatus.NotStart;
Paused = false;
}
}

View File

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

View File

@ -26,6 +26,9 @@ public class UIToolsAction : IAction
string totalScore; string totalScore;
string scoreStepName; string scoreStepName;
string autoHide; string autoHide;
string random;
string scrollSpeed;
string position;
public static UIToolsAction Allocate(Dictionary<string, string> datas, System.Action onDelayFinish = null) public static UIToolsAction Allocate(Dictionary<string, string> datas, System.Action onDelayFinish = null)
{ {
var retNode = mPool.Allocate(); var retNode = mPool.Allocate();
@ -44,6 +47,9 @@ public class UIToolsAction : IAction
retNode.totalScore = datas.ContainsKey("totalScore") ? datas["totalScore"] : ""; retNode.totalScore = datas.ContainsKey("totalScore") ? datas["totalScore"] : "";
retNode.scoreStepName = datas.ContainsKey("scoreStepName") ? datas["scoreStepName"] : ""; retNode.scoreStepName = datas.ContainsKey("scoreStepName") ? datas["scoreStepName"] : "";
retNode.autoHide = datas.ContainsKey("autoHide") ? datas["autoHide"] : ""; retNode.autoHide = datas.ContainsKey("autoHide") ? datas["autoHide"] : "";
retNode.random = datas.ContainsKey("random") ? datas["random"] : "";
retNode.scrollSpeed = datas.ContainsKey("scrollSpeed") ? datas["scrollSpeed"] : "";
retNode.position = datas.ContainsKey("position") ? datas["position"] : "";
return retNode; return retNode;
} }
@ -80,10 +86,20 @@ public class UIToolsAction : IAction
float.TryParse(totalScore, out data.totalScore); float.TryParse(totalScore, out data.totalScore);
data.scoreStepName = scoreStepName; data.scoreStepName = scoreStepName;
bool.TryParse(setActive, out data.SetActive); bool.TryParse(setActive, out data.SetActive);
if (bool.TryParse(random, out data.random) == false)
{
data.random = false;
}
if (float.TryParse(scrollSpeed, out data.scrollSpeed) == false)
{
data.scrollSpeed = 25;
}
if (float.TryParse(autoHide, out data.autoHideResult) == false) if (float.TryParse(autoHide, out data.autoHideResult) == false)
{ {
data.autoHideResult = -1; data.autoHideResult = -1;
} }
data.position = position;
UIKit.OpenPanelAsync<UITools>(uiData: data, canvasLevel: UILevel.PopUI).ToAction().StartGlobal(() => this.Finish()); UIKit.OpenPanelAsync<UITools>(uiData: data, canvasLevel: UILevel.PopUI).ToAction().StartGlobal(() => this.Finish());
} }

View File

@ -19,7 +19,6 @@ public class DeviceItem : MonoBehaviour
var effect = gameObject.GetOrAddComponent<HighlightEffect>(); var effect = gameObject.GetOrAddComponent<HighlightEffect>();
gameObject.GetOrAddComponent<HighlightTrigger>(); gameObject.GetOrAddComponent<HighlightTrigger>();
//¶ÁÈ¡xmlÑÕÉ«²¢×ª»¯ //¶ÁÈ¡xmlÑÕÉ«²¢×ª»¯
//effect.outline = 1;
effect.outlineColor = Utility.ToColor(device.HighColor); 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()
{ {
} }

55
Assets/Scripts/UI/UIBackPack.Designer.cs generated Normal file
View File

@ -0,0 +1,55 @@
using System;
using UnityEngine;
using UnityEngine.UI;
using QFramework;
namespace QFramework.Example
{
// Generate Id:df731f7c-b33b-4edd-ac53-d859f4d06272
public partial class UIBackPack
{
public const string Name = "UIBackPack";
[SerializeField]
public UnityEngine.UI.Image bg;
[SerializeField]
public UnityEngine.UI.ScrollRect Scroll;
[SerializeField]
public RectTransform Content;
[SerializeField]
public UnityEngine.UI.Button ItemPrefab;
private UIBackPackData mPrivateData = null;
protected override void ClearUIComponents()
{
bg = null;
Scroll = null;
Content = null;
ItemPrefab = null;
mData = null;
}
public UIBackPackData Data
{
get
{
return mData;
}
}
UIBackPackData mData
{
get
{
return mPrivateData ?? (mPrivateData = new UIBackPackData());
}
set
{
mUIData = value;
mPrivateData = value;
}
}
}
}

View File

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

View File

@ -0,0 +1,110 @@
using UnityEngine;
using UnityEngine.UI;
using QFramework;
using System.Collections.Generic;
using TMPro;
using static OperationController;
namespace QFramework.Example
{
public class UIBackPackData : UIPanelData
{
public List<string> devices;
public bool random = false;
public float scrollSpeed = 25;
public string position;
}
public partial class UIBackPack : UIPanel
{
ResLoader mResLoader;
protected override void OnInit(IUIData uiData = null)
{
mData = uiData as UIBackPackData ?? new UIBackPackData();
mResLoader = ResLoader.Allocate();
TypeEventSystem.Global.Register<OnModuleQuit>(OnModuleQuit).UnRegisterWhenGameObjectDestroyed(gameObject);
// please add init code here
}
protected override void OnOpen(IUIData uiData = null)
{
Content.RemoveAllChildren();
foreach (var device in mData.devices)
{
var item = DeviceController.Instance.GetDevice(device);
if (item == null)
{
Debug.LogError(device + ":没有找到对应的Device配置");
return;
}
GameObject obj = GameObject.Instantiate(ItemPrefab.gameObject, Content);
obj.name = item.Name;
obj.transform.Find("Name").GetComponent<TextMeshProUGUI>().text = item.Name;
Image icon = obj.transform.Find("IconBg/Icon").GetComponent<Image>();
var localImageUrl = Global.deviceIconsPath + item.Icon;
GameObject right = icon.transform.Find("Right").gameObject;
GameObject wrong = icon.transform.Find("Wrong").gameObject;
GameObject Selected = icon.transform.Find("Selected").gameObject;
mResLoader.Add2Load(localImageUrl.ToNetImageResName(),
(bool success, IRes res) =>
{
if (success)
{
icon.sprite = Utility.GetSprite(res.Asset as Texture2D);
}
});
Button btn = obj.GetComponent<Button>();
btn.onClick.AddListener(() =>
{
});
}
mResLoader.LoadAsync();
Scroll.verticalNormalizedPosition = 1;
switch (mData.position)
{
case "left":
// 将锚点设为父容器的右侧中间Middle-Right
bg.rectTransform.anchorMin = new Vector2(0, 0.5f); // 左下锚点(右侧)
bg.rectTransform.anchorMax = new Vector2(0, 0.5f); // 右上锚点(右侧)
// 将位置偏移归零(相对于锚点)
bg.rectTransform.anchoredPosition = Vector2.zero;
// 可选:设置轴心点为右侧中点(影响缩放/旋转中心)
bg.rectTransform.pivot = new Vector2(0, 0.5f);
break;
case "right":
default:
// 将锚点设为父容器的右侧中间Middle-Right
bg.rectTransform.anchorMin = new Vector2(1, 0.5f); // 左下锚点(右侧)
bg.rectTransform.anchorMax = new Vector2(1, 0.5f); // 右上锚点(右侧)
// 将位置偏移归零(相对于锚点)
bg.rectTransform.anchoredPosition = Vector2.zero;
// 可选:设置轴心点为右侧中点(影响缩放/旋转中心)
bg.rectTransform.pivot = new Vector2(1, 0.5f);
break;
}
}
protected override void OnShow()
{
}
protected override void OnHide()
{
}
protected override void OnClose()
{
}
public void OnModuleQuit(OnModuleQuit arg)
{
Hide();
}
}
}

View File

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

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;
}); });

View File

@ -5,11 +5,13 @@ using QFramework;
namespace QFramework.Example namespace QFramework.Example
{ {
// Generate Id:2bccd644-ac9b-4f30-8f17-4a933167afc1 // Generate Id:81b68f1b-6a7e-4133-9c0a-5297fa12f3ca
public partial class UITextTip public partial class UITextTip
{ {
public const string Name = "UITextTip"; public const string Name = "UITextTip";
[SerializeField]
public UnityEngine.UI.Image Mask;
[SerializeField] [SerializeField]
public TMPro.TextMeshProUGUI Title; public TMPro.TextMeshProUGUI Title;
[SerializeField] [SerializeField]
@ -23,6 +25,7 @@ namespace QFramework.Example
protected override void ClearUIComponents() protected override void ClearUIComponents()
{ {
Mask = null;
Title = null; Title = null;
Des = null; Des = null;
BtnContent = null; BtnContent = null;

View File

@ -14,6 +14,7 @@ namespace QFramework.Example
public string text; public string text;
public string audio; public string audio;
public string title; public string title;
public float alpha = 0;
public List<string> btns; public List<string> btns;
} }
public partial class UITextTip : UIPanel public partial class UITextTip : UIPanel
@ -64,6 +65,9 @@ namespace QFramework.Example
loader.LoadAsync(); loader.LoadAsync();
} }
Title.text = mData.title; Title.text = mData.title;
Color color = Mask.color;
color.a = mData.alpha;
Mask.color = color;
} }
protected override void OnShow() protected override void OnShow()

View File

@ -69,6 +69,7 @@ namespace QFramework.Example
}); });
loader.LoadAsync(); loader.LoadAsync();
} }
transform.SetAsLastSibling();
} }
protected override void OnShow() protected override void OnShow()

View File

@ -5,11 +5,13 @@ using QFramework;
namespace QFramework.Example namespace QFramework.Example
{ {
// Generate Id:5f777d12-69d4-455d-bef6-fb39dbeda60e // Generate Id:be7133cf-6b67-4ebc-b151-f39cadcba0d2
public partial class UITools public partial class UITools
{ {
public const string Name = "UITools"; public const string Name = "UITools";
[SerializeField]
public UnityEngine.UI.Image bg;
[SerializeField] [SerializeField]
public UnityEngine.UI.ScrollRect Scroll; public UnityEngine.UI.ScrollRect Scroll;
[SerializeField] [SerializeField]
@ -21,6 +23,7 @@ namespace QFramework.Example
protected override void ClearUIComponents() protected override void ClearUIComponents()
{ {
bg = null;
Scroll = null; Scroll = null;
Content = null; Content = null;
ItemPrefab = null; ItemPrefab = null;

View File

@ -23,6 +23,9 @@ namespace QFramework.Example
public float totalScore; public float totalScore;
public string scoreStepName; public string scoreStepName;
public float autoHideResult = -1; public float autoHideResult = -1;
public bool random = false;
public float scrollSpeed = 25;
public string position;
} }
public partial class UITools : UIPanel public partial class UITools : UIPanel
{ {
@ -31,6 +34,7 @@ namespace QFramework.Example
protected override void OnInit(IUIData uiData = null) protected override void OnInit(IUIData uiData = null)
{ {
mData = uiData as UIToolsData ?? new UIToolsData(); mData = uiData as UIToolsData ?? new UIToolsData();
mResLoader = ResLoader.Allocate();
// please add init code here // please add init code here
TypeEventSystem.Global.Register<OnModuleQuit>(OnModuleQuit).UnRegisterWhenGameObjectDestroyed(gameObject); TypeEventSystem.Global.Register<OnModuleQuit>(OnModuleQuit).UnRegisterWhenGameObjectDestroyed(gameObject);
} }
@ -48,13 +52,17 @@ namespace QFramework.Example
{ {
ScoreController.Instance.Add(mData.scoreStepName, mData.totalScore); ScoreController.Instance.Add(mData.scoreStepName, mData.totalScore);
} }
mResLoader = ResLoader.Allocate();
mData = uiData as UIToolsData ?? new UIToolsData(); mData = uiData as UIToolsData ?? new UIToolsData();
if (string.IsNullOrEmpty(mData.answer) == false) if (string.IsNullOrEmpty(mData.answer) == false)
{ {
answers = mData.answer.Split(',')?.ToList(); answers = mData.answer.Split(',')?.ToList();
} }
Content.RemoveAllChildren(); Content.RemoveAllChildren();
if (mData.devices.Count > 0 && mData.random)
{
Utility.Shuffle(mData.devices);
}
Scroll.scrollSensitivity = mData.scrollSpeed;
foreach (var device in mData.devices) foreach (var device in mData.devices)
{ {
var item = DeviceController.Instance.GetDevice(device); var item = DeviceController.Instance.GetDevice(device);
@ -133,6 +141,35 @@ namespace QFramework.Example
} }
mResLoader.LoadAsync(); mResLoader.LoadAsync();
Scroll.verticalNormalizedPosition = 1; Scroll.verticalNormalizedPosition = 1;
switch (mData.position)
{
case "left":
// 将锚点设为父容器的右侧中间Middle-Right
bg.rectTransform.anchorMin = new Vector2(0, 0.5f); // 左下锚点(右侧)
bg.rectTransform.anchorMax = new Vector2(0, 0.5f); // 右上锚点(右侧)
// 将位置偏移归零(相对于锚点)
bg.rectTransform.anchoredPosition = Vector2.zero;
// 可选:设置轴心点为右侧中点(影响缩放/旋转中心)
bg.rectTransform.pivot = new Vector2(0, 0.5f);
break;
case "right":
default:
// 将锚点设为父容器的右侧中间Middle-Right
bg.rectTransform.anchorMin = new Vector2(1, 0.5f); // 左下锚点(右侧)
bg.rectTransform.anchorMax = new Vector2(1, 0.5f); // 右上锚点(右侧)
// 将位置偏移归零(相对于锚点)
bg.rectTransform.anchoredPosition = Vector2.zero;
// 可选:设置轴心点为右侧中点(影响缩放/旋转中心)
bg.rectTransform.pivot = new Vector2(1, 0.5f);
break;
}
} }
public void SetSelected(GameObject item, bool isRight) public void SetSelected(GameObject item, bool isRight)

View File

@ -570,6 +570,43 @@ namespace XMLTool
{ {
act.args.Add("autoHide", autoHide.Value); act.args.Add("autoHide", autoHide.Value);
} }
var random = action.Attribute("random");
if (random != null)
{
act.args.Add("random", random.Value);
}
var scrollSpeed = action.Attribute("scrollSpeed");
if (scrollSpeed != null)
{
act.args.Add("scrollSpeed", scrollSpeed.Value);
}
var position = action.Attribute("position");
if (position != null)
{
act.args.Add("position", position.Value);
}
newAction = act;
}
break;
case "UIBackPack":
{
var act = new DictionaryAction();
act.args.Add("devices", action.Attribute("devices").Value);
var random = action.Attribute("random");
if (random != null)
{
act.args.Add("random", random.Value);
}
var scrollSpeed = action.Attribute("scrollSpeed");
if (scrollSpeed != null)
{
act.args.Add("scrollSpeed", scrollSpeed.Value);
}
var position = action.Attribute("position");
if (position != null)
{
act.args.Add("position", position.Value);
}
newAction = act; newAction = act;
} }
break; break;
@ -824,6 +861,11 @@ namespace XMLTool
{ {
act.args.Add("title", title.Value); act.args.Add("title", title.Value);
} }
XAttribute alpha = action.Attribute("alpha");
if (alpha != null)
{
act.args.Add("alpha", alpha.Value);
}
newAction = act; newAction = act;
} }

View File

@ -29,7 +29,10 @@
<!--用于右侧道具栏选择正确的道具 event用于配合StrEventCondition 做检测 <!--用于右侧道具栏选择正确的道具 event用于配合StrEventCondition 做检测
rightScore 正确选择一个 得分 wrongScore 错误一个 得分 scoreStepName是评分的key rightScore 正确选择一个 得分 wrongScore 错误一个 得分 scoreStepName是评分的key
autoHide =-1 则点击结束 否则 等待对应时间后自动结束 autoHide =-1 则点击结束 否则 等待对应时间后自动结束
totalScore 是配合wrongScore的用于初始化一个分数 然后选择扣分--> totalScore 是配合wrongScore的用于初始化一个分数 然后选择扣分
random 是否打乱devices的顺序
scrollSpeed 鼠标滚轮的滑动速度
position left/right 可以让道具栏在左侧或者右侧-->
<Action type="UITools" devices="道具名字1" answers="正确道具" <Action type="UITools" devices="道具名字1" answers="正确道具"
setActive="true" setActive="true"
rightLabel="提示:器械选择正确。" rightLabel="提示:器械选择正确。"
@ -40,7 +43,16 @@
wrongScore="" wrongScore=""
totalScore="" totalScore=""
scoreStepName="手术准备器械选择" scoreStepName="手术准备器械选择"
autoHide="-1"></Action> autoHide="-1"
random="true"
scrollSpeed="25"
position="right"></Action>
<!--道具背包,用于配合状态机进行道具的使用 目前是初步版本仅支持配合UIClick点击暂无道具数量等功能 详细参数可参考UITools-->
<Action type="UIBackPack" devices="道具名字1"
random="true"
scrollSpeed="25"
position="right"></Action>
<!--物体点位选择 物体的中心点--> <!--物体点位选择 物体的中心点-->
<Action type="PointQuestion" value="路径1,路径2"></Action> <Action type="PointQuestion" value="路径1,路径2"></Action>
@ -100,8 +112,10 @@
如果不配置 nearPos或者normalPos 则自动隐藏对应的视角UI按钮 如果不配置 nearPos或者normalPos 则自动隐藏对应的视角UI按钮
--> -->
<Action type="CameraSwitch" nearDevice="肠钳" normalDevice="组织钳" nearPos="-3.942,3.24,-4.319" nearRot="16.42331,180,0" nearTime="1" normalPos="-3.942,3.24,-3.946" normalRot="16.42331,180,-5.305351E-14" normalTime="1"></Action> <Action type="CameraSwitch" nearDevice="肠钳" normalDevice="组织钳" nearPos="-3.942,3.24,-4.319" nearRot="16.42331,180,0" nearTime="1" normalPos="-3.942,3.24,-3.946" normalRot="16.42331,180,-5.305351E-14" normalTime="1"></Action>
<!--文字弹窗 按钮可以多个 点击事件使用UIClick--> <!--文字弹窗 按钮可以多个 点击事件使用UIClick
<Action type="TextTip" title="这里是标题" value="这里是文字描述" audio="q001.mp3" btns="确定,取消"/> alpha 0-1 背景的透明度
-->
<Action type="TextTip" title="这里是标题" value="这里是文字描述" audio="q001.mp3" btns="确定,取消" alpha="0.5"/>
<!--锁定镜头 true为开启 false为锁定 isMove是移动镜头 isRotate是旋转镜头--> <!--锁定镜头 true为开启 false为锁定 isMove是移动镜头 isRotate是旋转镜头-->
<Action type="CameraLock" isMove="true" isRotate="true"></Action> <Action type="CameraLock" isMove="true" isRotate="true"></Action>
<!--播放视频 size为视频窗口大小 offset为窗口中心点偏移 播放完成事件和关闭事件 通常使用关闭事件即可 <!--播放视频 size为视频窗口大小 offset为窗口中心点偏移 播放完成事件和关闭事件 通常使用关闭事件即可