当前位置:网站首页>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;
}
}
}
边栏推荐
- To bypass obregistercallbacks, you need to drive the signature method
- The UVM Primer——Chapter2: A Conventional Testbench for the TinyALU
- JDBC 预防sql注入问题与解决方法[PreparedStatement]
- Unity SKFramework框架(十八)、RoamCameraController 漫游视角相机控制脚本
- Variable, "+" sign, data type
- Linear DP acwing 902 Shortest editing distance
- Post order traversal sequence of 24 binary search tree of sword finger offer
- Jerry's watch time synchronization [chapter]
- [opencv learning] [image histogram and equalization]
- Std:: vector batch import fast de duplication method
猜你喜欢
完全自主可控三维云CAD:CrownCAD便捷的命令搜索,快速定位所需命令具体位置。
Interval DP acwing 282 Stone merging
模数转换器(ADC) ADE7913ARIZ 专为三相电能计量应用而设计
Mobile layout (flow layout)
C modifier
Counting class DP acwing 900 Integer partition
Five best software architecture patterns that architects must understand
JS iterator generator asynchronous code processing promise+ generator - > await/async
Async/await asynchronous function
堆 AcWing 838. 堆排序
随机推荐
Jerry's watch ringtone audition [article]
三面阿里,有惊无险成功拿到offer定级P7,只能说是真的难
Mobile layout (flow layout)
Get started REPORT | today, talk about the microservice architecture currently used by Tencent
Ali on three sides, it's really difficult to successfully get the offer rated P7
Rust language document Lite (Part 1) - cargo, output, basic syntax, data type, ownership, structure, enumeration and pattern matching
获取文件版权信息
8A 同步降压稳压器 TPS568230RJER_规格信息
C operator
一些突然迸发出的程序思想(模块化处理)
移动式布局(流式布局)
Hundreds of web page special effects can be used. Don't you come and have a look?
阿里发布的Redis开发文档,涵盖了所有的redis操作
[opencv learning] [Canny edge detection]
ASP. Net MVC default configuration, if any, jumps to the corresponding program in the specified area
嵌入式软件开发
Analog to digital converter (ADC) ade7913ariz is specially designed for three-phase energy metering applications
Hash table acwing 841 String hash
bellman-ford AcWing 853. Shortest path with side limit
Docsify deploy IIS