当前位置:网站首页>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 ");
}
}边栏推荐
- Mysql常用命令详细大全
- 国内首款、完全自主、基于云架构的三维CAD平台——CrownCAD(皇冠CAD)
- [opencv learning] [image pyramid]
- Unity skframework framework (XV), singleton singleton
- 阿里发布的Redis开发文档,涵盖了所有的redis操作
- Web Foundation
- [Unity]使用GB2312,打包后程序不正常解决方案
- Unforgettable Ali, 4 skills, 5 hr additional written tests, it's really difficult and sad to walk
- ADB basic commands
- C operator
猜你喜欢

【笔耕不辍勋章活动】生命不止,写作不息

Unity skframework framework (XV), singleton singleton

Essential for operation and maintenance - Elk log analysis system

Ntmfs4c05nt1g N-ch 30V 11.9a MOS tube, pdf

完全自主可控三维云CAD:CrownCAD便捷的命令搜索,快速定位所需命令具体位置。

The redis development document released by Alibaba covers all redis operations

2022零代码/低代码开发白皮书【伙伴云出品】附下载

How to modify the error of easydss on demand service sharing time?

难忘阿里,4面技术5面HR附加笔试面,走的真艰难真心酸

国内首款、完全自主、基于云架构的三维CAD平台——CrownCAD(皇冠CAD)
随机推荐
OLED screen driver based on stm32
Finally, someone explained the supervised learning clearly
Ali was killed by two programming problems at the beginning, pushed inward again, and finally landed (he has taken an electronic offer)
TVOC, VOC, VOCs gas detection + Solution
SSL证书的分类有哪些?如何选择合适的SSL证书?
最近公共祖先LCA的三种求法
The redis development document released by Alibaba covers all redis operations
de4000h存储安装配置
Research shows that "congenial" is more likely to become friends
2022零代码/低代码开发白皮书【伙伴云出品】附下载
Daily question: 1175 Prime permutation
挥发性有机物TVOC、VOC、VOCS气体检测+解决方案
Embedded software development
Unforgettable Ali, 4 skills, 5 hr additional written tests, it's really difficult and sad to walk
[opencv learning] [image pyramid]
[opencv learning] [common image convolution kernel]
Answer: can the audio be set to on by default during easydss video on demand?
Everyone wants to eat a broken buffet. It's almost cold
Unity SKFramework框架(十六)、Package Manager 开发工具包管理器
PR usage skills, how to use PR to watermark?