コード例 #1
0
        /// <summary>
        /// The list has been reordered. Ensure the reorder is valid.
        /// </summary>
        private void OnViewTypeStateListReorder(ReorderableList list)
        {
            var viewType = m_CameraController.ViewTypes[EditorPrefs.GetInt(SelectedViewTypeIndexKey)];

            // Use the dummy array in order to determine what element the selected index was swapped with.
            var copiedStates = new Shared.StateSystem.State[viewType.States.Length];

            Array.Copy(viewType.States, copiedStates, viewType.States.Length);
            for (int i = 0; i < viewType.States.Length; ++i)
            {
                var element = list.serializedProperty.GetArrayElementAtIndex(i);
                if (element.intValue != i)
                {
                    viewType.States[i] = copiedStates[element.intValue];
                    element.intValue   = i;
                }
            }

            var states = StateInspector.OnStateListReorder(viewType.States);

            if (viewType.States.Length != states.Length)
            {
                InspectorUtility.SynchronizePropertyCount(states, m_ReorderableViewTypeStateList.serializedProperty);
                Shared.Editor.Utility.EditorUtility.RecordUndoDirtyObject(target, "Change Value");
                viewType.States = states;
                SerializeViewTypes();
            }
        }
コード例 #2
0
        /// <summary>
        /// The list has been reordered. Ensure the reorder is valid.
        /// </summary>
        private void OnAnimatorAudioStateSetStateListReorder(ReorderableList list)
        {
            var animatorAudioState = m_ShootableWeapon.ReloadAnimatorAudioStateSet.States[EditorPrefs.GetInt(SelectedReloadAnimatorAudioStateSetIndexKey)];

            // Use the dummy array in order to determine what element the selected index was swapped with.
            var copiedStates = new Shared.StateSystem.State[animatorAudioState.States.Length];

            Array.Copy(animatorAudioState.States, copiedStates, animatorAudioState.States.Length);
            for (int i = 0; i < animatorAudioState.States.Length; ++i)
            {
                var element = list.serializedProperty.GetArrayElementAtIndex(i);
                if (element.intValue != i)
                {
                    animatorAudioState.States[i] = copiedStates[element.intValue];
                    element.intValue             = i;
                }
            }

            var states = StateInspector.OnStateListReorder(animatorAudioState.States);

            if (animatorAudioState.States.Length != states.Length)
            {
                InspectorUtility.SynchronizePropertyCount(states, m_ReorderableReloadAnimatorAudioStateSetStateList.serializedProperty);
                Shared.Editor.Utility.EditorUtility.RecordUndoDirtyObject(target, "Change Value");
                animatorAudioState.States = states;
            }
        }
コード例 #3
0
        /// <summary>
        /// The list has been reordered. Ensure the reorder is valid.
        /// </summary>
        private void OnPickupSetStateListReorder(ReorderableList list)
        {
            var pickupSet = m_ItemPickup.ItemPickupSet[EditorPrefs.GetInt(SelectedPickupSetIndexKey, -1)];

            // Use the dummy array in order to determine what element the selected index was swapped with.
            var copiedStates = new UltimateCharacterController.StateSystem.State[pickupSet.ItemSet.States.Length];

            System.Array.Copy(pickupSet.ItemSet.States, copiedStates, pickupSet.ItemSet.States.Length);
            for (int i = 0; i < pickupSet.ItemSet.States.Length; ++i)
            {
                var element = list.serializedProperty.GetArrayElementAtIndex(i);
                if (element.intValue != i)
                {
                    pickupSet.ItemSet.States[i] = copiedStates[element.intValue];
                    element.intValue            = i;
                }
            }

            var states = StateInspector.OnStateListReorder(pickupSet.ItemSet.States);

            if (pickupSet.ItemSet.States.Length != states.Length)
            {
                InspectorUtility.SynchronizePropertyCount(states, m_ReorderablePickupSetStateList.serializedProperty);
                InspectorUtility.RecordUndoDirtyObject(target, "Change Value");
                pickupSet.ItemSet.States = states;
            }
        }
コード例 #4
0
        /// <summary>
        /// The list has been reordered. Ensure the reorder is valid.
        /// </summary>
        private void OnItemSetStateListReorder(ReorderableList list)
        {
            m_ItemSetListIndex = m_ReorderableListCategoryMap[list];
            var itemSet = m_ItemSetManager.CategoryItemSets[m_ItemSetListIndex].ItemSetList[EditorPrefs.GetInt(SelectedItemSetIndexKey, -1)];

            // Use the dummy array in order to determine what element the selected index was swapped with.
            var copiedStates = new Shared.StateSystem.State[itemSet.States.Length];

            System.Array.Copy(itemSet.States, copiedStates, itemSet.States.Length);
            for (int i = 0; i < itemSet.States.Length; ++i)
            {
                var element = list.serializedProperty.GetArrayElementAtIndex(i);
                if (element.intValue != i)
                {
                    itemSet.States[i] = copiedStates[element.intValue];
                    element.intValue  = i;
                }
            }

            var states = StateInspector.OnStateListReorder(itemSet.States);

            if (itemSet.States.Length != states.Length)
            {
                InspectorUtility.SynchronizePropertyCount(states, m_ReorderableItemSetStateList[m_ItemSetListIndex].serializedProperty);
                Shared.Editor.Utility.EditorUtility.RecordUndoDirtyObject(target, "Change Value");
                itemSet.States = states;
            }
        }
コード例 #5
0
        /// <summary>
        /// The list has been reordered. Ensure the reorder is valid.
        /// </summary>
        private void OnAttributeStateListReorder(ReorderableList list)
        {
            var attribute = m_AttributeManager.Attributes[EditorPrefs.GetInt(SelectedAttributeIndexKey)];

            // Use the dummy array in order to determine what element the selected index was swapped with.
            var copiedStates = new UltimateCharacterController.StateSystem.State[attribute.States.Length];

            Array.Copy(attribute.States, copiedStates, attribute.States.Length);
            for (int i = 0; i < attribute.States.Length; ++i)
            {
                var element = list.serializedProperty.GetArrayElementAtIndex(i);
                if (element.intValue != i)
                {
                    attribute.States[i] = copiedStates[element.intValue];
                    element.intValue    = i;
                }
            }

            var states = StateInspector.OnStateListReorder(attribute.States);

            if (attribute.States.Length != states.Length)
            {
                InspectorUtility.SynchronizePropertyCount(states, m_ReorderableAttributeStateList.serializedProperty);
                InspectorUtility.RecordUndoDirtyObject(target, "Change Value");
                attribute.States = states;
            }
        }