using System.Collections.Generic;
using UnityEngine.SceneManagement;
namespace FishNet.Managing.Scened
{
///
/// Data about which scenes to unload.
///
public class SceneUnloadData
{
///
/// When specified this scene will be set as the active scene after unloading occurs.
///
public SceneLookupData PreferredActiveScene = null;
///
/// SceneLookupData for each scene to load.
///
public SceneLookupData[] SceneLookupDatas = new SceneLookupData[0];
///
/// Parameters which may be set and will be included in load callbacks.
///
public UnloadParams Params = new UnloadParams();
///
/// Additional options to use for loaded scenes.
///
public UnloadOptions Options = new UnloadOptions();
///
///
///
public SceneUnloadData() { }
///
///
///
/// Scene to unload.
public SceneUnloadData(Scene scene) : this(new Scene[] { scene }) { }
///
///
///
/// Scene to unload by name.
public SceneUnloadData(string sceneName) : this(new string[] { sceneName }) { }
///
///
///
/// Scene to unload by handle.
public SceneUnloadData(int sceneHandle) : this(new int[] { sceneHandle }) { }
///
///
///
/// Scenes to unload.
public SceneUnloadData(List scenes) : this(scenes.ToArray()) { }
///
///
///
/// Scenes to unload by names.
public SceneUnloadData(List sceneNames) : this(sceneNames.ToArray()) { }
///
///
///
/// Scenes to unload by handles.
public SceneUnloadData(List sceneHandles) : this(sceneHandles.ToArray()) { }
///
///
///
/// Scenes to unload.
public SceneUnloadData(Scene[] scenes)
{
SceneLookupDatas = SceneLookupData.CreateData(scenes);
}
///
///
///
/// Scenes to unload by names.
public SceneUnloadData(string[] sceneNames)
{
SceneLookupDatas = SceneLookupData.CreateData(sceneNames);
}
///
///
///
/// Scenes to unload by handles.
public SceneUnloadData(int[] sceneHandles)
{
SceneLookupDatas = SceneLookupData.CreateData(sceneHandles);
}
///
///
///
/// Scenes to unload by SceneLookupDatas.
public SceneUnloadData(SceneLookupData[] sceneLookupDatas)
{
SceneLookupDatas = sceneLookupDatas;
}
///
/// Returns if any data is invalid, such as null entries.
///
///
internal bool DataInvalid()
{
//Null values.
if (Params == null || SceneLookupDatas == null ||
Options == null)
return true;
//No lookups.
if (SceneLookupDatas.Length == 0)
return true;
return false;
}
}
}