修复UITools bug
This commit is contained in:
parent
632966423e
commit
c258d1eab1
@ -853,7 +853,7 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 2fafe2cfe61f6974895a912c3755e8f1, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_AllowSwitchOff: 0
|
||||
m_AllowSwitchOff: 1
|
||||
--- !u!114 &1622034218903515943
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -987,7 +987,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
MarkType: 0
|
||||
CustomComponentName:
|
||||
CustomComponentName: BtnContent
|
||||
CustomComment:
|
||||
mComponentName: RectTransform
|
||||
--- !u!1 &7473196182865972638
|
||||
|
||||
@ -25,6 +25,7 @@ public class TextQuestionAction : IAction
|
||||
string scoreName = string.Empty;
|
||||
string absolutely = string.Empty;
|
||||
string finishedEvent = string.Empty;
|
||||
string optionType = null;
|
||||
public static TextQuestionAction Allocate(Dictionary<string, string> datas, System.Action onDelayFinish = null)
|
||||
{
|
||||
var retNode = mPool.Allocate();
|
||||
@ -42,6 +43,7 @@ public class TextQuestionAction : IAction
|
||||
retNode.scoreName = datas.ContainsKey("scoreName") ? datas["scoreName"] : string.Empty;
|
||||
retNode.absolutely = datas.ContainsKey("absolutely") ? datas["absolutely"] : string.Empty;
|
||||
retNode.finishedEvent = datas.ContainsKey("finishedEvent") ? datas["finishedEvent"] : string.Empty;
|
||||
retNode.optionType = datas.ContainsKey("optionType") ? datas["optionType"] : "0";
|
||||
return retNode;
|
||||
}
|
||||
|
||||
@ -84,6 +86,7 @@ public class TextQuestionAction : IAction
|
||||
float.TryParse(errorScore, out data.errorScore);
|
||||
bool.TryParse(absolutely, out data.absolutely);
|
||||
}
|
||||
int.TryParse(optionType, out data.OptionType);
|
||||
UIKit.OpenPanelAsync<UITextQuestion>(uiData: data, canvasLevel: UILevel.PopUI).ToAction().StartGlobal(() => this.Finish());
|
||||
}
|
||||
|
||||
|
||||
@ -77,7 +77,10 @@ public class UIToolsAction : IAction
|
||||
float.TryParse(wrongScore, out data.wrongScore);
|
||||
data.scoreStepName = scoreStepName;
|
||||
bool.TryParse(setActive, out data.SetActive);
|
||||
float.TryParse(autoHide, out data.autoHideResult);
|
||||
if (float.TryParse(autoHide, out data.autoHideResult) == false)
|
||||
{
|
||||
data.autoHideResult = -1;
|
||||
}
|
||||
UIKit.OpenPanelAsync<UITools>(uiData: data, canvasLevel: UILevel.PopUI).ToAction().StartGlobal(() => this.Finish());
|
||||
}
|
||||
|
||||
|
||||
@ -18,7 +18,6 @@ public class DeviceItem : MonoBehaviour
|
||||
var effect = gameObject.GetOrAddComponent<HighlightEffect>();
|
||||
gameObject.GetOrAddComponent<HighlightTrigger>();
|
||||
effect.outlineColor = Color.green;
|
||||
Debug.LogError("Regitser : " + gameObject.name);
|
||||
StringEventSystem.Global.Register<string[]>(Global.HighLightTrigger, OnHighLightTriggerEvent);
|
||||
}
|
||||
if (device.MeshCollider)
|
||||
|
||||
@ -59,7 +59,7 @@ namespace QFramework.Example
|
||||
ActionKit.Delay(mData.autoHideTime, () =>
|
||||
{
|
||||
SetHide();
|
||||
});
|
||||
}).Start(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -24,6 +24,10 @@ namespace QFramework.Example
|
||||
public string format;
|
||||
public string finishedEvent;
|
||||
/// <summary>
|
||||
/// 0:×Ô¶¯ÅÐ¶Ï 1:µ¥Ñ¡ 2:¶àÑ¡
|
||||
/// </summary>
|
||||
public int OptionType = 0;
|
||||
/// <summary>
|
||||
/// 绝对的 不计算分项得分 对就得分 错就不得分
|
||||
/// </summary>
|
||||
public bool absolutely = true;
|
||||
@ -53,6 +57,23 @@ namespace QFramework.Example
|
||||
GameObject obj = GameObject.Instantiate(OptionPrefab.gameObject, OptionContent.transform);
|
||||
obj.transform.Find("Label").GetComponent<TextMeshProUGUI>().text = item;
|
||||
obj.name = (i + 1).ToString();
|
||||
bool isGroup = false;
|
||||
switch (mData.OptionType)
|
||||
{
|
||||
case 0:
|
||||
isGroup = mData.answers.Count == 1;
|
||||
break;
|
||||
case 1:
|
||||
isGroup = true;
|
||||
break;
|
||||
case 2:
|
||||
isGroup = false;
|
||||
break;
|
||||
}
|
||||
if (isGroup)
|
||||
{
|
||||
obj.GetComponent<Toggle>().group = OptionContent.GetComponent<ToggleGroup>();
|
||||
}
|
||||
}
|
||||
|
||||
BtnContent.RemoveAllChildren();
|
||||
|
||||
@ -96,6 +96,7 @@ namespace QFramework.Example
|
||||
{
|
||||
StringEventSystem.Global.Send(mData.rightEvent);
|
||||
};
|
||||
data.autoHideTime = mData.autoHideResult;
|
||||
UIKit.OpenPanelAsync<UIResultTip>(uiData: data, canvasLevel: UILevel.PopUI).ToAction().StartGlobal();
|
||||
}
|
||||
}
|
||||
@ -110,6 +111,7 @@ namespace QFramework.Example
|
||||
StringEventSystem.Global.Send(mData.wrongEvent);
|
||||
SetSelected(obj, false);
|
||||
};
|
||||
data.autoHideTime = mData.autoHideResult;
|
||||
UIKit.OpenPanelAsync<UIResultTip>(uiData: data, canvasLevel: UILevel.PopUI).ToAction().Start(this);
|
||||
|
||||
}
|
||||
|
||||
@ -517,6 +517,11 @@ namespace XMLTool
|
||||
{
|
||||
act.args.Add("finishedEvent", finishedEvent.Value);
|
||||
}
|
||||
XAttribute optionType = action.Attribute("optionType");
|
||||
if (optionType != null)
|
||||
{
|
||||
act.args.Add("optionType", optionType.Value);
|
||||
}
|
||||
newAction = act;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -61,8 +61,9 @@
|
||||
format="{0:F1}" F1代表保留1位小数 F2代表2位 F0代表不保留小数
|
||||
注意:rightScore与wrongScore不能同时存在 同时存在则只生效rightScore
|
||||
finishedEvent 用于监听选择题UI消失
|
||||
optionType 0 根据答案数量自动判断单选还是多选 1 单选 2多选
|
||||
-->
|
||||
<Action type="TextQuestion" title="这里是标题" options="A.111|B.222|C.333|D.4444" answers="2" btns="确定" wait="1" showAnswer="true" scoreName="分数名" rightScore="5" wrongScore="-5" absolutely="false" format="{0:F1}" finishedEvent="事件名"></Action>
|
||||
<Action type="TextQuestion" title="这里是标题" options="A.111|B.222|C.333|D.4444" answers="2" btns="确定" wait="1" showAnswer="true" scoreName="分数名" rightScore="5" wrongScore="-5" absolutely="false" format="{0:F1}" finishedEvent="事件名" optionType="0"></Action>
|
||||
<!--提示 time为显示的时间 -1则一直显示 icon是前面的绿色图标是否显示 audio是音频 位于data文件夹下的Audio-->
|
||||
<Action type="Hint" value="这里是文字描述" time="5" icon="false" audio="音频.mp3"></Action>
|
||||
<!--设置变量 value只能是数字可以是小数-->
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user