diff --git a/Assets/Art/UIPrefab/UIRightTop.prefab b/Assets/Art/UIPrefab/UIRightTop.prefab index 4e719eef..6c2cfa05 100644 --- a/Assets/Art/UIPrefab/UIRightTop.prefab +++ b/Assets/Art/UIPrefab/UIRightTop.prefab @@ -59,12 +59,16 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 82127b0f7165d8448836e4fba0bce5b7, type: 3} m_Name: m_EditorClassIdentifier: + homeIcon: {fileID: 4524484033761581281} homeBtn: {fileID: 6786675438613954589} Score: {fileID: 2505519175557592291} + scoreIcon: {fileID: 5356868582514685091} scoreBtn: {fileID: 4619332097827032469} + desIcon: {fileID: 7353137941944010191} desBtn: {fileID: 7919768696017877647} - set: {fileID: 6232319401915539582} + setIcon: {fileID: 1693275654294396572} setBtn: {fileID: 1379509841866064611} + closeIcon: {fileID: 4865587638182302959} closeBtn: {fileID: 8552533863496002200} backBtn: {fileID: 1270587477707133155} Title: {fileID: 6296270029272226998} @@ -408,8 +412,10 @@ GameObject: - component: {fileID: 7233145839152708537} - component: {fileID: 1402148308183576929} - component: {fileID: 8746992706770596963} + - component: {fileID: 5356868582514685091} + - component: {fileID: 8349855814183288798} m_Layer: 5 - m_Name: score + m_Name: scoreIcon m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -456,7 +462,7 @@ MonoBehaviour: m_EditorClassIdentifier: m_Material: {fileID: 0} m_Color: {r: 1, g: 1, b: 1, a: 1} - m_RaycastTarget: 0 + m_RaycastTarget: 1 m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_Maskable: 1 m_OnCullStateChanged: @@ -472,6 +478,66 @@ MonoBehaviour: m_FillOrigin: 0 m_UseSpriteMesh: 0 m_PixelsPerUnitMultiplier: 1 +--- !u!114 &5356868582514685091 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1701073165711765044} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_WrapAround: 0 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 8746992706770596963} + m_OnClick: + m_PersistentCalls: + m_Calls: [] +--- !u!114 &8349855814183288798 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1701073165711765044} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0d51f3a7c41ab0346b49ae50d456bece, type: 3} + m_Name: + m_EditorClassIdentifier: + MarkType: 0 + CustomComponentName: scoreIcon + CustomComment: + mComponentName: UnityEngine.UI.Button --- !u!1 &2001560243448814407 GameObject: m_ObjectHideFlags: 0 @@ -483,8 +549,10 @@ GameObject: - component: {fileID: 6525947030875717277} - component: {fileID: 789589784473835523} - component: {fileID: 7028470492342371926} + - component: {fileID: 4865587638182302959} + - component: {fileID: 4951605237632423165} m_Layer: 5 - m_Name: close + m_Name: closeIcon m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -531,7 +599,7 @@ MonoBehaviour: m_EditorClassIdentifier: m_Material: {fileID: 0} m_Color: {r: 1, g: 1, b: 1, a: 1} - m_RaycastTarget: 0 + m_RaycastTarget: 1 m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_Maskable: 1 m_OnCullStateChanged: @@ -547,6 +615,66 @@ MonoBehaviour: m_FillOrigin: 0 m_UseSpriteMesh: 0 m_PixelsPerUnitMultiplier: 1 +--- !u!114 &4865587638182302959 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2001560243448814407} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_WrapAround: 0 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 7028470492342371926} + m_OnClick: + m_PersistentCalls: + m_Calls: [] +--- !u!114 &4951605237632423165 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2001560243448814407} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0d51f3a7c41ab0346b49ae50d456bece, type: 3} + m_Name: + m_EditorClassIdentifier: + MarkType: 0 + CustomComponentName: + CustomComment: + mComponentName: --- !u!1 &2066591663383786163 GameObject: m_ObjectHideFlags: 0 @@ -1879,8 +2007,10 @@ GameObject: - component: {fileID: 4996884698751205362} - component: {fileID: 3501697170914416043} - component: {fileID: 3350829478237842021} + - component: {fileID: 4524484033761581281} + - component: {fileID: 28784141111070070} m_Layer: 5 - m_Name: home + m_Name: homeIcon m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -1927,7 +2057,7 @@ MonoBehaviour: m_EditorClassIdentifier: m_Material: {fileID: 0} m_Color: {r: 1, g: 1, b: 1, a: 1} - m_RaycastTarget: 0 + m_RaycastTarget: 1 m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_Maskable: 1 m_OnCullStateChanged: @@ -1943,6 +2073,66 @@ MonoBehaviour: m_FillOrigin: 0 m_UseSpriteMesh: 0 m_PixelsPerUnitMultiplier: 1 +--- !u!114 &4524484033761581281 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7034543108323079013} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_WrapAround: 0 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 3350829478237842021} + m_OnClick: + m_PersistentCalls: + m_Calls: [] +--- !u!114 &28784141111070070 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7034543108323079013} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0d51f3a7c41ab0346b49ae50d456bece, type: 3} + m_Name: + m_EditorClassIdentifier: + MarkType: 0 + CustomComponentName: scoreIcon + CustomComment: + mComponentName: UnityEngine.UI.Button --- !u!1 &7666388055021823954 GameObject: m_ObjectHideFlags: 0 @@ -2030,8 +2220,9 @@ GameObject: - component: {fileID: 3057372319391471786} - component: {fileID: 4079667323957122093} - component: {fileID: 25235571411346071} + - component: {fileID: 1693275654294396572} m_Layer: 5 - m_Name: set + m_Name: setIcon m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -2079,7 +2270,7 @@ MonoBehaviour: MarkType: 0 CustomComponentName: set CustomComment: - mComponentName: RectTransform + mComponentName: UnityEngine.UI.Button --- !u!114 &25235571411346071 MonoBehaviour: m_ObjectHideFlags: 0 @@ -2110,6 +2301,50 @@ MonoBehaviour: m_FillOrigin: 0 m_UseSpriteMesh: 0 m_PixelsPerUnitMultiplier: 1 +--- !u!114 &1693275654294396572 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8846098100972990084} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_WrapAround: 0 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 25235571411346071} + m_OnClick: + m_PersistentCalls: + m_Calls: [] --- !u!1 &9012140064018885816 GameObject: m_ObjectHideFlags: 0 @@ -2121,8 +2356,10 @@ GameObject: - component: {fileID: 8926716519125320169} - component: {fileID: 3215134167559067386} - component: {fileID: 4690001865151866587} + - component: {fileID: 7353137941944010191} + - component: {fileID: 1176537812628747561} m_Layer: 5 - m_Name: des + m_Name: desIcon m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -2169,7 +2406,7 @@ MonoBehaviour: m_EditorClassIdentifier: m_Material: {fileID: 0} m_Color: {r: 1, g: 1, b: 1, a: 1} - m_RaycastTarget: 0 + m_RaycastTarget: 1 m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_Maskable: 1 m_OnCullStateChanged: @@ -2185,3 +2422,63 @@ MonoBehaviour: m_FillOrigin: 0 m_UseSpriteMesh: 0 m_PixelsPerUnitMultiplier: 1 +--- !u!114 &7353137941944010191 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9012140064018885816} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_WrapAround: 0 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 4690001865151866587} + m_OnClick: + m_PersistentCalls: + m_Calls: [] +--- !u!114 &1176537812628747561 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9012140064018885816} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0d51f3a7c41ab0346b49ae50d456bece, type: 3} + m_Name: + m_EditorClassIdentifier: + MarkType: 0 + CustomComponentName: + CustomComment: + mComponentName: diff --git a/Assets/Art/UIPrefab/UITextQuestion.prefab b/Assets/Art/UIPrefab/UITextQuestion.prefab index 1370ac81..3580c367 100644 --- a/Assets/Art/UIPrefab/UITextQuestion.prefab +++ b/Assets/Art/UIPrefab/UITextQuestion.prefab @@ -853,7 +853,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 2fafe2cfe61f6974895a912c3755e8f1, type: 3} m_Name: m_EditorClassIdentifier: - m_AllowSwitchOff: 0 + m_AllowSwitchOff: 1 --- !u!114 &1622034218903515943 MonoBehaviour: m_ObjectHideFlags: 0 @@ -987,7 +987,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: MarkType: 0 - CustomComponentName: + CustomComponentName: BtnContent CustomComment: mComponentName: RectTransform --- !u!1 &7473196182865972638 diff --git a/Assets/Art/UIPrefab/UITools.prefab b/Assets/Art/UIPrefab/UITools.prefab index a6d862c3..ff313573 100644 --- a/Assets/Art/UIPrefab/UITools.prefab +++ b/Assets/Art/UIPrefab/UITools.prefab @@ -280,7 +280,7 @@ MonoBehaviour: m_EditorClassIdentifier: m_Material: {fileID: 0} 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_Maskable: 1 m_OnCullStateChanged: @@ -502,6 +502,7 @@ GameObject: - component: {fileID: 323542383032252423} - component: {fileID: 6025220162707536696} - component: {fileID: 3617749440597198166} + - component: {fileID: 5740481659040249477} m_Layer: 0 m_Name: ItemPrefab m_TagString: Untagged @@ -626,9 +627,23 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: MarkType: 0 - CustomComponentName: + CustomComponentName: ItemPrefab CustomComment: mComponentName: UnityEngine.UI.Button +--- !u!114 &5740481659040249477 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1901611519389403572} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 456e447344348cf4680f6e09405e7b79, type: 3} + m_Name: + m_EditorClassIdentifier: + objs: + - {fileID: 5478117157784657024} --- !u!1 &2685508885550636136 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Resources/PointQuestion/Point3D.prefab b/Assets/Resources/PointQuestion/Point3D.prefab index 182e0947..3fc4cd43 100644 --- a/Assets/Resources/PointQuestion/Point3D.prefab +++ b/Assets/Resources/PointQuestion/Point3D.prefab @@ -73,7 +73,7 @@ SpriteRenderer: m_LightmapParameters: {fileID: 0} m_SortingLayerID: 0 m_SortingLayer: 0 - m_SortingOrder: 0 + m_SortingOrder: 1 m_Sprite: {fileID: 21300000, guid: 700820383005de14fba6008141269066, type: 3} m_Color: {r: 1, g: 1, b: 1, a: 1} m_FlipX: 0 diff --git a/Assets/Scripts/Actions/ActionHelper.cs b/Assets/Scripts/Actions/ActionHelper.cs index 6f4d1e3f..6770f9d6 100644 --- a/Assets/Scripts/Actions/ActionHelper.cs +++ b/Assets/Scripts/Actions/ActionHelper.cs @@ -111,10 +111,8 @@ public class ActionHelper } case "UITools": { - var strAction = (XMLTool.StringListAction)act; - return UIToolsAction.Allocate(strAction.args[0], strAction.args[1], strAction.args[2], strAction.args[3], - strAction.args[4], strAction.args[5], strAction.args[6], strAction.args[7], - strAction.args[8], strAction.args[9]); + var strAction = (XMLTool.DictionaryAction)act; + return UIToolsAction.Allocate(strAction.args); } case "PointQuestion": return PointQuestionAction.Allocate(act.Value); diff --git a/Assets/Scripts/Actions/AnimationAction.cs b/Assets/Scripts/Actions/AnimationAction.cs index dedeaf82..d22a624f 100644 --- a/Assets/Scripts/Actions/AnimationAction.cs +++ b/Assets/Scripts/Actions/AnimationAction.cs @@ -1,3 +1,4 @@ +using DG.Tweening; using System; using System.Collections.Generic; using UnityEngine; @@ -81,12 +82,29 @@ namespace QFramework { float.TryParse(speed, out curSpeed); } - anim[animName].speed = curSpeed; - anim.Play(animName); - if (anim[animName].wrapMode== WrapMode.Loop) + + if (curSpeed < 0) { - this.Finish(); + anim.Play(animName); + anim[animName].normalizedTime = 1; + DOTween.To(() => anim[animName].normalizedTime, v => anim[animName].normalizedTime = v, 0, anim[animName].length / Math.Abs(curSpeed)).onComplete = () => + { + anim.Stop(); + }; } + else + { + anim[animName].speed = curSpeed; + + anim.Play(animName); + + if (anim[animName].wrapMode == WrapMode.Loop) + { + this.Finish(); + } + } + + } } catch (Exception) diff --git a/Assets/Scripts/Actions/TextQuestionAction.cs b/Assets/Scripts/Actions/TextQuestionAction.cs index b6548e74..a116d865 100644 --- a/Assets/Scripts/Actions/TextQuestionAction.cs +++ b/Assets/Scripts/Actions/TextQuestionAction.cs @@ -25,6 +25,7 @@ public class TextQuestionAction : IAction string scoreName = string.Empty; string absolutely = string.Empty; string finishedEvent = string.Empty; + string optionType = null; public static TextQuestionAction Allocate(Dictionary datas, System.Action onDelayFinish = null) { var retNode = mPool.Allocate(); @@ -42,6 +43,7 @@ public class TextQuestionAction : IAction retNode.scoreName = datas.ContainsKey("scoreName") ? datas["scoreName"] : string.Empty; retNode.absolutely = datas.ContainsKey("absolutely") ? datas["absolutely"] : string.Empty; retNode.finishedEvent = datas.ContainsKey("finishedEvent") ? datas["finishedEvent"] : string.Empty; + retNode.optionType = datas.ContainsKey("optionType") ? datas["optionType"] : "0"; return retNode; } @@ -84,6 +86,7 @@ public class TextQuestionAction : IAction float.TryParse(errorScore, out data.errorScore); bool.TryParse(absolutely, out data.absolutely); } + int.TryParse(optionType, out data.OptionType); UIKit.OpenPanelAsync(uiData: data, canvasLevel: UILevel.PopUI).ToAction().StartGlobal(() => this.Finish()); } diff --git a/Assets/Scripts/Actions/UIToolsAction.cs b/Assets/Scripts/Actions/UIToolsAction.cs index c2cb680a..b5ef95dc 100644 --- a/Assets/Scripts/Actions/UIToolsAction.cs +++ b/Assets/Scripts/Actions/UIToolsAction.cs @@ -14,35 +14,34 @@ public class UIToolsAction : IAction private static readonly SimpleObjectPool mPool = new SimpleObjectPool(() => new UIToolsAction(), null, 10); - string answer = string.Empty; - string devices = string.Empty; - string setActive = string.Empty; - string rightLabel = string.Empty; - string wrongLabel = string.Empty; - string rightEvent = string.Empty; - string wrongEvent = string.Empty; - string rightScore = string.Empty; - string wrongScore = string.Empty; - string scoreStepName = string.Empty; - public static UIToolsAction Allocate(string devices, string answer, - string setActive, string rightLabel, string wrongLabel, string rightEvent, - string wrongEvent,string rightScore, string wrongScore, string scoreStepName, - System.Action onDelayFinish = null) + string answer; + string devices; + string setActive; + string rightLabel; + string wrongLabel; + string rightEvent; + string wrongEvent; + string rightScore; + string wrongScore; + string scoreStepName; + string autoHide; + public static UIToolsAction Allocate(Dictionary datas, System.Action onDelayFinish = null) { var retNode = mPool.Allocate(); retNode.ActionID = ActionKit.ID_GENERATOR++; retNode.Deinited = false; retNode.Reset(); - retNode.answer = answer; - retNode.devices = devices; - retNode.setActive = setActive; - retNode.rightLabel = rightLabel; - retNode.wrongLabel = wrongLabel; - retNode.rightEvent = rightEvent; - retNode.wrongEvent = wrongEvent; - retNode.rightScore = rightScore; - retNode.wrongScore = wrongScore; - retNode.scoreStepName = scoreStepName; + retNode.answer = datas.ContainsKey("answers") ? datas["answers"] : ""; + retNode.devices = datas.ContainsKey("devices") ? datas["devices"] : ""; + retNode.setActive = datas.ContainsKey("setActive") ? datas["setActive"] : "true"; + retNode.rightLabel = datas.ContainsKey("rightLabel") ? datas["rightLabel"] : ""; + retNode.wrongLabel = datas.ContainsKey("wrongLabel") ? datas["wrongLabel"] : ""; + retNode.rightEvent = datas.ContainsKey("rightEvent") ? datas["rightEvent"] : ""; + retNode.wrongEvent = datas.ContainsKey("wrongEvent") ? datas["wrongEvent"] : ""; + retNode.rightScore = datas.ContainsKey("rightScore") ? datas["rightScore"] : ""; + retNode.wrongScore = datas.ContainsKey("wrongScore") ? datas["wrongScore"] : ""; + retNode.scoreStepName = datas.ContainsKey("scoreStepName") ? datas["scoreStepName"] : ""; + retNode.autoHide = datas.ContainsKey("autoHide") ? datas["autoHide"] : ""; return retNode; } @@ -78,6 +77,10 @@ public class UIToolsAction : IAction float.TryParse(wrongScore, out data.wrongScore); data.scoreStepName = scoreStepName; bool.TryParse(setActive, out data.SetActive); + if (float.TryParse(autoHide, out data.autoHideResult) == false) + { + data.autoHideResult = -1; + } UIKit.OpenPanelAsync(uiData: data, canvasLevel: UILevel.PopUI).ToAction().StartGlobal(() => this.Finish()); } diff --git a/Assets/Scripts/Controller/DeviceController.cs b/Assets/Scripts/Controller/DeviceController.cs index 0c3829df..eed2ac05 100644 --- a/Assets/Scripts/Controller/DeviceController.cs +++ b/Assets/Scripts/Controller/DeviceController.cs @@ -29,6 +29,11 @@ public class DeviceController : MonoSingleton private void OnQuit(OnModuleQuit quit) { + foreach (var item in deviceDict) + { + item.Value.item?.Close(); + item.Value.device = null; + } deviceDict.Clear(); } diff --git a/Assets/Scripts/Item/DeviceItem.cs b/Assets/Scripts/Item/DeviceItem.cs index c1f33bc8..5cd14286 100644 --- a/Assets/Scripts/Item/DeviceItem.cs +++ b/Assets/Scripts/Item/DeviceItem.cs @@ -18,7 +18,7 @@ public class DeviceItem : MonoBehaviour var effect = gameObject.GetOrAddComponent(); gameObject.GetOrAddComponent(); effect.outlineColor = Color.green; - StringEventSystem.Global.Register(Global.HighLightTrigger, OnHighLightTriggerEvent).UnRegisterWhenGameObjectDestroyed(gameObject); + StringEventSystem.Global.Register(Global.HighLightTrigger, OnHighLightTriggerEvent); } if (device.MeshCollider) { @@ -40,6 +40,13 @@ public class DeviceItem : MonoBehaviour } } + public void Close() + { + device = null; + tipItem = null; + StringEventSystem.Global.UnRegister(Global.HighLightTrigger, OnHighLightTriggerEvent); + } + private void OnHighLightTriggerEvent(string[] obj) { if (obj.Length > 0) diff --git a/Assets/Scripts/Item/MouseOverItem.cs b/Assets/Scripts/Item/MouseOverItem.cs new file mode 100644 index 00000000..3a4aa4d5 --- /dev/null +++ b/Assets/Scripts/Item/MouseOverItem.cs @@ -0,0 +1,37 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.EventSystems; + +public class MouseOverItem : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler +{ + public List objs; + private void Awake() + { + SetItem(false); + } + public void OnPointerEnter(PointerEventData eventData) + { + + SetItem(true); + + } + + public void OnPointerExit(PointerEventData eventData) + { + + SetItem(false); + + } + + public void SetItem(bool isActive) + { + if (objs != null) + { + foreach (var obj in objs) + { + obj.SetActive(isActive); + } + } + } +} diff --git a/Assets/Scripts/Item/MouseOverItem.cs.meta b/Assets/Scripts/Item/MouseOverItem.cs.meta new file mode 100644 index 00000000..4c062276 --- /dev/null +++ b/Assets/Scripts/Item/MouseOverItem.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 456e447344348cf4680f6e09405e7b79 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/UI/UIResultTip.cs b/Assets/Scripts/UI/UIResultTip.cs index 5d685ef9..cc99f611 100644 --- a/Assets/Scripts/UI/UIResultTip.cs +++ b/Assets/Scripts/UI/UIResultTip.cs @@ -11,6 +11,7 @@ namespace QFramework.Example { public bool isRight = false; public string label; + public float autoHideTime = -1; public Action callback; } public partial class UIResultTip : UIPanel @@ -44,15 +45,31 @@ namespace QFramework.Example } obj.SetActive(true); obj.transform.Find("Bg/Label").GetComponent().text = mData.label; - Button btn = obj.GetComponent