Merge branch 'master' into LouDi_Quan

This commit is contained in:
shenjianxing 2025-01-09 10:53:25 +08:00
commit fe93589e07
33 changed files with 195 additions and 109 deletions

View File

@ -17,7 +17,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!224 &3411569463940388114
RectTransform:
m_ObjectHideFlags: 0
@ -226,7 +226,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!224 &7775706862032139777
RectTransform:
m_ObjectHideFlags: 0
@ -826,7 +826,7 @@ MonoBehaviour:
onValueChanged:
m_PersistentCalls:
m_Calls: []
m_IsOn: 1
m_IsOn: 0
--- !u!1 &8974889932437628810
GameObject:
m_ObjectHideFlags: 0

View File

@ -403,7 +403,7 @@ RectTransform:
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_SizeDelta: {x: -30, y: -30}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &7870331819941572208
CanvasRenderer:
@ -433,7 +433,7 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: "\u6A21\u5757\u540D\u79F0"
m_text:
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 9bbfb1bdb0251664eb0932e39724900e, type: 2}
m_sharedMaterial: {fileID: 5103963756306747964, guid: 9bbfb1bdb0251664eb0932e39724900e, type: 2}

View File

@ -763,7 +763,7 @@ MonoBehaviour:
m_ScrollSensitivity: 1
m_Viewport: {fileID: 8731652694218410629}
m_HorizontalScrollbar: {fileID: 0}
m_VerticalScrollbar: {fileID: 1945366071212582513}
m_VerticalScrollbar: {fileID: 0}
m_HorizontalScrollbarVisibility: 2
m_VerticalScrollbarVisibility: 2
m_HorizontalScrollbarSpacing: -3
@ -1068,7 +1068,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!224 &6772576175566796072
RectTransform:
m_ObjectHideFlags: 0
@ -1248,9 +1248,9 @@ RectTransform:
m_Father: {fileID: 2192231524565599668}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_SizeDelta: {x: -12, y: 0}
m_Pivot: {x: 0, y: 1}
--- !u!222 &1726614218311108045
CanvasRenderer:
@ -1336,7 +1336,7 @@ RectTransform:
m_Father: {fileID: 1644315794790874757}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}

View File

@ -429,9 +429,9 @@ RectTransform:
m_Children: []
m_Father: {fileID: 2505519175557592291}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 16, y: -16}
m_SizeDelta: {x: 32, y: 32}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &1402148308183576929
@ -838,7 +838,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!224 &2505519175557592291
RectTransform:
m_ObjectHideFlags: 0
@ -855,10 +855,10 @@ RectTransform:
- {fileID: 3064490650672719453}
m_Father: {fileID: 906599229421366858}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 583.3438, y: -35.5}
m_SizeDelta: {x: 68, y: 32}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &4014962916602461336
MonoBehaviour:
@ -1507,9 +1507,9 @@ RectTransform:
m_Children: []
m_Father: {fileID: 2505519175557592291}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 50, y: -16}
m_SizeDelta: {x: 36, y: 18}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &7242127381975158959

View File

@ -1690,10 +1690,10 @@ MonoBehaviour:
m_FillRect: {fileID: 4260347516208239176}
m_HandleRect: {fileID: 8825168004229886871}
m_Direction: 0
m_MinValue: 0.01
m_MinValue: 0
m_MaxValue: 0.1
m_WholeNumbers: 0
m_Value: 0.0983
m_Value: 0.05
m_OnValueChanged:
m_PersistentCalls:
m_Calls: []
@ -2088,7 +2088,7 @@ MonoBehaviour:
m_MinValue: 0
m_MaxValue: 1
m_WholeNumbers: 0
m_Value: 0.36
m_Value: 0.5
m_OnValueChanged:
m_PersistentCalls:
m_Calls: []

View File

@ -378,9 +378,7 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: '
'
m_text:
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 97936a7b3a86809479ac89371e95b079, type: 2}
m_sharedMaterial: {fileID: 168401102475399263, guid: 97936a7b3a86809479ac89371e95b079, type: 2}
@ -519,7 +517,7 @@ MonoBehaviour:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4085354983340029108}
m_Enabled: 1
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
@ -907,10 +905,10 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_Padding:
m_Left: 0
m_Right: 0
m_Top: 0
m_Bottom: 0
m_Left: 5
m_Right: 5
m_Top: 5
m_Bottom: 5
m_ChildAlignment: 1
m_Spacing: 0
m_ChildForceExpandWidth: 1

View File

@ -45,11 +45,11 @@ namespace QFramework
}
);
SoundVolume = new PlayerPrefsFloatProperty(KEY_AUDIO_MANAGER_SOUND_VOLUME, 1.0f);
SoundVolume = new PlayerPrefsFloatProperty(KEY_AUDIO_MANAGER_SOUND_VOLUME, 0.5f);
MusicVolume = new PlayerPrefsFloatProperty(KEY_AUDIO_MANAGER_MUSIC_VOLUME, 1.0f);
MusicVolume = new PlayerPrefsFloatProperty(KEY_AUDIO_MANAGER_MUSIC_VOLUME, 0.5f);
VoiceVolume = new PlayerPrefsFloatProperty(KEY_AUDIO_MANAGER_VOICE_VOLUME, 1.0f);
VoiceVolume = new PlayerPrefsFloatProperty(KEY_AUDIO_MANAGER_VOICE_VOLUME, 0.5f);
}

View File

@ -172,8 +172,8 @@ public class ActionHelper
}
case "LoadRes":
{
var strAction = (XMLTool.StringListAction)act;
return LoadResAction.Allocate(act.Value, strAction.args[0]);
var dictAction = (XMLTool.DictionaryAction)act;
return LoadResAction.Allocate(act.Value, dictAction.args);
}
case "Audio":
{

View File

@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Xml.Linq;
using UnityEngine;
using XMLTool;
@ -21,14 +22,16 @@ namespace QFramework
string fileName;
string type;
public static LoadResAction Allocate(string fileName, string type, System.Action OnFinished = null)
string index;
public static LoadResAction Allocate(string fileName, Dictionary<string, string> datas, System.Action OnFinished = null)
{
var retNode = mPool.Allocate();
retNode.ActionID = ActionKit.ID_GENERATOR++;
retNode.Deinited = false;
retNode.Reset();
retNode.fileName = fileName;
retNode.type = type;
retNode.type = datas.ContainsKey("resType") ? datas["resType"] : string.Empty;
retNode.index = datas.ContainsKey("index") ? datas["index"] : string.Empty;
retNode.OnFinished = OnFinished;
return retNode;
}
@ -55,7 +58,15 @@ namespace QFramework
XDocument doc = XDocument.Parse(xmlStr);
// »ñÈ¡¸ùÔªËØ
XElement moduleXml = doc.Root;
XmlParser.LoadModule(moduleXml, Global.Instance.appData);
if (string.IsNullOrEmpty(index))
{
// ÎÞÐò¼ÓÔØ
XmlParser.LoadModule(moduleXml, Global.Instance.appData);
}
else
{
Global.moduleDict.Add(index, moduleXml);
}
}
}
});

View File

@ -30,7 +30,6 @@ public class DeviceController : MonoSingleton<DeviceController>
private void OnQuit(OnModuleQuit quit)
{
deviceDict.Clear();
deviceDict.Clear();
}
private void OnStart(OnModuleStart start)

View File

@ -46,6 +46,7 @@ public class OperationController : MonoSingleton<OperationController>
{
Refresh();
}).UnRegisterWhenGameObjectDestroyed(gameObject);
}
public void Refresh()
@ -66,18 +67,24 @@ public class OperationController : MonoSingleton<OperationController>
}
TypeEventSystem.Global.Register<StepExecute>(OnExecute);
TypeEventSystem.Global.Register<OnNextStep>(OnNext);
TypeEventSystem.Global.Register<OnModuleQuit>(arg => Clear());
TypeEventSystem.Global.Register<OnModuleQuit>(OnModuleQuitHandler);
}
}
}
private void OnModuleQuitHandler(OnModuleQuit quit)
{
Clear();
}
public void Clear()
{
index = -1;
curAction.Deinit();
steps.Clear();
TypeEventSystem.Global.UnRegister<OnModuleQuit>(arg => Clear());
TypeEventSystem.Global.UnRegister<OnModuleQuit>(OnModuleQuitHandler);
TypeEventSystem.Global.UnRegister<StepExecute>(OnExecute);
TypeEventSystem.Global.UnRegister<OnNextStep>(OnNext);

View File

@ -1,4 +1,5 @@
using QFramework;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
@ -12,9 +13,15 @@ public class VarController : MonoSingleton<VarController>
{
base.OnSingletonInit();
varDict = new Dictionary<string, float>();
TypeEventSystem.Global.Register<OnModuleQuit>(OnQuit).UnRegisterWhenGameObjectDestroyed(gameObject);
}
private void OnQuit(OnModuleQuit quit)
{
varDict.Clear();
}
public void Set(string key, float value)
{
if (varDict.ContainsKey(key))

View File

@ -2,6 +2,7 @@ using QFramework;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Xml.Linq;
using UnityEngine;
using XMLTool;
@ -35,6 +36,6 @@ public class Global : Singleton<Global>
public static AppType appTpe = AppType.UnKnow;
public static Dictionary<string, XElement> moduleDict = new Dictionary<string, XElement>();
}

View File

@ -41,7 +41,21 @@ public class Launch : MonoBehaviour
yield return new WaitUntil(() => isLoadFinished == true);
if (Global.Instance.appData.preLoad != null && Global.Instance.appData.preLoad.action != null)
{
yield return ActionHelper.GetActionAndSub(Global.Instance.appData.preLoad.action).Start(this);
yield return ActionHelper.GetActionAndSub(Global.Instance.appData.preLoad.action).Start(this, () =>
{
// ÔÝʱ·ÅÔÚÕâÀï
if (Global.moduleDict.Count > 0)
{
for (int i = 0; i < Global.moduleDict.Count; i++)
{
string index = (i + 1).ToString();
if (Global.moduleDict.ContainsKey(index))
{
XmlParser.LoadModule(Global.moduleDict[index], Global.Instance.appData);
}
}
}
});
}
yield return UIKit.OpenPanelAsync<UIModeSelect>();
UIKit.HidePanel<UILoading>();

View File

@ -19,6 +19,7 @@ namespace QFramework.Example
mData = uiData as UIBtnsData ?? new UIBtnsData();
// please add init code here
TypeEventSystem.Global.Register<StepStatusOnChange>(OnStepChanged);
TypeEventSystem.Global.Register<OnModuleQuit>((arg) => Hide()).UnRegisterWhenGameObjectDestroyed(gameObject);
}
private void OnStepChanged(StepStatusOnChange change)

View File

@ -22,6 +22,7 @@ namespace QFramework.Example
{
protected override void OnInit(IUIData uiData = null)
{
TypeEventSystem.Global.Register<OnModuleQuit>((arg) => Hide()).UnRegisterWhenGameObjectDestroyed(gameObject);
mData = uiData as UICameraSwitchData ?? new UICameraSwitchData();
// please add init code here
Near.onValueChanged.AddListener(isOn =>
@ -33,7 +34,7 @@ namespace QFramework.Example
Near.transform.Find("Bg/Line").gameObject.SetActive(isOn);
});
Far.onValueChanged.AddListener(isOn =>
{
{
if (isOn)
{
SetNormal();
@ -68,6 +69,21 @@ namespace QFramework.Example
}
}
private void Update()
{
#if UNITY_STANDALONE_WIN
if (Near.isOn == true || Far.isOn == true)
{
if (Input.GetKeyDown(KeyCode.W) || Input.GetKeyDown(KeyCode.A) || Input.GetKeyDown(KeyCode.S) || Input.GetKeyDown(KeyCode.D))
{
Near.isOn = false;
Far.isOn = false;
}
}
#endif
}
protected override void OnShow()
{
}

View File

@ -13,6 +13,7 @@ namespace QFramework.Example
{
mData = uiData as UIDeviceTipData ?? new UIDeviceTipData();
// please add init code here
TypeEventSystem.Global.Register<OnModuleQuit>((arg) => Hide()).UnRegisterWhenGameObjectDestroyed(gameObject);
}
protected override void OnOpen(IUIData uiData = null)

View File

@ -23,6 +23,7 @@ namespace QFramework.Example
mData = uiData as UIHintData ?? new UIHintData();
SetItem(0);
TypeEventSystem.Global.Register<StepStatusOnChange>(OnStepChanged);
TypeEventSystem.Global.Register<OnModuleQuit>((arg) => Hide()).UnRegisterWhenGameObjectDestroyed(gameObject);
}
private void OnStepChanged(StepStatusOnChange change)

View File

@ -12,6 +12,7 @@ namespace QFramework.Example
{
protected override void OnInit(IUIData uiData = null)
{
TypeEventSystem.Global.Register<OnModuleQuit>((arg) => Hide()).UnRegisterWhenGameObjectDestroyed(gameObject);
mData = uiData as UIInstructionData ?? new UIInstructionData();
// please add init code here
Training.onValueChanged.AddListener(isOn =>

View File

@ -14,6 +14,7 @@ namespace QFramework.Example
protected override void OnInit(IUIData uiData = null)
{
mData = uiData as UILoadingData ?? new UILoadingData();
TypeEventSystem.Global.Register<OnModuleQuit>((arg) => Hide()).UnRegisterWhenGameObjectDestroyed(gameObject);
TypeEventSystem.Global.Register<OnLoadingShow>(arg => Show()).UnRegisterWhenGameObjectDestroyed(gameObject);
TypeEventSystem.Global.Register<OnLoadingHide>((arg) => Hide()).UnRegisterWhenGameObjectDestroyed(gameObject);
}

View File

@ -20,7 +20,7 @@ namespace QFramework.Example
protected override void OnInit(IUIData uiData = null)
{
mData = uiData as UIOperationListData ?? new UIOperationListData();
TypeEventSystem.Global.Register<StepStatusOnChange>(OnStepChanged);
TypeEventSystem.Global.Register<OnModuleQuit>((arg)=>Hide()).UnRegisterWhenGameObjectDestroyed(gameObject);
}
private void OnStepChanged(StepStatusOnChange change)
@ -67,7 +67,7 @@ namespace QFramework.Example
break;
case StepStatus.Finished:
// TODO实现方式过于耦合 后期优化
if (Global.Instance.curModule.type=="Exam")
if (Global.Instance.curModule.type == "Exam")
{
stepLabel.color = highColor;
}
@ -82,6 +82,8 @@ namespace QFramework.Example
protected override void OnOpen(IUIData uiData = null)
{
TypeEventSystem.Global.Register<StepStatusOnChange>(OnStepChanged).UnRegisterWhenDisabled(this);
btns.Clear();
op = OperationController.Instance.operation;
StepContent.RemoveAllChildren();
foreach (var item in op.Steps)
@ -138,13 +140,9 @@ namespace QFramework.Example
protected override void OnShow()
{
}
protected override void OnHide()
{
}
protected override void OnClose()
{
TypeEventSystem.Global.UnRegister<StepStatusOnChange>(OnStepChanged);
}
}
}

View File

@ -18,6 +18,7 @@ namespace QFramework.Example
mData = uiData as UIPointQuestionData ?? new UIPointQuestionData();
// please add init code here
TypeEventSystem.Global.Register<StepStatusOnChange>(OnStepChanged);
TypeEventSystem.Global.Register<OnModuleQuit>((arg) => Hide()).UnRegisterWhenGameObjectDestroyed(gameObject);
}
private void OnStepChanged(StepStatusOnChange change)

View File

@ -21,6 +21,7 @@ namespace QFramework.Example
Right.gameObject.SetActive(false);
Wrong.gameObject.SetActive(false);
TypeEventSystem.Global.Register<StepStatusOnChange>(OnStepChanged);
TypeEventSystem.Global.Register<OnModuleQuit>((arg) => Hide()).UnRegisterWhenGameObjectDestroyed(gameObject);
}
private void OnStepChanged(StepStatusOnChange change)

View File

@ -13,8 +13,6 @@ namespace QFramework.Example
protected override void OnInit(IUIData uiData = null)
{
mData = uiData as UIRightTopData ?? new UIRightTopData();
setBtn.onClick.AddListener(() =>
{
UIKit.OpenPanelAsync<UISetting>(canvasLevel: UILevel.PopUI).ToAction().StartGlobal();
@ -23,28 +21,12 @@ namespace QFramework.Example
{
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();
});
homeBtn.onClick.AddListener(() =>
{
UITipWindowData data = new UITipWindowData();
data.txt = "是否退出当前模块?";
data.btns.Add(new UITipWindowData.ItemData()
{
txt = "确定",
OnClick = () =>
{
Hide();
TypeEventSystem.Global.Send<OnModuleQuit>();
UIKit.OpenPanelAsync<UIModeSelect>().ToAction().StartGlobal();
}
});
data.btns.Add(new UITipWindowData.ItemData() { 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();
});
backBtn.onClick.AddListener(Home);
homeBtn.onClick.AddListener(Home);
desBtn.onClick.AddListener(() =>
{
@ -57,19 +39,39 @@ namespace QFramework.Example
});
}
public void Home()
{
UITipWindowData data = new UITipWindowData();
data.txt = "是否退出当前模块?";
data.btns.Add(new UITipWindowData.ItemData()
{
txt = "是",
OnClick = () =>
{
Hide();
TypeEventSystem.Global.Send<OnModuleQuit>();
UIKit.OpenPanelAsync<UIModeSelect>().ToAction().StartGlobal();
}
});
data.btns.Add(new UITipWindowData.ItemData() { txt = "否" });
UIKit.OpenPanelAsync<UITipWindow>(uiData: data, canvasLevel: UILevel.PopUI).ToAction().StartGlobal();
}
protected override void OnOpen(IUIData uiData = null)
{
Title.text = Global.Instance.curModule.ModuleName;
switch (Global.Instance.curModule.type)
switch (Global.appTpe)
{
case "All":
case "Exam":
case Global.AppType.UnKnow:
break;
case Global.AppType.Study:
Score.gameObject.SetActive(true);
break;
default:
case Global.AppType.Exam:
Score.gameObject.SetActive(false);
break;
case Global.AppType.All:
break;
}
}

View File

@ -12,6 +12,7 @@ namespace QFramework.Example
protected override void OnInit(IUIData uiData = null)
{
mData = uiData as UIScoreData ?? new UIScoreData();
TypeEventSystem.Global.Register<OnModuleQuit>((arg) => Hide()).UnRegisterWhenGameObjectDestroyed(gameObject);
DownLoad.onClick.AddListener(() =>
{
if (string.IsNullOrEmpty(InputName.text) || string.IsNullOrEmpty(InputId.text))

View File

@ -14,7 +14,6 @@ namespace QFramework.Example
{
mData = uiData as UISettingData ?? new UISettingData();
AudioKit.Settings.MusicVolume.RegisterWithInitValue(v => VoiceSlider.value = v).UnRegisterWhenGameObjectDestroyed(this);
VoiceSlider.onValueChanged.AddListener(volume =>
{

View File

@ -35,6 +35,7 @@ namespace QFramework.Example
mData = uiData as UITextQuestionData ?? new UITextQuestionData();
// please add init code here
TypeEventSystem.Global.Register<StepStatusOnChange>(OnStepChanged);
TypeEventSystem.Global.Register<OnModuleQuit>((arg) => Hide()).UnRegisterWhenGameObjectDestroyed(gameObject);
}
private void OnStepChanged(StepStatusOnChange change)

View File

@ -4,6 +4,8 @@ using QFramework;
using System.Collections.Generic;
using TMPro;
using System.Text.RegularExpressions;
using static OperationController;
using System;
namespace QFramework.Example
{
@ -20,7 +22,14 @@ namespace QFramework.Example
{
mData = uiData as UITextTipData ?? new UITextTipData();
TypeEventSystem.Global.Register<StepStatusOnChange>(OnStepChanged).UnRegisterWhenGameObjectDestroyed(this);
TypeEventSystem.Global.Register<OnModuleQuit>((arg) => Hide()).UnRegisterWhenGameObjectDestroyed(gameObject);
}
private void OnStepChanged(StepStatusOnChange change)
{
Hide();
}
protected override void OnOpen(IUIData uiData = null)

View File

@ -36,11 +36,13 @@ namespace QFramework.Example
public List<Sprite> sprites;
bool isRun = false;
List<TweenerCore<float, float, FloatOptions>> dotwens = new List<TweenerCore<float, float, FloatOptions>>();
TweenerCore<int, int, NoOptions> imgTwen;
int index = 0;
protected override void OnInit(IUIData uiData = null)
{
mData = uiData as UITimeTipData ?? new UITimeTipData();
// please add init code here
TypeEventSystem.Global.Register<OnModuleQuit>((arg) => Hide()).UnRegisterWhenGameObjectDestroyed(gameObject);
}
private void Update()
@ -74,18 +76,21 @@ namespace QFramework.Example
mData = uiData as UITimeTipData ?? new UITimeTipData();
index = 0;
isRun = true;
int endIndex = sprites.Count;
int endIndex = sprites.Count - 1;
if (mData.reverse)
{
index = sprites.Count;
endIndex = 0;
}
DOTween.To(() => index, v =>
imgTwen = DOTween.To(() => index, v =>
{
index = v;
Img.sprite = sprites[index];
Img.SetNativeSize();
}, endIndex, mData.time).SetEase(Ease.Linear).onComplete = () =>
}, endIndex, mData.time);
imgTwen.SetEase(Ease.Linear).onComplete = () =>
{
if (string.IsNullOrEmpty(mData.finishedEvent) == false)
{
@ -129,6 +134,11 @@ namespace QFramework.Example
item.Kill();
}
dotwens.Clear();
if (imgTwen != null)
{
imgTwen.Kill();
imgTwen = null;
}
}
protected override void OnClose()

View File

@ -28,6 +28,7 @@ namespace QFramework.Example
// please add init code here
TypeEventSystem.Global.Register<StepStatusOnChange>(OnStepChanged);
TypeEventSystem.Global.Register<OnModuleQuit>((arg) => Hide()).UnRegisterWhenGameObjectDestroyed(gameObject);
}
private void OnStepChanged(StepStatusOnChange change)

View File

@ -31,6 +31,7 @@ namespace QFramework.Example
mData = uiData as UIToolsData ?? new UIToolsData();
// please add init code here
TypeEventSystem.Global.Register<StepStatusOnChange>(OnStepChanged);
TypeEventSystem.Global.Register<OnModuleQuit>(OnModuleQuit).UnRegisterWhenGameObjectDestroyed(gameObject);
}
private void OnStepChanged(StepStatusOnChange change)
@ -40,7 +41,6 @@ namespace QFramework.Example
protected override void OnOpen(IUIData uiData = null)
{
TypeEventSystem.Global.Register<OnModuleQuit>(OnModuleQuit).UnRegisterWhenDisabled(gameObject);
mResLoader = ResLoader.Allocate();
mData = uiData as UIToolsData ?? new UIToolsData();
if (string.IsNullOrEmpty(mData.answer) == false)

View File

@ -24,30 +24,14 @@ namespace QFramework.Example
protected override void OnInit(IUIData uiData = null)
{
mData = uiData as UIVideoData ?? new UIVideoData();
TypeEventSystem.Global.Register<OnModuleQuit>((arg) => Close()).UnRegisterWhenGameObjectDestroyed(gameObject);
// please add init code here
Progress.onValueChanged.AddListener(OnSliderValueChanged);
Progress.OnBeginDragEvent(OnProgressBeginDrag);
Progress.OnEndDragEvent(OnProgressEndDrag);
player.loopPointReached += VideoPlayer_loopPointReached;
player.prepareCompleted += OnPrepareCompleted;
CloseBtn.onClick.AddListener(() =>
{
if (player.isPlaying)
{
player.Stop();
}
if (string.IsNullOrEmpty(mData.finishedEvent) == false)
{
StringEventSystem.Global.Send(mData.finishedEvent);
}
if (string.IsNullOrEmpty(mData.closeEvent) == false)
{
StringEventSystem.Global.Send(mData.closeEvent);
}
player.targetTexture.Release();
Hide();
});
CloseBtn.onClick.AddListener(Close);
VideoPlayBtn.onClick.AddListener(() =>
{
player.Pause();
@ -80,6 +64,26 @@ namespace QFramework.Example
}
}
public void Close()
{
if (player.isPlaying)
{
player.Stop();
}
if (string.IsNullOrEmpty(mData.finishedEvent) == false)
{
StringEventSystem.Global.Send(mData.finishedEvent);
}
if (string.IsNullOrEmpty(mData.closeEvent) == false)
{
StringEventSystem.Global.Send(mData.closeEvent);
}
player.targetTexture.Release();
Hide();
}
private void OnPrepareCompleted(VideoPlayer source)
{
Progress.maxValue = (float)player.length;

View File

@ -362,7 +362,7 @@ namespace XMLTool
var animName = action.Attribute("animName");
if (animName != null)
{
act.args.Add("animName",animName.Value);
act.args.Add("animName", animName.Value);
}
var frame = action.Attribute("frame");
if (frame != null)
@ -585,7 +585,7 @@ namespace XMLTool
XAttribute isShow = action.Attribute("isShow");
if (isShow != null)
{
act.args.Add("isShow",isShow.Value);
act.args.Add("isShow", isShow.Value);
}
XAttribute isDevice = action.Attribute("isDevice");
@ -784,15 +784,16 @@ namespace XMLTool
break;
case "LoadRes":
{
var act = new StringListAction();
var act = new DictionaryAction();
XAttribute resType = action.Attribute("resType");
if (resType != null)
{
act.args.Add(resType.Value);
act.args.Add("resType", resType.Value);
}
else
XAttribute index = action.Attribute("index");
if (index != null)
{
act.args.Add("");
act.args.Add("index", index.Value);
}
newAction = act;
}