예제 #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 MouseDetection(IMouseInputQueryable mouseQueryable, ITaskDelayFactory taskDelayFactory)
 {
     MouseQueryable   = mouseQueryable ?? throw new ArgumentNullException(nameof(mouseQueryable));
     TaskDelayFactory = taskDelayFactory;
     coordsY          = new int[500];
     running          = true;
     coordsX          = new int[500];
 }
예제 #3
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;
 }
예제 #4
0
 public OnDemandFetcher(ITaskDelayFactory taskDelayFactory)
 {
     TaskDelayFactory = taskDelayFactory ?? throw new ArgumentNullException(nameof(taskDelayFactory));
     requested        = new DoubleEndedQueue();
     statusString     = "";
     //crc32 = new CRC32();
     payload           = new byte[500];
     filePriorities    = new byte[4][];
     passiveRequests   = new DoubleEndedQueue();
     running           = true;
     waiting           = false;
     complete          = new DoubleEndedQueue();
     gzipInputBuffer   = new byte[65000];
     nodeSubList       = new CacheableQueue();
     versions          = new int[4][];
     crcs              = new int[4][];
     unrequested       = new DoubleEndedQueue();
     mandatoryRequests = new DoubleEndedQueue();
 }
예제 #5
0
 /// <summary>
 /// Constructor - receive JSLIB instance id of allocated socket
 /// </summary>
 /// <param name="instanceId">Instance identifier.</param>
 /// <param name="taskDelayFactory"></param>
 public WebGLWebSocket(int instanceId, [NotNull] ITaskDelayFactory taskDelayFactory)
 {
     this.instanceId  = instanceId;
     TaskDelayFactory = taskDelayFactory ?? throw new ArgumentNullException(nameof(taskDelayFactory));
 }
예제 #6
0
 public WebGLWebSocketFactory([NotNull] ITaskDelayFactory taskDelayFactory)
 {
     TaskDelayFactory = taskDelayFactory ?? throw new ArgumentNullException(nameof(taskDelayFactory));
 }
예제 #7
0
 public RsUnityWebGLClient(ClientConfiguration config, UnityRsGraphics graphicsObject, [NotNull] MonoBehaviour clientMonoBehaviour, ITaskDelayFactory taskDelayFactory)
     : this(config, graphicsObject, clientMonoBehaviour, new WebGLTcpClientRsSocketFactory(), taskDelayFactory)
 {
 }
예제 #8
0
 public WebGLOnDemandFetcher([NotNull] ITaskDelayFactory taskDelayFactory)
     : base(taskDelayFactory)
 {
 }