当前位置:网站首页>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;
}
}
}
边栏推荐
- 获取文件版权信息
- 基于STM32的OLED 屏幕驱动
- JDBC prevent SQL injection problems and solutions [preparedstatement]
- 8A 同步降压稳压器 TPS568230RJER_规格信息
- Linear DP acwing 896 Longest ascending subsequence II
- Day4 operator, self increasing, self decreasing, logical operator, bit operation, binary conversion decimal, ternary operator, package mechanism, document comment
- 完全自主可控三维云CAD:CrownCAD便捷的命令搜索,快速定位所需命令具体位置。
- 国产免费数据仓库ETL调度自动化运维专家—TASKCTL
- . Net wechat message template push
- Linear DP acwing 899 Edit distance
猜你喜欢

Unity SKFramework框架(十七)、FreeCameraController 上帝视角/自由视角相机控制脚本
![Jerry's watch modifies the alarm clock [chapter]](/img/d6/04fb8143027578bb707529a05db548.jpg)
Jerry's watch modifies the alarm clock [chapter]
![[opencv] [image gradient]](/img/37/1f366501e2b4e70ecee6365088167c.jpg)
[opencv] [image gradient]

spfa AcWing 851. SPFA finding the shortest path

Unity SKFramework框架(十八)、RoamCameraController 漫游视角相机控制脚本

Sensor adxl335bcpz-rl7 3-axis accelerometer complies with rohs/weee

Redis sentinel mechanism and configuration

Five best software architecture patterns that architects must understand

The redis development document released by Alibaba covers all redis operations

Unity SKFramework框架(十九)、POI 兴趣点/信息点
随机推荐
Apply lnk306gn-tl converter, non isolated power supply
Everyone wants to eat a broken buffet. It's almost cold
Jerry's weather direction coding table [chapter]
Explain in detail the process of realizing Chinese text classification by CNN
How to get the operating system running PHP- How to get the OS on which PHP is running?
Wechat official account payment prompt MCH_ ID parameter format error
net share
js5day(事件监听,函数赋值给变量,回调函数,环境对象this,全选反选案例,tab栏案例)
ArrayList与LinkedList效率的对比
Heap acwing 838 Heap sort
js1day(輸入輸出語法,數據類型,數據類型轉換,var和let區別)
Ltc3307ahv meets EMI standard, step-down converter qca7005-al33 phy
Docsify deploy IIS
Oracle from entry to mastery (4th Edition)
Package management tools
百款拿来就能用的网页特效,不来看看吗?
About the loading of layer web spring layer components, the position of the layer is centered
How can attribute mapping of entity classes be without it?
架构师必须了解的 5 种最佳软件架构模式
Some sudden program ideas (modular processing)