public void InitUIType(bool isClearStack, bool isESCClose, bool isClickElsewhereClose, UIFormTypes uiForms_Type, UIFormShowModes uiForms_ShowMode, UIFormLucencyTypes uiForm_LucencyType) { IsClearStack = isClearStack; IsESCClose = isESCClose; IsClickElsewhereClose = isClickElsewhereClose; UIForms_Type = uiForms_Type; UIForms_ShowMode = uiForms_ShowMode; UIForm_LucencyType = uiForm_LucencyType; }
/// <summary> /// 设置遮罩状态 /// </summary> /// <param name="goDisplayUIForms">需要显示的UI窗体</param> /// <param name="lucencyType">显示透明度属性</param> public void SetMaskWindow(GameObject goDisplayUIForms, UIFormTypes uiFormType, UIFormLucencyTypes lucencyType) { bool needMask = uiFormType == UIFormTypes.PopUp || uiFormType == UIFormTypes.Fixed; bool needMask_Blur = uiFormType == UIFormTypes.PopUp; //顶层窗体下移 UIRoot.transform.SetAsLastSibling(); //启用遮罩窗体以及设置透明度 switch (lucencyType) { //完全透明,不能穿透 case UIFormLucencyTypes.Lucency: MaskPanel.SetActive(needMask); Color newColor0 = new Color(1, 1, 1, 0); MaskPanel_Image.color = newColor0; MaskPanel_Blur.SetActive(false); break; //毛玻璃效果,不能穿透 case UIFormLucencyTypes.Blur: MaskPanel.SetActive(false); MaskPanel_Blur.SetActive(needMask_Blur); RootManager.Instance.StartBlurBackGround(); break; //半透明,不能穿透 case UIFormLucencyTypes.Translucence: MaskPanel.SetActive(needMask); Color newColor2 = new Color(0, 0, 0, 0.2f); MaskPanel_Image.color = newColor2; MaskPanel_Blur.SetActive(false); break; //低透明,不能穿透 case UIFormLucencyTypes.ImPenetrable: MaskPanel.SetActive(needMask); Color newColor3 = new Color(0, 0, 0, 0.8f); MaskPanel_Image.color = newColor3; MaskPanel_Blur.SetActive(false); break; //可以穿透 case UIFormLucencyTypes.Penetrable: MaskPanel.SetActive(false); MaskPanel_Blur.SetActive(false); break; } //遮罩窗体下移 MaskPanel.transform.SetAsLastSibling(); MaskPanel_Blur.transform.SetAsLastSibling(); //显示窗体的下移 goDisplayUIForms.transform.SetAsLastSibling(); }