提交模块制作内容修改
This commit is contained in:
parent
5ea204fb13
commit
2c68283445
File diff suppressed because one or more lines are too long
22124
Assets/Art/UIPrefab/DaTiUI.prefab
Normal file
22124
Assets/Art/UIPrefab/DaTiUI.prefab
Normal file
File diff suppressed because it is too large
Load Diff
7
Assets/Art/UIPrefab/DaTiUI.prefab.meta
Normal file
7
Assets/Art/UIPrefab/DaTiUI.prefab.meta
Normal file
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4dc68579594dce245ac3a9f3b701fdbb
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName: datiui_prefab
|
||||
assetBundleVariant:
|
||||
@ -1,5 +1,6 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b79d4a2bd64de954c9be268d874a6918
|
||||
guid: 20fcb4339ba909d418d5dfa2ef27379d
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
8
Assets/Projects/Scripts/ExamScripts/ShiJuan.cs
Normal file
8
Assets/Projects/Scripts/ExamScripts/ShiJuan.cs
Normal file
@ -0,0 +1,8 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class ShiJuan : MonoBehaviour
|
||||
{
|
||||
|
||||
}
|
||||
11
Assets/Projects/Scripts/ExamScripts/ShiJuan.cs.meta
Normal file
11
Assets/Projects/Scripts/ExamScripts/ShiJuan.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6a74fc05173f0b441a7a4bedf5ff3958
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@ -12,6 +12,7 @@ public class CustomUIMap : MonoBehaviour
|
||||
{
|
||||
//{ "UIOperationList", typeof(UIOperationList) },
|
||||
{ "UIOperationList", typeof(UIOperationList) },
|
||||
{ "DaTiUI", typeof(DaTiUI) },
|
||||
|
||||
};
|
||||
|
||||
|
||||
8
Assets/Scripts/UI/DaTiUI.meta
Normal file
8
Assets/Scripts/UI/DaTiUI.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1873ae96c315e18419f5dee8c3817adc
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
43
Assets/Scripts/UI/DaTiUI/DaTiUI.Designer.cs
generated
Normal file
43
Assets/Scripts/UI/DaTiUI/DaTiUI.Designer.cs
generated
Normal file
@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using QFramework;
|
||||
|
||||
namespace QFramework.Example
|
||||
{
|
||||
// Generate Id:64794f28-ece0-44e2-a7d6-11ac5ac3097f
|
||||
public partial class DaTiUI
|
||||
{
|
||||
public const string Name = "DaTiUI";
|
||||
|
||||
|
||||
private DaTiUIData mPrivateData = null;
|
||||
|
||||
protected override void ClearUIComponents()
|
||||
{
|
||||
|
||||
mData = null;
|
||||
}
|
||||
|
||||
public DaTiUIData Data
|
||||
{
|
||||
get
|
||||
{
|
||||
return mData;
|
||||
}
|
||||
}
|
||||
|
||||
DaTiUIData mData
|
||||
{
|
||||
get
|
||||
{
|
||||
return mPrivateData ?? (mPrivateData = new DaTiUIData());
|
||||
}
|
||||
set
|
||||
{
|
||||
mUIData = value;
|
||||
mPrivateData = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/UI/DaTiUI/DaTiUI.Designer.cs.meta
Normal file
11
Assets/Scripts/UI/DaTiUI/DaTiUI.Designer.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cff211e9e981611488d1afd365830bea
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
132
Assets/Scripts/UI/DaTiUI/DaTiUI.cs
Normal file
132
Assets/Scripts/UI/DaTiUI/DaTiUI.cs
Normal file
@ -0,0 +1,132 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using QFramework;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace QFramework.Example
|
||||
{
|
||||
public class DaTiUIData : UIPanelData
|
||||
{
|
||||
}
|
||||
public partial class DaTiUI : UIPanel
|
||||
{
|
||||
public List<QuestionData> questions = new List<QuestionData>();
|
||||
public Button TiJiaoBtn;
|
||||
public Button XiaYiBuBtn;
|
||||
private int totalScore = 0; // 新增变量用于记录总得分
|
||||
private List<bool> answerResults = new List<bool>(); // 用于记录每道题的答题结果
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 初始化数据
|
||||
/// </summary>
|
||||
public void ReSetData()
|
||||
{
|
||||
totalScore = 0; // 重置总得分
|
||||
answerResults.Clear(); // 清空答题结果记录
|
||||
for (int i = 0; i < questions.Count; i++)
|
||||
{
|
||||
int P = i;
|
||||
questions[P].JieXi.gameObject.SetActive(false);
|
||||
for (int j = 0; j < questions[P].options.Count; j++)
|
||||
{
|
||||
questions[P].options[j].interactable = true;
|
||||
questions[P].options[j].isOn = false;
|
||||
}
|
||||
}
|
||||
TiJiaoBtn.gameObject.SetActive(true);
|
||||
XiaYiBuBtn.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 按钮,提交答案
|
||||
/// </summary>
|
||||
public void TiJiao()
|
||||
{
|
||||
totalScore = 0; // 每次提交时重置总得分
|
||||
answerResults.Clear(); // 清空答题结果记录
|
||||
|
||||
for (int i = 0; i < questions.Count; i++)
|
||||
{
|
||||
int P = i;
|
||||
bool isCorrect = false; // 标记本题是否答对
|
||||
bool hasSelected = false; // 标记本题是否有选择
|
||||
|
||||
|
||||
for (int j = 0; j < questions[P].options.Count; j++)
|
||||
{
|
||||
Toggle Curtog;
|
||||
if (questions[P].options[j].isOn)
|
||||
{
|
||||
hasSelected = true;
|
||||
Curtog = questions[P].options[j];
|
||||
if (Curtog == questions[P].rightToggle)
|
||||
{
|
||||
isCorrect = true;
|
||||
totalScore += questions[P].scoreValue; // 答对加两分
|
||||
Debug.Log($"第 {i + 1} 题:答对了,当前总得分: {totalScore}");
|
||||
questions[P].JieXi.gameObject.SetActive(false); // 答对隐藏解析
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log($"第 {i + 1} 题:答错了,当前总得分: {totalScore}");
|
||||
questions[P].JieXi.gameObject.SetActive(true); // 答错显示解析
|
||||
}
|
||||
break; // 找到所选的 Toggle 后跳出内层循环
|
||||
}
|
||||
|
||||
questions[P].options[j].interactable = false;
|
||||
|
||||
}
|
||||
|
||||
if (!hasSelected)
|
||||
{
|
||||
isCorrect = false;
|
||||
Debug.Log($"第 {i + 1} 题:未选择答案,答错了,当前总得分: {totalScore}");
|
||||
questions[P].JieXi.gameObject.SetActive(true); // 未选择答案显示解析
|
||||
}
|
||||
|
||||
answerResults.Add(isCorrect); // 记录本题的答题结果
|
||||
}
|
||||
|
||||
|
||||
Debug.Log($"最终总得分: {totalScore}");
|
||||
TiJiaoBtn.gameObject.SetActive(false);
|
||||
XiaYiBuBtn.gameObject.SetActive(true);
|
||||
}
|
||||
|
||||
|
||||
protected override void OnInit(IUIData uiData = null)
|
||||
{
|
||||
mData = uiData as DaTiUIData ?? new DaTiUIData();
|
||||
// please add init code here
|
||||
|
||||
ReSetData();
|
||||
TiJiaoBtn.onClick.RemoveAllListeners();
|
||||
TiJiaoBtn.onClick.AddListener(() => { TiJiao(); });
|
||||
XiaYiBuBtn.onClick.RemoveAllListeners();
|
||||
XiaYiBuBtn.onClick.AddListener(() => {
|
||||
|
||||
|
||||
StringEventSystem.Global.Send("理论考核通过", "理论考核通过");
|
||||
Hide();
|
||||
});
|
||||
}
|
||||
|
||||
protected override void OnOpen(IUIData uiData = null)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnShow()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnHide()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnClose()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/UI/DaTiUI/DaTiUI.cs.meta
Normal file
11
Assets/Scripts/UI/DaTiUI/DaTiUI.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3ca3fd75751d1624289eb0c9a7be345a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
27
Assets/Scripts/UI/DaTiUI/QuestionData.cs
Normal file
27
Assets/Scripts/UI/DaTiUI/QuestionData.cs
Normal file
@ -0,0 +1,27 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
|
||||
public class QuestionData: MonoBehaviour
|
||||
{
|
||||
public List<Toggle> options;
|
||||
[SerializeField]
|
||||
public Toggle rightToggle;
|
||||
public GameObject JieXi;
|
||||
public int scoreValue = 2;
|
||||
public bool hasBeenAnswered = false;
|
||||
|
||||
|
||||
[ContextMenu("»ñÈ¡ËùÓе¥Ñ¡°´Å¥")]
|
||||
public void GetAllToggle()
|
||||
{
|
||||
Toggle[] v=transform.GetComponentsInChildren<Toggle>();
|
||||
options= v.ToList();
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/UI/DaTiUI/QuestionData.cs.meta
Normal file
11
Assets/Scripts/UI/DaTiUI/QuestionData.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bdcd817f1d70e7a4abd597c3c1ed1ba4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -4,4 +4,115 @@
|
||||
<Type>All</Type>
|
||||
<Name>考核模式</Name>
|
||||
<Icon>KaoHe.png</Icon>
|
||||
|
||||
<FSM name="考核模式状态机">
|
||||
<State name="考核模式初始状态">
|
||||
<Enter>
|
||||
<Action type="Sequence">
|
||||
<Action type="Log" value="bbb"></Action>
|
||||
<Action type="Var" name="理论考核" value="1"></Action>
|
||||
|
||||
|
||||
<Action type="Var" name="三维构造考核" value="1"></Action>
|
||||
|
||||
|
||||
</Action>
|
||||
</Enter>
|
||||
<Exit>
|
||||
<Action type="Sequence">
|
||||
|
||||
<Action type="Log" value="ddd"></Action>
|
||||
</Action>
|
||||
</Exit>
|
||||
</State>
|
||||
|
||||
<State name="理论考核">
|
||||
<Enter>
|
||||
<Action type="Sequence">
|
||||
<Action type="Log" value="理论考核"></Action>
|
||||
|
||||
|
||||
|
||||
<Action type="Var" name="理论考核" value="2"></Action>
|
||||
<Action type="UIShow" value="DaTiUI"></Action>
|
||||
<Condition type="StrEvent" value="理论考核通过"></Condition>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</Action>
|
||||
</Enter>
|
||||
<Exit>
|
||||
<Action type="Sequence">
|
||||
|
||||
<Action type="Log" value="!!!理论考核"></Action>
|
||||
</Action>
|
||||
</Exit>
|
||||
</State>
|
||||
|
||||
<State name="三维构造考核">
|
||||
<Enter>
|
||||
<Action type="Sequence">
|
||||
<Action type="Log" value="三维构造考核"></Action>
|
||||
</Action>
|
||||
</Enter>
|
||||
<Exit>
|
||||
<Action type="Sequence">
|
||||
|
||||
<Action type="Log" value="!!!三维构造考核"></Action>
|
||||
</Action>
|
||||
</Exit>
|
||||
</State>
|
||||
|
||||
<State name="综合计算考核">
|
||||
<Enter>
|
||||
<Action type="Sequence">
|
||||
<Action type="Log" value="综合计算考核"></Action>
|
||||
</Action>
|
||||
</Enter>
|
||||
<Exit>
|
||||
<Action type="Sequence">
|
||||
|
||||
<Action type="Log" value="!!!综合计算考核"></Action>
|
||||
</Action>
|
||||
</Exit>
|
||||
</State>
|
||||
|
||||
<State name="案例考核">
|
||||
<Enter>
|
||||
<Action type="Sequence">
|
||||
<Action type="Log" value="案例考核"></Action>
|
||||
</Action>
|
||||
</Enter>
|
||||
<Exit>
|
||||
<Action type="Sequence">
|
||||
|
||||
<Action type="Log" value="!!!案例考核"></Action>
|
||||
</Action>
|
||||
</Exit>
|
||||
</State>
|
||||
|
||||
|
||||
<Transision from="any" to="理论考核">
|
||||
|
||||
<Condition type="Var" name="理论考核" value="1"></Condition>
|
||||
|
||||
</Transision>
|
||||
<Transision from="any" to="三维构造考核">
|
||||
|
||||
</Transision>
|
||||
<Transision from="any" to="综合计算考核">
|
||||
|
||||
</Transision>
|
||||
<Transision from="any" to="案例考核">
|
||||
|
||||
</Transision>
|
||||
</FSM>
|
||||
|
||||
|
||||
</Module>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user