Пример #1
0
 public RaqnApiSession() : base()
 {
     id      = "L$" + System.Guid.NewGuid();
     started = RaqnTime.LocalNow();
     expires = RaqnTime.FOREVER;
     logins  = new List <RaqnLogin>();
 }
Пример #2
0
        public Coroutine SyncPlaySession(RaqnPlaySession _ps, Action <RaqnPlaySession> OnReady = null, Action <string> OnError = null)
        {
            RaqnRequest _req = new RaqnRequest("/play/sync");

            _req.SetField <RaqnPlaySession>("playsession", _ps);
            _req.SetField <string>("time", RaqnTime.LocalNow());
            if (OnReady != null)
            {
                _req.OnSuccess += RaqnUtils.ComposeAction <RaqnResponse, RaqnPlaySession>(OnReady, _ResponseParser <RaqnPlaySession>("_playsession"));
            }
            if (OnError != null)
            {
                _req.OnError += OnError;
            }
            return(Raqn.Instance.StartCoroutine(SendRequest(_req)));
        }
Пример #3
0
 public void End(Action OnReady = null, Action <string> OnError = null)
 {
     if (IsOffline())
     {
         end = RaqnTime.LocalNow();
         Sync(OnReady, OnError);
     }
     else
     {
         Raqn.Api.OnPlayEndSuccess += () =>
         {
             Sync(OnReady, OnError);
         };
         Raqn.Api.OnPlayEndError += (_err) =>
         {
             Sync(OnReady, OnError);
         };
         Raqn.Api.EndPlay();
     }
 }
Пример #4
0
 public RaqnPlaySession() : base()
 {
     id    = "L$" + System.Guid.NewGuid();
     start = RaqnTime.LocalNow();
     local_engine_start = RaqnTime.LocalEngineNow();
 }