3 results

@using Sandbox;
@using Sandbox.UI;
@inherits PanelComponent

@if ( Network.OwnerConnection is Connection owner && owner != Connection.Local )
{
    <root>

        <div class="card">
            <div class="avatar" style="background-image: url( avatar:@owner.SteamId )"></div>
            <div class="name">@owner.DisplayName</div>
        </div>

    </root>
}

@code
{
    protected override void OnEnabled()
    {
        base.OnEnabled();
    }
    protected override int BuildHash() => System.HashCode.Combine(Network.OwnerConnection);
}
@using Sandbox;
@using Sandbox.UI;
@inherits PanelComponent

<root>
	<div class="title">@MyStringValue</div>
</root>

@code
{

	[Property, TextArea] public string MyStringValue { get; set; } = "Hello World!";

	/// <summary>
	/// the hash determines if the system should be rebuilt. If it changes, it will be rebuilt
	/// </summary>
	protected override int BuildHash() => System.HashCode.Combine( MyStringValue );
}
@using Sandbox;
@using Sandbox.UI;

@inherits PanelComponent

<style>
    Hud {
        pointer-events: all;
        width: 100%;
        height: 100%;
    }

	.hello {
		margin: 100px;
		font-size: 32px;
		color: red;
		text-shadow: 2px 2px 10px  black}

	.goodbye {
		margin: 200px;
		font-size: 64px;
		color: green;
		text-shadow: 5px 5px 20px  black}
</style>

<root>
	<panel class="hello" onmousedown="@Play" >
		Hello Razer. Ti gondone: @SomeNumber
	</panel>

	@if(ShowGoodbye)
	{
		<panel class="goodbye">
			Goodbye Lads!
		</panel>
	}
</root>

@code
{
	private int SomeNumber = 32;
	private bool ShowGoodbye = false;

	private void Play()
	{
		Log.Error("SEX TIME!");
		ShowGoodbye = !ShowGoodbye;
	}
}