Exemple #1
0
    protected override void Awake()
    {
        if (!Application.isPlaying)
        {
            return;
        }

        InitSingleInstance();
        if (Instance != this)
        {
            return;
        }

        host = IpAddressUtils.GetIpAddress(AddressFamily.IPv4, NetworkInterfaceType.Wireless80211);
        NoEndpointFoundCallback = SendNoEndpointFound;
        StartHttpListener();

        this.RegisterEndpoint(gameObject, HttpMethod.Get, "api/rest/endpoints",
                              "Get currently registered endpoints",
                              SendRegisteredEndpoints);

        this.RegisterEndpoint(gameObject, HttpMethod.Get, "api/rest/songs",
                              "Get loaded songs",
                              SendLoadedSongs);

        this.RegisterEndpoint(gameObject, HttpMethod.Get, "/api/rest/hello/{name}",
                              "Say hello (path-parameter example)",
                              SendHello);
    }