Exemplo n.º 1
0
        /// <summary>
        /// Creates a default entity on the server
        /// </summary>
        /// <param name="accessLevel"> accessLevel for entity </param>
        /// <returns> The ID of the entity </returns>
        private string CreateDefaultAddressEntity(ACL.Access accessLevel)
        {
            TestResult tr = new TestResult();

            ACL access = new ACL() { Other = accessLevel };
            string entityId = "";

            //Create entity
            BrainCloudClient.Get().EntityService.CreateEntity(
                _defaultEntityType,
                Helpers.CreateJsonPair(_defaultEntityValueName, _defaultEntityValue),
                access.ToJsonString(),
                tr.ApiSuccess,
                tr.ApiError);

            if (tr.Run()) entityId = GetEntityId(tr.m_response);

            return entityId;
        }
Exemplo n.º 2
0
 public static ACL CreateFromJson(JsonData in_json)
 {
     ACL acl = new ACL();
     acl.ReadFromJson(in_json);
     return acl;
 }
Exemplo n.º 3
0
 public static ACL ReadOnlyOther()
 {
     ACL acl = new ACL();
     acl.m_other = Access.ReadOnly;
     return acl;
 }
        /// <summary>
        /// Creates a default entity on the server
        /// </summary>
        /// <param name="accessLevel"> accessLevel for entity </param>
        /// <returns> The ID of the entity </returns>
        private string CreateDefaultGlobalEntity(ACL.Access accessLevel = ACL.Access.None, string indexedId = "")
        {
            TestResult tr = new TestResult();

            ACL access = new ACL() { Other = accessLevel };
            string entityId = "";

            //Create entity
            if (indexedId.Length <= 0)
            {
                BrainCloudClient.Get().GlobalEntityService.CreateEntity(
                 _defaultEntityType,
                 0,
                 access.ToJsonString(),
                 Helpers.CreateJsonPair(_defaultEntityValueName, _defaultEntityValue),
                 tr.ApiSuccess,
                 tr.ApiError);
            }
            else
            {
                BrainCloudClient.Get().GlobalEntityService.CreateEntityWithIndexedId(
                _defaultEntityType,
               indexedId,
                0,
                access.ToJsonString(),
                Helpers.CreateJsonPair(_defaultEntityValueName, _defaultEntityValue),
                tr.ApiSuccess,
                tr.ApiError);
            }

            if (tr.Run())
            {
                entityId = GetEntityId(tr.m_response);
            }

            return entityId;
        }