当前位置:网站首页>Unity skframework framework (XII), score scoring module
Unity skframework framework (XII), score scoring module
2022-07-02 13:20:00 【CoderZ1010】
Catalog
5、 ... and 、 Calculate the total score
One 、 The configuration file
1. newly build
Right click /Create/Score Profile Create a score Profile
2. edit
First, in the ScoreIDConstant Write a score item in the script ID Of int Constant
Fill in the configuration file
ID by Score item ID,Description by Score item description information ,Value by Score item score .
3. route
The default configuration file loading path in the module is Resources/Score Profile, You can also make changes in the code
// Load profile
Resources.Load<ScoreProfile>("Score Profile");
Two 、 Create scores
1. Create a single score
Use Create Method to create a single score , Parameters of the incoming Score item ID
using UnityEngine;
using SK.Framework;
public class Example : MonoBehaviour
{
private void Start()
{
Score.Create(ScoreIDConstant.QUESTION_1);
}
}
2. Create a score combination
Use CreateGroup Method to create a score combination , The first parameter is passed in The naming of fraction combination ; The second parameter is passed in Scoring method , There are two scoring methods ,Additive Indicates that the score is Cumulative ,Mutually Exclusive Indicates that there is Mutually exclusive ; The following parameters are Score item ID, Is an optional parameter .
using UnityEngine;
using SK.Framework;
public class Example : MonoBehaviour
{
private void Start()
{
Score.CreateGroup(" choice question ", ValueMode.Additive,
ScoreIDConstant.QUESTION_1,
ScoreIDConstant.QUESTION_2,
ScoreIDConstant.QUESTION_3,
ScoreIDConstant.QUESTION_4);
}
}
3、 ... and 、 Get points
When creating a score item, the corresponding number of identification , You can get 、 Cancel score .
using UnityEngine;
using SK.Framework;
public class Example : MonoBehaviour
{
private void Start()
{
// Create a score combination Record identification
string[] flags = Score.CreateGroup(" choice question ", ValueMode.Additive,
ScoreIDConstant.QUESTION_1,
ScoreIDConstant.QUESTION_2,
ScoreIDConstant.QUESTION_3,
ScoreIDConstant.QUESTION_4);
// Score by logo
Score.Obtain(" choice question ", flags[0]);
}
}
In the above example, it means to get " choice question " The score of the first score item of the score combination , That is to say ID by QUESTION_1 The score of the score item .
Four 、 Cancel score
If you want to cancel a score that has been obtained , adopt Cancle Method realization
using UnityEngine;
using SK.Framework;
public class Example : MonoBehaviour
{
private void Start()
{
// Create a score combination Record identification
string[] flags = Score.CreateGroup(" choice question ", ValueMode.Additive,
ScoreIDConstant.QUESTION_1,
ScoreIDConstant.QUESTION_2,
ScoreIDConstant.QUESTION_3,
ScoreIDConstant.QUESTION_4);
// Score by logo
Score.Obtain(" choice question ", flags[0]);
// Cancel score
Score.Cancle(" choice question ", flags[0]);
}
}
As shown in the figure ,Obtain Get the score and then pass Cancle Cancel score , The score obtained has been cancelled
5、 ... and 、 Calculate the total score
adopt GetSum Method to obtain the total score obtained
using UnityEngine;
using SK.Framework;
public class Example : MonoBehaviour
{
private void Start()
{
// Create a score combination Record identification
string[] flags = Score.CreateGroup(" choice question ", ValueMode.Additive,
ScoreIDConstant.QUESTION_1,
ScoreIDConstant.QUESTION_2,
ScoreIDConstant.QUESTION_3,
ScoreIDConstant.QUESTION_4);
// Score by logo
Score.Obtain(" choice question ", flags[0]);
// Get total score
float sum = Score.GetSum();
}
}
In addition, you can use GetGroupSum Method to obtain the total score obtained in a score combination
using UnityEngine;
using SK.Framework;
public class Example : MonoBehaviour
{
private void Start()
{
// Create a score combination Record identification
string[] flags = Score.CreateGroup(" choice question ", ValueMode.Additive,
ScoreIDConstant.QUESTION_1,
ScoreIDConstant.QUESTION_2,
ScoreIDConstant.QUESTION_3,
ScoreIDConstant.QUESTION_4);
// Score by logo
Score.Obtain(" choice question ", flags[0]);
// Get the total score of a score combination
float sum = Score.GetGroupSum(" choice question ");
}
}
边栏推荐
- [opencv learning] [image filtering]
- 8A Synchronous Step-Down regulator tps568230rjer_ Specification information
- C operator
- 解答:EasyDSS视频点播时音频是否可以设置为默认开启?
- Independent and controllable 3D cloud CAD: crowncad enables innovative design of enterprises
- 为什么switch 的default后面要跟break?
- 操作教程:EasyDSS如何将MP4点播文件转化成RTSP视频流?
- Unity skframework Framework (XVI), package manager Development Kit Manager
- Node.js通过ODBC访问PostgreSQL数据库
- JS逆向之行行查data解密
猜你喜欢
为什么switch 的default后面要跟break?
OpenApi-Generator:简化RESTful API开发流程
Web基础
(7) Web security | penetration testing | how does network security determine whether CND exists, and how to bypass CND to find the real IP
The second anniversary of the three winged bird: the wings are getting richer and the take-off is just around the corner
Unity skframework framework (XXI), texture filter map resource filtering tool
OpenAPI generator: simplify the restful API development process
Independent and controllable 3D cloud CAD: crowncad enables innovative design of enterprises
Ntmfs4c05nt1g N-ch 30V 11.9a MOS tube, pdf
West digital decided to raise the price of flash memory products immediately after the factory was polluted by materials
随机推荐
[Unity]使用GB2312,打包后程序不正常解决方案
免费SSL证书知多少?免费SSL证书和收费SSL证书的区别
三翼鸟两周年:羽翼渐丰,腾飞指日可待
Unity skframework framework (XIV), extension extension function
[200 opencv routines] 100 Adaptive local noise reduction filter
Jerry's watch delete alarm clock [chapter]
Explain in detail the process of realizing Chinese text classification by CNN
SSL证书的分类有哪些?如何选择合适的SSL证书?
Explanation of 34 common terms on the Internet
Jerry's watch time synchronization [chapter]
国产免费数据仓库ETL调度自动化运维专家—TASKCTL
Everyone wants to eat a broken buffet. It's almost cold
Redis数据库持久化
Three methods of finding LCA of the nearest common ancestor
[true topic of the Blue Bridge Cup trials 43] scratch space flight children's programming explanation of the true topic of the Blue Bridge Cup trials
How to get the operating system running PHP- How to get the OS on which PHP is running?
What are eNB, EPC and PGW?
完全自主可控三维云CAD:CrownCAD便捷的命令搜索,快速定位所需命令具体位置。
Tencent three sides: in the process of writing files, the process crashes, and will the file data be lost?
Jerry's watch ringtone audition [article]