using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using UnityEngine; using UnityEngine.UI; using UnityEngine.EventSystems; //namespace Assets.Scripts.UI.Prefab.Panel //{ public class PFUIPanel : UIBehaviour { public void OpenURL(string url) { Application.OpenURL(url); } public virtual void Show() { base.gameObject.SetActive(true); } public virtual void Close() { //DestroyImmediate(this.gameObject); this.gameObject.SetActive(false); } public void AddChild(PFUIPanel child) { if(child == null) { return; } child.transform.SetParent(this.transform); } /// /// 给对象设置圆角 /// /// /// protected void SetRounded(Transform panel, float radius) { var rounded = Resources.Load("UI/Material/RoundedCornersTextureMaterial"); var material = Instantiate(rounded); var rect = ((RectTransform)panel).rect; material.SetVector(Shader.PropertyToID("_WidthHeightRadius"), new Vector4(rect.width, rect.height, radius, 0)); var img = panel.GetComponent(); if (img != null) { img.material = material; return; } var rawImg = panel.GetComponent(); if(rawImg != null) { rawImg.material = material; return; } } } //}