243 lines
8.6 KiB
C#
243 lines
8.6 KiB
C#
using System.Collections.Generic;
|
|
using UnityEditor;
|
|
using UnityEngine;
|
|
|
|
namespace BulletHellTemplate
|
|
{
|
|
[CreateAssetMenu(fileName = "NewMapInfoData", menuName = "Map Info Data", order = 52)]
|
|
public class MapInfoData : ScriptableObject
|
|
{
|
|
[Tooltip("The scene associated with the map.")]
|
|
public string scene;
|
|
|
|
[Tooltip("The unique identifier for the map.")]
|
|
public int mapId;
|
|
|
|
[Tooltip("Indicates whether the map is unlocked.")]
|
|
public bool isUnlocked;
|
|
|
|
[Tooltip("The name of the map.")]
|
|
public string mapName;
|
|
public NameTranslatedByLanguage[] mapNameTranslated;
|
|
|
|
[Tooltip("A brief description of the map.")]
|
|
public string mapDescription;
|
|
public DescriptionTranslatedByLanguage[] mapDescriptionTranslated;
|
|
|
|
[Tooltip("The preview image of the map.")]
|
|
public Sprite mapPreviewImage;
|
|
|
|
[Tooltip("The minimap display image.")]
|
|
public Sprite mapMinimapImage;
|
|
|
|
[Tooltip("The difficulty rating of the map."), Range(1, 5)]
|
|
public int difficultyRating;
|
|
|
|
[Space, Header("Reward Settings")]
|
|
[Tooltip("Enable to provide rewards when completing this map for the first time.")]
|
|
public bool isRewardOnCompleteFirstTime;
|
|
|
|
[Tooltip("List of currency rewards for completing the map.")]
|
|
public List<MapRewards> WinMapRewards;
|
|
|
|
[Tooltip("Type of special reward for completing the map.")]
|
|
public MapRewardType rewardType;
|
|
|
|
[Tooltip("Icon reward item.")]
|
|
public IconItem iconItem;
|
|
|
|
[Tooltip("Frame reward item.")]
|
|
public FrameItem frameItem;
|
|
|
|
[Tooltip("Character data reward.")]
|
|
public CharacterData characterData;
|
|
|
|
public InventoryItem inventoryItem;
|
|
|
|
[Space, Header("Map Access Settings")]
|
|
[Tooltip("Requires specific currency to access this map.")]
|
|
public bool isNeedCurrency;
|
|
|
|
[Tooltip("Currency type needed to enter the map.")]
|
|
public Currency currency;
|
|
|
|
[Tooltip("Amount of currency required.")]
|
|
public int amount;
|
|
|
|
[Tooltip("Allows skipping this map requirement when completing previous maps.")]
|
|
public bool canIgnoreMap;
|
|
|
|
[Space, Header("Event Map Settings")]
|
|
[Tooltip("Enable if this is a time-limited event map.")]
|
|
public bool isEventMap;
|
|
|
|
[Tooltip("Unique identifier for the event in Firebase.")]
|
|
public string eventIdName;
|
|
}
|
|
|
|
[System.Serializable]
|
|
public class MapRewards
|
|
{
|
|
[Tooltip("Type of currency to reward.")]
|
|
public Currency currency;
|
|
|
|
[Tooltip("Amount of currency to award.")]
|
|
public int amount;
|
|
|
|
public int accountExp;
|
|
|
|
public int characterExp;
|
|
|
|
public int characterMasteryAmount;
|
|
|
|
|
|
}
|
|
|
|
public enum MapRewardType
|
|
{
|
|
None,
|
|
Icon,
|
|
Frame,
|
|
Character,
|
|
InventoryItem
|
|
}
|
|
}
|
|
|
|
#if UNITY_EDITOR
|
|
|
|
namespace BulletHellTemplate
|
|
{
|
|
[CustomEditor(typeof(MapInfoData))]
|
|
public class MapInfoDataEditor : Editor
|
|
{
|
|
private SerializedProperty scene;
|
|
private SerializedProperty mapId;
|
|
private SerializedProperty isUnlocked;
|
|
private SerializedProperty mapName;
|
|
private SerializedProperty mapDescription;
|
|
private SerializedProperty mapPreviewImage;
|
|
private SerializedProperty mapMinimapImage;
|
|
private SerializedProperty difficultyRating;
|
|
|
|
// Reward Section
|
|
private SerializedProperty isRewardOnCompleteFirstTime;
|
|
private SerializedProperty currencyRewards;
|
|
private SerializedProperty rewardType;
|
|
private SerializedProperty iconItem;
|
|
private SerializedProperty frameItem;
|
|
private SerializedProperty characterData;
|
|
private SerializedProperty inventoryItem;
|
|
// Access Settings
|
|
private SerializedProperty isNeedCurrency;
|
|
private SerializedProperty currency;
|
|
private SerializedProperty amount;
|
|
private SerializedProperty canIgnoreMap;
|
|
|
|
// Event Settings
|
|
private SerializedProperty isEventMap;
|
|
private SerializedProperty eventIdName;
|
|
|
|
private void OnEnable()
|
|
{
|
|
scene = serializedObject.FindProperty("scene");
|
|
mapId = serializedObject.FindProperty("mapId");
|
|
isUnlocked = serializedObject.FindProperty("isUnlocked");
|
|
mapName = serializedObject.FindProperty("mapName");
|
|
mapDescription = serializedObject.FindProperty("mapDescription");
|
|
mapPreviewImage = serializedObject.FindProperty("mapPreviewImage");
|
|
mapMinimapImage = serializedObject.FindProperty("mapMinimapImage");
|
|
difficultyRating = serializedObject.FindProperty("difficultyRating");
|
|
|
|
isRewardOnCompleteFirstTime = serializedObject.FindProperty("isRewardOnCompleteFirstTime");
|
|
currencyRewards = serializedObject.FindProperty("WinMapRewards");
|
|
rewardType = serializedObject.FindProperty("rewardType");
|
|
iconItem = serializedObject.FindProperty("iconItem");
|
|
frameItem = serializedObject.FindProperty("frameItem");
|
|
characterData = serializedObject.FindProperty("characterData");
|
|
inventoryItem = serializedObject.FindProperty("inventoryItem");
|
|
|
|
isNeedCurrency = serializedObject.FindProperty("isNeedCurrency");
|
|
currency = serializedObject.FindProperty("currency");
|
|
amount = serializedObject.FindProperty("amount");
|
|
canIgnoreMap = serializedObject.FindProperty("canIgnoreMap");
|
|
|
|
isEventMap = serializedObject.FindProperty("isEventMap");
|
|
eventIdName = serializedObject.FindProperty("eventIdName");
|
|
}
|
|
|
|
public override void OnInspectorGUI()
|
|
{
|
|
serializedObject.Update();
|
|
|
|
EditorGUILayout.LabelField("Basic Map Settings", EditorStyles.boldLabel);
|
|
EditorGUILayout.PropertyField(scene);
|
|
EditorGUILayout.PropertyField(mapId);
|
|
EditorGUILayout.PropertyField(isUnlocked);
|
|
EditorGUILayout.PropertyField(mapName);
|
|
EditorGUILayout.PropertyField(mapDescription);
|
|
EditorGUILayout.PropertyField(mapPreviewImage);
|
|
EditorGUILayout.PropertyField(mapMinimapImage);
|
|
EditorGUILayout.PropertyField(difficultyRating);
|
|
|
|
// Reward Section
|
|
EditorGUILayout.Space();
|
|
EditorGUILayout.LabelField("Completion Rewards", EditorStyles.boldLabel);
|
|
EditorGUILayout.PropertyField(isRewardOnCompleteFirstTime);
|
|
|
|
if (isRewardOnCompleteFirstTime.boolValue)
|
|
{
|
|
EditorGUI.indentLevel++;
|
|
EditorGUILayout.PropertyField(currencyRewards, true);
|
|
EditorGUILayout.PropertyField(rewardType);
|
|
|
|
switch (rewardType.enumValueIndex)
|
|
{
|
|
case (int)MapRewardType.None:
|
|
break;
|
|
case (int)MapRewardType.Icon:
|
|
EditorGUILayout.PropertyField(iconItem);
|
|
break;
|
|
case (int)MapRewardType.Frame:
|
|
EditorGUILayout.PropertyField(frameItem);
|
|
break;
|
|
case (int)MapRewardType.Character:
|
|
EditorGUILayout.PropertyField(characterData);
|
|
break;
|
|
case (int)MapRewardType.InventoryItem:
|
|
EditorGUILayout.PropertyField(inventoryItem);
|
|
break;
|
|
}
|
|
EditorGUI.indentLevel--;
|
|
}
|
|
|
|
// Access Settings
|
|
EditorGUILayout.Space();
|
|
EditorGUILayout.LabelField("Map Access Requirements", EditorStyles.boldLabel);
|
|
EditorGUILayout.PropertyField(isNeedCurrency);
|
|
|
|
if (isNeedCurrency.boolValue)
|
|
{
|
|
EditorGUI.indentLevel++;
|
|
EditorGUILayout.PropertyField(currency);
|
|
EditorGUILayout.PropertyField(amount);
|
|
EditorGUILayout.PropertyField(canIgnoreMap);
|
|
EditorGUI.indentLevel--;
|
|
}
|
|
|
|
// Event Settings
|
|
EditorGUILayout.Space();
|
|
EditorGUILayout.LabelField("Event Configuration", EditorStyles.boldLabel);
|
|
EditorGUILayout.PropertyField(isEventMap);
|
|
|
|
if (isEventMap.boolValue)
|
|
{
|
|
EditorGUI.indentLevel++;
|
|
EditorGUILayout.PropertyField(eventIdName);
|
|
EditorGUI.indentLevel--;
|
|
}
|
|
|
|
serializedObject.ApplyModifiedProperties();
|
|
}
|
|
}
|
|
}
|
|
#endif |