简单的Unity全局弹窗方式

Unity版本2020.3.27f

WebGL示例

资源使用方式

  1. 直接克隆该项目
  2. 导入unitypackage包

使用方法

显示弹窗


PopupWindowControl.Instance.AccordingToPopupWindow(new PopupWindowControl.CC_PopupWindow()
        {
            Title = new PopupWindowControl.CC_Title()
            {
                TitleColor = new Color(1.0f,0.5f,0.5f,1.0f),
                TitleText = "示例标题",
                TitleTextColor = Color.white
            },
            Body = new PopupWindowControl.CC_Body()
            {
                BodyColor = new Color(1.0f,0.5f,0.5f,1.0f),
                BodyText = "示例内容",
                BodyTextColor = Color.white
            },
            Buttons = new List<PopupWindowControl.CC_Button>()
            {
                new PopupWindowControl.CC_Button()
                {
                    ButtonColor =new Color(1.0f,0.5f,0.5f,1.0f),
                    ButtonText = "确定",
                    ButtonTextColor = Color.white,
                    CallBack = (g =>
                    {
                        Debug.Log("按下按钮");
                        PopupWindowControl.Instance.ClosePopupWindow(g);
                    })
                },
                new PopupWindowControl.CC_Button()
                {
                    ButtonColor = Color.gray,
                    ButtonText = "取消",
                    ButtonTextColor = Color.white,
                    CallBack = (g =>
                    {
                        Debug.Log("按下按钮");
                        PopupWindowControl.Instance.ClosePopupWindow(g);
                    })
                }
            }
        });

关闭弹窗


PopupWindowControl.Instance.ClosePopupWindow(g);

演示视频

https://user-images.githubusercontent.com/57337795/160265258-99da2131-100a-44ed-89d9-fdcb6bb60dd6.mp4

Last modification:March 27, 2022
本文作者:
文章标题:简单的Unity全局弹窗方式
本文地址:https://www.ccrui.cn/archives/259.html
版权说明:若无注明,本文皆个人的辣鸡小站原创,转载请保留文章出处。
如果觉得我的文章对你有用,请随意赞赏