This commit is contained in:
parent
9728a2de88
commit
0075e99e16
|
@ -1,6 +1,8 @@
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
public abstract class ScoreBase : MonoBehaviour
|
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>
|
||||||
/// 步骤满分
|
/// 步骤满分
|
||||||
/// </summary>
|
/// </summary>
|
||||||
float maxScore;
|
public float maxScore;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 步骤得分
|
/// 步骤得分
|
||||||
/// </summary>
|
/// </summary>
|
||||||
float currentScore=0;
|
public float currentScore=0;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 步骤是否已完成
|
/// 步骤是否已完成
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool isDone;
|
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.subProcessId = subProcessId;
|
||||||
this.maxScore = maxScore;
|
this.maxScore = maxScore;
|
||||||
|
this.isOneVoteVeto= isOneVoteVeto;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ScoreSubjectStep(float maxScore)
|
public ScoreSubjectStep(float maxScore)
|
||||||
|
|
|
@ -48,13 +48,15 @@ public class Score_1002 : ScoreBase
|
||||||
currentInstallTestJieXian.Clear();
|
currentInstallTestJieXian.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if UNITY_EDITOR
|
||||||
private void Update()
|
private void Update()
|
||||||
{
|
{
|
||||||
if (Input.GetKeyDown(KeyCode.P))
|
if (Input.GetKeyDown(KeyCode.O))
|
||||||
{
|
{
|
||||||
Debug.Log(JsonConvert.SerializeObject(steps));
|
GetTotalScore();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Čý˛˝ŃéľçËłĐň
|
/// Čý˛˝ŃéľçËłĐň
|
||||||
|
|
Loading…
Reference in New Issue