using NewHorizons.Utility;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
namespace NewHorizons.External.Modules
{
[JsonObject]
public class VolumesModule
{
///
/// Add audio volumes to this planet.
///
public AudioVolumeInfo[] audioVolumes;
///
/// Add hazard volumes to this planet.
///
public HazardVolumeInfo[] hazardVolumes;
///
/// Add interference volumes to this planet.
///
public VolumeInfo[] interferenceVolumes;
///
/// Add insulating volumes to this planet. These will stop electricty hazard volumes from affecting you (just like the jellyfish).
///
public VolumeInfo[] insulatingVolumes;
///
/// Add map restriction volumes to this planet.
///
public VolumeInfo[] mapRestrictionVolumes;
///
/// Add notification volumes to this planet.
///
public NotificationVolumeInfo[] notificationVolumes;
///
/// Add triggers that reveal parts of the ship log on this planet.
///
public RevealVolumeInfo[] revealVolumes;
///
/// Add reverb volumes to this planet. Great for echoes in caves.
///
public VolumeInfo[] reverbVolumes;
[JsonObject]
public class VolumeInfo
{
///
/// The location of this volume. Optional (will default to 0,0,0).
///
public MVector3 position;
///
/// The radius of this volume.
///
public float radius = 1f;
///
/// The relative path from the planet to the parent of this object. Optional (will default to the root sector).
///
public string parentPath;
///
/// An optional rename of this volume.
///
public string rename;
}
[JsonObject]
public class RevealVolumeInfo : VolumeInfo
{
[JsonConverter(typeof(StringEnumConverter))]
public enum RevealVolumeType
{
[EnumMember(Value = @"enter")] Enter = 0,
[EnumMember(Value = @"observe")] Observe = 1,
[EnumMember(Value = @"snapshot")] Snapshot = 2
}
///
/// The max view angle (in degrees) the player can see the volume with to unlock the fact (`observe` only)
///
public float maxAngle = 180f; // Observe Only
///
/// The max distance the user can be away from the volume to reveal the fact (`snapshot` and `observe` only)
///
public float maxDistance = -1f; // Snapshot & Observe Only
///
/// What needs to be done to the volume to unlock the facts
///
[DefaultValue("enter")] public RevealVolumeType revealOn = RevealVolumeType.Enter;
///
/// A list of facts to reveal
///
public string[] reveals;
///
/// An achievement to unlock. Optional.
///
public string achievementID;
}
[JsonObject]
public class AudioVolumeInfo : VolumeInfo
{
///
/// The audio to use. Can be a path to a .wav/.ogg/.mp3 file, or taken from the AudioClip list.
///
public string audio;
///
/// The audio track of this audio volume
///
[DefaultValue("environment")] public AudioMixerTrackName track = AudioMixerTrackName.Environment;
///
/// Whether to loop this audio while in this audio volume or just play it once
///
[DefaultValue(true)] public bool loop = true;
///
/// The loudness of the audio
///
[Range(0f, 1f)]
[DefaultValue(1f)]
public float volume = 1f;
}
[JsonObject]
public class NotificationVolumeInfo : VolumeInfo
{
///
/// What the notification will show for.
///
[DefaultValue("all")] public NotificationTarget target = NotificationTarget.All;
///
/// The notification that will play when you enter this volume.
///
public NotificationInfo entryNotification;
///
/// The notification that will play when you exit this volume.
///
public NotificationInfo exitNotification;
[JsonObject]
public class NotificationInfo
{
///
/// The message that will be displayed.
///
public string displayMessage;
///
/// The duration this notification will be displayed.
///
[DefaultValue(5f)] public float duration = 5f;
}
[JsonConverter(typeof(StringEnumConverter))]
public enum NotificationTarget
{
[EnumMember(Value = @"all")] All = 0,
[EnumMember(Value = @"ship")] Ship = 1,
[EnumMember(Value = @"player")] Player = 2,
}
}
[JsonObject]
public class HazardVolumeInfo : VolumeInfo
{
///
/// The type of hazard for this volume.
///
[DefaultValue("general")] public HazardType type = HazardType.GENERAL;
///
/// The amount of damage you will take per second while inside this volume.
///
[DefaultValue(10f)] public float damagePerSecond = 10f;
///
/// The type of damage you will take when you first touch this volume.
///
[DefaultValue("impact")] public InstantDamageType firstContactDamageType = InstantDamageType.Impact;
///
/// The amount of damage you will take when you first touch this volume.
///
public float firstContactDamage;
[JsonConverter(typeof(StringEnumConverter))]
public enum HazardType
{
[EnumMember(Value = @"none")] NONE = 0,
[EnumMember(Value = @"general")] GENERAL = 1,
[EnumMember(Value = @"ghostMatter")] DARKMATTER = 2,
[EnumMember(Value = @"heat")] HEAT = 4,
[EnumMember(Value = @"fire")] FIRE = 8,
[EnumMember(Value = @"sandfall")] SANDFALL = 16,
[EnumMember(Value = @"electricity")] ELECTRICITY = 32,
[EnumMember(Value = @"rapids")] RAPIDS = 64
}
[JsonConverter(typeof(StringEnumConverter))]
public enum InstantDamageType
{
[EnumMember(Value = @"impact")] Impact,
[EnumMember(Value = @"puncture")] Puncture,
[EnumMember(Value = @"electrical")] Electrical
}
}
}
[JsonConverter(typeof(StringEnumConverter))]
public enum AudioMixerTrackName
{
[EnumMember(Value = @"undefined")] Undefined = 0,
[EnumMember(Value = @"menu")] Menu = 1,
[EnumMember(Value = @"music")] Music = 2,
[EnumMember(Value = @"environment")] Environment = 4,
[EnumMember(Value = @"environmentUnfiltered")] Environment_Unfiltered = 5,
[EnumMember(Value = @"endTimesSfx")] EndTimes_SFX = 8,
[EnumMember(Value = @"signal")] Signal = 16,
[EnumMember(Value = @"death")] Death = 32,
[EnumMember(Value = @"player")] Player = 64,
[EnumMember(Value = @"playerExternal")] Player_External = 65,
[EnumMember(Value = @"ship")] Ship = 128,
[EnumMember(Value = @"map")] Map = 256,
[EnumMember(Value = @"endTimesMusic")] EndTimes_Music = 512,
[EnumMember(Value = @"muffleWhileRafting")] MuffleWhileRafting = 1024,
[EnumMember(Value = @"muffleIndoors")] MuffleIndoors = 2048,
[EnumMember(Value = @"slideReelMusic")] SlideReelMusic = 4096,
}
}