private void UpdateInterval()
 {
     _interval = 1000f / RealTimeHandler.GetSerializationRate();
     if (_isInternal)
     {
         _interval += 10 * RealTimeConst.MinObserverThreshold;
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        ///     Get Current PacketLost
        ///     NOTE : You Must Join To RealTime Servers To Get Valid Data, Otherwise Return -1
        /// </summary>
        public override long GetPacketLost()
        {
            if (GameService.IsGuest)
            {
                throw new GameServiceException("This Function Not Working In Guest Mode").LogException <GsLiveRealTime>(
                          DebugLocation.RealTime, "GetPacketLost");
            }

            return(RealTimeHandler.GetPacketLost());
        }
Ejemplo n.º 3
0
        /// <summary>
        ///     Get Current RoundTripTime(RTT)
        ///     NOTE : You Must Join To RealTime Servers To Get Valid Data, Otherwise Return -1
        /// </summary>
        public override int GetRoundTripTime()
        {
            if (GameService.IsGuest)
            {
                throw new GameServiceException("This Function Not Working In Guest Mode").LogException <GsLiveRealTime>(
                          DebugLocation.RealTime, "GetRoundTripTime");
            }

            return(RealTimeHandler.GetRoundTripTime());
        }
Ejemplo n.º 4
0
    private void Awake()
    {
        Screen.sleepTimeout = SleepTimeout.NeverSleep;

        questManager       = FindObjectOfType <QuestManager>();
        userData           = FindObjectOfType <UserData>();
        colorPaletteHolder = FindObjectOfType <ColorPalleteHolder>();
        encyclopedia       = FindObjectOfType <Encyclopedia>();
        characterManager   = FindObjectOfType <CharacterManager>();
        dailyReward        = FindObjectOfType <DailyReward>();
        realTimeHandler    = FindObjectOfType <RealTimeHandler>();
    }
        internal void Dispose()
        {
            CommandHandler?.Dispose(false);
            RealTimeHandler?.Dispose(false);
            TurnBasedHandler?.Dispose(false);

            CommandHandler   = null;
            RealTimeHandler  = null;
            TurnBasedHandler = null;

            try
            {
                GC.SuppressFinalize(this);
            }
            catch (Exception)
            {
                // ignored
            }
        }
        private void OnJoinRoom(object sender, StartPayload startPayload)
        {
            switch (startPayload.Room.GsLiveType)
            {
            case GSLiveType.TurnBased:
                TurnBasedHandler = new TurnBasedHandler(startPayload);
                TurnBasedHandler.Init();
                break;

            case GSLiveType.RealTime:
                RealTimeHandler = new RealTimeHandler(startPayload);
                RealTimeHandler.Init(false);
                break;

            case GSLiveType.Command:
            case GSLiveType.NotSet:
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
        private void OnDispose(object sender, DisposeData disposeData)
        {
            switch (disposeData.Type)
            {
            case GSLiveType.RealTime:
                RealTimeHandler?.Dispose(disposeData.IsGraceful);
                RealTimeHandler = null;
                GsSerializer.CurrentPlayerLeftRoom?.Invoke(this, null);
                break;

            case GSLiveType.TurnBased:
                TurnBasedHandler?.Dispose(disposeData.IsGraceful);
                TurnBasedHandler = null;
                break;

            case GSLiveType.NotSet:
            case GSLiveType.Command:
            case GSLiveType.Voice:
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(disposeData), disposeData, null);
            }
        }
 /// <summary>
 ///     Get Serialization Rate In GProtocol
 /// </summary>
 /// <returns></returns>
 public static int GetSerializationRate()
 {
     return(RealTimeHandler.GetSerializationRate());
 }
 public override bool IsRealTimeAvailable()
 {
     return(RealTimeHandler.IsAvailable());
 }