using System.Collections; using System.Collections.Generic; using System.Linq; using UnityEngine; using Newtonsoft.Json; using SK.Framework; public abstract class ScoreBase : MonoBehaviour { /// /// 系统id /// public int systemId; /// /// 科目id /// public int schemeId; /// /// 科目满分 /// protected float maxScore = 100; /// /// 科目得分s /// protected float currentScore; /// /// 此科目步骤 /// public Dictionary steps; public virtual void Init() { systemId = 10001; schemeId = 10001; } /// /// 判分 /// public virtual void CheckScore(string triggerName,object para) { } public virtual void SetScore(List scores) { for (int i = 0; i < scores.Count; i++) { steps[i+1].maxScore= scores[i]; } } /// /// 获取总分 /// public float 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); return all; } /// /// 返回成绩详情 /// /// public Dictionary GetStepScore() { //Debug.LogError(JsonConvert.SerializeObject(steps)); return steps; } /// /// 记录现场环境中scoreBase的各项List缓存 /// public abstract string SaveSceneBufferList(); /// /// 还原现场环境中scoreBase的各项List缓存 /// public abstract void LoadSceneBufferList(string sceneInfo); }