コード例 #1
0
        public static void ExportCsharp(string fileName, dynamic data)
        {
            Debug.WriteLine("START EXPORT C#");

            TdeList.Clear();

            fileName = fileName + ".txt";

            Export(fileName, $"====================[TDE by APPI]======================");
            Export(fileName, $"                {DateTime.Now:dd/MM/yyyy} {DateTime.Now:HH:mm:ss tt}");
            Export(fileName, $"=======================================================");
            Export(fileName, $"");
            Export(fileName, $"");
            Export(fileName, $"");

            var localData = (IList <Object>)data;

            foreach (var item in localData)
            {
                try
                {
                    var tdeInfo   = new TdeItem();
                    var localItem = (IDictionary <String, Object>)item;

                    foreach (var property in typeof(TdeItem).GetProperties())
                    {
                        property.SetValue(tdeInfo, localItem[property.Name], null);
                    }

                    if (tdeInfo.Type == 0)
                    {
                        Export(fileName, $"DrawRectangle({tdeInfo.PosX}f, {tdeInfo.PosY}f, {tdeInfo.SizeW}f, {tdeInfo.SizeH}f, {tdeInfo.R}, {tdeInfo.G}, {tdeInfo.B}, {tdeInfo.A}, {tdeInfo.VerticalAligment}, {tdeInfo.HorizontalAligment});");
                    }
                    else if (tdeInfo.Type == 1)
                    {
                        Export(fileName, $"DrawText(\"{tdeInfo.Text}\", {tdeInfo.PosX}f, {tdeInfo.PosY}f, {tdeInfo.SizeW}f, {tdeInfo.R}, {tdeInfo.G}, {tdeInfo.B}, {tdeInfo.A}, {tdeInfo.Font}, {tdeInfo.Aligment}, {tdeInfo.Shadow.ToString().ToLower()}, {tdeInfo.Outline.ToString().ToLower()}, 0, {tdeInfo.VerticalAligment}, {tdeInfo.HorizontalAligment});");
                    }
                    else if (tdeInfo.Type == 2)
                    {
                        Export(fileName, $"DrawGameSprite(\"{tdeInfo.Name}\", \"{tdeInfo.Text}\", {tdeInfo.PosX}f, {tdeInfo.PosY}f, {tdeInfo.SizeW}f, {tdeInfo.SizeH}f, {tdeInfo.R}, {tdeInfo.G}, {tdeInfo.B}, {tdeInfo.A}, {tdeInfo.VerticalAligment}, {tdeInfo.HorizontalAligment});");
                    }

                    TdeList.Add(tdeInfo);
                }
                catch (Exception e)
                {
                    Export(fileName, e.ToString());
                    throw;
                }
            }

            Export(fileName, $"");
            Export(fileName, $"");
            Export(fileName, $"");
            Export(fileName, "protected static SizeF Res = GetScreenResolutionMaintainRatio();");
            Export(fileName, "private static float Height = CitizenFX.Core.UI.Screen.Resolution.Height;");
            Export(fileName, "private static readonly float Ratio = Res.Width / Res.Height;");
            Export(fileName, "private static readonly float Width = Height * Ratio;");
            Export(fileName, "");
            Export(fileName, "public static SizeF GetScreenResolutionMaintainRatio()");
            Export(fileName, "{");
            Export(fileName, "    return new SizeF(CitizenFX.Core.UI.Screen.Resolution.Height * ((float) CitizenFX.Core.UI.Screen.Resolution.Width / (float) CitizenFX.Core.UI.Screen.Resolution.Height), CitizenFX.Core.UI.Screen.Resolution.Height);");
            Export(fileName, "}");
            Export(fileName, "");
            Export(fileName, "public static async void DrawGameSprite(string dict, string txtName, float xPos, float yPos, float width, float height, float heading, int r, int g, int b, int alpha, int vAlig = 0, int hAlig = 0)");
            Export(fileName, "{");
            Export(fileName, "    if (!IsHudPreferenceSwitchedOn() || !CitizenFX.Core.UI.Screen.Hud.IsVisible) return;");
            Export(fileName, "");
            Export(fileName, "    if (!HasStreamedTextureDictLoaded(dict))");
            Export(fileName, "        RequestStreamedTextureDict(dict, true);");
            Export(fileName, "");
            Export(fileName, "    float w = width / Width;");
            Export(fileName, "    float h = height / Height;");
            Export(fileName, "    float x = ToHorizontalAlignment(hAlig, xPos) / Width + w * 0.5f;");
            Export(fileName, "    float y = ToVerticalAlignment(vAlig, yPos) / Height + h * 0.5f;");
            Export(fileName, "");
            Export(fileName, "    CitizenFX.Core.Native.API.DrawSprite(dict, txtName, x, y, w, h, heading, r, g, b, alpha);");
            Export(fileName, "}");
            Export(fileName, "");
            Export(fileName, "");
            Export(fileName, "public static void DrawRectangle(float xPos, float yPos, float wSize, float hSize, int r, int g, int b, int alpha, int vAlig = 0, int hAlig = 0)");
            Export(fileName, "{");
            Export(fileName, "    if (!IsHudPreferenceSwitchedOn() || !CitizenFX.Core.UI.Screen.Hud.IsVisible) return;");
            Export(fileName, "");
            Export(fileName, "    float w = width / Width;");
            Export(fileName, "    float h = height / Height;");
            Export(fileName, "    float x = ToHorizontalAlignment(hAlig, xPos) / Width + w * 0.5f;");
            Export(fileName, "    float y = ToVerticalAlignment(vAlig, yPos) / Height + h * 0.5f;");
            Export(fileName, "");
            Export(fileName, "    DrawRect(x, y, w, h, r, g, b, alpha);");
            Export(fileName, "}");
            Export(fileName, "");
            Export(fileName, "public static void DrawText(string caption, float xPos, float yPos, float scale, int r, int g, int b, int alpha, int font, int justify, bool shadow, bool outline, int wordWrap, int vAlig = 0, int hAlig = 0)");
            Export(fileName, "{");
            Export(fileName, "    if (!IsHudPreferenceSwitchedOn() || !CitizenFX.Core.UI.Screen.Hud.IsVisible) return;");
            Export(fileName, "");
            Export(fileName, "    float x = ToHorizontalAlignment(hAlig, xPos) / Width;");
            Export(fileName, "    float y = ToVerticalAlignment(vAlig, yPos) / Height;");
            Export(fileName, "");
            Export(fileName, "    SetTextFont(font);");
            Export(fileName, "    SetTextScale(1f, scale);");
            Export(fileName, "    SetTextColour(r, g, b, alpha);");
            Export(fileName, "    if (shadow) SetTextDropShadow();");
            Export(fileName, "    if (outline) SetTextOutline();");
            Export(fileName, "");
            Export(fileName, "    switch (justify)");
            Export(fileName, "    {");
            Export(fileName, "        case 1:");
            Export(fileName, "            SetTextCentre(true);");
            Export(fileName, "            break;");
            Export(fileName, "        case 2:");
            Export(fileName, "            SetTextRightJustify(true);");
            Export(fileName, "            SetTextWrap(0, x);");
            Export(fileName, "            break;");
            Export(fileName, "    }");
            Export(fileName, "");
            Export(fileName, "    if (wordWrap != 0)");
            Export(fileName, "        SetTextWrap(x, (xPos + wordWrap) / Width);");
            Export(fileName, "");
            Export(fileName, "    BeginTextCommandDisplayText(\"STRING\");");
            Export(fileName, "");
            Export(fileName, "    const int maxStringLength = 99;");
            Export(fileName, "    for (int i = 0; i < caption.Length; i += maxStringLength)");
            Export(fileName, "        AddTextComponentSubstringPlayerName(caption.Substring(i, System.Math.Min(maxStringLength, caption.Length - i)));");
            Export(fileName, "    EndTextCommandDisplayText(x, y);");
            Export(fileName, "}");
            Export(fileName, "");
            Export(fileName, "public static float ToVerticalAlignment(int type, float x)");
            Export(fileName, "{");
            Export(fileName, "    if (type == 2)");
            Export(fileName, "        return Res.Height - x;");
            Export(fileName, "    if (type == 1)");
            Export(fileName, "        return Res.Height / 2 + x;");
            Export(fileName, "    return x;");
            Export(fileName, "}");
            Export(fileName, "");
            Export(fileName, "public static float ToHorizontalAlignment(int type, float y)");
            Export(fileName, "{");
            Export(fileName, "    if (type == 2)");
            Export(fileName, "        return Res.Width - y;");
            Export(fileName, "    if (type == 1)");
            Export(fileName, "        return Res.Width / 2 + y;");
            Export(fileName, "    return y;");
            Export(fileName, "}");
            Export(fileName, "");
            Export(fileName, "");
            Export(fileName, "");
            Export(fileName, $"=====================[Count {TdeList.Count}]======================");

            Debug.WriteLine($"FINISH EXPORT TEXT DRAWS ({TdeList.Count})");
        }
コード例 #2
0
        public static void ShowMainMenu()
        {
            HideMenu();
            var menu = new Menu();

            UiMenu = menu.Create("Menu", "~b~By Appi");

            ShowCursor(false);

            var list = new List <dynamic> {
                "Rectangle", "Text", "Sprite"
            };

            menu.AddMenuItemList(UiMenu, "Create", list).OnListSelected += async(uimenu, index) =>
            {
                HideMenu();

                if (index == 0)
                {
                    var tdeItem = new TdeItem
                    {
                        Id         = TdeList.Count,
                        Type       = index,
                        Text       = "Rectangle",
                        R          = 255,
                        G          = 255,
                        B          = 255,
                        A          = 255,
                        SizeW      = 100f,
                        SizeH      = 10f,
                        IsSelected = true
                    };
                    TdeList.Add(tdeItem);

                    foreach (var localItem in TdeList)
                    {
                        localItem.IsSelected = localItem.Id == tdeItem.Id;
                    }
                }
                else if (index == 1)
                {
                    string text = await Menu.GetUserInput("Text...", null, 128);

                    var tdeItem = new TdeItem
                    {
                        Id         = TdeList.Count,
                        Type       = index,
                        Text       = text,
                        R          = 255,
                        G          = 255,
                        B          = 255,
                        A          = 255,
                        SizeW      = 1f,
                        IsSelected = true
                    };

                    TdeList.Add(tdeItem);

                    foreach (var localItem in TdeList)
                    {
                        localItem.IsSelected = localItem.Id == tdeItem.Id;
                    }
                }
                else if (index == 2)
                {
                    string name = await Menu.GetUserInput("Dict", null, 128);

                    string text = await Menu.GetUserInput("Name", null, 128);

                    var tdeItem = new TdeItem
                    {
                        Id         = TdeList.Count,
                        Type       = index,
                        Text       = text,
                        Name       = name,
                        R          = 255,
                        G          = 255,
                        B          = 255,
                        A          = 255,
                        SizeW      = 100f,
                        SizeH      = 100f,
                        IsSelected = true
                    };

                    TdeList.Add(tdeItem);

                    foreach (var localItem in TdeList)
                    {
                        localItem.IsSelected = localItem.Id == tdeItem.Id;
                    }
                }

                ShowCursor(true);
                SendNotification("You can edit position (use LMB)");
                SendNotification("Press ~b~F1~s~ if you wanna stop edit");
            };

            menu.AddMenuItem(UiMenu, "TDE List").Activated += (uimenu, index) =>
            {
                HideMenu();
                ShowTdeListMenu();
            };

            var outline = new List <dynamic> {
                "Disable", "Enable"
            };
            var menuListItem2 = menu.AddMenuItemList(UiMenu, "Debug", outline);

            menuListItem2.Index           = EnableDebug ? 1 : 0;
            menuListItem2.OnListSelected += (uimenu, index) =>
            {
                EnableDebug = index == 1;
            };

            menu.AddMenuItem(UiMenu, "~g~Export (C#)").Activated += async(uimenu, index) =>
            {
                HideMenu();
                if (TdeList.Count < 1)
                {
                    SendNotification("~r~There are no textdraws created.");
                    return;
                }
                var fileName = await Menu.GetUserInput("File name");

                TriggerServerEvent("TDE:Export:Csharp", fileName, TdeList);
                SendNotification($"Export ~b~C#~s~. Filename: ~b~{fileName}.txt");
            };


            menu.AddMenuItem(UiMenu, "~g~Export (Lua)").Activated += async(uimenu, index) =>
            {
                HideMenu();
                if (TdeList.Count < 1)
                {
                    SendNotification("~r~There are no textdraws created.");
                    return;
                }
                var fileName = await Menu.GetUserInput("File name");

                TriggerServerEvent("TDE:Export:Lua", fileName, TdeList);
                SendNotification($"Export ~b~Lua~s~. Filename: ~b~{fileName}.lua");
            };

            menu.AddMenuItem(UiMenu, "~o~Clear All").Activated += (uimenu, index) =>
            {
                HideMenu();
                ShowClearAllMenu();
            };

            menu.AddMenuItem(UiMenu, "~r~Close").Activated += (uimenu, item) =>
            {
                HideMenu();
            };

            MenuPool.Add(UiMenu);
        }
コード例 #3
0
        public static void ExportLua(string fileName, dynamic data)
        {
            Debug.WriteLine("START EXPORT LUA");

            TdeList.Clear();

            fileName = fileName + ".lua";

            Export(fileName, $"--====================[TDE by APPI]======================");
            Export(fileName, $"--                {DateTime.Now:dd/MM/yyyy} {DateTime.Now:HH:mm:ss tt}");
            Export(fileName, $"--                Thanks Disquse for help");
            Export(fileName, $"--=======================================================");
            Export(fileName, $"");
            Export(fileName, $"");
            Export(fileName, $"");
            Export(fileName, $"local Width, Height = GetActiveScreenResolution()");
            Export(fileName, $"");
            Export(fileName, $"");
            Export(fileName, $"Citizen.CreateThread(function()");
            Export(fileName, $"    while true do");
            Export(fileName, $"        Width, Height = GetActiveScreenResolution()");
            Export(fileName, $"        Wait(100)");
            Export(fileName, $"    end");
            Export(fileName, $"end)");
            Export(fileName, $"");
            Export(fileName, $"");
            Export(fileName, $"local function ToHorizontalAlignment(atype, x)");
            Export(fileName, $"    if atype == 2 then");
            Export(fileName, $"        return Width - x");
            Export(fileName, $"    elseif atype == 1 then");
            Export(fileName, $"        return Width / 2 + x");
            Export(fileName, $"    end");
            Export(fileName, $"    return x");
            Export(fileName, $"end");
            Export(fileName, $"");
            Export(fileName, $"local function ToVerticalAlignment(atype, y)");
            Export(fileName, $"    if atype == 2 then");
            Export(fileName, $"        return Height - y");
            Export(fileName, $"    elseif atype == 1 then");
            Export(fileName, $"        return Height / 2 + y");
            Export(fileName, $"    end");
            Export(fileName, $"    return y");
            Export(fileName, $"end");
            Export(fileName, $"");
            Export(fileName, $"function DrawText(caption, xPos, yPos, scale, r, g, b, alpha, font, justify, shadow, outline, wordWrap, vAlig, hAlig)");
            Export(fileName, $"    vAlig = vAlig or 0");
            Export(fileName, $"    hAlig = hAlig or 0");
            Export(fileName, $"");
            Export(fileName, $"");
            Export(fileName, $"    if not IsHudPreferenceSwitchedOn() or IsHudHidden() then");
            Export(fileName, $"        return");
            Export(fileName, $"    end");
            Export(fileName, $"");
            Export(fileName, $"    local x = ToHorizontalAlignment(hAlig, xPos) / Width");
            Export(fileName, $"    local y = ToVerticalAlignment(vAlig, yPos) / Height");
            Export(fileName, $"");
            Export(fileName, $"    SetTextFont(font);");
            Export(fileName, $"    SetTextScale(1.0, scale);");
            Export(fileName, $"    SetTextColour(r, g, b, alpha);");
            Export(fileName, $"");
            Export(fileName, $"    if shadow then SetTextDropShadow() end");
            Export(fileName, $"    if outline then SetTextOutline() end");
            Export(fileName, $"");
            Export(fileName, $"    if justify == 1 then");
            Export(fileName, $"        SetTextCentre(true)");
            Export(fileName, $"    elseif justify == 2 then");
            Export(fileName, $"        SetTextRightJustify(true)");
            Export(fileName, $"        SetTextWrap(0, x)");
            Export(fileName, $"    end");
            Export(fileName, $"");
            Export(fileName, $"    if wordWrap ~= 0 then");
            Export(fileName, $"        SetTextWrap(x, (xPos + wordWrap) / Width)");
            Export(fileName, $"    end");
            Export(fileName, $"");
            Export(fileName, $"    BeginTextCommandDisplayText(\"STRING\")");
            Export(fileName, $"    local maxStringLength = 99");
            Export(fileName, $"    for i = 0, #caption, maxStringLength do");
            Export(fileName, $"        AddTextComponentSubstringPlayerName(string.sub(caption, i, #caption))");
            Export(fileName, $"    end");
            Export(fileName, $"    EndTextCommandDisplayText(x, y)");
            Export(fileName, $"end");
            Export(fileName, $"");
            Export(fileName, $"function DrawGameSprite(dict, txtName, xPos, yPos, width, height, heading, r, g, b, alpha, vAlig, hAlig)");
            Export(fileName, $"    vAlig = vAlig or 0");
            Export(fileName, $"    hAlig = hAlig or 0");
            Export(fileName, $"");
            Export(fileName, $"");
            Export(fileName, $"    if not IsHudPreferenceSwitchedOn() or IsHudHidden() then");
            Export(fileName, $"        return");
            Export(fileName, $"    end");
            Export(fileName, $"");
            Export(fileName, $"    local x = ToHorizontalAlignment(hAlig, xPos) / Width");
            Export(fileName, $"    local y = ToVerticalAlignment(vAlig, yPos) / Height");
            Export(fileName, $"");
            Export(fileName, $"    if not HasStreamedTextureDictLoaded(dict) then");
            Export(fileName, $"        RequestStreamedTextureDict(dict, true)");
            Export(fileName, $"    end");
            Export(fileName, $"");
            Export(fileName, $"    local w = wSize / Width");
            Export(fileName, $"    local h = hSize / Height");
            Export(fileName, $"    local x = ToHorizontalAlignment(hAlig, xPos) / Width + w * 0.5");
            Export(fileName, $"    local y = ToVerticalAlignment(vAlig, yPos) / Height + h * 0.5");
            Export(fileName, $"");
            Export(fileName, $"    DrawSprite(dict, txtName, x, y, w, h, heading, r, g, b, alpha)");
            Export(fileName, $"end");
            Export(fileName, $"");
            Export(fileName, $"function DrawRectangle(xPos, yPos, wSize, hSize, r, g, b, alpha, vAlig, hAlig)");
            Export(fileName, $"    vAlig = vAlig or 0");
            Export(fileName, $"    hAlig = hAlig or 0");
            Export(fileName, $"");
            Export(fileName, $"");
            Export(fileName, $"    if not IsHudPreferenceSwitchedOn() or IsHudHidden() then");
            Export(fileName, $"        return");
            Export(fileName, $"    end");
            Export(fileName, $"");
            Export(fileName, $"    local w = wSize / Width");
            Export(fileName, $"    local h = hSize / Height");
            Export(fileName, $"    local x = ToHorizontalAlignment(hAlig, xPos) / Width + w * 0.5");
            Export(fileName, $"    local y = ToVerticalAlignment(vAlig, yPos) / Height + h * 0.5");
            Export(fileName, $"");
            Export(fileName, $"    DrawRect(x, y, w, h, r, g, b, alpha)");
            Export(fileName, $"end");
            Export(fileName, $"");
            Export(fileName, $"");
            Export(fileName, $"");
            Export(fileName, $"Citizen.CreateThread(function()");
            Export(fileName, $"    while true do");

            var localData = (IList <Object>)data;

            foreach (var item in localData)
            {
                try
                {
                    var tdeInfo   = new TdeItem();
                    var localItem = (IDictionary <String, Object>)item;

                    foreach (var property in typeof(TdeItem).GetProperties())
                    {
                        property.SetValue(tdeInfo, localItem[property.Name], null);
                    }

                    if (tdeInfo.Type == 0)
                    {
                        Export(fileName, $"        DrawRectangle({tdeInfo.PosX}, {tdeInfo.PosY}, {tdeInfo.SizeW}, {tdeInfo.SizeH}, {tdeInfo.R}, {tdeInfo.G}, {tdeInfo.B}, {tdeInfo.A}, {tdeInfo.VerticalAligment}, {tdeInfo.HorizontalAligment})");
                    }
                    else if (tdeInfo.Type == 1)
                    {
                        Export(fileName, $"        DrawText(\"{tdeInfo.Text}\", {tdeInfo.PosX}, {tdeInfo.PosY}, {tdeInfo.SizeW}, {tdeInfo.R}, {tdeInfo.G}, {tdeInfo.B}, {tdeInfo.A}, {tdeInfo.Font}, {tdeInfo.Aligment}, {tdeInfo.Shadow.ToString().ToLower()}, {tdeInfo.Outline.ToString().ToLower()}, 0, {tdeInfo.VerticalAligment}, {tdeInfo.HorizontalAligment})");
                    }
                    else if (tdeInfo.Type == 2)
                    {
                        Export(fileName, $"        DrawGameSprite(\"{tdeInfo.Name}\", \"{tdeInfo.Text}\", {tdeInfo.PosX}, {tdeInfo.PosY}, {tdeInfo.SizeW}, {tdeInfo.SizeH}, {tdeInfo.R}, {tdeInfo.G}, {tdeInfo.B}, {tdeInfo.A}, {tdeInfo.VerticalAligment}, {tdeInfo.HorizontalAligment})");
                    }

                    TdeList.Add(tdeInfo);
                }
                catch (Exception e)
                {
                    Export(fileName, e.ToString());
                    throw;
                }
            }

            Export(fileName, $"        Wait(0)");
            Export(fileName, $"    end");
            Export(fileName, $"end)");
            Export(fileName, $"");
            Export(fileName, $"");
            Export(fileName, $"");
            Export(fileName, $"--=====================[Count {TdeList.Count}]======================");

            Debug.WriteLine($"FINISH EXPORT TEXT DRAWS ({TdeList.Count})");
        }
コード例 #4
0
        public static void ShowItemEditMenu(TdeItem tdeItem)
        {
            HideMenu();
            var menu = new Menu();

            UiMenu = menu.Create("Menu", $"~b~Edit: {tdeItem.Text}");

            foreach (var localItem in TdeList)
            {
                localItem.IsSelected = localItem.Id == tdeItem.Id;
            }

            menu.AddMenuItem(UiMenu, "Edit position").Activated += (uimenu, index) =>
            {
                HideMenu();
                ShowCursor(true);
                SendNotification("You can edit position (use LMB)");
                SendNotification("Press ~b~F1~s~ if you wanna stop edit");
            };

            menu.AddMenuItem(UiMenu, "Set RGBA color").Activated += async(uimenu, index) =>
            {
                HideMenu();
                int r = Convert.ToInt32(await Menu.GetUserInput("R", null, 3));
                int g = Convert.ToInt32(await Menu.GetUserInput("G", null, 3));
                int b = Convert.ToInt32(await Menu.GetUserInput("B", null, 3));
                int a = Convert.ToInt32(await Menu.GetUserInput("A", null, 3));

                foreach (var localItem in TdeList)
                {
                    if (tdeItem.Id != localItem.Id)
                    {
                        continue;
                    }
                    localItem.R = r;
                    localItem.G = g;
                    localItem.B = b;
                    localItem.A = a;
                    tdeItem.R   = r;
                    tdeItem.G   = g;
                    tdeItem.B   = b;
                    tdeItem.A   = a;
                    SendNotification($"New color: {r} {g} {b} {a}");
                    ShowItemEditMenu(localItem);
                }
            };

            if (tdeItem.Type == 0 || tdeItem.Type == 2)
            {
                menu.AddMenuItem(UiMenu, "Size").Activated += async(uimenu, index) =>
                {
                    HideMenu();
                    float w = float.Parse(await Menu.GetUserInput("Width", null, 10));
                    float h = float.Parse(await Menu.GetUserInput("Height", null, 10));
                    foreach (var localItem in TdeList)
                    {
                        if (tdeItem.Id != localItem.Id)
                        {
                            continue;
                        }
                        localItem.SizeW = w;
                        localItem.SizeH = h;
                        tdeItem.SizeW   = w;
                        tdeItem.SizeH   = h;
                        SendNotification($"New size: {w}px {h}px");
                        ShowItemEditMenu(localItem);
                    }
                };

                if (tdeItem.Type == 2)
                {
                    var menuItem0 = menu.AddMenuItem(UiMenu, "Heading");
                    menuItem0.SetRightLabel(tdeItem.Heading.ToString(CultureInfo.InvariantCulture));
                    menuItem0.Activated += async(uimenu, index) =>
                    {
                        HideMenu();
                        float w = float.Parse(await Menu.GetUserInput("Heading", null, 10));
                        foreach (var localItem in TdeList)
                        {
                            if (tdeItem.Id != localItem.Id)
                            {
                                continue;
                            }
                            localItem.Heading = w;
                            tdeItem.Heading   = w;
                            SendNotification($"New heading: {w}");
                            ShowItemEditMenu(localItem);
                        }
                    };
                }
            }
            else if (tdeItem.Type == 1)
            {
                menu.AddMenuItem(UiMenu, "Edit label").Activated += async(uimenu, index) =>
                {
                    HideMenu();
                    string l = await Menu.GetUserInput("New label", null, 128);

                    foreach (var localItem in TdeList)
                    {
                        if (tdeItem.Id != localItem.Id)
                        {
                            continue;
                        }
                        localItem.Text = l;
                        tdeItem.Text   = l;
                        SendNotification($"New label: {l}");
                        ShowItemEditMenu(localItem);
                    }
                };

                var menuItem0 = menu.AddMenuItem(UiMenu, "Font size");
                menuItem0.SetRightLabel(tdeItem.SizeW.ToString(CultureInfo.InvariantCulture));
                menuItem0.Activated += async(uimenu, index) =>
                {
                    HideMenu();
                    float w = float.Parse(await Menu.GetUserInput("Size", null, 10));
                    foreach (var localItem in TdeList)
                    {
                        if (tdeItem.Id != localItem.Id)
                        {
                            continue;
                        }
                        localItem.SizeW = w;
                        tdeItem.SizeW   = w;
                        SendNotification($"New font size: {w}");
                        ShowItemEditMenu(localItem);
                    }
                };

                var font = new List <dynamic> {
                    "0", "1", "2", "3", "4", "5", "6", "7"
                };
                var menuListItem0 = menu.AddMenuItemList(UiMenu, "Font", font);
                menuListItem0.Index           = tdeItem.Font;
                menuListItem0.OnListSelected += (uimenu, index) =>
                {
                    foreach (var localItem in TdeList)
                    {
                        if (tdeItem.Id != localItem.Id)
                        {
                            continue;
                        }
                        localItem.Font = index;
                        tdeItem.Font   = index;
                        SendNotification($"New font: {font[index]}");
                    }
                };

                var aligment = new List <dynamic> {
                    "Left", "Center", "Right"
                };
                var menuListItem1 = menu.AddMenuItemList(UiMenu, "Aligment", aligment);
                menuListItem1.Index           = tdeItem.Aligment;
                menuListItem1.OnListSelected += (uimenu, index) =>
                {
                    foreach (var localItem in TdeList)
                    {
                        if (tdeItem.Id != localItem.Id)
                        {
                            continue;
                        }
                        localItem.Aligment = index;
                        tdeItem.Aligment   = index;
                        SendNotification($"New aligment: {aligment[index]}");
                    }
                };

                var outline = new List <dynamic> {
                    "Disable", "Enable"
                };
                var menuListItem2 = menu.AddMenuItemList(UiMenu, "Outline", outline);
                menuListItem2.Index           = tdeItem.Outline ? 1 : 0;
                menuListItem2.OnListSelected += (uimenu, index) =>
                {
                    foreach (var localItem in TdeList)
                    {
                        if (tdeItem.Id != localItem.Id)
                        {
                            continue;
                        }
                        localItem.Outline = index == 1;
                        tdeItem.Outline   = index == 1;
                        SendNotification($"New outline: {outline[index]}");
                    }
                };

                var shadow = new List <dynamic> {
                    "Disable", "Enable"
                };
                var menuListItem3 = menu.AddMenuItemList(UiMenu, "Shadow", shadow);
                menuListItem3.Index           = tdeItem.Shadow ? 1 : 0;
                menuListItem3.OnListSelected += (uimenu, index) =>
                {
                    foreach (var localItem in TdeList)
                    {
                        if (tdeItem.Id != localItem.Id)
                        {
                            continue;
                        }
                        localItem.Shadow = index == 1;
                        tdeItem.Shadow   = index == 1;
                        SendNotification($"New shadow: {shadow[index]}");
                    }
                };
            }

            var floatH = new List <dynamic> {
                "Up", "Center", "Down"
            };
            var menuListItem4 = menu.AddMenuItemList(UiMenu, "Vertical align", floatH);

            menuListItem4.Index           = tdeItem.VerticalAligment;
            menuListItem4.OnListSelected += (uimenu, index) =>
            {
                foreach (var localItem in TdeList)
                {
                    if (tdeItem.Id != localItem.Id)
                    {
                        continue;
                    }
                    localItem.VerticalAligment = index;
                    tdeItem.VerticalAligment   = index;
                    SendNotification($"New float vertical: {floatH[index]}");
                }
            };

            var floatW = new List <dynamic> {
                "Left", "Center", "Right"
            };
            var menuListItem5 = menu.AddMenuItemList(UiMenu, "Horizontal align", floatW);

            menuListItem5.Index           = tdeItem.HorizontalAligment;
            menuListItem5.OnListSelected += (uimenu, index) =>
            {
                foreach (var localItem in TdeList)
                {
                    if (tdeItem.Id != localItem.Id)
                    {
                        continue;
                    }
                    localItem.HorizontalAligment = index;
                    tdeItem.HorizontalAligment   = index;
                    SendNotification($"New float horizontal: {floatW[index]}");
                }
            };

            menu.AddMenuItem(UiMenu, "~g~Copy").Activated += (uimenu, item) =>
            {
                HideMenu();
                TdeList.Add(tdeItem);
                ShowTdeListMenu();
            };

            menu.AddMenuItem(UiMenu, "~o~Delete").Activated += (uimenu, item) =>
            {
                HideMenu();
                TdeList.Remove(tdeItem);
                ShowTdeListMenu();
            };

            menu.AddMenuItem(UiMenu, "~r~Close").Activated += (uimenu, item) =>
            {
                HideMenu();
                ShowCursor(false);
            };

            MenuPool.Add(UiMenu);
        }