public static ItemAttribute Create() { int num = 1; while (System.IO.File.Exists(EditorPrefs.GetString("DatabasePath") + "/ItemAttributes/New ItemAttribute" + "(" + num.ToString() + ")" + ".asset")) { num++; } ItemAttribute asset = ScriptableObject.CreateInstance <ItemAttribute>(); AssetDatabase.CreateAsset(asset, EditorPrefs.GetString("DatabasePath") + "/ItemAttributes/New ItemAttribute(" + num.ToString() + ")" + ".asset"); asset.attributeName = asset.name; AssetDatabase.SaveAssets(); return(asset); }
void EquipmentOnReorderableListAddDropdownClick(object target) { ItemAttribute state = (ItemAttribute)target; int index = m_EquipmentList.serializedProperty.arraySize; m_EquipmentList.serializedProperty.arraySize++; m_EquipmentList.index = index; SerializedProperty element = m_EquipmentList.serializedProperty.GetArrayElementAtIndex(index); element.FindPropertyRelative("equipmentItemAttribute").objectReferenceValue = state; element.FindPropertyRelative("effectType").enumValueIndex = 0; element.FindPropertyRelative("value").floatValue = 0f; m_ConsumbleSerializedObject.ApplyModifiedProperties(); }
void playerAttributesUIOnReorderableListAddDropdownClick(object target) { ItemAttribute state = (ItemAttribute)target; int index = m_playerAttributesUIList.serializedProperty.arraySize; m_playerAttributesUIList.serializedProperty.arraySize++; m_playerAttributesUIList.index = index; SerializedProperty element = m_playerAttributesUIList.serializedProperty.GetArrayElementAtIndex(index); element.FindPropertyRelative("m_Attribute").objectReferenceValue = state; element.FindPropertyRelative("showType").enumValueIndex = 0; element.FindPropertyRelative("showText").objectReferenceValue = null; element.FindPropertyRelative("showSlider").objectReferenceValue = null; serializedObject.ApplyModifiedProperties(); }
void playerAttributeOnReorderableListAddDropdownClick(object target) { ItemAttribute state = (ItemAttribute)target; int index = m_playerAttributeList.serializedProperty.arraySize; m_playerAttributeList.serializedProperty.arraySize++; m_playerAttributeList.index = index; SerializedProperty element = m_playerAttributeList.serializedProperty.GetArrayElementAtIndex(index); element.FindPropertyRelative("playerAttribute").objectReferenceValue = state; element.FindPropertyRelative("currentValue").floatValue = 0f; element.FindPropertyRelative("minValue").floatValue = 0f; element.FindPropertyRelative("maxValue").floatValue = 100f; serializedObject.ApplyModifiedProperties(); }