using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.SocialPlatforms.Impl; using UnityEngine.UI; public class Electricitychargeaccounting : MonoBehaviour { public static Electricitychargeaccounting Instance; /// /// 考试模式初始化 /// public Sprite examination; /// /// 考试和练习图片切换 /// public Image examinationimage3; /// /// 下一题按钮 /// public Button nextbutton3; /// /// 上一题按钮 /// public Button upbutton3; /// /// 第一题页面 /// public GameObject electricitychargeaccounting3; /// /// 第二天页面 /// public GameObject electricitychargeaccounting4; /// /// 第一题题目 /// public List Calculateinput = new List(); /// /// 第一题答案 /// public List Calculateinput2 = new List(); /// /// 用来管理题目 /// public Dictionary topicdics = new Dictionary(); /// /// 第一答题第一小题的初始分数 /// public float awardofpoints = 10f; /// /// 第一小题判分 /// public List awards = new List(); private void Awake() { Instance = this; Init(); } private void Init() { examination = Resources.Load("UIpanel/考试模式"); if (ScoreManager.Instance.Subject == Subject.Electricityfeetest) { examinationimage3.sprite = examination; } for (int i = 0; i < 9; i++) { awards.Add(false); } } void Start() { Doexercises();//上下题切换 } public void Doexercises() { nextbutton3.onClick.AddListener(() => { nextbutton3.gameObject.SetActive(false); upbutton3.gameObject.SetActive(true); electricitychargeaccounting3.SetActive(false); electricitychargeaccounting4.SetActive(true); }); upbutton3.onClick.AddListener(() => { nextbutton3.gameObject.SetActive(true); upbutton3.gameObject.SetActive(false); electricitychargeaccounting3.SetActive(true); electricitychargeaccounting4.SetActive(false); }); } void Update() { } /// /// 计算电费核算考试得分 /// public void Electricitytestscore() { Thefirststep();//第一步 if (Calculateinput2[9].text == "223332")//第二个得分 { ScoreManager.Instance.Electricitytestscores[1] = float.Parse(ScoreManager.Instance.totalpoints[1]); } Thesecondstepcountspoints();//第三步得分 Thefourthstepistocountpoints();//第四步得分 if (Calculateinput2[13].text == "1380.84")//第五步得分 { ScoreManager.Instance.Electricitytestscores[4] = float.Parse(ScoreManager.Instance.totalpoints[4]); } if (Calculateinput2[17].text == "15000")//第六步得分 { ScoreManager.Instance.Electricitytestscores[5] = float.Parse(ScoreManager.Instance.totalpoints[5]); } StepCountpoints();//第七步得分 if (Calculateinput2[21].text == "216.42")//第八步得分 { ScoreManager.Instance.Electricitytestscores[7] = float.Parse(ScoreManager.Instance.totalpoints[7]); } Stepninecountspoints();//第九步得分 Steptencountspoints();//第十步得分 if (Calculateinput2[26].text == "-1.24")//第十一步得分 { ScoreManager.Instance.Electricitytestscores[10] = float.Parse(ScoreManager.Instance.totalpoints[10]); } if (Calculateinput2[27].text == "144723.89")//第十二步得分 { ScoreManager.Instance.Electricitytestscores[11] = float.Parse(ScoreManager.Instance.totalpoints[11]); } float score1 = float.Parse(ScoreManager.Instance.totalpoints[0]); float scoers = (float.Parse(ScoreManager.Instance.totalpoints[0]) * 0.2f); for (int i = 0; i < awards.Count; i++) { if (awards[i] == false) { score1 -= scoers; } } if (score1 < 0) { score1 = 0; ScoreManager.Instance.Electricitytestscores[0] = score1; } else { ScoreManager.Instance.Electricitytestscores[0] = score1; } } /// /// 第十步得分 /// private void Steptencountspoints() { string str; float score = 0f; float score1 = (float.Parse(ScoreManager.Instance.totalpoints[6]) / 2); if ((score1 - Mathf.Floor(score1)) < 0.001f) { str = score1.ToString(); } else { str = score1.ToString("f2"); } if (Calculateinput2[24].text == "-340.88") { score += float.Parse(str); } if (Calculateinput2[25].text == "-152.63") { score += float.Parse(str); } ScoreManager.Instance.Electricitytestscores[9] = score; } /// /// 第九步得分 /// private void Stepninecountspoints() { string str; float score = 0f; float score1 = (float.Parse(ScoreManager.Instance.totalpoints[6]) / 2); if ((score1 - Mathf.Floor(score1)) < 0.001f) { str = score1.ToString(); } else { str = score1.ToString("f2"); } if (Calculateinput2[22].text == "-90") { score += float.Parse(str); } if (Calculateinput2[23].text == "-243.48") { score += float.Parse(str); } ScoreManager.Instance.Electricitytestscores[8] = score; } /// /// 第七步得分 /// private void StepCountpoints() { string str; float score = 0f; float score1 = (float.Parse(ScoreManager.Instance.totalpoints[6]) / 3); if ((score1 - Mathf.Floor(score1)) < 0.001f) { str = score1.ToString(); } else { str = score1.ToString("f2"); } if (Calculateinput2[18].text == "41895.87") { score += float.Parse(str); } if (Calculateinput2[19].text == "59952.46") { score += float.Parse(str); } if (Calculateinput2[20].text == "28487.37") { score += float.Parse(str); } ScoreManager.Instance.Electricitytestscores[6] = score; } /// /// 第四步得分 /// private void Thefourthstepistocountpoints() { string str; float score = 0f; float score1 = (float.Parse(ScoreManager.Instance.totalpoints[3]) / 3); if ((score1 - Mathf.Floor(score1)) < 0.001f) { str = score1.ToString(); } else { str = score1.ToString("f2"); } if (Calculateinput2[14].text == "39166") { score += float.Parse(str); } if (Calculateinput2[15].text == "90753") { score += float.Parse(str); } if (Calculateinput2[16].text == "93413") { score += float.Parse(str); } ScoreManager.Instance.Electricitytestscores[3] = score; } /// /// 第三个得分 /// private void Thesecondstepcountspoints() { string str; float score = 0f; float score1 = (float.Parse(ScoreManager.Instance.totalpoints[2]) / 3); if ((score1 - Mathf.Floor(score1)) < 0.001f) { str = score1.ToString(); } else { str = score1.ToString("f2"); } if (Calculateinput2[10].text == "242.16") { score += float.Parse(str); } if (Calculateinput2[11].text == "577.56") { score += float.Parse(str); } if (Calculateinput2[12].text == "561.12") { score += float.Parse(str); } ScoreManager.Instance.Electricitytestscores[2] = score; } /// /// 第一题练习 /// private void Thefirststep() { if (Calculateinput2[0].text == "220933") { awards[0] = true; } if (Calculateinput2[1].text == "490") { awards[1] = true; } if (Calculateinput2[2].text == "2209") { awards[2] = true; } if (Calculateinput2[3].text == "223632") { awards[3] = true; } if (Calculateinput2[4].text == "69214") { awards[4] = true; } if (Calculateinput2[5].text == "0") { awards[5] = true; } if (Calculateinput2[6].text == "3528") { awards[6] = true; } if (Calculateinput2[7].text == "8284") { awards[7] = true; } if (Calculateinput2[8].text == "81026") { awards[8] = true; } } public void Calculatescore() { if (Calculateinput[0].text == "220933kWh") { ScoreManager.Instance.AddElectriccharge(1); } if (Calculateinput[1].text == "490kWh") { ScoreManager.Instance.AddElectriccharge(1); } if (Calculateinput[2].text == "2209kWh") { ScoreManager.Instance.AddElectriccharge(1); } if (Calculateinput[3].text == "223632kWh") { ScoreManager.Instance.AddElectriccharge(1); } if (Calculateinput[4].text == "69214kvarh") { ScoreManager.Instance.AddElectriccharge(1); } if (Calculateinput[5].text == "0kvarh") { ScoreManager.Instance.AddElectriccharge(1); } if (Calculateinput[6].text == "3528kvarh") { ScoreManager.Instance.AddElectriccharge(1); } if (Calculateinput[7].text == "8284kvarh") { ScoreManager.Instance.AddElectriccharge(1); } if (Calculateinput[8].text == "81026kvarh") { ScoreManager.Instance.AddElectriccharge(1); } if (Calculateinput[9].text == "0.94") { ScoreManager.Instance.AddElectriccharge(1); } if (Calculateinput[10].text == "223332kWh") { ScoreManager.Instance.AddElectriccharge(1); } if (Calculateinput[11].text == "38746kWh") { ScoreManager.Instance.AddElectriccharge(1); } if (Calculateinput[12].text == "92410kWh") { ScoreManager.Instance.AddElectriccharge(1); } if (Calculateinput[13].text == "89779kWh") { ScoreManager.Instance.AddElectriccharge(1); } if (Calculateinput[14].text == "220935kWh") { ScoreManager.Instance.AddElectriccharge(1); } if (Calculateinput[15].text == "39166kWh") { ScoreManager.Instance.AddElectriccharge(1); } if (Calculateinput[16].text == "90753kWh") { ScoreManager.Instance.AddElectriccharge(1); } if (Calculateinput[17].text == "93413kWh") { ScoreManager.Instance.AddElectriccharge(1); } if (Calculateinput[18].text == "15000元") { ScoreManager.Instance.AddElectriccharge(1); } if (Calculateinput[19].text == "41895.87元") { ScoreManager.Instance.AddElectriccharge(1); } if (Calculateinput[20].text == "59952.46元") { ScoreManager.Instance.AddElectriccharge(1); } if (Calculateinput[21].text == "28487.37") { ScoreManager.Instance.AddElectriccharge(1); } if (Calculateinput[22].text == "216.42元") { ScoreManager.Instance.AddElectriccharge(1); } if (Calculateinput[23].text == "-90元") { ScoreManager.Instance.AddElectriccharge(1); } if (Calculateinput[24].text == "-243.48元") { ScoreManager.Instance.AddElectriccharge(1); } if (Calculateinput[25].text == "-340.88元") { ScoreManager.Instance.AddElectriccharge(1); } if (Calculateinput[26].text == "-152.63元") { ScoreManager.Instance.AddElectriccharge(1); } if (Calculateinput[27].text == "-1.24元") { ScoreManager.Instance.AddElectriccharge(1); } if (Calculateinput[28].text == "144723.89元") { ScoreManager.Instance.AddElectriccharge(1); } } /// /// 计算电费核算练习得分 /// public void Calculatescore2() { if (Calculateinput2[0].text == "220933") { awards[0] = true; } if (Calculateinput2[1].text == "490") { awards[1] = true; } if (Calculateinput2[2].text == "2209") { awards[2] = true; } if (Calculateinput2[3].text == "223632") { awards[3] = true; } if (Calculateinput2[4].text == "69214") { awards[4] = true; } if (Calculateinput2[5].text == "0") { awards[5] = true; } if (Calculateinput2[6].text == "3528") { awards[6] = true; } if (Calculateinput2[7].text == "8284") { awards[7] = true; } if (Calculateinput2[8].text == "81026") { awards[8] = true; } if (Calculateinput2[9].text == "223332") { ScoreManager.Instance.AddElectriccharge(5); } if (Calculateinput2[10].text == "242.16") { ScoreManager.Instance.AddElectriccharge(5); } if (Calculateinput2[11].text == "577.56") { ScoreManager.Instance.AddElectriccharge(5); } if (Calculateinput2[12].text == "561.12") { ScoreManager.Instance.AddElectriccharge(5); } if (Calculateinput2[13].text == "1380.84") { ScoreManager.Instance.AddElectriccharge(5); } if (Calculateinput2[14].text == "39166") { ScoreManager.Instance.AddElectriccharge(5); } if (Calculateinput2[15].text == "90753") { ScoreManager.Instance.AddElectriccharge(5); } if (Calculateinput2[16].text == "93413") { ScoreManager.Instance.AddElectriccharge(5); } if (Calculateinput2[17].text == "15000") { ScoreManager.Instance.AddElectriccharge(15); } if (Calculateinput2[18].text == "41895.87") { ScoreManager.Instance.AddElectriccharge(5); } if (Calculateinput2[19].text == "59952.46") { ScoreManager.Instance.AddElectriccharge(5); } if (Calculateinput2[20].text == "28487.37") { ScoreManager.Instance.AddElectriccharge(5); } if (Calculateinput2[21].text == "216.42") { ScoreManager.Instance.AddElectriccharge(5); } if (Calculateinput2[22].text == "-90") { ScoreManager.Instance.AddElectriccharge(1); } if (Calculateinput2[23].text == "-243.48") { ScoreManager.Instance.AddElectriccharge(1); } if (Calculateinput2[24].text == "-340.88") { ScoreManager.Instance.AddElectriccharge(1); } if (Calculateinput2[25].text == "-152.63") { ScoreManager.Instance.AddElectriccharge(1); } if (Calculateinput2[26].text == "-1.24") { ScoreManager.Instance.AddElectriccharge(2); } if (Calculateinput2[27].text == "144723.89") { ScoreManager.Instance.AddElectriccharge(9); } for (int i = 0; i < awards.Count; i++) { if (awards[i] == false) { awardofpoints -= 2f; } } if (awardofpoints < 0) { awardofpoints = 0; } else { ScoreManager.Instance.AddElectriccharge(awardofpoints); } } }