Add files via upload

This commit is contained in:
celisej567
2021-08-05 17:54:51 +03:00
committed by GitHub
parent d58ad89d11
commit 76b55e2a87
57 changed files with 5632 additions and 0 deletions

37
code/ui/left/SpawnList.cs Normal file
View File

@@ -0,0 +1,37 @@
using Sandbox;
using Sandbox.UI;
using Sandbox.UI.Tests;
[Library]
public partial class SpawnList : Panel
{
VirtualScrollPanel Canvas;
public SpawnList()
{
AddClass( "spawnpage" );
AddChild( out Canvas, "canvas" );
Canvas.Layout.AutoColumns = true;
Canvas.Layout.ItemSize = new Vector2( 100, 100 );
Canvas.OnCreateCell = ( cell, data ) =>
{
var file = (string)data;
var panel = cell.Add.Panel( "icon" );
panel.AddEventListener( "onclick", () => ConsoleSystem.Run( "spawn", "models/" + file ) );
panel.Style.Background = new PanelBackground
{
Texture = Texture.Load( $"/models/{file}_c.png", false )
};
};
foreach ( var file in FileSystem.Mounted.FindFile( "models", "*.vmdl_c.png", true ) )
{
if ( string.IsNullOrWhiteSpace( file ) ) continue;
if ( file.Contains( "_lod0" ) ) continue;
if ( file.Contains( "clothes" ) ) continue;
Canvas.AddItem( file.Remove( file.Length - 6 ) );
}
}
}