示例#1
0
        private async Task StartClient(int localWorldId, short portOffset, bool membersWorld)
        {
            Debug.Log($"Starting client.");

            try
            {
                await signlink.startpriv(IPAddress.Parse("127.0.0.1"), new Unity3DResourceCacheLoader());
            }
            catch (Exception e)
            {
                Console.WriteLine($"Failed to load signlink/cache. Reason: {e}");
                throw;
            }

            //Get back onto the main thread.
            if (!RsUnityPlatform.isWebGLBuild)
            {
                await new UnityYieldAwaitable();
            }

            ClientConfiguration configuration = new ClientConfiguration(localWorldId, portOffset, membersWorld);

            RsUnityClient client1 = CreateRsClient(configuration);

            InputObject.InputSubscribable    = client1;
            GraphicsObject.GameStateHookable = client1;
            client1.createClientFrame(765, 503);

            Debug.Log($"Client frame created.");
        }
示例#2
0
        private async Task StartClient(int localWorldId, short portOffset, bool membersWorld)
        {
            Debug.Log($"Starting client.");

            try
            {
                await signlink.startpriv(Endpoint, new Unity3DResourceCacheLoader());
            }
            catch (Exception e)
            {
                Console.WriteLine($"Failed to load signlink/cache. Reason: {e}");
                throw;
            }

            //Get back onto the main thread.
            if (!RsUnityPlatform.isWebGLBuild)
            {
                await new UnityYieldAwaitable();
            }

            //WebGL port is + 1 off normal port for Websocket proxy.
            if (RsUnityPlatform.isWebGLBuild)
            {
                portOffset++;
            }

            ClientConfiguration configuration = new ClientConfiguration(localWorldId, portOffset, membersWorld);

            RsUnityClient client1 = CreateRsClient(configuration);

            InputObject.InputSubscribable    = client1;
            GraphicsObject.GameStateHookable = client1;
            client1.createClientFrame((int)(765 * ResolutionMultiplier), (int)(503 * ResolutionMultiplier));

            Debug.Log($"Client frame created.");
        }