コード例 #1
0
        private void DrawAssociatedObjectReference(EditorBindingInfo aCurrentBindingInfo, EditorBindingInfo aAssociatedBindingInfo)
        {
            GUILayout.BeginHorizontal();

            GUILayout.FlexibleSpace();

            GUILayout.BeginHorizontal(EditorStyles.helpBox, GUILayout.Width(EditorGUIUtility.currentViewWidth / 1.25f));
            GUIContent label = new GUIContent("[" + aAssociatedBindingInfo.ClipInfo.Clip.name + "]", aAssociatedBindingInfo.ClipInfo.Clip.name);

            GUILayout.Label(label);

            GUILayout.FlexibleSpace();

            if (aAssociatedBindingInfo.HasPendingChanges && aAssociatedBindingInfo.NewPath.Equals(aCurrentBindingInfo.NewPath) == false)
            {
                GUILayout.Label("already has a different pending change!", EditorStyles.miniLabel);
            }
            else if (aAssociatedBindingInfo.ClipInfo.ContainsBinding(aCurrentBindingInfo.NewPath, aAssociatedBindingInfo))
            {
                GUILayout.Label("already has that binding or has it as a pending change!", EditorStyles.miniLabel);
            }
            else
            {
                bool set = GUILayout.Toggle(aAssociatedBindingInfo.HasPendingChanges, string.Empty);
                if (set)
                {
                    if (aAssociatedBindingInfo.HasPendingChanges == false)
                    {
                        aAssociatedBindingInfo.SetPendingUpdate(aCurrentBindingInfo.NewPath);
                        pendingChanges++;
                    }
                }
                else
                {
                    if (aAssociatedBindingInfo.HasPendingChanges)
                    {
                        aAssociatedBindingInfo.ClearPendingChanges();
                        pendingChanges--;
                    }
                }
            }

            GUILayout.EndHorizontal();

            GUILayout.EndHorizontal();
        }
コード例 #2
0
 /// <summary>
 /// Clear all pending changes from provided BindingInfo
 /// </summary>
 /// <param name="aBindingInfo">BindingInfo to update</param>
 private void ClearPendingChanges(EditorBindingInfo aBindingInfo)
 {
     aBindingInfo.ClearPendingChanges();
     pendingChanges--;
 }