Make abstract UIPanel class, refactor SceneExplorer into that, some fixes

This commit is contained in:
Sinai
2021-04-16 17:49:05 +10:00
parent c8a64c39b1
commit 1769a4ed8d
10 changed files with 437 additions and 603 deletions

View File

@ -116,8 +116,8 @@ namespace UnityExplorer.UI.Utility
GameObject sliderObj = UIFactory.CreateUIObject("SliderScrollbar", parent, UIFactory._smallElementSize);
GameObject bgObj = UIFactory.CreateUIObject("Background", sliderObj);
GameObject fillAreaObj = UIFactory.CreateUIObject("Fill Area", sliderObj);
GameObject fillObj = UIFactory.CreateUIObject("Fill", fillAreaObj);
//GameObject fillAreaObj = UIFactory.CreateUIObject("Fill Area", sliderObj);
//GameObject fillObj = UIFactory.CreateUIObject("Fill", fillAreaObj);
GameObject handleSlideAreaObj = UIFactory.CreateUIObject("Handle Slide Area", sliderObj);
GameObject handleObj = UIFactory.CreateUIObject("Handle", handleSlideAreaObj);
@ -131,22 +131,11 @@ namespace UnityExplorer.UI.Utility
bgRect.sizeDelta = Vector2.zero;
bgRect.offsetMax = new Vector2(0f, 0f);
RectTransform fillAreaRect = fillAreaObj.GetComponent<RectTransform>();
fillAreaRect.anchorMin = new Vector2(0f, 0.20f);
fillAreaRect.anchorMax = new Vector2(1f, 0.8f);
fillAreaRect.anchoredPosition = new Vector2(0f, 0f);
fillAreaRect.sizeDelta = new Vector2(-20f, 0f);
Image fillImage = fillObj.AddComponent<Image>();
fillImage.type = Image.Type.Sliced;
fillImage.color = Color.clear;
fillObj.GetComponent<RectTransform>().sizeDelta = new Vector2(10f, 0f);
RectTransform handleSlideRect = handleSlideAreaObj.GetComponent<RectTransform>();
handleSlideRect.anchorMin = new Vector2(0f, 0f);
handleSlideRect.anchorMax = new Vector2(1f, 1f);
handleSlideRect.offsetMin = new Vector2(25f, 30f);
handleSlideRect.pivot = new Vector2(0.5f, 0.5f);
handleSlideRect.offsetMin = new Vector2(27f, 30f);
handleSlideRect.offsetMax = new Vector2(-15f, 0f);
handleSlideRect.sizeDelta = new Vector2(-20f, -30f);
@ -165,13 +154,12 @@ namespace UnityExplorer.UI.Utility
sliderBarLayout.flexibleHeight = 5000;
slider = sliderObj.AddComponent<Slider>();
slider.fillRect = fillObj.GetComponent<RectTransform>();
//slider.fillRect = fillObj.GetComponent<RectTransform>();
slider.handleRect = handleObj.GetComponent<RectTransform>();
slider.targetGraphic = handleImage;
slider.direction = Slider.Direction.BottomToTop;
RuntimeProvider.Instance.SetColorBlock(
slider,
RuntimeProvider.Instance.SetColorBlock(slider,
new Color(0.25f, 0.25f, 0.25f),
new Color(0.3f, 0.3f, 0.3f),
new Color(0.2f, 0.2f, 0.2f));