当前位置:网站首页>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;
}
}
}
边栏推荐
- JSON serialization and parsing
- Redis bloom filter
- Oracle从入门到精通(第4版)
- Js2day (also i++ and ++i, if statements, ternary operators, switch, while statements, for loop statements)
- Linear DP acwing 899 Edit distance
- Finally, someone explained the supervised learning clearly
- Async/await asynchronous function
- 面渣逆袭:MySQL六十六问,两万字+五十图详解!有点六
- Jerry's watch time synchronization [chapter]
- js4day(DOM开始:获取DOM元素内容,修改元素样式,修改表单元素属性,setInterval定时器,轮播图案例)
猜你喜欢

JS10day(api 阶段性完结,正则表达式简介,自定义属性,过滤敏感词案例,注册模块验证案例)

The redis development document released by Alibaba covers all redis operations

Js4day (DOM start: get DOM element content, modify element style, modify form element attributes, setinterval timer, carousel Map Case)

Linear DP acwing 897 Longest common subsequence

(7) Web security | penetration testing | how does network security determine whether CND exists, and how to bypass CND to find the real IP

堆 AcWing 839. 模拟堆

Floyd AcWing 854. Floyd finds the shortest path

Five best software architecture patterns that architects must understand

Hash table acwing 841 String hash

Fully autonomous and controllable 3D cloud CAD: crowncad's convenient command search can quickly locate the specific location of the required command.
随机推荐
[opencv learning] [template matching]
Linear DP acwing 895 Longest ascending subsequence
[opencv learning] [common image convolution kernel]
How to get the operating system running PHP- How to get the OS on which PHP is running?
Jerry's watch gets the default ringtone selection list [article]
spfa AcWing 851. SPFA finding the shortest path
Rust language document Lite (Part 1) - cargo, output, basic syntax, data type, ownership, structure, enumeration and pattern matching
Mobile layout (flow layout)
Explain in detail the process of realizing Chinese text classification by CNN
Rust语言文档精简版(上)——cargo、输出、基础语法、数据类型、所有权、结构体、枚举和模式匹配
基于STM32的OLED 屏幕驱动
JDBC 预防sql注入问题与解决方法[PreparedStatement]
MySQL: Invalid GIS data provided to function st_ geometryfromtext
West digital decided to raise the price of flash memory products immediately after the factory was polluted by materials
Record idea shortcut keys
Js4day (DOM start: get DOM element content, modify element style, modify form element attributes, setinterval timer, carousel Map Case)
Efficiency comparison between ArrayList and LinkedList
自主可控三维云CAD:CrownCAD赋能企业创新设计
获取文件版权信息
Js5day (event monitoring, function assignment to variables, callback function, environment object this, select all, invert selection cases, tab column cases)