Пример #1
0
        public RsUnityWebGLClient(ClientConfiguration config, UnityRsGraphics graphicsObject, [NotNull] MonoBehaviour clientMonoBehaviour, IRsSocketFactory socketFactory, ITaskDelayFactory taskDelayFactory)
            : base(config, graphicsObject, new WebGLRunnableStarterStrategy(), socketFactory)
        {
            if (config == null)
            {
                throw new ArgumentNullException(nameof(config));
            }

            ClientMonoBehaviour = clientMonoBehaviour ?? throw new ArgumentNullException(nameof(clientMonoBehaviour));

            //Only need to override this for WebGL.
            Sprite.ExternalLoadImageHook += ExternalLoadImageHook;
            TaskDelayFactory              = taskDelayFactory;

            //This is a hack to make sure that WebGL doesn't cut off frames in the background
            //causing disconnections.
            Time.maximumDeltaTime = 20.0f;

            //Can't do this in the editor.
            if (!RsUnityPlatform.isInEditor)
            {
                SetOnPageVisible(DelegateOnVisibilityChangeVisible);
                SetOnPageInvisible(DelegateOnVisibilityChangeInvisible);
                InitializePageVisibilityCallbacks();
            }

            //WebGL probably forces vsync already but we should ensure it.
            QualitySettings.vSyncCount = 1;
        }
Пример #2
0
        public RsUnityPS4Client(ClientConfiguration config, UnityRsGraphics graphicsObject)
            : base(config, graphicsObject, new DefaultRunnableStarterStrategy(), new DefaultRsSocketFactory(new DefaultRunnableStarterStrategy()))
        {
            if (config == null)
            {
                throw new ArgumentNullException(nameof(config));
            }

            Sprite.ExternalLoadImageHook += ExternalLoadImageHook;
        }
Пример #3
0
        public RsUnityPS4Client(ClientConfiguration config, UnityRsGraphics graphicsObject)
            : base(config, graphicsObject)
        {
            if (config == null)
            {
                throw new ArgumentNullException(nameof(config));
            }

            Sprite.ExternalLoadImageHook += ExternalLoadImageHook;
        }
Пример #4
0
 public GladMMORsUnityWebGLClient(ClientConfiguration config,
                                  UnityRsGraphics graphicsObject,
                                  [JetBrains.Annotations.NotNull] MonoBehaviour clientMonoBehaviour,
                                  IRsSocketFactory socketFactory,
                                  ITaskDelayFactory taskDelayFactory,
                                  [JetBrains.Annotations.NotNull] GameManager rootGameManager)
     : base(config, graphicsObject, clientMonoBehaviour, socketFactory, taskDelayFactory)
 {
     GameManagerService = rootGameManager ?? throw new ArgumentNullException(nameof(rootGameManager));
     this.LoggedIn.OnVariableValueChanged += GameManagerService.OnLoginStateChanged;
 }
Пример #5
0
        public RsUnityWebGLClient(ClientConfiguration config, UnityRsGraphics graphicsObject, [NotNull] MonoBehaviour clientMonoBehaviour)
            : base(config, graphicsObject)
        {
            if (config == null)
            {
                throw new ArgumentNullException(nameof(config));
            }

            ClientMonoBehaviour = clientMonoBehaviour ?? throw new ArgumentNullException(nameof(clientMonoBehaviour));

            //Only need to override this for WebGL.
            Sprite.ExternalLoadImageHook += ExternalLoadImageHook;
        }
Пример #6
0
        public RsUnityAndroidClient(ClientConfiguration config, UnityRsGraphics graphicsObject)
            : base(config, graphicsObject, new DefaultRunnableStarterStrategy(), new DefaultRsSocketFactory(new DefaultRunnableStarterStrategy()))
        {
            if (config == null)
            {
                throw new ArgumentNullException(nameof(config));
            }

            UnityEngine.GameObject mobileBehaviorObject = new UnityEngine.GameObject();

            var inputHandler = mobileBehaviorObject.AddComponent <MobileTitlescreenKeyboardInputHandler>();

            inputHandler.Initialize(this);
        }
Пример #7
0
 public RsUnityWebGLClient(ClientConfiguration config, UnityRsGraphics graphicsObject, [NotNull] MonoBehaviour clientMonoBehaviour, ITaskDelayFactory taskDelayFactory)
     : this(config, graphicsObject, clientMonoBehaviour, new WebGLTcpClientRsSocketFactory(), taskDelayFactory)
 {
 }