예제 #1
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();
        }
예제 #2
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();
        }