Merge remote-tracking branch 'origin/master' into LouDi_Pig

This commit is contained in:
李浩 2025-01-15 08:46:31 +08:00
commit 32f720f33c
19 changed files with 596 additions and 128 deletions

View File

@ -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:

View File

@ -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

View File

@ -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

View File

@ -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

View File

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

View File

@ -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)

View File

@ -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<string, string> 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<UITextQuestion>(uiData: data, canvasLevel: UILevel.PopUI).ToAction().StartGlobal(() => this.Finish());
}

View File

@ -14,35 +14,34 @@ public class UIToolsAction : IAction
private static readonly SimpleObjectPool<UIToolsAction> mPool =
new SimpleObjectPool<UIToolsAction>(() => 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<string, string> 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<UITools>(uiData: data, canvasLevel: UILevel.PopUI).ToAction().StartGlobal(() => this.Finish());
}

View File

@ -29,6 +29,11 @@ public class DeviceController : MonoSingleton<DeviceController>
private void OnQuit(OnModuleQuit quit)
{
foreach (var item in deviceDict)
{
item.Value.item?.Close();
item.Value.device = null;
}
deviceDict.Clear();
}

View File

@ -18,7 +18,7 @@ public class DeviceItem : MonoBehaviour
var effect = gameObject.GetOrAddComponent<HighlightEffect>();
gameObject.GetOrAddComponent<HighlightTrigger>();
effect.outlineColor = Color.green;
StringEventSystem.Global.Register<string[]>(Global.HighLightTrigger, OnHighLightTriggerEvent).UnRegisterWhenGameObjectDestroyed(gameObject);
StringEventSystem.Global.Register<string[]>(Global.HighLightTrigger, OnHighLightTriggerEvent);
}
if (device.MeshCollider)
{
@ -40,6 +40,13 @@ public class DeviceItem : MonoBehaviour
}
}
public void Close()
{
device = null;
tipItem = null;
StringEventSystem.Global.UnRegister<string[]>(Global.HighLightTrigger, OnHighLightTriggerEvent);
}
private void OnHighLightTriggerEvent(string[] obj)
{
if (obj.Length > 0)

View File

@ -0,0 +1,37 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
public class MouseOverItem : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler
{
public List<GameObject> 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);
}
}
}
}

View File

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

View File

@ -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<TextMeshProUGUI>().text = mData.label;
Button btn = obj.GetComponent<Button>();
btn.onClick.RemoveAllListeners();
btn.onClick.AddListener(() =>
if (mData.autoHideTime == -1)
{
mData.callback?.Invoke();
Hide();
});
Button btn = obj.GetComponent<Button>();
btn.onClick.RemoveAllListeners();
btn.onClick.AddListener(() =>
{
SetHide();
});
}
else
{
ActionKit.Delay(mData.autoHideTime, () =>
{
SetHide();
}).Start(this);
}
}
public void SetHide()
{
mData.callback?.Invoke();
Hide();
}
protected override void OnShow()
{
}

View File

@ -5,24 +5,32 @@ using QFramework;
namespace QFramework.Example
{
// Generate Id:c0117dd8-dba4-4b88-a9a4-9d2a475f39e4
// Generate Id:b281c961-e874-477e-aab7-2b6e6869f621
public partial class UIRightTop
{
public const string Name = "UIRightTop";
[SerializeField]
public UnityEngine.UI.Button homeIcon;
[SerializeField]
public UnityEngine.UI.Button homeBtn;
[SerializeField]
public RectTransform Score;
[SerializeField]
public UnityEngine.UI.Button scoreIcon;
[SerializeField]
public UnityEngine.UI.Button scoreBtn;
[SerializeField]
public UnityEngine.UI.Button desIcon;
[SerializeField]
public UnityEngine.UI.Button desBtn;
[SerializeField]
public RectTransform set;
public UnityEngine.UI.Button setIcon;
[SerializeField]
public UnityEngine.UI.Button setBtn;
[SerializeField]
public UnityEngine.UI.Button closeIcon;
[SerializeField]
public UnityEngine.UI.Button closeBtn;
[SerializeField]
public UnityEngine.UI.Button backBtn;
@ -33,12 +41,16 @@ namespace QFramework.Example
protected override void ClearUIComponents()
{
homeIcon = null;
homeBtn = null;
Score = null;
scoreIcon = null;
scoreBtn = null;
desIcon = null;
desBtn = null;
set = null;
setIcon = null;
setBtn = null;
closeIcon = null;
closeBtn = null;
backBtn = null;
Title = null;

View File

@ -13,36 +13,80 @@ namespace QFramework.Example
protected override void OnInit(IUIData uiData = null)
{
mData = uiData as UIRightTopData ?? new UIRightTopData();
setBtn.onClick.AddListener(() =>
setBtn.onClick.AddListener(OnSetClick);
setIcon.onClick.AddListener(OnSetClick);
closeBtn.onClick.AddListener(OnCloseClick);
closeIcon.onClick.AddListener(OnCloseClick);
backBtn.onClick.AddListener(OnBackClick);
homeIcon.onClick.AddListener(OnHomeClick);
homeBtn.onClick.AddListener(OnHomeClick);
desBtn.onClick.AddListener(OnDesClick);
desIcon.onClick.AddListener(OnDesClick);
scoreBtn.onClick.AddListener(OnScoreClick);
scoreIcon.onClick.AddListener(OnScoreClick);
}
public void OnScoreClick()
{
UIKit.OpenPanelAsync<UIScore>(canvasLevel: UILevel.PopUI).ToAction().StartGlobal();
}
public void OnDesClick()
{
UIKit.OpenPanelAsync<UIInstruction>(canvasLevel: UILevel.PopUI).ToAction().StartGlobal();
}
public void OnSetClick()
{
UIKit.OpenPanelAsync<UISetting>(canvasLevel: UILevel.PopUI).ToAction().StartGlobal();
}
public void OnCloseClick()
{
UITipWindowData data = new UITipWindowData();
data.txt = "是否关闭软件?";
data.btns.Add(new UITipWindowData.ItemData() { txt = "是", OnClick = () => Application.Quit() });
data.btns.Add(new UITipWindowData.ItemData() { txt = "否" });
UIKit.OpenPanelAsync<UITipWindow>(uiData: data, canvasLevel: UILevel.PopUI).ToAction().StartGlobal();
}
public void OnBackClick()
{
int count = 0;
foreach (var item in Global.Instance.appData.Modules)
{
UIKit.OpenPanelAsync<UISetting>(canvasLevel: UILevel.PopUI).ToAction().StartGlobal();
});
closeBtn.onClick.AddListener(() =>
if (item.type == Global.Instance.curModule.type)
{
count++;
}
}
Debug.LogError(count);
if (count > 1)
{
UITipWindowData data = new UITipWindowData();
data.txt = "是否关闭软件?";
data.btns.Add(new UITipWindowData.ItemData() { txt = "是", OnClick = () => Application.Quit() });
data.txt = "是否退出当前模块?";
data.btns.Add(new UITipWindowData.ItemData()
{
txt = "是",
OnClick = () =>
{
Hide();
TypeEventSystem.Global.Send<OnModuleQuit>();
UIKit.OpenPanelAsync<UIModuleSelect>().ToAction().StartGlobal();
}
});
data.btns.Add(new UITipWindowData.ItemData() { txt = "·ñ" });
UIKit.OpenPanelAsync<UITipWindow>(uiData: data, canvasLevel: UILevel.PopUI).ToAction().StartGlobal();
});
backBtn.onClick.AddListener(Home);
homeBtn.onClick.AddListener(Home);
desBtn.onClick.AddListener(() =>
}
else
{
UIKit.OpenPanelAsync<UIInstruction>(canvasLevel: UILevel.PopUI).ToAction().StartGlobal();
});
OnHomeClick();
}
scoreBtn.onClick.AddListener(() =>
{
UIKit.OpenPanelAsync<UIScore>(canvasLevel: UILevel.PopUI).ToAction().StartGlobal();
});
}
public void Home()
public void OnHomeClick()
{
UITipWindowData data = new UITipWindowData();
data.txt = "是否退出当前模块?";
data.txt = "是否返回首页";
data.btns.Add(new UITipWindowData.ItemData()
{
txt = "ÊÇ",

View File

@ -24,6 +24,10 @@ namespace QFramework.Example
public string format;
public string finishedEvent;
/// <summary>
/// 0:×Ô¶¯ÅÐ¶Ï 1:µ¥Ñ¡ 2:¶àÑ¡
/// </summary>
public int OptionType = 0;
/// <summary>
/// 绝对的 不计算分项得分 对就得分 错就不得分
/// </summary>
public bool absolutely = true;
@ -53,6 +57,23 @@ namespace QFramework.Example
GameObject obj = GameObject.Instantiate(OptionPrefab.gameObject, OptionContent.transform);
obj.transform.Find("Label").GetComponent<TextMeshProUGUI>().text = item;
obj.name = (i + 1).ToString();
bool isGroup = false;
switch (mData.OptionType)
{
case 0:
isGroup = mData.answers.Count == 1;
break;
case 1:
isGroup = true;
break;
case 2:
isGroup = false;
break;
}
if (isGroup)
{
obj.GetComponent<Toggle>().group = OptionContent.GetComponent<ToggleGroup>();
}
}
BtnContent.RemoveAllChildren();

View File

@ -21,6 +21,7 @@ namespace QFramework.Example
public float rightScore;
public float wrongScore;
public string scoreStepName;
public float autoHideResult = -1;
}
public partial class UITools : UIPanel
{
@ -51,7 +52,7 @@ namespace QFramework.Example
foreach (var device in mData.devices)
{
var item = DeviceController.Instance.GetDevice(device);
if (item==null)
if (item == null)
{
Debug.LogError(device + ":ûÓÐÕÒµ½¶ÔÓ¦µÄDeviceÅäÖÃ");
return;
@ -65,7 +66,6 @@ namespace QFramework.Example
GameObject right = icon.transform.Find("Right").gameObject;
GameObject wrong = icon.transform.Find("Wrong").gameObject;
GameObject Selected = icon.transform.Find("Selected").gameObject;
GameObject CurSelect = obj.transform.Find("CurSelect").gameObject;
mResLoader.Add2Load(localImageUrl.ToNetImageResName(),
(bool success, IRes res) =>
{
@ -77,7 +77,6 @@ namespace QFramework.Example
Button btn = obj.GetComponent<Button>();
btn.onClick.AddListener(() =>
{
CurSelect.gameObject.SetActive(true);
if (answers != null)
{
if (answers.Contains(item.Name))
@ -98,6 +97,7 @@ namespace QFramework.Example
{
StringEventSystem.Global.Send(mData.rightEvent);
};
data.autoHideTime = mData.autoHideResult;
UIKit.OpenPanelAsync<UIResultTip>(uiData: data, canvasLevel: UILevel.PopUI).ToAction().StartGlobal();
}
}
@ -112,6 +112,7 @@ namespace QFramework.Example
StringEventSystem.Global.Send(mData.wrongEvent);
SetSelected(obj, false);
};
data.autoHideTime = mData.autoHideResult;
UIKit.OpenPanelAsync<UIResultTip>(uiData: data, canvasLevel: UILevel.PopUI).ToAction().Start(this);
}
@ -129,8 +130,6 @@ namespace QFramework.Example
GameObject right = icon.Find("Right").gameObject;
GameObject wrong = icon.Find("Wrong").gameObject;
GameObject Selected = icon.Find("Selected").gameObject;
GameObject CurSelect = item.transform.Find("CurSelect").gameObject;
CurSelect.SetActive(false);
Selected.SetActive(true);
if (isRight)
{

View File

@ -402,82 +402,54 @@ namespace XMLTool
break;
case "UITools":
{
var act = new StringListAction();
act.args.Add(action.Attribute("devices").Value);
act.args.Add(action.Attribute("answers").Value);
var act = new DictionaryAction();
act.args.Add("devices", action.Attribute("devices").Value);
act.args.Add("answers", action.Attribute("answers").Value);
var setActive = action.Attribute("setActive");
if (setActive != null)
{
act.args.Add(setActive.Value);
}
else
{
act.args.Add("true");
act.args.Add("setActive", setActive.Value);
}
var rightLabel = action.Attribute("rightLabel");
if (rightLabel != null)
{
act.args.Add(rightLabel.Value);
}
else
{
act.args.Add("");
act.args.Add("rightLabel", rightLabel.Value);
}
var wrongLabel = action.Attribute("wrongLabel");
if (wrongLabel != null)
{
act.args.Add(wrongLabel.Value);
}
else
{
act.args.Add("");
act.args.Add("wrongLabel", wrongLabel.Value);
}
var rightEvent = action.Attribute("rightEvent");
if (rightEvent != null)
{
act.args.Add(rightEvent.Value);
}
else
{
act.args.Add("");
act.args.Add("rightEvent", rightEvent.Value);
}
var wrongEvent = action.Attribute("wrongEvent");
if (wrongEvent != null)
{
act.args.Add(wrongEvent.Value);
}
else
{
act.args.Add("");
act.args.Add("wrongEvent", wrongEvent.Value);
}
var rightScore = action.Attribute("rightScore");
if (rightScore != null)
{
act.args.Add(rightScore.Value);
}
else
{
act.args.Add("");
act.args.Add("rightScore", rightScore.Value);
}
var wrongScore = action.Attribute("wrongScore");
if (wrongScore != null)
{
act.args.Add(wrongScore.Value);
}
else
{
act.args.Add("");
act.args.Add("wrongScore", wrongScore.Value);
}
var scoreStepName = action.Attribute("scoreStepName");
if (scoreStepName != null)
{
act.args.Add(scoreStepName.Value);
act.args.Add("scoreStepName", scoreStepName.Value);
}
else
var autoHide = action.Attribute("autoHide");
if (autoHide != null)
{
act.args.Add("");
act.args.Add("autoHide", autoHide.Value);
}
newAction = act;
}
break;
@ -545,6 +517,11 @@ namespace XMLTool
{
act.args.Add("finishedEvent", finishedEvent.Value);
}
XAttribute optionType = action.Attribute("optionType");
if (optionType != null)
{
act.args.Add("optionType", optionType.Value);
}
newAction = act;
}
break;
@ -1093,7 +1070,7 @@ namespace XMLTool
Point3DQuestion.Data data = new Point3DQuestion.Data();
data.name = item.Attribute("name")?.Value;
XAttribute atr = item.Attribute("deviceName");
if (atr!=null)
if (atr != null)
{
data.deviceName = item.Attribute("deviceName").Value;
}

View File

@ -21,7 +21,9 @@
<Action type="Anim" value="物体路径" deviceName="" animName="动画名字" frame="-1" speed="1"></Action>
<!--右下角生成按钮 可生成多个 用逗号分开-->
<Action type="Btns" value="按钮1,按钮2,按钮3"></Action>
<!--用于右侧道具栏选择正确的道具 event用于配合StrEventCondition 做检测 rightScore 正确选择一个 得分 wrongScore 错误一个 得分 scoreStepName是评分的key -->
<!--用于右侧道具栏选择正确的道具 event用于配合StrEventCondition 做检测
rightScore 正确选择一个 得分 wrongScore 错误一个 得分 scoreStepName是评分的key
autoHide =-1 则点击结束 否则 等待对应时间后自动结束-->
<Action type="UITools" devices="道具名字1" answers="正确道具"
setActive="true"
rightLabel="提示:器械选择正确。"
@ -30,7 +32,8 @@
wrongEvent=""
rightScore=""
wrongScore=""
scoreStepName="手术准备器械选择"></Action>
scoreStepName="手术准备器械选择"
autoHide="-1"></Action>
<!--物体点位选择 物体的中心点-->
<Action type="PointQuestion" value="路径1,路径2"></Action>
@ -58,8 +61,9 @@
format="{0:F1}" F1代表保留1位小数 F2代表2位 F0代表不保留小数
注意rightScore与wrongScore不能同时存在 同时存在则只生效rightScore
finishedEvent 用于监听选择题UI消失
optionType 0 根据答案数量自动判断单选还是多选 1 单选 2多选
-->
<Action type="TextQuestion" title="这里是标题" options="A.111|B.222|C.333|D.4444" answers="2" btns="确定" wait="1" showAnswer="true" scoreName="分数名" rightScore="5" wrongScore="-5" absolutely="false" format="{0:F1}" finishedEvent="事件名"></Action>
<Action type="TextQuestion" title="这里是标题" options="A.111|B.222|C.333|D.4444" answers="2" btns="确定" wait="1" showAnswer="true" scoreName="分数名" rightScore="5" wrongScore="-5" absolutely="false" format="{0:F1}" finishedEvent="事件名" optionType="0"></Action>
<!--提示 time为显示的时间 -1则一直显示 icon是前面的绿色图标是否显示 audio是音频 位于data文件夹下的Audio-->
<Action type="Hint" value="这里是文字描述" time="5" icon="false" audio="音频.mp3"></Action>
<!--设置变量 value只能是数字可以是小数-->