if _G.WINDUI_SITE_LOCK then print("[windui] 脚本已在运行,跳过重复注入") return end _G.WINDUI_SITE_LOCK = true local SITE = "https://raw.gaychou.top" local URL_MAIN = SITE .. "/api/windui-official.php" local URL_PART = SITE .. "/api/windui-part.php" local PARTS = 6 local cloneref_fn = (type(cloneref) == "function" and cloneref) or function(s) return s end local Players = cloneref_fn(game:GetService("Players")) local LocalPlayer = Players.LocalPlayer local function getCoreGui() local ok, h = pcall(function() if type(gethui) == "function" then return gethui() end return nil end) if ok and h then return h end local ok2, cg = pcall(function() return game:GetService("CoreGui") end) if ok2 and cg then return cg end return LocalPlayer:WaitForChild("PlayerGui", 10) end local function makeBox(parent, titleText) local gui = Instance.new("ScreenGui") gui.Name = "WINDUI_SITE_StatusBox" gui.ResetOnSpawn = false gui.IgnoreGuiInset = true gui.DisplayOrder = 9999 gui.Parent = parent local frame = Instance.new("Frame") frame.AnchorPoint = Vector2.new(0.5, 0.5) frame.Position = UDim2.new(0.5, 0, 0.5, 0) frame.Size = UDim2.new(0, 440, 0, 110) frame.BackgroundColor3 = Color3.fromRGB(28, 30, 28) frame.BackgroundTransparency = 0.08 frame.BorderSizePixel = 0 frame.Parent = gui local corner = Instance.new("UICorner") corner.CornerRadius = UDim.new(0, 10) corner.Parent = frame local title = Instance.new("TextLabel") title.Size = UDim2.new(1, -24, 0, 26) title.Position = UDim2.new(0, 12, 0, 10) title.BackgroundTransparency = 1 title.Text = titleText title.TextColor3 = Color3.fromRGB(180, 255, 180) title.TextSize = 18 title.Font = Enum.Font.GothamBold title.TextXAlignment = Enum.TextXAlignment.Left title.Parent = frame local body = Instance.new("TextLabel") body.Size = UDim2.new(1, -24, 1, -52) body.Position = UDim2.new(0, 12, 0, 40) body.BackgroundTransparency = 1 body.Text = "" body.TextColor3 = Color3.fromRGB(230, 230, 230) body.TextSize = 15 body.Font = Enum.Font.Gotham body.TextXAlignment = Enum.TextXAlignment.Left body.TextYAlignment = Enum.TextYAlignment.Top body.TextWrapped = true body.Parent = frame return { say = function(text) body.Text = tostring(text) body.TextColor3 = Color3.fromRGB(230, 230, 230) end, error = function(text) frame.BackgroundColor3 = Color3.fromRGB(60, 24, 24) title.Text = titleText .. " · 出错" title.TextColor3 = Color3.fromRGB(255, 120, 120) body.Text = tostring(text) body.TextColor3 = Color3.fromRGB(255, 190, 190) end, destroy = function() gui:Destroy() end, } end local function checkLib(src) if type(src) ~= "string" or #src < 10000 then return false end if src:find("WindUI", 1, true) then return true end return false end local function fetchWhole() local ok, res = pcall(function() return game:HttpGet(URL_MAIN, true) end) if ok and checkLib(res) then return res end return nil, tostring(res) end local function fetchParts(onProgress) local buf = {} for i = 1, PARTS do onProgress(i, PARTS) local ok, res = pcall(function() return game:HttpGet(URL_PART .. "?n=" .. i .. "&parts=" .. PARTS, true) end) if not ok or type(res) ~= "string" or #res == 0 then return nil, "第 " .. i .. "/" .. PARTS .. " 片下载失败:" .. tostring(res) end buf[#buf + 1] = res end local src = table.concat(buf) if not checkLib(src) then return nil, "拼接后校验未通过(共 " .. #src .. " 字节)" end return src end local function onReady(WindUI, Window) local Tab = Window:Tab({ Title = "示例", Icon = "solar:widget-add-bold-duotone", }) Tab:Section({ Title = "照着自己的功能往里加" }) Tab:Button({ Title = "发一条通知", Desc = "调用 WindUI:Notify", Callback = function() WindUI:Notify({ Title = "Hello", Content = "站内 WindUI 加载成功,通知可用", Duration = 3, }) end, }) Tab:Toggle({ Title = "示例开关", Default = false, Callback = function(v) print("[windui] 开关状态:", v) end, }) Tab:Slider({ Title = "示例滑条", Value = { Min = 0, Max = 100, Default = 50 }, Callback = function(v) print("[windui] 滑条:", v) end, }) Tab:Dropdown({ Title = "示例下拉", Values = { "选项 A", "选项 B", "选项 C" }, Default = "选项 A", Callback = function(v) print("[windui] 下拉:", v) end, }) WindUI:Notify({ Title = "站内 WindUI", Content = "加载完成,右键(手机长按)隐藏按钮可收起", Duration = 4, }) end local function main() local coreGui = getCoreGui() local box = makeBox(coreGui, "站内 WindUI · 加载中") box.say("初始化...") box.say("下载 WindUI(整包)...") local src, err = fetchWhole() if not src then box.say("整包失败,改用分片下载(" .. PARTS .. " 片)...") src, err = fetchParts(function(i, n) box.say("分片下载 " .. i .. "/" .. n .. "...") end) end if not src then box.error("WindUI 下载失败\n" .. tostring(err) .. "\n请检查网络后重试") return end box.say("编译 WindUI...") local fn, compileErr = loadstring(src) if type(fn) ~= "function" then box.error("编译失败\n" .. tostring(compileErr) .. "\n源码长度 " .. #src .. " 字节") return end box.say("初始化 WindUI...") local okLib, WindUI = xpcall(fn, function(e) return debug.traceback(tostring(e), 2) end) if not okLib or type(WindUI) ~= "table" then box.error("初始化失败\n" .. tostring(WindUI)) return end box.say("创建窗口...") local okWin, Window = xpcall(function() return WindUI:CreateWindow({ Title = "站内 WindUI 示例", Icon = "solar:widget-add-bold-duotone", Folder = "WindUI_Site", ToggleKey = Enum.KeyCode.RightShift, OpenButton = { Title = "站内 WindUI", Icon = "solar:widget-add-bold-duotone", Draggable = true, OnlyIcon = false, OnlyMobile = true, Position = UDim2.new(0.5, 0, 0, 60), }, }) end, function(e) return debug.traceback(tostring(e), 2) end) if not okWin or not Window then box.error("窗口创建失败\n" .. tostring(Window)) return end box.say("启动完成") box.destroy() local okMain, err2 = xpcall(function() onReady(WindUI, Window) end, function(e) return debug.traceback(tostring(e), 2) end) if not okMain then local errBox = makeBox(coreGui, "站内 WindUI · 运行错误") errBox.error(err2) end end xpcall(main, function(e) print("[windui][致命] " .. debug.traceback(tostring(e), 2)) pcall(function() local coreGui = getCoreGui() local box = makeBox(coreGui, "站内 WindUI · 致命错误") box.error(debug.traceback(tostring(e), 2)) end) end) print("[windui] 脚本执行完毕")