Advertisement
Guest User

Untitled

a guest
Sep 25th, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1.  
  2. local GAceInstance
  3.  
  4. concommand.Add("minigace-open", function()
  5. if IsValid(GAceInstance) then
  6. GAceInstance:SetVisible(true)
  7. return
  8. end
  9. local fr = vgui.Create("DFrame")
  10. fr:SetSize(800, 600)
  11. fr:SetTitle("Mini G-Ace")
  12. fr:SetDeleteOnClose(false)
  13. fr:Center()
  14.  
  15. GAceInstance = fr
  16.  
  17. local was_esc_down
  18. fr.Think = function()
  19. local is_esc_down = input.IsKeyDown(KEY_ESCAPE)
  20. local esc_pressed = is_esc_down ~= was_esc_down and is_esc_down
  21. was_esc_down = is_esc_down
  22.  
  23. if esc_pressed then
  24. local function CancelGUIOpen()
  25. if gui.IsGameUIVisible () then
  26. gui.HideGameUI ()
  27. else
  28. gui.ActivateGameUI ()
  29. end
  30. end
  31.  
  32. fr:SetVisible(false)
  33. CancelGUIOpen()
  34. end
  35. end
  36.  
  37. local contents = ""
  38.  
  39. for k,v in pairs {
  40. {txt = "Server", act = function() runSvLua(contents) end},
  41. {txt = "Shared", act = function() runShLua(contents) end},
  42. {txt = "Self", act = function() RunString(contents) end},
  43. } do
  44. local btn = fr:Add("DButton")
  45. btn:SetPos(70 * k, 2)
  46. btn:SetText(v.txt)
  47. btn.DoClick = function()
  48. v.act()
  49. end
  50. end
  51.  
  52. local html = fr:Add("DHTML", fr)
  53. html:Dock(FILL)
  54.  
  55. for _,v in pairs{
  56. "QueryGmodApi", "ContextMenu", "OpenDocumentationFor",
  57. "EditorReady", "ModeChanged",
  58. "SaveSession", "NewSession", "CloseSession"} do
  59. html:AddFunction("gace", v, function()end)
  60. end
  61.  
  62. html:AddFunction("gace", "UpdateSessionContent", function(c) contents = c end)
  63.  
  64. html:OpenURL("http://wyozi.github.io/g-ace/editor_refactored.html")
  65. timer.Simple(3, function()
  66. html:RunJavascript("gaceSessions.setSession('minigace.lua', {});")
  67. end)
  68.  
  69. fr:MakePopup()
  70. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement