| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 | #if UNITY_EDITORusing System.Collections.Generic;using UnityEngine;using UnityEngine.UIElements;namespace xy002Editor.CombatEditor{    public class ProgressBarShowModle    {        public VisualElement root;        private Dictionary<string, HeroValueReport> valueReprot = new Dictionary<string, HeroValueReport>();        public CombaReportEnditorManager manager;        public ProgressBarShowModle(VisualElement root, CombaReportEnditorManager manager)        {            this.root = root;            this.manager = manager;        }        public void CrendHarmValue(string vname, float currValue, float maxValue)        {            if (valueReprot.TryGetValue(vname, out HeroValueReport heroValueReport))            {                heroValueReport.progressBar.title = currValue.ToString();                              if (maxValue > 0)                {                    heroValueReport.progressBar.lowValue = currValue;                    heroValueReport.progressBar.highValue = maxValue;                    heroValueReport.progressBar.title = currValue + "/" + maxValue;                    heroValueReport.progressBar.value = currValue ;                                  }                else                {                    heroValueReport.progressBar.title  = currValue.ToString();                    heroValueReport.progressBar.lowValue = 1;                    heroValueReport.progressBar.highValue = 1;                    heroValueReport.progressBar.value = 1 ;                }            }            else            {                heroValueReport = new HeroValueReport();                VisualElement herovaluegrid = manager.Copy<VisualElement>("value_data_entity_style");                root.Add(herovaluegrid);                Label testv = manager.Copy<Label>("valuename");                testv.text = vname;                testv.style.unityFontStyleAndWeight = FontStyle.Bold;                testv.style.color = Color.magenta;                herovaluegrid.Add(testv);                ProgressBar progressBar = manager.Copy<ProgressBar>("valuebar");                                     herovaluegrid.Add(progressBar);                heroValueReport.progressBar = progressBar;                                if (maxValue > 0)                {                    heroValueReport.progressBar.lowValue = currValue;                    heroValueReport.progressBar.highValue = maxValue;                    heroValueReport.progressBar.title = currValue + "/" + maxValue;                    heroValueReport.progressBar.value = currValue ;                                  }                else                {                    heroValueReport.progressBar.title  = currValue.ToString();                    heroValueReport.progressBar.lowValue = 1;                    heroValueReport.progressBar.highValue = 1;                    heroValueReport.progressBar.value = 1 ;                }                                valueReprot.Add(vname, heroValueReport);            }        }    }}#endif
 |