Exemple #1
0
    // Start is called before the first frame update
    void Start()
    {
        MyText.text = "Hello from Script - Press > space <";

        var webSocket = new NetStandardWebSocketImplementation();

        webSocket.ExceptionThrown += (sender, e) =>  // Optional if you want to catch Connection issues
        {
            throw e.Exception;
        };

        SenstateContext.SerializerInstance = new NetStandardJsonNetImplementation();
        SenstateContext.WebSocketInstance  = webSocket;
        SenstateContext.RegisterApp("Unity Example");


        m_stringWatcher = new Watcher(
            new WatcherMeta
        {
            Tag  = "Label Text",
            Type = WatcherType.String, // or Number / Json
        }
            );

        m_updateCallCount = new Watcher(
            new WatcherMeta
        {
            Tag  = "Update All the Things",
            Type = WatcherType.Number, // or Number / Json
        }
            );
    }
Exemple #2
0
    // Declare member variables here. Examples:
    // private int a = 2;
    // private string b = "text";

    // Called when the node enters the scene tree for the first time.
    public override void _Ready()
    {
        var webSocket = new NetStandardWebSocketImplementation();

        webSocket.ExceptionThrown += (sender, e) => // Optional if you want to catch Connection issues
        {
            throw e.Exception;
        };

        SenstateContext.SerializerInstance = new NetStandardJsonNetImplementation();
        SenstateContext.WebSocketInstance  = webSocket;
        SenstateContext.RegisterApp("Godot");

        stringWatcher = new Watcher(
            new WatcherMeta
        {
            Tag  = "Text label",
            Type = WatcherType.String,      // or Number / Json
        }
            );

        countWatcher = new Watcher(
            new WatcherMeta
        {
            Tag  = "Click Counter",
            Type = WatcherType.Number,      // or Number / Json
        }
            );
    }
Exemple #3
0
        public Startup(IConfiguration configuration)
        {
            Configuration = configuration;

            var webSocket = new NetStandardWebSocketImplementation();

            webSocket.ExceptionThrown += (sender, e) =>  // Optional if you want to catch Connection issues
            {
                throw e.Exception;
            };

            SenstateContext.SerializerInstance = new NetStandardJsonNetImplementation();
            SenstateContext.WebSocketInstance  = webSocket;
            SenstateContext.RegisterApp("C# Blazor ServerSide");
        }
Exemple #4
0
        public static async Task Main(string[] args)
        {
            var webSocket = new NetStandardWebSocketImplementation();

            webSocket.ExceptionThrown += (sender, e) =>  // Optional if you want to catch Connection issues
            {
                throw e.Exception;
            };

            SenstateContext.SerializerInstance = new NetStandardJsonNetImplementation();
            SenstateContext.WebSocketInstance  = webSocket;
            SenstateContext.RegisterApp("C# Blazor WASM");

            var builder = WebAssemblyHostBuilder.CreateDefault(args);

            builder.RootComponents.Add <App>("app");

            builder.Services.AddBaseAddressHttpClient();

            await builder.Build().RunAsync();
        }