From 9201c7343a5e59ef854e766b03b49d79b9d99d3d Mon Sep 17 00:00:00 2001 From: shenjianxing <”315615051@qq.com“> Date: Thu, 9 Jan 2025 16:32:17 +0800 Subject: [PATCH 01/10] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8A=A8=E7=94=BB?= =?UTF-8?q?=E5=88=86=E5=B8=A7=E5=B7=A5=E5=85=B7=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Editor/FbxAnimListPostprocessor.cs | 124 +++++++++--------- 1 file changed, 65 insertions(+), 59 deletions(-) diff --git a/Assets/Scripts/Editor/FbxAnimListPostprocessor.cs b/Assets/Scripts/Editor/FbxAnimListPostprocessor.cs index 0f451c54..fdb5e5fe 100644 --- a/Assets/Scripts/Editor/FbxAnimListPostprocessor.cs +++ b/Assets/Scripts/Editor/FbxAnimListPostprocessor.cs @@ -5,80 +5,86 @@ using System.Collections; using System.IO; using System.Text.RegularExpressions; using System; -using System.IO; public class FbxAnimListPostprocessor : MonoBehaviour { [MenuItem("Assets/SplitAnimNew")] public static void SplitAnim() - { - UnityEngine.Object obj = Selection.activeObject; - if( null != obj ) + { + UnityEngine.Object obj = Selection.activeObject; + if (null != obj) { string assetPath = AssetDatabase.GetAssetPath(obj); - try - { - string fileAnim; - fileAnim = assetPath; - string ClipText = Path.ChangeExtension(fileAnim, ".txt"); - StreamReader file = new StreamReader(ClipText); - string sAnimList = file.ReadToEnd(); - file.Close(); - // - if (EditorUtility.DisplayDialog("FBX Animation Import from file", - fileAnim, "Import", "Cancel")) - { - System.Collections.ArrayList List = new ArrayList(); - ParseAnimFile(sAnimList, ref List); + try + { + string fileAnim; + fileAnim = assetPath; + string ClipText = Path.ChangeExtension(fileAnim, ".txt"); + StreamReader file = new StreamReader(ClipText); + string sAnimList = file.ReadToEnd(); + file.Close(); + // + if (EditorUtility.DisplayDialog("FBX Animation Import from file", + fileAnim, "Import", "Cancel")) + { + System.Collections.ArrayList List = new ArrayList(); + ParseAnimFile(sAnimList, ref List); ModelImporter modelImporter = ModelImporter.GetAtPath(assetPath) as ModelImporter; modelImporter.animationType = ModelImporterAnimationType.Legacy; - //modelImporter.clipAnimations. = true; - modelImporter.clipAnimations = (ModelImporterClipAnimation[]) - List.ToArray(typeof(ModelImporterClipAnimation)); + //modelImporter.clipAnimations. = true; + modelImporter.clipAnimations = (ModelImporterClipAnimation[]) + List.ToArray(typeof(ModelImporterClipAnimation)); AssetDatabase.ImportAsset(assetPath); - EditorUtility.DisplayDialog("导入成功", - "Number of imported clips: " - + modelImporter.clipAnimations.GetLength(0).ToString(), "OK"); - } - } - catch { } - // (Exception e) { EditorUtility.DisplayDialog("Imported animations", e.Message, "OK"); } - } - } + EditorUtility.DisplayDialog("导入成功", + "Number of imported clips: " + + modelImporter.clipAnimations.GetLength(0).ToString(), "OK"); + } + } + catch { } + // (Exception e) { EditorUtility.DisplayDialog("Imported animations", e.Message, "OK"); } + } + } - static void ParseAnimFile(string sAnimList, ref System.Collections.ArrayList List) - { - Regex regexString = new Regex(" *(?[0-9]+) *- *(?[0-9]+) *(?(loop|noloop| )) *(?[^\r^\n]*[^\r^\n^ ])", - RegexOptions.Compiled | RegexOptions.ExplicitCapture); + static void ParseAnimFile(string sAnimList, ref System.Collections.ArrayList List) + { + Regex regexString = new Regex(" *(?[0-9]+) *- *(?[0-9]+) *(?(loop|noloop| )) *(?[^\r^\n]*[^\r^\n^ ])", + RegexOptions.Compiled | RegexOptions.ExplicitCapture); - Match match = regexString.Match(sAnimList, 0); - while (match.Success) - { - ModelImporterClipAnimation clip = new ModelImporterClipAnimation(); + Match match = regexString.Match(sAnimList, 0); + while (match.Success) + { + ModelImporterClipAnimation clip = new ModelImporterClipAnimation(); - if (match.Groups["firstFrame"].Success) - { - clip.firstFrame = System.Convert.ToInt32(match.Groups["firstFrame"].Value, 10); - } - if (match.Groups["lastFrame"].Success) - { - clip.lastFrame = System.Convert.ToInt32(match.Groups["lastFrame"].Value, 10); - } - if (match.Groups["loop"].Success) - { - clip.loop = match.Groups["loop"].Value == "loop"; - } - if (match.Groups["name"].Success) - { - clip.name = match.Groups["name"].Value; - } + if (match.Groups["firstFrame"].Success) + { + clip.firstFrame = System.Convert.ToInt32(match.Groups["firstFrame"].Value, 10); + } + if (match.Groups["lastFrame"].Success) + { + clip.lastFrame = System.Convert.ToInt32(match.Groups["lastFrame"].Value, 10); + } + if (match.Groups["loop"].Success) + { + if (match.Groups["loop"].Value == "loop") + { + clip.loop = true; + clip.wrapMode = WrapMode.Loop; + } + else + { + clip.loop = false; + } + } + if (match.Groups["name"].Success) + { + clip.name = match.Groups["name"].Value; + } + List.Add(clip); - List.Add(clip); - - match = regexString.Match(sAnimList, match.Index + match.Length); - } - } + match = regexString.Match(sAnimList, match.Index + match.Length); + } + } } \ No newline at end of file From dba53a088f38962f5dd340cc83de55d0fe6cc725 Mon Sep 17 00:00:00 2001 From: shenjianxing <”315615051@qq.com“> Date: Thu, 9 Jan 2025 17:08:20 +0800 Subject: [PATCH 02/10] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=AE=9E=E8=AE=AD?= =?UTF-8?q?=E5=86=85=E5=AE=B9=E4=BB=8B=E7=BB=8D=E5=8F=AF=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Art/UIPrefab/UIInstruction.prefab | 18 ++++++++++++++++++ Assets/Scripts/UI/UIInstruction.Designer.cs | 5 ++++- Assets/Scripts/UI/UIInstruction.cs | 10 ++++++++++ Assets/Scripts/Xml/XmlParser.cs | 2 ++ Doc/Xml配置文档.xml | 4 ++++ 5 files changed, 38 insertions(+), 1 deletion(-) diff --git a/Assets/Art/UIPrefab/UIInstruction.prefab b/Assets/Art/UIPrefab/UIInstruction.prefab index 08c7c14a..873108a6 100644 --- a/Assets/Art/UIPrefab/UIInstruction.prefab +++ b/Assets/Art/UIPrefab/UIInstruction.prefab @@ -468,6 +468,7 @@ MonoBehaviour: Training: {fileID: 2329671978117574524} Operation: {fileID: 616562839221942952} TrainContent: {fileID: 5869372504899619242} + ContentText: {fileID: 2630179459340483145} OperationContent: {fileID: 3768800539522999701} ConfirmBtn: {fileID: 783019177237190269} --- !u!1 &2550146359932684284 @@ -1805,6 +1806,7 @@ GameObject: - component: {fileID: 1747114938129779637} - component: {fileID: 6155234247361610581} - component: {fileID: 2630179459340483145} + - component: {fileID: 956712290457367647} m_Layer: 5 m_Name: ContentText m_TagString: Untagged @@ -1928,6 +1930,22 @@ MonoBehaviour: m_hasFontAssetChanged: 0 m_baseMaterial: {fileID: 0} m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!114 &956712290457367647 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8301949965222141633} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0d51f3a7c41ab0346b49ae50d456bece, type: 3} + m_Name: + m_EditorClassIdentifier: + MarkType: 0 + CustomComponentName: + CustomComment: + mComponentName: TMPro.TextMeshProUGUI --- !u!1 &8662634946358023954 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/UI/UIInstruction.Designer.cs b/Assets/Scripts/UI/UIInstruction.Designer.cs index 605a53d9..14859343 100644 --- a/Assets/Scripts/UI/UIInstruction.Designer.cs +++ b/Assets/Scripts/UI/UIInstruction.Designer.cs @@ -5,7 +5,7 @@ using QFramework; namespace QFramework.Example { - // Generate Id:b1c63efb-a7a0-4270-8cd9-08f25e4d69b5 + // Generate Id:031f03df-56cd-4f22-b0e4-b4cc8ddb2f1a public partial class UIInstruction { public const string Name = "UIInstruction"; @@ -17,6 +17,8 @@ namespace QFramework.Example [SerializeField] public RectTransform TrainContent; [SerializeField] + public TMPro.TextMeshProUGUI ContentText; + [SerializeField] public UnityEngine.UI.Image OperationContent; [SerializeField] public UnityEngine.UI.Button ConfirmBtn; @@ -28,6 +30,7 @@ namespace QFramework.Example Training = null; Operation = null; TrainContent = null; + ContentText = null; OperationContent = null; ConfirmBtn = null; diff --git a/Assets/Scripts/UI/UIInstruction.cs b/Assets/Scripts/UI/UIInstruction.cs index aa7d6981..b936f544 100644 --- a/Assets/Scripts/UI/UIInstruction.cs +++ b/Assets/Scripts/UI/UIInstruction.cs @@ -2,6 +2,7 @@ using UnityEngine; using UnityEngine.UI; using QFramework; using TMPro; +using System.Diagnostics.Eventing.Reader; namespace QFramework.Example { @@ -47,6 +48,15 @@ namespace QFramework.Example protected override void OnOpen(IUIData uiData = null) { + if (string.IsNullOrEmpty(Global.Instance.curModule.Descript)) + { + + ContentText.text = "ûDescript"; + } + else + { + ContentText.text = Global.Instance.curModule.Descript; + } } protected override void OnShow() diff --git a/Assets/Scripts/Xml/XmlParser.cs b/Assets/Scripts/Xml/XmlParser.cs index 970508a6..20dcf3f9 100644 --- a/Assets/Scripts/Xml/XmlParser.cs +++ b/Assets/Scripts/Xml/XmlParser.cs @@ -22,6 +22,7 @@ namespace XMLTool public string type { get; set; } public string Scene { get; set; } public string ModuleName { get; set; } + public string Descript { get; set; } public List Operations { get; set; } public List Devices { get; set; } @@ -186,6 +187,7 @@ namespace XMLTool // ģ module.type = moduleElement.Element("Type")?.Value; module.ModuleName = moduleElement.Element("Name")?.Value; + module.Descript = moduleElement.Element("Descript")?.Value; module.Scene = moduleElement.Element("Scene")?.Value; // 豸 diff --git a/Doc/Xml配置文档.xml b/Doc/Xml配置文档.xml index c8c19d72..08b2837f 100644 --- a/Doc/Xml配置文档.xml +++ b/Doc/Xml配置文档.xml @@ -156,6 +156,10 @@ 模块1 + +这里是实训描述内容..... +巴拉巴拉.... + 组织钳 From 9c1f082194a6311684e354a932aa1250a264188d Mon Sep 17 00:00:00 2001 From: shenjianxing <”315615051@qq.com“> Date: Thu, 9 Jan 2025 17:15:32 +0800 Subject: [PATCH 03/10] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E6=98=A0=E5=B0=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scripts/Actions/ActionHelper.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Assets/Scripts/Actions/ActionHelper.cs b/Assets/Scripts/Actions/ActionHelper.cs index aa776072..3077ce6b 100644 --- a/Assets/Scripts/Actions/ActionHelper.cs +++ b/Assets/Scripts/Actions/ActionHelper.cs @@ -18,6 +18,7 @@ public class ActionHelper { "UIHint", typeof(QFramework.Example.UIHint) }, { "UIPointQuestion", typeof(QFramework.Example.UIPointQuestion) }, { "UICameraSwitch", typeof(QFramework.Example.UICameraSwitch) }, + { "UIInstruction", typeof(QFramework.Example.UIInstruction) }, }; From d6fa77d75b8cbac53c10aba7d0366b90ef0a78e0 Mon Sep 17 00:00:00 2001 From: shenjianxing <”315615051@qq.com“> Date: Fri, 10 Jan 2025 13:42:01 +0800 Subject: [PATCH 04/10] =?UTF-8?q?=E5=BD=93=E5=89=8D=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E4=BB=85=E4=B8=80=E4=B8=AA=E6=A8=A1=E5=9D=97=E7=9A=84=E6=97=B6?= =?UTF-8?q?=E5=80=99=E8=87=AA=E5=8A=A8=E8=BF=9B=E5=85=A5=20=E4=B8=8D?= =?UTF-8?q?=E9=9C=80=E8=A6=81=E6=A8=A1=E5=9D=97=E9=80=89=E6=8B=A9=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scripts/UI/UIModuleSelect.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Assets/Scripts/UI/UIModuleSelect.cs b/Assets/Scripts/UI/UIModuleSelect.cs index fa26becb..35c5ca0a 100644 --- a/Assets/Scripts/UI/UIModuleSelect.cs +++ b/Assets/Scripts/UI/UIModuleSelect.cs @@ -34,6 +34,8 @@ namespace QFramework.Example protected override void OnOpen(IUIData uiData = null) { Content.RemoveAllChildren(); + int moduleCount = 0; + int lastIndex = 0; for (int i = 0; i < Global.Instance.appData.Modules.Count; i++) { var item = Global.Instance.appData.Modules[i]; @@ -42,6 +44,7 @@ namespace QFramework.Example if (curType == Global.appTpe || curType == Global.AppType.All) { + moduleCount++; int index = i; GameObject obj = GameObject.Instantiate(BtnItem.gameObject, Content); obj.transform.Find("Label").GetComponent().text = item.ModuleName; @@ -54,12 +57,25 @@ namespace QFramework.Example SceneManager.sceneLoaded += OnLoadFinished; }); }); + lastIndex = index; } + } + Debug.LogError(Global.Instance.appData.Modules.Count); + if (moduleCount == 1) + { + Global.Instance.curModule = Global.Instance.appData.Modules[lastIndex]; + UIKit.OpenPanelAsync(canvasLevel: UILevel.PopUI).ToAction().StartGlobal(() => + { + SceneManager.LoadSceneAsync(Global.Instance.curModule.Scene, LoadSceneMode.Single); + SceneManager.sceneLoaded += OnLoadFinished; + }); } + + } From afadc78cbcde65d3eb94e441a00b38a122d77a03 Mon Sep 17 00:00:00 2001 From: shenjianxing <”315615051@qq.com“> Date: Fri, 10 Jan 2025 14:03:38 +0800 Subject: [PATCH 05/10] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=88=90=E7=BB=A9UI?= =?UTF-8?q?=E7=9A=84=E5=B1=82=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scripts/UI/UIModuleSelect.cs | 1 - Assets/Scripts/UI/UIRightTop.cs | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Assets/Scripts/UI/UIModuleSelect.cs b/Assets/Scripts/UI/UIModuleSelect.cs index 35c5ca0a..279c9bb3 100644 --- a/Assets/Scripts/UI/UIModuleSelect.cs +++ b/Assets/Scripts/UI/UIModuleSelect.cs @@ -61,7 +61,6 @@ namespace QFramework.Example } } - Debug.LogError(Global.Instance.appData.Modules.Count); if (moduleCount == 1) { Global.Instance.curModule = Global.Instance.appData.Modules[lastIndex]; diff --git a/Assets/Scripts/UI/UIRightTop.cs b/Assets/Scripts/UI/UIRightTop.cs index af5b0951..d4d9287d 100644 --- a/Assets/Scripts/UI/UIRightTop.cs +++ b/Assets/Scripts/UI/UIRightTop.cs @@ -35,7 +35,7 @@ namespace QFramework.Example scoreBtn.onClick.AddListener(() => { - UIKit.OpenPanelAsync().ToAction().StartGlobal(); + UIKit.OpenPanelAsync(canvasLevel: UILevel.PopUI).ToAction().StartGlobal(); }); } @@ -65,10 +65,10 @@ namespace QFramework.Example case Global.AppType.UnKnow: break; case Global.AppType.Study: - Score.gameObject.SetActive(true); + Score.gameObject.SetActive(false); break; case Global.AppType.Exam: - Score.gameObject.SetActive(false); + Score.gameObject.SetActive(true); break; case Global.AppType.All: break; From 208af8eab9abbc07115bb79e267c1a82a779625c Mon Sep 17 00:00:00 2001 From: shenjianxing <”315615051@qq.com“> Date: Fri, 10 Jan 2025 15:49:30 +0800 Subject: [PATCH 06/10] =?UTF-8?q?=E4=BF=AE=E6=94=B9UI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Art/UIPrefab/UITools.prefab | 82 ++++++++++++++++++++++++++++-- Assets/Scripts/UI/UITools.cs | 4 +- 2 files changed, 81 insertions(+), 5 deletions(-) diff --git a/Assets/Art/UIPrefab/UITools.prefab b/Assets/Art/UIPrefab/UITools.prefab index dd87420e..a6d862c3 100644 --- a/Assets/Art/UIPrefab/UITools.prefab +++ b/Assets/Art/UIPrefab/UITools.prefab @@ -522,7 +522,7 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: - {fileID: 7464141640143892343} - - {fileID: 3051202814640239909} + - {fileID: 4775158531114985421} - {fileID: 642645979159612403} m_Father: {fileID: 8969698929162076767} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -1055,7 +1055,7 @@ RectTransform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 6746250251467292074} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 @@ -1063,7 +1063,7 @@ RectTransform: - {fileID: 1684458048730538019} - {fileID: 5860908020037853715} - {fileID: 8568704472119011922} - m_Father: {fileID: 5675325337001315481} + m_Father: {fileID: 4775158531114985421} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} @@ -1183,3 +1183,79 @@ MonoBehaviour: m_FillOrigin: 0 m_UseSpriteMesh: 0 m_PixelsPerUnitMultiplier: 1 +--- !u!1 &9141652036248099059 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4775158531114985421} + - component: {fileID: 5397078064978493576} + - component: {fileID: 6634696415031054332} + m_Layer: 0 + m_Name: IconBg + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &4775158531114985421 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9141652036248099059} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 3051202814640239909} + m_Father: {fileID: 5675325337001315481} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 76, y: 76} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &5397078064978493576 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9141652036248099059} + m_CullTransparentMesh: 1 +--- !u!114 &6634696415031054332 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9141652036248099059} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.07058824, g: 0.15686275, b: 0.19607843, a: 1} + m_RaycastTarget: 0 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 0} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 diff --git a/Assets/Scripts/UI/UITools.cs b/Assets/Scripts/UI/UITools.cs index 368bf262..11f27906 100644 --- a/Assets/Scripts/UI/UITools.cs +++ b/Assets/Scripts/UI/UITools.cs @@ -59,7 +59,7 @@ namespace QFramework.Example GameObject obj = GameObject.Instantiate(ItemPrefab.gameObject, Content); obj.name = item.Name; obj.transform.Find("Name").GetComponent().text = item.Name; - Image icon = obj.transform.Find("Icon").GetComponent(); + Image icon = obj.transform.Find("IconBg/Icon").GetComponent(); var localImageUrl = Global.deviceIconsPath + item.Icon; GameObject right = icon.transform.Find("Right").gameObject; GameObject wrong = icon.transform.Find("Wrong").gameObject; @@ -124,7 +124,7 @@ namespace QFramework.Example public void SetSelected(GameObject item, bool isRight) { - Transform icon = item.transform.Find("Icon"); + Transform icon = item.transform.Find("IconBg/Icon"); GameObject right = icon.Find("Right").gameObject; GameObject wrong = icon.Find("Wrong").gameObject; GameObject Selected = icon.Find("Selected").gameObject; From 6f1286cb4a8b71f6306a948023f221fe0aabff93 Mon Sep 17 00:00:00 2001 From: shenjianxing <”315615051@qq.com“> Date: Fri, 10 Jan 2025 20:33:28 +0800 Subject: [PATCH 07/10] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=B7=A5=E5=85=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Editor/FbxAnimListPostprocessor.cs | 80 ++++++++++++++++--- Assets/Scripts/Editor/SetReadWrite.cs | 3 + 2 files changed, 71 insertions(+), 12 deletions(-) diff --git a/Assets/Scripts/Editor/FbxAnimListPostprocessor.cs b/Assets/Scripts/Editor/FbxAnimListPostprocessor.cs index fdb5e5fe..c44922ab 100644 --- a/Assets/Scripts/Editor/FbxAnimListPostprocessor.cs +++ b/Assets/Scripts/Editor/FbxAnimListPostprocessor.cs @@ -4,7 +4,6 @@ using UnityEditor; using System.Collections; using System.IO; using System.Text.RegularExpressions; -using System; public class FbxAnimListPostprocessor : MonoBehaviour @@ -16,17 +15,73 @@ public class FbxAnimListPostprocessor : MonoBehaviour if (null != obj) { string assetPath = AssetDatabase.GetAssetPath(obj); - try + SplitAnim(assetPath); + } + } + + [MenuItem("Assets/SplitAnimFloder")] + public static void SetAplitAnim() + { + Object[] selectedObjects = Selection.GetFiltered(SelectionMode.DeepAssets); + foreach (Object obj in selectedObjects) + { + if (obj != null) + { + string path = AssetDatabase.GetAssetPath(obj); + if (Directory.Exists(path)) + { + EnableFBXReadWriteInFolder(path); + } + else if (path.EndsWith(".fbx", System.StringComparison.OrdinalIgnoreCase)) + { + EnableFBXReadWriteForFile(path); + } + } + } + } + public static void EnableFBXReadWriteInFolder(string folderPath) + { + string[] files = Directory.GetFiles(folderPath, "*.fbx", SearchOption.AllDirectories); + foreach (string file in files) + { + EnableFBXReadWriteForFile(file); + } + } + + public static void EnableFBXReadWriteForFile(string filePath) + { + string relativePath = filePath; + SplitAnim(filePath, true); + } + + + public static void SplitAnim(string assetPath, bool autoImport = false) + { + try + { + string fileAnim; + fileAnim = assetPath; + string ClipText = Path.ChangeExtension(fileAnim, ".txt"); + StreamReader file = new StreamReader(ClipText); + string sAnimList = file.ReadToEnd(); + file.Close(); + // + if (autoImport) + { + System.Collections.ArrayList List = new ArrayList(); + ParseAnimFile(sAnimList, ref List); + + ModelImporter modelImporter = ModelImporter.GetAtPath(assetPath) as ModelImporter; + modelImporter.animationType = ModelImporterAnimationType.Legacy; + //modelImporter.clipAnimations. = true; + modelImporter.clipAnimations = (ModelImporterClipAnimation[]) + List.ToArray(typeof(ModelImporterClipAnimation)); + AssetDatabase.ImportAsset(assetPath); + } + else { - string fileAnim; - fileAnim = assetPath; - string ClipText = Path.ChangeExtension(fileAnim, ".txt"); - StreamReader file = new StreamReader(ClipText); - string sAnimList = file.ReadToEnd(); - file.Close(); - // if (EditorUtility.DisplayDialog("FBX Animation Import from file", - fileAnim, "Import", "Cancel")) + fileAnim, "Import", "Cancel")) { System.Collections.ArrayList List = new ArrayList(); ParseAnimFile(sAnimList, ref List); @@ -43,9 +98,10 @@ public class FbxAnimListPostprocessor : MonoBehaviour + modelImporter.clipAnimations.GetLength(0).ToString(), "OK"); } } - catch { } - // (Exception e) { EditorUtility.DisplayDialog("Imported animations", e.Message, "OK"); } + } + catch { } + // (Exception e) { EditorUtility.DisplayDialog("Imported animations", e.Message, "OK"); } } static void ParseAnimFile(string sAnimList, ref System.Collections.ArrayList List) diff --git a/Assets/Scripts/Editor/SetReadWrite.cs b/Assets/Scripts/Editor/SetReadWrite.cs index cb45e4f0..45cf043f 100644 --- a/Assets/Scripts/Editor/SetReadWrite.cs +++ b/Assets/Scripts/Editor/SetReadWrite.cs @@ -27,6 +27,9 @@ public class SetReadWrite : Editor } } + + + public static void EnableFBXReadWriteInFolder(string folderPath) { string[] files = Directory.GetFiles(folderPath, "*.fbx", SearchOption.AllDirectories); From d2e3c0af6f110a0344111077d69449a60d5dacdd Mon Sep 17 00:00:00 2001 From: shenjianxing <”315615051@qq.com“> Date: Sat, 11 Jan 2025 13:13:01 +0800 Subject: [PATCH 08/10] =?UTF-8?q?=E5=A2=9E=E5=8A=A0UIShow=E7=9A=84?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scripts/Actions/ActionHelper.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Assets/Scripts/Actions/ActionHelper.cs b/Assets/Scripts/Actions/ActionHelper.cs index 3077ce6b..b48e6ff9 100644 --- a/Assets/Scripts/Actions/ActionHelper.cs +++ b/Assets/Scripts/Actions/ActionHelper.cs @@ -19,6 +19,7 @@ public class ActionHelper { "UIPointQuestion", typeof(QFramework.Example.UIPointQuestion) }, { "UICameraSwitch", typeof(QFramework.Example.UICameraSwitch) }, { "UIInstruction", typeof(QFramework.Example.UIInstruction) }, + { "UIScore", typeof(QFramework.Example.UIScore) }, }; From 81246b1a1b3bba403a7fe1d2e9b59382e36ad1da Mon Sep 17 00:00:00 2001 From: shenjianxing <”315615051@qq.com“> Date: Sat, 11 Jan 2025 13:52:16 +0800 Subject: [PATCH 09/10] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=88=90=E7=BB=A9UIbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scripts/UI/UIScore.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Assets/Scripts/UI/UIScore.cs b/Assets/Scripts/UI/UIScore.cs index 4856c51e..a4636f5e 100644 --- a/Assets/Scripts/UI/UIScore.cs +++ b/Assets/Scripts/UI/UIScore.cs @@ -61,6 +61,8 @@ namespace QFramework.Example sum += float.Parse(item.Value.sum); score += item.Value.value; } + this.Score.text = score.ToString(); + this.Sum.text = sum.ToString(); } protected override void OnShow() From d15534a0043139541c66a84b404bf15879e31a8b Mon Sep 17 00:00:00 2001 From: shenjianxing <”315615051@qq.com“> Date: Mon, 13 Jan 2025 08:51:44 +0800 Subject: [PATCH 10/10] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=A9=BA=E5=88=A4?= =?UTF-8?q?=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scripts/Item/DeviceItem.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Assets/Scripts/Item/DeviceItem.cs b/Assets/Scripts/Item/DeviceItem.cs index 51687e3e..c1f33bc8 100644 --- a/Assets/Scripts/Item/DeviceItem.cs +++ b/Assets/Scripts/Item/DeviceItem.cs @@ -48,7 +48,15 @@ public class DeviceItem : MonoBehaviour bool.TryParse(obj[0], out isActive); if (obj.Length == 1 || (obj.Length > 1 && obj[1] == device.Name)) { - gameObject.GetComponent().enabled = isActive; + var high = gameObject.GetComponent(); + if (high != null) + { + gameObject.GetComponent().enabled = isActive; + } + else + { + Debug.LogError(device.Name + "ûи"); + } } } }