This commit is contained in:
YangHua 2024-08-29 17:54:40 +08:00
commit c7beeb4a7d
3 changed files with 33 additions and 5 deletions

View File

@ -1,6 +1,8 @@
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using Newtonsoft.Json;
public abstract class ScoreBase : MonoBehaviour
{
@ -39,4 +41,23 @@ public abstract class ScoreBase : MonoBehaviour
{
}
/// <summary>
/// 获取总分和各步骤分数
/// </summary>
public void GetTotalScore()
{
float all = 0;
foreach (var item in steps)
{
all+=item.Value.currentScore;
if(item.Value.isOneVoteVeto && item.Value.currentScore==0)
{
all = 0;
break;
}
}
Debug.LogError("总分为:" + all);
Debug.LogError(JsonConvert.SerializeObject(steps));
}
}

View File

@ -11,20 +11,25 @@ public class ScoreSubjectStep
/// <summary>
/// 步骤满分
/// </summary>
float maxScore;
public float maxScore;
/// <summary>
/// 步骤得分
/// </summary>
float currentScore=0;
public float currentScore=0;
/// <summary>
/// 步骤是否已完成
/// </summary>
public bool isDone;
/// <summary>
/// 是否一票否决
/// </summary>
public bool isOneVoteVeto;
public ScoreSubjectStep(int subProcessId,float maxScore)
public ScoreSubjectStep(int subProcessId,float maxScore,bool isOneVoteVeto=false)
{
this.subProcessId = subProcessId;
this.maxScore = maxScore;
this.isOneVoteVeto= isOneVoteVeto;
}
public ScoreSubjectStep(float maxScore)

View File

@ -48,13 +48,15 @@ public class Score_1002 : ScoreBase
currentInstallTestJieXian.Clear();
}
#if UNITY_EDITOR
private void Update()
{
if (Input.GetKeyDown(KeyCode.P))
if (Input.GetKeyDown(KeyCode.O))
{
Debug.Log(JsonConvert.SerializeObject(steps));
GetTotalScore();
}
}
#endif
/// <summary>
/// Čý˛˝ŃéľçËłĐň