当前位置:网站首页>Unity SKFramework框架(十三)、Question 问题模块
Unity SKFramework框架(十三)、Question 问题模块
2022-07-02 09:45:00 【CoderZ1010】
目录
一、Questions Profile 问题配置文件
1.配置文件的创建
通过右键/Create/Question Profile菜单进行创建

2.配置文件的编辑

如图所示,模块中内置了五种题型,可以在配置文件中进行配置,分别是判断题、单选题、多选题、填空题、论述题,它们均继承自Question Base基类。

1).判断题

2).单选题

3).多选题

4).填空题

5).论述题

二、Questions Handler 问题处理器
1.初始化
QuestionsHandler包含两个构造函数
/// <summary>
/// 构造函数
/// </summary>
/// <param name="profile">问题配置文件</param>
public QuestionsHandler(QuestionsProfile profile)
/// <summary>
/// 构造函数
/// </summary>
/// <param name="resourcesPath">配置文件的路径</param>
public QuestionsHandler(string resourcesPath)2.Last、Next、Switch
/// <summary>
/// 上一题
/// </summary>
public QuestionBase Last()
/// <summary>
/// 下一题
/// </summary>
public QuestionBase Next()
/// <summary>
/// 根据题号切换到指定问题
/// </summary>
/// <param name="sequence">题号</param>
public QuestionBase Switch(int sequence)3.根据题号获取指定的问题
/// <summary>
/// 根据题号获取问题
/// </summary>
/// <typeparam name="T">题型</typeparam>
/// <param name="sequence">题号</param>
public T Get<T>(int sequence) where T : QuestionBase三、Example 示例
using UnityEngine;
using SK.Framework;
public class Example : MonoBehaviour
{
private QuestionsHandler handler;
private QuestionBase question;
private void Start()
{
handler = new QuestionsHandler("New Questions Profile");
}
private void OnGUI()
{
GUILayout.BeginHorizontal();
if (GUILayout.Button("Last", GUILayout.Width(200f), GUILayout.Height(50f)))
question = handler.Last();
if (GUILayout.Button("Next", GUILayout.Width(200f), GUILayout.Height(50f)))
question = handler.Next();
GUILayout.EndHorizontal();
if (question == null) return;
switch (question.Type)
{
case QuestionType.JUDGE: break;
case QuestionType.SINGLE_CHOICE:
GUILayout.Label(string.Format(" {0}.{1}", question.Sequence, question.Question));
GUILayout.BeginHorizontal();
if (GUILayout.Button("A")) Debug.Log(question.IsCorrect(0));
if (GUILayout.Button("B")) Debug.Log(question.IsCorrect(1));
if (GUILayout.Button("C")) Debug.Log(question.IsCorrect(2));
if (GUILayout.Button("D")) Debug.Log(question.IsCorrect(3));
GUILayout.EndHorizontal();
break;
case QuestionType.MULTIPLE_CHOICE: break;
case QuestionType.COMPLETION: break;
case QuestionType.ESSAY: break;
default: break;
}
}
}
边栏推荐
- Linear DP acwing 902 Shortest editing distance
- Direct control PTZ PTZ PTZ PTZ camera debugging (c)
- 移动式布局(流式布局)
- [opencv learning] [template matching]
- Jerry's weather code table [chapter]
- std::vector批量导入快速去重方法
- Interesting interview questions
- JSON serialization and parsing
- Oracle from entry to mastery (4th Edition)
- Analog to digital converter (ADC) ade7913ariz is specially designed for three-phase energy metering applications
猜你喜欢

Linear DP acwing 902 Shortest editing distance

js1day(输入输出语法,数据类型,数据类型转换,var和let区别)

Unity SKFramework框架(十七)、FreeCameraController 上帝视角/自由视角相机控制脚本

完全自主可控三维云CAD:CrownCAD便捷的命令搜索,快速定位所需命令具体位置。
![[opencv learning] [moving object detection]](/img/2e/9b437b7fe22f1d57334529eda68e37.jpg)
[opencv learning] [moving object detection]

C#运算符

Get started REPORT | today, talk about the microservice architecture currently used by Tencent

Redis bloom filter

上海交大教授:何援军——包围盒(包容体/包围盒子)

Variable, "+" sign, data type
随机推荐
Ali was killed by two programming problems at the beginning, pushed inward again, and finally landed (he has taken an electronic offer)
[opencv learning] [moving object detection]
[opencv learning] [image filtering]
Jerry's watch delete alarm clock [chapter]
8 examples of using date commands
Jerry's watch modifies the alarm clock [chapter]
Jerry's weather code table [chapter]
LTC3307AHV 符合EMI标准,降压转换器 QCA7005-AL33 PHY
嵌入式软件开发
(6) Web security | penetration test | network security encryption and decryption ciphertext related features, with super encryption and decryption software
js1day(輸入輸出語法,數據類型,數據類型轉換,var和let區別)
NTMFS4C05NT1G N-CH 30V 11.9A MOS管,PDF
. Net wechat message template push
Fully autonomous and controllable 3D cloud CAD: crowncad's convenient command search can quickly locate the specific location of the required command.
Direct control PTZ PTZ PTZ PTZ camera debugging (c)
Get started REPORT | today, talk about the microservice architecture currently used by Tencent
How to get the operating system running PHP- How to get the OS on which PHP is running?
Record idea shortcut keys
The redis development document released by Alibaba covers all redis operations
面渣逆袭:MySQL六十六问,两万字+五十图详解!有点六