UITools新增错误次数
This commit is contained in:
parent
d1ab8046f9
commit
60e6691027
@ -29,7 +29,7 @@ public class UIToolsAction : IAction
|
||||
string random;
|
||||
string scrollSpeed;
|
||||
string position;
|
||||
string errorCount;
|
||||
string wrongCount;
|
||||
public static UIToolsAction Allocate(Dictionary<string, string> datas, System.Action onDelayFinish = null)
|
||||
{
|
||||
var retNode = mPool.Allocate();
|
||||
@ -51,7 +51,7 @@ public class UIToolsAction : IAction
|
||||
retNode.random = datas.ContainsKey("random") ? datas["random"] : "";
|
||||
retNode.scrollSpeed = datas.ContainsKey("scrollSpeed") ? datas["scrollSpeed"] : "";
|
||||
retNode.position = datas.ContainsKey("position") ? datas["position"] : "";
|
||||
retNode.errorCount = datas.ContainsKey("errorCount") ? datas["errorCount"] : "";
|
||||
retNode.wrongCount = datas.ContainsKey("wrongCount") ? datas["wrongCount"] : "";
|
||||
return retNode;
|
||||
}
|
||||
|
||||
@ -102,9 +102,9 @@ public class UIToolsAction : IAction
|
||||
data.autoHideResult = -1;
|
||||
}
|
||||
data.position = position;
|
||||
if (int.TryParse(errorCount, out data.errorCount) == false)
|
||||
if (int.TryParse(wrongCount, out data.wrongCount) == false)
|
||||
{
|
||||
data.errorCount = 0;
|
||||
data.wrongCount = 0;
|
||||
}
|
||||
|
||||
UIKit.OpenPanelAsync<UITools>(uiData: data, canvasLevel: UILevel.PopUI).ToAction().StartGlobal(() => this.Finish());
|
||||
|
||||
@ -26,13 +26,13 @@ namespace QFramework.Example
|
||||
public bool random = false;
|
||||
public float scrollSpeed = 25;
|
||||
public string position;
|
||||
public int errorCount = 0;
|
||||
public int wrongCount = 0;
|
||||
}
|
||||
public partial class UITools : UIPanel
|
||||
{
|
||||
ResLoader mResLoader;
|
||||
public List<string> answers;
|
||||
int curErrorCount = 0;
|
||||
int curWrongCount = 0;
|
||||
protected override void OnInit(IUIData uiData = null)
|
||||
{
|
||||
mData = uiData as UIToolsData ?? new UIToolsData();
|
||||
@ -49,7 +49,7 @@ namespace QFramework.Example
|
||||
protected override void OnOpen(IUIData uiData = null)
|
||||
{
|
||||
mData = uiData as UIToolsData ?? new UIToolsData();
|
||||
curErrorCount = 0;
|
||||
curWrongCount = 0;
|
||||
TypeEventSystem.Global.Register<StepStatusOnChange>(OnStepChanged).UnRegisterWhenDisabled(gameObject);
|
||||
if (mData.totalScore > 0)
|
||||
{
|
||||
@ -126,7 +126,7 @@ namespace QFramework.Example
|
||||
{
|
||||
if (string.IsNullOrEmpty(mData.rightEvent) == false)
|
||||
{
|
||||
if (curErrorCount >= mData.errorCount)
|
||||
if (curWrongCount >= mData.wrongCount)
|
||||
{
|
||||
StringEventSystem.Global.Send(mData.rightEvent);
|
||||
}
|
||||
@ -147,7 +147,7 @@ namespace QFramework.Example
|
||||
|
||||
if (string.IsNullOrEmpty(mData.wrongEvent) == false)
|
||||
{
|
||||
if (curErrorCount >= mData.errorCount)
|
||||
if (curWrongCount >= mData.wrongCount)
|
||||
{
|
||||
StringEventSystem.Global.Send(mData.wrongEvent);
|
||||
}
|
||||
@ -161,7 +161,7 @@ namespace QFramework.Example
|
||||
{
|
||||
if (string.IsNullOrEmpty(mData.wrongEvent) == false)
|
||||
{
|
||||
if (curErrorCount >= mData.errorCount)
|
||||
if (curWrongCount >= mData.wrongCount)
|
||||
{
|
||||
StringEventSystem.Global.Send(mData.wrongEvent);
|
||||
}
|
||||
@ -171,7 +171,7 @@ namespace QFramework.Example
|
||||
}
|
||||
}
|
||||
}
|
||||
this.curErrorCount++;
|
||||
this.curWrongCount++;
|
||||
});
|
||||
}
|
||||
mResLoader.LoadAsync();
|
||||
|
||||
@ -592,10 +592,10 @@ namespace XMLTool
|
||||
{
|
||||
act.args.Add("position", position.Value);
|
||||
}
|
||||
var errorCount = action.Attribute("errorCount");
|
||||
if (errorCount != null)
|
||||
var wrongCount = action.Attribute("wrongCount");
|
||||
if (wrongCount != null)
|
||||
{
|
||||
act.args.Add("errorCount", errorCount.Value);
|
||||
act.args.Add("wrongCount", wrongCount.Value);
|
||||
}
|
||||
newAction = act;
|
||||
}
|
||||
|
||||
@ -37,7 +37,8 @@
|
||||
totalScore 是配合wrongScore的用于初始化一个分数 然后选择扣分
|
||||
random 是否打乱devices的顺序
|
||||
scrollSpeed 鼠标滚轮的滑动速度
|
||||
position left/right 可以让道具栏在左侧或者右侧-->
|
||||
position left/right 可以让道具栏在左侧或者右侧
|
||||
errorCount 错误的次数 不为0的情况下 大于这个次数才会触发WrongScore-->
|
||||
<Action type="UITools" devices="道具名字1" answers="正确道具"
|
||||
setActive="true"
|
||||
rightLabel="提示:器械选择正确。"
|
||||
@ -51,7 +52,8 @@
|
||||
autoHide="-1"
|
||||
random="true"
|
||||
scrollSpeed="25"
|
||||
position="right"></Action>
|
||||
position="right"
|
||||
wrongCount="0"></Action>
|
||||
|
||||
<!--道具背包,用于配合状态机进行道具的使用 目前是初步版本,仅支持配合UIClick点击,暂无道具数量等功能 详细参数可参考UITools-->
|
||||
<Action type="UIBackPack" devices="道具名字1"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user