public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();
        EditorGUILayout.Space();

        string orgId  = CloudDataManager.instance.organizationId;
        string projId = CloudDataManager.instance.projectId;

        if (!String.IsNullOrEmpty(orgId) && !String.IsNullOrEmpty(projId))
        {
            GUI.contentColor             = String.IsNullOrEmpty(CloudDataManager.accessToken) ? Color.red : Color.white;
            CloudDataManager.accessToken = EditorGUILayout.TextField("Access Token:", CloudDataManager.accessToken);
            GUI.contentColor             = Color.white;
            EditorGUILayout.Space();
        }

        EditorGUI.BeginDisabledGroup(String.IsNullOrEmpty(CloudDataManager.accessToken));
        if (GUILayout.Button("Refresh All"))
        {
            CloudDataManager.RefreshAll(RefreshCallback);
        }
        if (GUILayout.Button("Create New Sheet"))
        {
            CloudDataManager.CreateNewSheet();
        }
        EditorGUI.EndDisabledGroup();
    }
Beispiel #2
0
    protected void RefreshPropertyLists()
    {
        // reset lists of properties
        m_CloudDataProperties    = new List <SerializedProperty>();
        m_NewCloudDataProperties = new List <SerializedProperty>();

        // iterate through all properties on this behavior
        CloudDataMonoBehaviour behavior = target as CloudDataMonoBehaviour;
        var cloudDataFields             = behavior.GetAllCloudDataFields();

        foreach (var pair in cloudDataFields)
        {
            var info          = pair.Key;
            var cloudDataAttr = pair.Value;

            BaseCloudDataSheet sheet = behavior.defaultCloudDataSheet;

            // Try to load the custom cloud data sheet specified by the attribute
            if (cloudDataAttr.sheetPath != null)
            {
                sheet = CloudDataManager.GetSheet(cloudDataAttr.sheetPath);
                if (sheet == null)
                {
                    Debug.LogWarning(string.Format("[Unity Cloud Data] No CloudDataSheet with alias '{0}' found for {1}.{2}", cloudDataAttr.sheetPath, behavior.GetType().FullName, info.Name));
                }
            }

            // If a sheet exists, determine if this key has been added or not
            if (sheet != null)
            {
                // check if the sheet actually HAS the field
                string cloudDataKey = target.GetType().FullName + "." + info.Name;
                if (sheet.ContainsKey(cloudDataKey))
                {
                    m_CloudDataProperties.Add(serializedObject.FindProperty(info.Name));
                    continue;
                }
            }

            m_NewCloudDataProperties.Add(serializedObject.FindProperty(info.Name));
        }

        // generate the list of properties that AREN'T for cloud data
        m_ExcludedProperties = (from prop in m_CloudDataProperties
                                select prop.name)
                               .Concat
                                   (from prop in m_NewCloudDataProperties
                                   select prop.name).ToArray();
    }
Beispiel #3
0
 public CloudDataController(AppSettings _appSettings)
 {
     cdMgr = new CloudDataManager(_appSettings);
 }