This commit is contained in:
parent
9728a2de88
commit
0075e99e16
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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>
|
||||
/// Čý˛˝ŃéľçËłĐň
|
||||
|
|
Loading…
Reference in New Issue