示例#1
0
    void DisplayAddMainArea()
    {
        EditorGUILayout.LabelField("SETTINGS", EditorStyles.boldLabel);
        EditorGUILayout.Space();

        new_icon = ( Sprite )EditorGUILayout.ObjectField("Icon: ", new_icon, typeof(Sprite), false);
        new_name = EditorGUILayout.TextField(new GUIContent("Name: "), new_name);
        new_desc = EditorGUILayout.TextField(new GUIContent("Decription: "), new_desc);

        EditorGUILayout.Space();
        EditorGUILayout.LabelField("ATTRIBUTES", EditorStyles.boldLabel);
        EditorGUILayout.Space();

        EditorGUILayout.LabelField("Hp Gain: ");
        new_hpGain = ( int )EditorGUILayout.Slider(new_hpGain, -100, 100);
        EditorGUILayout.LabelField("Sanity Gain: ");
        new_sanityGain = ( int )EditorGUILayout.Slider(new_sanityGain, -100, 100);
        EditorGUILayout.LabelField("Hydration Gain: ");
        new_hydrationGain = ( int )EditorGUILayout.Slider(new_hydrationGain, -100, 100);
        EditorGUILayout.LabelField("Nourishment Gain: ");
        new_nourishmentGain = ( int )EditorGUILayout.Slider(new_nourishmentGain, -100, 100);
        new_effectA         = (Consumable.EffectType)EditorGUILayout.EnumPopup("Effect Applied", new_effectA);
        new_effectB         = (Consumable.EffectType)EditorGUILayout.EnumPopup("Side-Effect Applied", new_effectB);

        EditorGUILayout.Space();

        if (GUILayout.Button("Done", GUILayout.Width(100)))
        {
            consumableDb.Database.Add(new Consumable(new_name, new_desc, new_icon, new_hpGain, new_sanityGain, new_nourishmentGain, new_hydrationGain, new_effectA, new_effectB));

            EditorUtility.SetDirty(consumableDb);
            ResetThings();
        }
    }
示例#2
0
 void ResetThings()
 {
     new_name            = string.Empty;
     new_desc            = string.Empty;
     new_icon            = null;
     new_hpGain          = 0;
     new_sanityGain      = 0;
     new_hydrationGain   = 0;
     new_nourishmentGain = 0;
     new_effectA         = Consumable.EffectType.NONE;
     new_effectB         = Consumable.EffectType.NONE;
     state = EditorState.BLANK;
 }