Exemplo n.º 1
0
        public override void OnUpdate()
        {
            if (_task.IsFaulted || _task.IsCanceled)
            {
                ParseException _e = PlayMakerParseProxy.GetParseException(_task.Exception);
                if (_e != null)
                {
                    if (_e.Code == ParseException.ErrorCode.ObjectNotFound)
                    {
                        Fsm.Event(noResultEvent);
                    }
                    else
                    {
                        LogWarning(_e.Code + " " + _e.Message);

                        Fsm.EventData.IntData    = (int)_e.Code;
                        Fsm.EventData.StringData = _e.Message;
                        Fsm.Event(errorEvent);
                    }
                }
                else
                {
                    Fsm.Event(errorEvent);
                }
                Finish();
            }
            else if (_task.IsCompleted)
            {
                resultObjectId.Value = PlayMakerParseProxy.CacheParseObject(_task.Result);

                Fsm.Event(successEvent);
                Finish();
            }
        }
Exemplo n.º 2
0
        public override void OnUpdate()
        {
            if (_task.IsFaulted || _task.IsCanceled)
            {
                ParseException _e        = PlayMakerParseProxy.GetParseException(_task.Exception);
                string         _eMessage = "";
                if (_e != null)
                {
                    _eMessage                = "ErrorCode:" + _e.Code + " ErrorMessage:" + _e.Message;
                    Fsm.EventData.IntData    = (int)_e.Code;
                    Fsm.EventData.StringData = _e.Message;
                    Fsm.Event(errorEvent);
                }
                else
                {
                    Fsm.Event(errorEvent);
                }


                LogError("Parse SaveAsync failed :" + _eMessage);

                Finish();
            }

            if (_task.IsCompleted)
            {
                objectId.Value = _object.ObjectId;
                PlayMakerParseProxy.CacheParseObject(_object);
                Fsm.Event(successEvent);
                Finish();
            }
        }
Exemplo n.º 3
0
        public override void OnEnter()
        {
            ParseObject _object;

            if (objectId.IsNone)
            {
                _object = ParseUser.CurrentUser;
            }
            else
            {
                _object = PlayMakerParseProxy.GetParseObject(objectId.Value);
            }

            bool ok = true;

            if (_object.ContainsKey(propertyKey.Value))
            {
                ParseObject _relationObject = _object.Get <ParseObject>(propertyKey.Value);

                if (_relationObject != null)
                {
                    relationObjectId.Value = PlayMakerParseProxy.CacheParseObject(_relationObject);
                }
                else
                {
                    ok = false;
                }

                if (fetchIfNeeded.Value)
                {
                    _task = _relationObject.FetchIfNeededAsync();
                    return;                     // we are asynch
                }
            }
            else
            {
                ok = false;
            }


            if (!ok)
            {
                Fsm.Event(errorEvent);
            }
            else
            {
                Fsm.Event(successEvent);
            }

            Finish();
        }
Exemplo n.º 4
0
        public override void OnUpdate()
        {
            if (_task.IsFaulted || _task.IsCanceled)
            {
                Fsm.Event(errorEvent);
                Finish();
            }

            if (_task.IsCompleted)
            {
                PlayMakerParseProxy.CacheParseObject(_task.Result);

                Fsm.Event(successEvent);
                Finish();
            }
        }
Exemplo n.º 5
0
        public override void OnUpdate()
        {
            if (_task.IsFaulted || _task.IsCanceled)
            {
                ParseException _e = PlayMakerParseProxy.GetParseException(_task.Exception);
                if (_e != null)
                {
                    Fsm.EventData.IntData    = (int)_e.Code;
                    Fsm.EventData.StringData = _e.Message;
                }

                Fsm.Event(errorEvent);
                Finish();
            }
            else if (_task.IsCompleted)
            {
                PlayMakerParseProxy.CacheParseObject(_task.Result);

                Fsm.Event(successEvent);
                Finish();
            }
        }