コード例 #1
0
        public static void ShowIntroOverlay(BasePlayer player, string message, string command)
        {
            string gui = "ShowIntroOverlay";

            guiList.Add(gui);
            CuiHelper.DestroyUi(player, gui);
            var elements = new CuiElementContainer();
            var mainName = elements.Add(new CuiPanel
            {
                Image =
                {
                    Color = "0.1 0.1 0.1 1"
                },
                RectTransform =
                {
                    AnchorMin = "0 0",
                    AnchorMax = "1 1"
                },
                CursorEnabled = true
            }, "Overlay", gui);

            elements.Add(new CuiLabel
            {
                Text =
                {
                    Text     = message,
                    FontSize =      22,
                    Align    = TextAnchor.MiddleCenter
                },
                RectTransform =
                {
                    AnchorMin = "0.25 0.25",
                    AnchorMax = "0.75 0.75"
                }
            }, mainName);

            if (command == null)
            {
                elements.Add(new CuiButton
                {
                    Button =
                    {
                        Close = mainName,
                        Color = "0 255 0 1"
                    },
                    RectTransform =
                    {
                        AnchorMin = "0.4 0.16",
                        AnchorMax = "0.6 0.2"
                    },
                    Text =
                    {
                        Text     = "I Agree",
                        FontSize =        22,
                        Align    = TextAnchor.MiddleCenter
                    }
                }, mainName);
            }
            else
            {
                me.Puts("using command " + command);
                elements.Add(new CuiButton
                {
                    Button =
                    {
                        Command = command,
                        Color   = "0 255 0 1"
                    },
                    RectTransform =
                    {
                        AnchorMin = "0.4 0.16",
                        AnchorMax = "0.6 0.2"
                    },
                    Text =
                    {
                        Text     = "Start Game",
                        FontSize =           22,
                        Align    = TextAnchor.MiddleCenter
                    }
                }, mainName);
            }


            CuiHelper.AddUi(player, elements);
        }