Sboku/UI/StartMenu.razor
@using SWB.Base
@using SWB.Demo
@using SWB.HUD
@using SWB.Player
@using Sandbox;
@using Sandbox.Events
@using Sandbox.Sboku.Arena
@using Sandbox.UI;
@using System;
@using System.Linq;
@using System.Collections.Generic;
@inherits PanelComponent
@namespace Sandbox.Sboku.UI
<root>
<div class="menu">
<p class="title">Enter map</p>
<div class="divider" />
<textarea class="textbox"
rows="13"
value="@UserText"
oninput="@OnTextChanged"
placeholder="Enter grid / text here...">
</textarea>
</div>
</root>
@code
{
public string UserText { get; set; } = "";
protected override void OnAwake()
{
base.OnAwake();
UserText = @"
#######################
#@..0+0#......+X#.....#
#....#.#......+.#^.^..#
######.#......+X#^.^..#
#@..0+0#......+.#0^...#
#....#.#.....0+0+.^^^.#
######.#......+X#0^^..#
#@..0+0#......+.#^.^..#
#....#.#......+.#^.^..#
#....#.#0^....+.#.....#
######.#+########.....#
#X...#..0^#.....#.....#
#######################".Trim();
}
protected override int BuildHash()
=> HashCode.Combine(UserText);
private void StartGame()
{
GameObject.Destroy();
}
// HUOM: s&box antaa stringin, ei eventti�
private void OnTextChanged( string value )
{
UserText = value ?? "";
}
private void Close()
{
//Delete();
}
private void Exit()
{
//Game.Quit();
}
}