74 lines
2.0 KiB
C#
74 lines
2.0 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class ScoreSubjectStep
|
|
{
|
|
/// <summary>
|
|
/// 步骤id
|
|
/// </summary>
|
|
public int subProcessId;
|
|
/// <summary>
|
|
/// 步骤满分
|
|
/// </summary>
|
|
public float maxScore;
|
|
/// <summary>
|
|
/// 步骤得分
|
|
/// </summary>
|
|
public float currentScore=0;
|
|
/// <summary>
|
|
/// 步骤是否已完成
|
|
/// </summary>
|
|
public bool isDone;
|
|
/// <summary>
|
|
/// 是否一票否决
|
|
/// </summary>
|
|
public bool isOneVoteVeto;
|
|
/// <summary>
|
|
/// 步骤
|
|
/// </summary>
|
|
public D_SubProcess step;
|
|
|
|
public ScoreSubjectStep(int subProcessId,float maxScore,bool isOneVoteVeto=false)
|
|
{
|
|
this.subProcessId = subProcessId;
|
|
this.maxScore = maxScore;
|
|
this.isOneVoteVeto= isOneVoteVeto;
|
|
}
|
|
|
|
public ScoreSubjectStep(float maxScore)
|
|
{
|
|
this.maxScore = maxScore;
|
|
}
|
|
/// <summary>
|
|
/// 得全或扣光
|
|
/// </summary>
|
|
/// <param name="AllScore"></param>
|
|
/// <param name="canRepeat">是否可以重复打分</param>
|
|
public void SetScore(bool AllScore,bool canRepeat=false)
|
|
{
|
|
if (!isDone || canRepeat)
|
|
{
|
|
isDone = true;
|
|
currentScore = (AllScore ? maxScore : 0);
|
|
currentScore = (float)Math.Round(currentScore, 2);
|
|
Debug.LogError(string.Format("打分:{0}.{1} 得分:{2} / {3}", subProcessId, step.subProcessName, currentScore, maxScore));
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 百分比分数
|
|
/// </summary>
|
|
/// <param name="scaleScore"></param>
|
|
public void SetScore(float scaleScore, bool canRepeat=false)
|
|
{
|
|
if (!isDone || canRepeat)
|
|
{
|
|
isDone = true;
|
|
currentScore = scaleScore*maxScore;
|
|
currentScore = (float)Math.Round(currentScore,2);
|
|
Debug.LogError(string.Format("打分:{0}.{1} 得分:{2} / {3}", subProcessId, step.subProcessName, currentScore, maxScore));
|
|
}
|
|
}
|
|
}
|