示例#1
0
    public override void OnInspectorGUI()
    {
        serializedObject.Update();

        // Draw all of the properties other than the cloud properties
        DrawPropertiesExcluding(serializedObject, m_ExcludedProperties);

        // Draw all of the cloud properties
        CloudDataMonoBehaviour behavior = target as CloudDataMonoBehaviour;

        DrawCloudProperties(m_CloudDataProperties, "Cloud Data Fields", true, ref behavior.expandFieldsInInspector);
        DrawCloudProperties(m_NewCloudDataProperties, "Cloud Data Fields [New]", behavior.isSavingSheets, ref behavior.expandNewFieldsInInspector);

        // Show button for Saving to cloud
        if (m_NewCloudDataProperties.Count > 0 && behavior.defaultCloudDataSheet != null)
        {
            if (behavior.isSavingSheets)
            {
                GUIStyle style = new GUIStyle();
                style.richText  = true;
                style.alignment = TextAnchor.MiddleCenter;

                GUILayout.BeginHorizontal("box");
                GUILayout.Label("<color=yellow>Saving new fields to Unity Cloud Data...</color>", style);
                GUILayout.EndHorizontal();
            }
            else if (GUILayout.Button("Save to Cloud Data Sheet"))
            {
                behavior.UpdateCloudDataFields(true);
                behavior.SaveAllAssociatedSheets();
            }
        }

        serializedObject.ApplyModifiedProperties();
    }
示例#2
0
    public void OnEnable()
    {
        // force the fields in the bahvior to update
        CloudDataMonoBehaviour behavior = target as CloudDataMonoBehaviour;

        behavior.UpdateCloudDataFields();

        // refresh the property lists
        RefreshPropertyLists();

        // watch for changes to cache
        BaseCloudDataSheet.globalRefreshCacheComplete += OnCloudDataSheetRefreshCacheComplete;
    }