修改KnowIedgeBug,添加刷新组件前清除一次子项,音频工具添加暂停音频后转到完成状态。添加点击播放,再次点击停止逻辑。
This commit is contained in:
parent
af45dc2d17
commit
c3ca663b21
@ -119,6 +119,8 @@ namespace QFramework
|
||||
AudioKit.StopAllSound();
|
||||
break;
|
||||
}
|
||||
this.Finish();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -14,7 +14,8 @@ namespace QFramework.Example
|
||||
public partial class UIKnowledge : UIPanel
|
||||
{
|
||||
ResLoader loader;
|
||||
|
||||
Transform content;
|
||||
Transform subContent;
|
||||
Dictionary<string, Sprite> sprites = new Dictionary<string, Sprite>();
|
||||
IAction curAction;
|
||||
|
||||
@ -32,6 +33,8 @@ namespace QFramework.Example
|
||||
UIKit.OpenPanelAsync<UIModuleSelect>().ToAction().StartGlobal();
|
||||
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected override void OnOpen(IUIData uiData = null)
|
||||
@ -39,6 +42,7 @@ namespace QFramework.Example
|
||||
if (Global.Instance.curModule.knowledge != null && Global.Instance.curModule.knowledge.items != null)
|
||||
{
|
||||
LeftContent.RemoveAllChildren();
|
||||
GlobalComs.RemoveAllChildren();
|
||||
string bg = Global.Instance.curModule.knowledge.bgImage;
|
||||
LoadBgImage(bg, () =>
|
||||
{
|
||||
@ -55,8 +59,10 @@ namespace QFramework.Example
|
||||
public void ItemFactory(XMLTool.Knowledge.Item itemData, Transform parent = null)
|
||||
{
|
||||
Transform content = parent == null ? LeftContent : parent;
|
||||
|
||||
GameObject leftObj = GameObject.Instantiate(LeftItem.gameObject, content);
|
||||
Transform subContent = leftObj.transform.Find("SubContent");
|
||||
|
||||
Toggle toggle = leftObj.transform.Find("Toggle").GetComponent<Toggle>();
|
||||
TextMeshProUGUI label = toggle.transform.Find("Name").GetComponent<TextMeshProUGUI>();
|
||||
label.text = itemData.title;
|
||||
@ -103,6 +109,7 @@ namespace QFramework.Example
|
||||
/// </summary>
|
||||
public void RefreshComponents(List<XMLTool.Knowledge.Item.Component> coms, Transform content)
|
||||
{
|
||||
int numIndex = 0;
|
||||
if (coms != null && coms.Count > 0)
|
||||
{
|
||||
foreach (var ComData in coms)
|
||||
@ -111,6 +118,7 @@ namespace QFramework.Example
|
||||
{
|
||||
case "Button":
|
||||
GameObject btn = GameObject.Instantiate(BtnPrefab.gameObject, content);
|
||||
btn.name ="Btn" +numIndex;
|
||||
btn.GetComponent<RectTransform>().sizeDelta = Utility.GetVector2FromStrArray(ComData.size);
|
||||
btn.transform.localPosition = Utility.GetVector2FromStrArray(ComData.pos);
|
||||
btn.GetComponent<Button>().onClick.AddListener(() =>
|
||||
@ -126,6 +134,7 @@ namespace QFramework.Example
|
||||
curAction = null;
|
||||
});
|
||||
});
|
||||
numIndex++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -192,10 +201,12 @@ namespace QFramework.Example
|
||||
|
||||
protected override void OnHide()
|
||||
{
|
||||
AudioKit.StopVoice();
|
||||
}
|
||||
|
||||
protected override void OnClose()
|
||||
{
|
||||
AudioKit.StopVoice();
|
||||
sprites.Clear();
|
||||
loader.ReleaseAllRes();
|
||||
}
|
||||
|
||||
@ -8,13 +8,26 @@
|
||||
<FSM name="状态机1">
|
||||
<State name="初始状态">
|
||||
<Enter>
|
||||
<Action type="Parallel">
|
||||
<Action type="Sequence">
|
||||
|
||||
<Action type="UIShow" value="UIKnowledge" isShow="true"></Action>
|
||||
|
||||
|
||||
|
||||
|
||||
<Action type="Delay" value="0.1"></Action>
|
||||
|
||||
<Action type="Show" value="UIRoot/Common/UIKnowledge/Mask/Bg/Right/Viewport/RightContent/GlobalComs/Btn25" isShow="false" isDevice="false"></Action>
|
||||
|
||||
</Action>
|
||||
</Enter>
|
||||
<Exit>
|
||||
<Action type="Sequence">
|
||||
|
||||
|
||||
|
||||
</Action>
|
||||
</Exit>
|
||||
</State>
|
||||
<!--<Transision from="初始状态" to="状态2">
|
||||
<Condition type="ObjClick" value="Cube (1)"></Condition>
|
||||
@ -26,6 +39,8 @@
|
||||
<Item title="项目简介" setPos="0,0">
|
||||
<Item title="实验名称" bgImage="" setPos="0,67.59607" >
|
||||
|
||||
|
||||
|
||||
<!--<Action type="Audio" audioType="Voice" value="二、shiyanlilunrenzhi/sound_1.mp3" loop="false" waitFinished="false" volumen="1" isPlay="true"></Action>-->
|
||||
|
||||
|
||||
@ -471,11 +486,23 @@
|
||||
<Action type="Sequence">
|
||||
<Action type="Log" value="播放背景音乐"></Action>
|
||||
<Action type="Audio" audioType="Voice" value="BgMusic.mp3" loop="false" waitFinished="false" volumen="1" isPlay="true"></Action>
|
||||
<Action type="Audio" audioType="Voice" value="BgMusic.mp3" loop="false" waitFinished="false" volumen="1" isPlay="false"></Action>
|
||||
<Action type="Show" value="UIRoot/Common/UIKnowledge/Mask/Bg/Right/Viewport/RightContent/GlobalComs/Btn25" isShow="true" isDevice="false"></Action>
|
||||
|
||||
<Action type="Log" value="2222222222"></Action>
|
||||
</Action>
|
||||
</Component>
|
||||
|
||||
<Component type="Button" size="535.0657,137.6156" pos="-23,-10333">
|
||||
<Action type="Sequence">
|
||||
<Action type="Log" value="暂停背景音乐"></Action>
|
||||
<Action type="Show" value="UIRoot/Common/UIKnowledge/Mask/Bg/Right/Viewport/RightContent/GlobalComs/Btn25" isShow="false" isDevice="false"></Action>
|
||||
<Action type="Show" value="UIRoot/Common/UIKnowledge/Mask/Bg/Right/Viewport/RightContent/GlobalComs/Btn24" isShow="true" isDevice="false"></Action>
|
||||
|
||||
<Action type="Audio" audioType="Voice" value="BgMusic.mp3" loop="false" waitFinished="false" volumen="1" isPlay="false"></Action>
|
||||
|
||||
<Action type="Log" value="0000000"></Action>
|
||||
</Action>
|
||||
</Component>
|
||||
<!--<Component type="Button" size="535.0657,137.6156" pos="-23,-10333">
|
||||
<Action type="Sequence">
|
||||
<Action type="Log" value="暂停背景音乐"></Action>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user