114 lines
4.2 KiB
C#
114 lines
4.2 KiB
C#
using ChartAndGraph;
|
||
using Newtonsoft.Json;
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using UnityEngine;
|
||
using UnityEngine.UI;
|
||
using ZXKFramework;
|
||
namespace YiLiao.XinFeiTingZhen
|
||
{
|
||
public class KaoHePanel : UIBase
|
||
{
|
||
RectTransform content;
|
||
GameObject step;
|
||
CanvasRadarChart radar;
|
||
//GameObject aiSpeak;
|
||
//Text aiText;
|
||
public override string GroupName => "KaoHePanel";
|
||
public override string Name => "KaoHePanel";
|
||
public override void Init(IUIManager uictrl)
|
||
{
|
||
base.Init(uictrl);
|
||
content = transform.FindFirst<RectTransform>("Content");
|
||
step = transform.FindFirst<Transform>("Step").gameObject;
|
||
radar = transform.FindFirst<CanvasRadarChart>("Radar");
|
||
}
|
||
|
||
public override void Show()
|
||
{
|
||
base.Show();
|
||
GeneSteps(GameManager.Instance.kaoheManager.results);
|
||
transform.FindFirst<Text>("timeText").text = GameManager.Instance.timeCounterManager.GetRemainTime();
|
||
transform.FindFirst<Text>("totalScoreText").text = GameManager.Instance.kaoheManager.totalScore.ToString();
|
||
SetRadar();
|
||
transform.FindFirst<Text>("BottomText").gameObject.SetActive(true);
|
||
}
|
||
|
||
public void GeneSteps(List<Step> steps)
|
||
{
|
||
for (int i = 0; i < steps.Count; i++)
|
||
{
|
||
int seq = i + 1;
|
||
Step s = steps[i];
|
||
GameObject obj = Instantiate(step, content);
|
||
obj.SetActive(true);
|
||
obj.transform.FindFirst<Text>("ID").text = seq.ToString();
|
||
obj.transform.FindFirst<Text>("Name").text = s.name1+"-"+s.name2+"-"+s.name3+"-"+s.name4;
|
||
obj.transform.FindFirst<Text>("Type").text = s.stepType;
|
||
obj.transform.FindFirst<Text>("MaxScore").text = s.maxScore;
|
||
obj.transform.FindFirst<Text>("Score").text = s.score.ToString();
|
||
}
|
||
}
|
||
public void SetRadar()
|
||
{
|
||
double czjc = 0;
|
||
double jnzd = 0;
|
||
double wjgn = 0;
|
||
double lcsw = 0;
|
||
double rwgh = 0;
|
||
|
||
double czjc_max = 0;
|
||
double jnzd_max = 0;
|
||
double wjgn_max = 0;
|
||
double lcsw_max = 0;
|
||
double rwgh_max = 0;
|
||
List<Step> steps = GameManager.Instance.kaoheManager.results;
|
||
foreach (Step step in steps)
|
||
{
|
||
switch (step.stepType)
|
||
{
|
||
case "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>":
|
||
czjc += Convert.ToDouble(step.score);
|
||
czjc_max += Convert.ToDouble(step.maxScore);
|
||
break;
|
||
case "<22>ٴ<EFBFBD>˼ά":
|
||
lcsw += Convert.ToDouble(step.score);
|
||
lcsw_max += Convert.ToDouble(step.maxScore);
|
||
break;
|
||
case "<22><><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD>":
|
||
jnzd += Convert.ToDouble(step.score);
|
||
jnzd_max += Convert.ToDouble(step.maxScore);
|
||
break;
|
||
case "<22><EFBFBD><DEBE><EFBFBD><EFBFBD><EFBFBD>":
|
||
wjgn += Convert.ToDouble(step.score);
|
||
wjgn_max += Convert.ToDouble(step.maxScore);
|
||
break;
|
||
case "<22><><EFBFBD>Ĺػ<C4B9>":
|
||
rwgh += Convert.ToDouble(step.score);
|
||
rwgh_max += Convert.ToDouble(step.maxScore);
|
||
break;
|
||
}
|
||
}
|
||
if (czjc_max != 0)
|
||
{
|
||
radar.DataSource.SetValue("Player 1", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", czjc / czjc_max * 10);
|
||
}
|
||
if (lcsw_max != 0)
|
||
{
|
||
radar.DataSource.SetValue("Player 1", "<22>ٴ<EFBFBD>˼ά", lcsw / lcsw_max * 10);
|
||
}
|
||
if (jnzd_max != 0)
|
||
{
|
||
radar.DataSource.SetValue("Player 1", "<22><><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD>", jnzd / jnzd_max * 10);
|
||
}
|
||
if (wjgn_max != 0)
|
||
{
|
||
radar.DataSource.SetValue("Player 1", "<22><EFBFBD><DEBE><EFBFBD><EFBFBD><EFBFBD>", wjgn / wjgn_max * 10);
|
||
}
|
||
if (rwgh_max != 0)
|
||
{
|
||
radar.DataSource.SetValue("Player 1", "<22><><EFBFBD>Ĺػ<C4B9>", rwgh / rwgh_max * 10);
|
||
}
|
||
}
|
||
}
|
||
} |