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