Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local GAceInstance
- concommand.Add("minigace-open", function()
- if IsValid(GAceInstance) then
- GAceInstance:SetVisible(true)
- return
- end
- local fr = vgui.Create("DFrame")
- fr:SetSize(800, 600)
- fr:SetTitle("Mini G-Ace")
- fr:SetDeleteOnClose(false)
- fr:Center()
- GAceInstance = fr
- local was_esc_down
- fr.Think = function()
- local is_esc_down = input.IsKeyDown(KEY_ESCAPE)
- local esc_pressed = is_esc_down ~= was_esc_down and is_esc_down
- was_esc_down = is_esc_down
- if esc_pressed then
- local function CancelGUIOpen()
- if gui.IsGameUIVisible () then
- gui.HideGameUI ()
- else
- gui.ActivateGameUI ()
- end
- end
- fr:SetVisible(false)
- CancelGUIOpen()
- end
- end
- local contents = ""
- for k,v in pairs {
- {txt = "Server", act = function() runSvLua(contents) end},
- {txt = "Shared", act = function() runShLua(contents) end},
- {txt = "Self", act = function() RunString(contents) end},
- } do
- local btn = fr:Add("DButton")
- btn:SetPos(70 * k, 2)
- btn:SetText(v.txt)
- btn.DoClick = function()
- v.act()
- end
- end
- local html = fr:Add("DHTML", fr)
- html:Dock(FILL)
- for _,v in pairs{
- "QueryGmodApi", "ContextMenu", "OpenDocumentationFor",
- "EditorReady", "ModeChanged",
- "SaveSession", "NewSession", "CloseSession"} do
- html:AddFunction("gace", v, function()end)
- end
- html:AddFunction("gace", "UpdateSessionContent", function(c) contents = c end)
- html:OpenURL("http://wyozi.github.io/g-ace/editor_refactored.html")
- timer.Simple(3, function()
- html:RunJavascript("gaceSessions.setSession('minigace.lua', {});")
- end)
- fr:MakePopup()
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement