Advertisement
Guest User

Thomas Siladi

a guest
Aug 10th, 2009
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 12.84 KB | None | 0 0
  1. */
  2. ============================
  3. myPC - A Garry's Mod OS
  4. by Wolfie!
  5. v0.4   BUILT 0158
  6. ============================
  7.  
  8. TABLE OF CONTENTS:
  9.  
  10. && - MainPanel
  11. && - myBIOS-Main
  12. && - myBIOS-LoadingOS
  13. && - myOS-Welcome //Coming soon...
  14. && - myOS-Main
  15. && - myOS-Menu-SecurityCenter //Coming soon...
  16. */
  17.  
  18. CreateConVar("myPC_loadingos", "0");
  19. CreateConVar("myPC_successload", "0");
  20. CreateConVar("myPC_Debug", "1");
  21. CreateConVar("myPC_Development", "1");
  22.  
  23. function MainPanel()
  24.  
  25.     local MainPanel = vgui.Create( "DFrame" );
  26.     MainPanel:SetPos( 50, 50 );
  27.     MainPanel:SetSize( 800, 620 );
  28.     MainPanel:SetTitle( "myPC v0.4 - a Garrys Mod OS - by Wolfie!" );
  29.     MainPanel:SetVisible( true );
  30.     MainPanel:SetDraggable( false );
  31.     MainPanel:ShowCloseButton( true ); //I've set that to true for debugging options. I'll set that later to false again.
  32.     MainPanel:MakePopup();
  33.  
  34. end
  35.  
  36. function myBIOSMain()
  37.  
  38.     local MyBIOSMainImg = vgui.Create( "DPanel", MainPanel );
  39.     MyBIOSMainImg:SetPos( 0, 20 );
  40.     MyBIOSMainImg:SetSize( 800, 600 );
  41.     MyBIOSMainImg.Paint = function()
  42.         surface.SetDrawColor( 60, 60, 60, 255 );
  43.         surface.DrawRect( 0, 0, MyBIOSMainImg:GetWide(), MyBIOSMainImg:GetTall() );
  44.     end
  45.     /*
  46.     //I will add an picture for MyBIOS in there, or maybe not...
  47.     myBIOSImg = vgui.Create( "DImage", MyBIOSMainImg );
  48.     myBIOSImg:SetPos( 25, 50 );
  49.     myBIOSImg:SetSize( &&, && );
  50.     myBIOSImg:SetImage( "Brick/brickfloor001a.vtf" );
  51.     */
  52.     timer.Simple( 1, (Label1 = vgui.Create( "DLabel", MainPanel );
  53.                      Label1:SetText("myBIOS - v1.4");
  54.                      Label1:SetPos( 25, 50 );
  55.                      ));
  56.    
  57.     timer.Simple( 1.5, (Label2 = vgui.Create( "DLabel", MainPanel );
  58.                        Label2:SetText("by Wolfie!");
  59.                        Label2:SetPos( 25, 50 );
  60.                        ));
  61.    
  62.     timer.Simple( 2, (Label3 = vgui.Create( "DLabel", MainPanel );
  63.                      Label3:SetText("Checking GMOD version...");
  64.                      Label3:SetPos( 25, 50 );
  65.                      ));
  66.    
  67.     timer.Simple( 2.5, (Label4 = vgui.Create( "DLabel", MainPanel );
  68.                        Label4:SetText("success!");
  69.                        Label4:SetPos( 25, 50 );
  70.                        ));
  71.    
  72.     timer.Simple( 3, (Label5 = vgui.Create( "DLabel", MainPanel );
  73.                      Label5:SetText("Checking myPC version...");
  74.                      Label5:SetPos( 25, 50 );
  75.                      ));
  76.    
  77.     timer.Simple( 3.5, (Label6 = vgui.Create( "DLabel", MainPanel );
  78.                        Label6:SetText("success!");
  79.                        Label6:SetPos( 25, 50 );
  80.                        ));
  81.    
  82.     timer.Simple( 4, (Label7 = vgui.Create( "DLabel", MainPanel );
  83.                      Label7:SetText("Starting myPC v0.4...");
  84.                      Label7:SetPos( 25, 50 );
  85.                      ))
  86.    
  87.     timer.Simple( 5.8, SetConVarNumber("myPC_successload","1") );
  88.     timer.Simple( 5.9, SetConVarNumber("myPC_loadingos","1") );
  89.    
  90.     function StartLoadingOS()
  91.         if GetConVarNumber("myPC_loadingos") == 1 and GetConVarNumber("myPC_successload") == 1 then
  92.             myBIOSImg:Remove;
  93.             Label1:Remove;
  94.             Label2:Remove;
  95.             Label3:Remove;
  96.             Label4:Remove;
  97.             Label5:Remove;
  98.             Label6:Remove;
  99.             Label7:Remove;
  100.            
  101.             myBIOSLoadingOS();
  102.         else
  103.             Label8 = vgui.Create( "DLabel", MainPanel );
  104.             Label8:SetText("Starting myPC v0.4 FAILED!");
  105.             Label8:SetPos( 25, 50 );
  106.         end
  107.     end
  108.     timer.Simple( 6, StartLoadingOS );
  109. end
  110. concommand.Add( "myPC_start", myBIOSMain );
  111.  
  112. function myBIOSLoadingOS()
  113.  
  114.     local MyBIOSLoadingImg = vgui.Create( "DPanel", MainPanel );
  115.     MyBIOSLoadingImg:SetPos( 0, 20 );
  116.     MyBIOSLoadingImg:SetSize( 800, 600 );
  117.     MyBIOSLoadingImg.Paint = function()
  118.         surface.SetDrawColor( 60, 60, 60, 255 );
  119.         surface.DrawRect( 0, 0, MyBIOSLoadingImg:GetWide(), MyBIOSLoadingImg:GetTall() );
  120.     end
  121.    
  122.     LoadingLabel = vgui.Create( "DLabel", MainPanel );
  123.     LoadingLabel:SetText("loading...");
  124.     LoadingLabel:SetPos( 25, 50 );
  125.    
  126.     myPCMainImg = vgui.Create( "DImageButton", MainPanel );
  127.     myPCMainImg:SetPos( 25, 50 );
  128.     myPCMainImg:SetSize( 50, 50 );
  129.     myPCMainImg:SetImage( "Brick/brickfloor001a.vtf" );
  130.    
  131.     --------------------------------------------
  132.     timer.Simple( 1, (LoadingKernel = vgui.Create( "DLabel", MainPanel );
  133.                      LoadingKernel:SetText("Loading 'Kernel' ...");
  134.                      LoadingKernel:SetPos( 25, 50 );
  135.                      ));
  136.    
  137.     timer.Simple( 1.5, (LoadingKernelSuccess = vgui.Create( "DLabel", MainPanel );
  138.                        LoadingKernelSuccess:SetText(" done!");
  139.                        LoadingKernelSuccess:SetPos( 25, 50 );
  140.                        ));
  141.     --------------------------------------------
  142.     timer.Simple( 2, (LoadingPrograms = vgui.Create( "DLabel", MainPanel );
  143.                      LoadingPrograms:SetText("Loading 'Programs' ...");
  144.                      LoadingPrograms:SetPos( 25, 50 );
  145.                      ));
  146.     timer.Simple( 2.5, (LoadingProgramsSuccess = vgui.Create( "DLabel", MainPanel );
  147.                        LoadingProgramsSuccess:SetText(" done!");
  148.                        LoadingProgramsSuccess:SetPos( 25, 50 );
  149.                        ));
  150.     --------------------------------------------
  151.     timer.Simple( 3, (LoadingThemes = vgui.Create( "DLabel", MainPanel );
  152.                      LoadingThemes:SetText("Loading 'Themes' ...");
  153.                      LoadingThemes:SetPos( 25, 50 );
  154.                      ));
  155.     timer.Simple( 3.5, (LoadingThemesSuccess = vgui.Create( "DLabel", MainPanel )
  156.                        LoadingThemesSuccess:SetText(" done!")
  157.                        LoadingThemesSuccess:SetPos( 25, 50 )
  158.                        ));
  159.     --------------------------------------------
  160.     timer.Simple( 4, (LoadingInterface = vgui.Create( "DLabel", MainPanel );
  161.                      LoadingInterface:SetText("Loading 'Interface' ...");
  162.                      LoadingInterface:SetPos( 25, 50 );
  163.                      ));
  164.     timer.Simple( 4.5, (LoadingInterfaceSuccess = vgui.Create( "DLabel", MainPanel );
  165.                        LoadingInterfaceSuccess:SetText(" done!");
  166.                        LoadingInterfaceSuccess:SetPos( 25, 50 );
  167.                        ));
  168.     --------------------------------------------
  169.     timer.Simple( 5.3, SetConVar("myPC_successload","1") );
  170.     timer.Simple( 5.4, SetConVar("myPC_loadingos","1") );
  171.     --------------------------------------------
  172.     function StartOurOS()
  173.         if GetConVarNumber("myPC_loadingos") == 1 and GetConVarNumber("myPC_successload") == 1 then
  174.             LoadingLabel:Remove;
  175.             myPCMainImg:Remove;
  176.             --------------------------------------------
  177.             LoadingKernel:Remove;
  178.             LoadingKernelSuccess:Remove;
  179.             --------------------------------------------
  180.             LoadingPrograms:Remove;
  181.             LoadingProgramsSuccess:Remove;
  182.             --------------------------------------------
  183.             LoadingThemes:Remove;
  184.             LoadingThemesSuccess:Remove;
  185.             --------------------------------------------
  186.             LoadingInterface:Remove;
  187.             LoadingInterfaceSuccess:Remove;
  188.            
  189.             myOSWelcome();
  190.         else
  191.             OSStartFailed = vgui.Create( "DLabel", MainPanel );
  192.             Label8:SetText("Starting myPC v0.4 FAILED!");
  193.             Label8:SetPos( 25, 50 );
  194.         end
  195.     end
  196.     timer.Simple( 5.5, StartOurOS );
  197. end
  198.  
  199. function myOS-Welcome()
  200.  
  201.     //Coming soon...
  202.     myOS-Main();
  203.  
  204. end
  205.  
  206. function myOSMain()
  207.  
  208.     //myPC Desktop
  209.     local myOSDesktop = vgui.Create( "DPanel", MainPanel );
  210.     myOSDesktop:SetPos( 0, 20 );
  211.     myOSDesktop:SetSize( 800, 600 );
  212.     myOSDesktop.Paint = function()
  213.         surface.SetDrawColor( 60, 60, 60, 255 );
  214.         surface.DrawRect( 0, 0, myOSDesktop:GetWide(), myOSDesktop:GetTall() );
  215.     end
  216.    
  217.     //myPC Taskbar
  218.     local myOSTaskbar = vgui.Create( "DPanel", myOSDesktop );
  219.     myOSTaskbar:SetPos( 0, 0 );
  220.     myOSTaskbar:SetSize( 800, 20 );
  221.     myOSTaskbar.Paint = function()
  222.         surface.SetDrawColor( 50, 50, 50, 239 );
  223.         surface.DrawRect( 0, 0, myOSTaskbar:GetWide(), myOSTaskbar:GetTall() );
  224.     end
  225.     ---------------------------------------------------------------------------------------------------------
  226.     local MenuItemSelected = function()
  227.         Derma_Message( "Opening an Item will be added later. Now use Terminal!" );
  228.     end
  229.     ---------------------------------------------------------------------------------------------------------
  230.     //Start button
  231.     local StartButton = vgui.Create( "DButton" );
  232.     StartButton:SetParent( myOSTaskbar );
  233.     StartButton:SetText( "Start >" );
  234.     StartButton:SetPos( 0, 0 );
  235.     StartButton:SetSize( 50, 20 );
  236.     StartButton.DoClick = function ( btn )
  237.         local StartButtonMenu = DermaMenu();
  238.         local StartButtonSubMenu = menu:AddSubMenu( "Programs" );
  239.             StartButtonSubMenu:AddOption( "GNotepad", MenuItemSelected );
  240.             StartButtonSubMenu:AddOption( "GMediaPlayer", MenuItemSelected );
  241.             StartButtonSubMenu:AddOption( "MuseX", MenuItemSelected );
  242.             StartButtonSubMenu:AddOption( "Terminal", MenuItemSelected );
  243.         StartButtonMenu:AddOption("Control Panel", MenuItemSelected );
  244.         StartButtonMenu:AddOption("Turn Off", myOSShutDown );
  245.         StartButtonMenu:Open( 0, 20 );
  246.     end
  247.     ------------------------------
  248.     //Clock func
  249.     T_HOURS = 12;
  250.     T_MINUTES = 44;
  251.    
  252.     function RefreshClockHours()
  253.         timer.Simple( 3600, T_HOURS = T_HOURS + 1 );
  254.         if T_HOURS == 24 then T_HOURS = 0 end;
  255.     end
  256.    
  257.     function RefreshClockMinutes()
  258.         timer.Simple( 60, T_MINUTES = T_MINUTES + 1 );
  259.         if T_MINUTES == 60 then T_MINUTES = 0 end;
  260.     end
  261.    
  262.     function RefreshClock()
  263.         RefreshClockHours();
  264.         RefreshClockMinutes();
  265.     end
  266.     RefreshClock();
  267.     ------------------------------
  268.     //Clock
  269.     TaskbarClock = vgui.Create( "DLabel", MainPanel );
  270.     Label8:SetText( "" ..T_HOURS.. ":" ..T_MINUTES.. "" ); //When this doesn't work, then I will use the "tostring" function!!!
  271.     Label8:SetPos( 25, 50 );
  272.     /*--------------------------------------
  273.     BELOW: ServerManager
  274.     --------------------------------------*/
  275.     local ServerManagerTask = vgui.Create("DCollapsibleCategory", myOSTaskbar );
  276.     ServerManagerTask:SetPos( 25,50 );
  277.     ServerManagerTask:SetSize( 200, 50 ;
  278.     ServerManagerTask:SetExpanded( 0 );
  279.     ServerManagerTask:SetLabel( "ServerManager(C)" );
  280.    
  281.     ServerManagerList = vgui.Create( "DPanelList" );
  282.     ServerManagerList:SetAutoSize( true );
  283.     ServerManagerList:SetSpacing( 5 );
  284.     ServerManagerList:EnableHorizontal( false );
  285.     ServerManagerList:EnableVerticalScrollbar( true );
  286.    
  287.     ServerManagerTask:SetContents( ServerManagerList );
  288.  
  289.         local CategoryContentOne = vgui.Create( "DCheckBoxLabel" );
  290.         CategoryContentOne:SetText( "God Mode" );
  291.         CategoryContentOne:SetConVar( "sbox_godmode" );
  292.         CategoryContentOne:SetValue( 1 );
  293.         CategoryContentOne:SizeToContents();
  294.     ServerManagerList:AddItem( CategoryContentOne );
  295.  
  296.         local CategoryContentTwo = vgui.Create( "DCheckBoxLabel" );
  297.         CategoryContentTwo:SetText( "Player Damage" );
  298.         CategoryContentTwo:SetConVar( "sbox_plpldamage" );
  299.         CategoryContentTwo:SetValue( 1 );
  300.         CategoryContentTwo:SizeToContents();
  301.     ServerManagerList:AddItem( CategoryContentTwo );
  302.  
  303.         local CategoryContentThree = vgui.Create( "DCheckBoxLabel" );
  304.         CategoryContentThree:SetText( "Fall Damage" );
  305.         CategoryContentThree:SetConVar( "mp_falldamage" );
  306.         CategoryContentThree:SetValue( 1 );
  307.         CategoryContentThree:SizeToContents();
  308.     ServerManagerList:AddItem( CategoryContentThree );
  309.  
  310.         local CategoryContentFour = vgui.Create( "DCheckBoxLabel" );
  311.         CategoryContentFour:SetText( "Noclip" );
  312.         CategoryContentFour:SetConVar( "sbox_noclip" );
  313.         CategoryContentFour:SetValue( 1 );
  314.         CategoryContentFour:SizeToContents();
  315.     ServerManagerList:AddItem( CategoryContentFour );
  316.    
  317.         local CategoryContentFive = vgui.Create( "DCheckBoxLabel" );
  318.         CategoryContentFive:SetText( "All Talk" );
  319.         CategoryContentFive:SetConVar( "sv_alltalk" );
  320.         CategoryContentFive:SetValue( 1 );
  321.         CategoryContentFive:SizeToContents();
  322.     ServerManagerList:AddItem( CategoryContentFive );
  323.    
  324.         local CategoryContentSix = vgui.Create( "DNumSlider" );
  325.         CategoryContentSix:SetSize( 150, 50 );
  326.         CategoryContentSix:SetText( "Max Props" );
  327.         CategoryContentSix:SetMin( 0 );
  328.         CategoryContentSix:SetMax( 99999 );
  329.         CategoryContentSix:SetDecimals( 0 );
  330.         CategoryContentSix:SetConVar( "sbox_maxprops" );
  331.     ServerManagerList:AddItem( CategoryContentSix );
  332.  
  333.         local CategoryContentSeven = vgui.Create( "DSysButton" );
  334.         CategoryContentSeven:SetType( "close" );
  335.         CategoryContentSeven.DoClick = function();
  336.             Derma_Message("ERROR: Cannot close that! -Wolfie!");
  337.             error("LOL:using .DoClick, reports nil -Wolfie!");
  338.             //This is one of the FUN-Part. It will get an Error-Message when he presses the "X" button. lol
  339.         end
  340.     ServerManagerList:AddItem( CategoryContentSeven );
  341.    
  342.     //The "Turn Off" func! :D
  343.     function myOSShutDown()
  344.         //myOSDesktop:Remove
  345.         myOSDesktop.Paint = function()
  346.             surface.SetDrawColor( 50, 50, 50, 255 );
  347.             surface.DrawRect( 0, 0, myOSDesktop:GetWide(), myOSDesktop:GetTall() );
  348.         end
  349.         myOSTaskbar:Remove;
  350.         StartButton:Remove;
  351.         TaskbarClock:Remove;
  352.         ServerManagerTask:Remove;
  353.         //MainPanel:Remove;
  354.         //"//"'ed them because the User should turn it off himself!
  355.        
  356.         TheEndMessage = vgui.Create( "DLabel", myOSDesktop );
  357.         Label8:SetText( "This is 'The End'.\n\nYou can turn your PC off now." );
  358.         Label8:SetPos( 10, 10 );
  359.     end
  360. end
  361.  
  362. function myOSMenuSecurityCenter()
  363.  
  364.     //Coming soon...
  365.  
  366. end
  367.  
  368. //This is only for debugging and developing!!!
  369. if GetConVarNumber("myPC_Debug") == 1 or GetConVarNumber("myPC_Development") == 1 then
  370.     concommand.Add( "myPC_DEBUG_MainPanel", MainPanel );
  371.     concommand.Add( "myPC_DEBUG_StartLoadingOS", myBIOS-LoadingOS );
  372.     concommand.Add( "myPC_DEBUG_StartWelcome", myOS-Welcome );
  373.     concommand.Add( "myPC_DEBUG_StartOS", myOS-Main );
  374.     concommand.Add( "myPC_DEBUG_StartSecCenter", myOS-Menu-SecurityCenter );
  375. end
  376.  
  377.  
  378.  
  379.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement