예제 #1
0
        /// <summary>
        /// Draws all of the added states.
        /// </summary>
        private void OnViewTypeStateListDraw(Rect rect, int index, bool isActive, bool isFocused)
        {
            if (m_ReorderableViewTypeStateList == null)
            {
                return;
            }

            var viewType = m_CameraController.ViewTypes[EditorPrefs.GetInt(SelectedViewTypeIndexKey)];

            // The index may be out of range if the component was copied.
            if (index >= m_CameraController.ViewTypes[EditorPrefs.GetInt(SelectedViewTypeIndexKey)].States.Length)
            {
                m_ReorderableViewTypeStateList.index = -1;
                EditorPrefs.SetInt(GetSelectedViewTypeStateIndexKey(viewType), m_ReorderableViewTypeStateList.index);
                return;
            }

            EditorGUI.BeginChangeCheck();
            StateInspector.OnStateListDraw(viewType, viewType.States, rect, index);
            if (EditorGUI.EndChangeCheck())
            {
                Shared.Editor.Utility.EditorUtility.RecordUndoDirtyObject(target, "Change Value");
                SerializeViewTypes();

                StateInspector.UpdateDefaultStateValues(viewType.States);
            }
        }
        /// <summary>
        /// Draws all of the added states.
        /// </summary>
        private void OnItemSetStateListDraw(Rect rect, int index, bool isActive, bool isFocused)
        {
            EditorGUI.BeginChangeCheck();
            if (m_ItemSetListIndex >= m_ItemSetManager.CategoryItemSets.Length ||
                EditorPrefs.GetInt(SelectedItemSetIndexKey, -1) == -1 ||
                EditorPrefs.GetInt(SelectedItemSetIndexKey, -1) >= m_ItemSetManager.CategoryItemSets[m_ItemSetListIndex].ItemSetList.Count)
            {
                m_ReorderableItemSetStateList[m_ItemSetListIndex].index = -1;
                return;
            }

            var itemSet = m_ItemSetManager.CategoryItemSets[m_ItemSetListIndex].ItemSetList[EditorPrefs.GetInt(SelectedItemSetIndexKey, -1)];

            // The index may be out of range if the component was copied.
            if (index >= itemSet.States.Length)
            {
                m_ReorderableItemSetStateList[m_ItemSetListIndex].index = -1;
                return;
            }

            StateInspector.OnStateListDraw(itemSet, itemSet.States, rect, index);
            if (EditorGUI.EndChangeCheck())
            {
                Shared.Editor.Utility.EditorUtility.RecordUndoDirtyObject(target, "Change Value");
                StateInspector.UpdateDefaultStateValues(itemSet.States);
            }
        }
예제 #3
0
        /// <summary>
        /// Draws all of the added states.
        /// </summary>
        private void OnPickupSetStateListDraw(Rect rect, int index, bool isActive, bool isFocused)
        {
            EditorGUI.BeginChangeCheck();
            var pickupSet = m_ItemPickup.ItemPickupSet[EditorPrefs.GetInt(SelectedPickupSetIndexKey, -1)];

            // The index may be out of range if the component was copied.
            if (index >= pickupSet.ItemSet.States.Length)
            {
                m_ReorderablePickupSetStateList.index = -1;
                return;
            }

            StateInspector.OnStateListDraw(pickupSet.ItemSet, pickupSet.ItemSet.States, rect, index);
            if (EditorGUI.EndChangeCheck())
            {
                InspectorUtility.RecordUndoDirtyObject(target, "Change Value");
                StateInspector.UpdateDefaultStateValues(pickupSet.ItemSet.States);
            }
        }
        /// <summary>
        /// Draws all of the added states.
        /// </summary>
        private void OnAnimatorAudioStateSetStateListDraw(Rect rect, int index, bool isActive, bool isFocused)
        {
            EditorGUI.BeginChangeCheck();
            var animatorAudioState = m_ShootableWeapon.ReloadAnimatorAudioStateSet.States[EditorPrefs.GetInt(SelectedReloadAnimatorAudioStateSetIndexKey)];

            // The index may be out of range if the component was copied.
            if (index >= animatorAudioState.States.Length)
            {
                m_ReorderableReloadAnimatorAudioStateSetStateList.index = -1;
                EditorPrefs.SetInt(GetSelectedAnimatorAudioStateSetStateIndexKey(EditorPrefs.GetInt(SelectedReloadAnimatorAudioStateSetIndexKey)), m_ReorderableReloadAnimatorAudioStateSetStateList.index);
                return;
            }

            StateInspector.OnStateListDraw(animatorAudioState, animatorAudioState.States, rect, index);
            if (EditorGUI.EndChangeCheck())
            {
                Shared.Editor.Utility.EditorUtility.RecordUndoDirtyObject(target, "Change Value");
                StateInspector.UpdateDefaultStateValues(animatorAudioState.States);
            }
        }
예제 #5
0
        /// <summary>
        /// Draws all of the added states.
        /// </summary>
        private void OnAttributeStateListDraw(Rect rect, int index, bool isActive, bool isFocused)
        {
            EditorGUI.BeginChangeCheck();
            var attribute = m_AttributeManager.Attributes[EditorPrefs.GetInt(SelectedAttributeIndexKey)];

            // The index may be out of range if the component was copied.
            if (index >= m_AttributeManager.Attributes[EditorPrefs.GetInt(SelectedAttributeIndexKey)].States.Length)
            {
                m_ReorderableAttributeStateList.index = -1;
                EditorPrefs.SetInt(GetSelectedAttributeStateIndexKey(attribute), m_ReorderableAttributeStateList.index);
                return;
            }

            StateInspector.OnStateListDraw(attribute, attribute.States, rect, index);
            if (EditorGUI.EndChangeCheck())
            {
                InspectorUtility.RecordUndoDirtyObject(target, "Change Value");

                StateInspector.UpdateDefaultStateValues(attribute.States);
            }
        }