public UIInfo(string path, UIType type, UIMaskType maskState = UIMaskType.None) { loadPath = "Prefabs/" + path; uiType = type; maskType = maskState; userDatas = null; }
public void CreateMask(Transform panelTransfrom, UIMaskType uIMaskType, Action onClick) { string suffix = uIMaskType == UIMaskType.Light? "Light": "Dark"; GameObject temp = Instantiate(Resources.Load <GameObject>("Prefabs/MaskImage" + suffix)); temp.transform.SetParent(panelTransfrom, false); temp.transform.SetAsFirstSibling(); //temp.GetComponent<AnimatedButton>().onClick.AddListener(()=>onClick?.Invoke()); }
public void SetMaskWindow(GameObject UIForms, UIMaskType maskType = UIMaskType.Lucency) { topPanel.transform.SetAsLastSibling(); switch (maskType) { //完全透明,不能穿透 case UIMaskType.Lucency: maskPanel.SetActive(true); maskImage.color = maskColors[0]; break; //半透明,不能穿透 case UIMaskType.Translucence: maskPanel.SetActive(true); maskImage.color = maskColors[1]; break; //低透明,不能穿透 case UIMaskType.ImPenetrable: maskPanel.SetActive(true); maskImage.color = maskColors[2]; break; //可以穿透 case UIMaskType.Pentrate: if (maskPanel.activeInHierarchy) { maskPanel.SetActive(false); } break; default: break; } maskPanel.transform.SetAsLastSibling(); UIForms.transform.SetAsLastSibling(); }