当前位置:网站首页>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;
}
}
}
边栏推荐
- The redis development document released by Alibaba covers all redis operations
- Js7day (event object, event flow, event capture and bubble, prevent event flow, event delegation, student information table cases)
- Window10 upgrade encountered a big hole error code: 0xc000000e perfect solution
- Traverse entrylist method correctly
- [error record] cannot open "XXX" because Apple cannot check whether it contains malware
- moon
- Interval DP acwing 282 Stone merging
- Unity SKFramework框架(十九)、POI 兴趣点/信息点
- Redis bloom filter
- Counter attack of flour dregs: MySQL 66 questions, 20000 words + 50 pictures in detail! A little six
猜你喜欢
![Jerry's watch modifies the alarm clock [chapter]](/img/d6/04fb8143027578bb707529a05db548.jpg)
Jerry's watch modifies the alarm clock [chapter]

Tencent three sides: in the process of writing files, the process crashes, and will the file data be lost?

Linear DP acwing 902 Shortest editing distance

C operator

js5day(事件监听,函数赋值给变量,回调函数,环境对象this,全选反选案例,tab栏案例)

自主可控三维云CAD:CrownCAD赋能企业创新设计

JS10day(api 阶段性完结,正则表达式简介,自定义属性,过滤敏感词案例,注册模块验证案例)
![Jerry's watch time synchronization [chapter]](/img/64/a48772b4e503ae0a2d36fc292e4e0d.jpg)
Jerry's watch time synchronization [chapter]

通过反射执行任意类的任意方法

js1day(輸入輸出語法,數據類型,數據類型轉換,var和let區別)
随机推荐
Some sudden program ideas (modular processing)
Structured data, semi-structured data and unstructured data
spfa AcWing 851. SPFA finding the shortest path
Linear DP acwing 902 Shortest editing distance
(7) Web security | penetration testing | how does network security determine whether CND exists, and how to bypass CND to find the real IP
Modular commonjs es module
(6) Web security | penetration test | network security encryption and decryption ciphertext related features, with super encryption and decryption software
Fully autonomous and controllable 3D cloud CAD: crowncad's convenient command search can quickly locate the specific location of the required command.
堆 AcWing 838. 堆排序
Efficiency comparison between ArrayList and LinkedList
About the loading of layer web spring layer components, the position of the layer is centered
Tencent three sides: in the process of writing files, the process crashes, and will the file data be lost?
Linear DP acwing 897 Longest common subsequence
Oracle从入门到精通(第4版)
Obtain file copyright information
[opencv learning] [image filtering]
[opencv] [image gradient]
js1day(輸入輸出語法,數據類型,數據類型轉換,var和let區別)
Js8day (rolling event (scroll family), offset family, client family, carousel map case (to be done))
Mongodb redis differences