PaintBrushDlg.cs 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. using ShadowStudio.Tool;
  2. using System;
  3. using System.Collections;
  4. using System.Collections.Generic;
  5. using UnityEngine;
  6. using UnityEngine.UI;
  7. using XRTool.Util;
  8. using XRTool.WorldUI;
  9. namespace ShadowStudio.UI
  10. {
  11. [RequireComponent(typeof(WorldDlg))]
  12. public class PaintBrushDlg : UnitySingleton<PaintBrushDlg>
  13. {
  14. private Transform paintBrushGroupTran;
  15. private ToggleGroup paintBrushGroup;
  16. private ColorPaletteDlg colorPaletteDlg;
  17. private Button showColor;
  18. public Transform ShowColorBack;
  19. private Slider brushSlider;
  20. // Start is called before the first frame update
  21. void Start()
  22. {
  23. WorldDlg dlg = GetComponent<WorldDlg>();
  24. paintBrushGroupTran = dlg.GetBreadthChild<Transform>("PaintBrushGroup");
  25. paintBrushGroup = dlg.GetBreadthChild<ToggleGroup>("PaintBrushGroup");
  26. showColor = dlg.GetBreadthChild<Button>("ShowColorBtn");
  27. ShowColorBack = dlg.GetBreadthChild<Transform>("ShowColorBack");
  28. brushSlider = dlg.GetBreadthChild<Slider>("BrushSlider");
  29. brushSlider.onValueChanged.AddListener(OnBrushValueChange);
  30. showColor.onClick.AddListener(ClickOnShowColor);
  31. colorPaletteDlg = transform.GetComponentInChildren<ColorPaletteDlg>(true);
  32. }
  33. private void OnBrushValueChange(float value)
  34. {
  35. DrawPener.Instance.radius = value;
  36. }
  37. public bool isok = false;
  38. public void ClickOnShowColor()
  39. {
  40. isok = !isok;
  41. colorPaletteDlg.gameObject.SetActive(isok);
  42. ShowColorBack.gameObject.SetActive(isok);
  43. }
  44. }
  45. }