1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- using 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();
- heroValueReport.progressBar.lowValue = currValue;
- heroValueReport.progressBar.highValue = maxValue;
- }
- 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");
- progressBar.title = currValue.ToString();
- progressBar.lowValue = currValue;
- progressBar.highValue = maxValue;
- herovaluegrid.Add(progressBar);
- heroValueReport.progressBar = progressBar;
- valueReprot.Add(vname, heroValueReport);
- }
- }
- }
- }
|