Compare commits

..

No commits in common. "faa1a9d1b6ff94292ba73adab6c8f64720d46734" and "941178cf580a76ed400f50172397ded9e521d170" have entirely different histories.

4 changed files with 6 additions and 33 deletions

View File

@ -29,7 +29,6 @@ public class UIToolsAction : IAction
string random;
string scrollSpeed;
string position;
string wrongCount;
public static UIToolsAction Allocate(Dictionary<string, string> datas, System.Action onDelayFinish = null)
{
var retNode = mPool.Allocate();
@ -51,7 +50,6 @@ 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.wrongCount = datas.ContainsKey("wrongCount") ? datas["wrongCount"] : "";
return retNode;
}
@ -102,11 +100,6 @@ public class UIToolsAction : IAction
data.autoHideResult = -1;
}
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());
}

View File

@ -26,13 +26,11 @@ namespace QFramework.Example
public bool random = false;
public float scrollSpeed = 25;
public string position;
public int wrongCount = 0;
}
public partial class UITools : UIPanel
{
ResLoader mResLoader;
public List<string> answers;
int curWrongCount = 0;
protected override void OnInit(IUIData uiData = null)
{
mData = uiData as UIToolsData ?? new UIToolsData();
@ -49,7 +47,6 @@ namespace QFramework.Example
protected override void OnOpen(IUIData uiData = null)
{
mData = uiData as UIToolsData ?? new UIToolsData();
curWrongCount = 0;
TypeEventSystem.Global.Register<StepStatusOnChange>(OnStepChanged).UnRegisterWhenDisabled(gameObject);
if (mData.totalScore > 0)
{
@ -93,7 +90,6 @@ namespace QFramework.Example
Button btn = obj.GetComponent<Button>();
btn.onClick.AddListener(() =>
{
if (answers != null)
{
if (answers.Contains(item.Name))
@ -126,10 +122,7 @@ namespace QFramework.Example
{
if (string.IsNullOrEmpty(mData.rightEvent) == false)
{
if (curWrongCount >= mData.wrongCount)
{
StringEventSystem.Global.Send(mData.rightEvent);
}
StringEventSystem.Global.Send(mData.rightEvent);
}
}
}
@ -147,10 +140,7 @@ namespace QFramework.Example
if (string.IsNullOrEmpty(mData.wrongEvent) == false)
{
if (curWrongCount >= mData.wrongCount)
{
StringEventSystem.Global.Send(mData.wrongEvent);
}
StringEventSystem.Global.Send(mData.wrongEvent);
}
SetSelected(obj, false);
};
@ -161,17 +151,14 @@ namespace QFramework.Example
{
if (string.IsNullOrEmpty(mData.wrongEvent) == false)
{
if (curWrongCount >= mData.wrongCount)
{
StringEventSystem.Global.Send(mData.wrongEvent);
}
StringEventSystem.Global.Send(mData.wrongEvent);
}
SetSelected(obj, false);
}
}
}
this.curWrongCount++;
});
}
mResLoader.LoadAsync();

View File

@ -592,11 +592,6 @@ namespace XMLTool
{
act.args.Add("position", position.Value);
}
var wrongCount = action.Attribute("wrongCount");
if (wrongCount != null)
{
act.args.Add("wrongCount", wrongCount.Value);
}
newAction = act;
}
break;

View File

@ -37,8 +37,7 @@
totalScore 是配合wrongScore的用于初始化一个分数 然后选择扣分
random 是否打乱devices的顺序
scrollSpeed 鼠标滚轮的滑动速度
position left/right 可以让道具栏在左侧或者右侧
errorCount 错误的次数 不为0的情况下 大于这个次数才会触发WrongScore-->
position left/right 可以让道具栏在左侧或者右侧-->
<Action type="UITools" devices="道具名字1" answers="正确道具"
setActive="true"
rightLabel="提示:器械选择正确。"
@ -52,8 +51,7 @@
autoHide="-1"
random="true"
scrollSpeed="25"
position="right"
wrongCount="0"></Action>
position="right"></Action>
<!--道具背包,用于配合状态机进行道具的使用 目前是初步版本仅支持配合UIClick点击暂无道具数量等功能 详细参数可参考UITools-->
<Action type="UIBackPack" devices="道具名字1"