示例#1
0
        public override void OnEnter()
        {
            ParseObject _object;

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

            if (_object == null)
            {
                Fsm.Event(errorEvent);
            }
            else
            {
                bool _isDirty = _object.IsDirty;
                isDirty.Value = _isDirty;

                if (_isDirty)
                {
                    Fsm.Event(isDirtyEvent);
                }
                else
                {
                    Fsm.Event(isNotDirtyEvent);
                }
                Fsm.Event(successEvent);
            }

            Finish();
        }
示例#2
0
        public override void OnEnter()
        {
            ParseObject _object;

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

            if (_object == null)
            {
                Fsm.Event(errorEvent);
            }
            else
            {
                bool _isDataAvailable = _object.IsDataAvailable;
                isDataAvailable.Value = _isDataAvailable;

                if (_isDataAvailable)
                {
                    Fsm.Event(dataIsAvailableEvent);
                }
                else
                {
                    Fsm.Event(dataIsNotAvailableEvent);
                }
                Fsm.Event(successEvent);
            }

            Finish();
        }
示例#3
0
        public override void OnEnter()
        {
            ParseObject _object;

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

            if (_object == null)
            {
                Fsm.Event(errorEvent);
            }
            else
            {
                _object.Revert();
                Fsm.Event(successEvent);
            }

            Finish();
        }
示例#4
0
        public override void OnEnter()
        {
            ParseObject _object;

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

            bool ok = PlayMakerParseProxy.SetParsePropertyFromFsmVar(_object, propertyKey.Value, this.Fsm, value);

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

            Finish();
        }
示例#5
0
        public override void OnEnter()
        {
            ParseObject _object;

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

            if (_object == null)
            {
                Fsm.Event(errorEvent);
                Finish();
            }
            else
            {
                if (fetchOnlyIfNeeded.Value)
                {
                    _task = _object.FetchIfNeededAsync();
                }
                else
                {
                    _task = _object.FetchAsync();
                }
            }
        }
示例#6
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();
        }
示例#7
0
        public override void OnEnter()
        {
            if (!PlayMakerParseProxy.IsPropertyKeyValid(className.Value))
            {
                LogError("Class name invalid");
                Fsm.Event(errorEvent);
                Finish();
            }

            _object = new ParseObject(className.Value);

            if (useAcl)
            {
                ParseUser _aclOwner;

                if (AclOwnerObjectId.IsNone)
                {
                    _aclOwner = ParseUser.CurrentUser;
                }
                else
                {
                    _aclOwner = (ParseUser)PlayMakerParseProxy.GetParseObject(AclOwnerObjectId.Value);
                }

                if (_aclOwner != null)
                {
                    _object.ACL = new ParseACL(_aclOwner)
                    {
                        PublicReadAccess  = AclReadAccess.Value,
                        PublicWriteAccess = AclWriteAccess.Value
                    };
                }
                else
                {
                    LogError("ACL Owner is null.If you target the current user, make sure a user is logged in");
                    Fsm.Event(errorEvent);
                    Finish();
                }
            }

            bool ok = PlayMakerParseProxy.SetParsePropertyFromFsmVar(_object, property.Value, this.Fsm, value);

            if (!ok)
            {
                LogError("Set parse property failed");
                Fsm.Event(errorEvent);
                Finish();
            }

            _task = _object.SaveAsync();
        }
示例#8
0
        public override void OnEnter()
        {
            ParseObject _object;

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

            if (_object == null)
            {
                Fsm.Event(errorEvent);
            }
            else
            {
                System.DateTime _createdAt = (System.DateTime)_object.CreatedAt;

                if (!createdAt.IsNone)
                {
                    createdAt.Value = _createdAt.ToString(dateTimeFormat.Value);
                }

                if (!createdAtUnixStamp.IsNone)
                {
                    var date          = new System.DateTime(1970, 1, 1, 0, 0, 0, _createdAt.Kind);
                    var unixTimestamp = System.Convert.ToInt64((_createdAt - date).TotalSeconds);

                    createdAtUnixStamp.Value = (float)unixTimestamp;
                }

                Fsm.Event(successEvent);
            }

            Finish();
        }