|
|
@ -0,0 +1,63 @@ |
|
|
|
|
|
using System; |
|
|
|
|
|
using System.Collections; |
|
|
|
|
|
using System.Collections.Generic; |
|
|
|
|
|
using UnityEngine; |
|
|
|
|
|
|
|
|
|
|
|
public class SplitScreenTest : MonoBehaviour |
|
|
|
|
|
{ |
|
|
|
|
|
[SerializeField] |
|
|
|
|
|
private GameInstance[] gameInstances = new GameInstance[4]; |
|
|
|
|
|
|
|
|
|
|
|
[SerializeField] |
|
|
|
|
|
private List<VisualStyle> visualStyles = new List<VisualStyle>(); |
|
|
|
|
|
|
|
|
|
|
|
private void Start() |
|
|
|
|
|
{ |
|
|
|
|
|
Debug.Log($"Running in {IntPtr.Size * 8}-bit mode"); |
|
|
|
|
|
|
|
|
|
|
|
Layers gameLayer = Layers.Game1; |
|
|
|
|
|
Layers viewLayer = Layers.ViewModel1; |
|
|
|
|
|
int layerStride = Layers.Game2 - Layers.Game1; |
|
|
|
|
|
|
|
|
|
|
|
foreach (var gameInstance in gameInstances) |
|
|
|
|
|
{ |
|
|
|
|
|
if (gameInstance == null || gameInstance.mainCamera == null) |
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
|
|
|
|
var uq = gameObject.AddComponent<UniQuake>(); |
|
|
|
|
|
uq.BaseGame = gameInstance.baseGame; |
|
|
|
|
|
uq.ModDirectory = gameInstance.modPath; |
|
|
|
|
|
uq.AdditionalArguments = ParseArgs(gameInstance.arguments); |
|
|
|
|
|
uq.Camera = gameInstance.mainCamera; |
|
|
|
|
|
uq.GameLayer = gameLayer; |
|
|
|
|
|
uq.ViewModelLayer = viewLayer; |
|
|
|
|
|
uq.LibraryOverride = gameInstance.libraryName; |
|
|
|
|
|
uq.SetVisualStyle(visualStyles[0]); |
|
|
|
|
|
|
|
|
|
|
|
gameLayer += layerStride; |
|
|
|
|
|
viewLayer += layerStride; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private string[] ParseArgs(string args) |
|
|
|
|
|
{ |
|
|
|
|
|
if (args == null) |
|
|
|
|
|
return new string[0]; |
|
|
|
|
|
|
|
|
|
|
|
return args.Split(new[] {' ', '\t', '\r', '\n'}, StringSplitOptions.RemoveEmptyEntries); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
[Serializable] |
|
|
|
|
|
public class GameInstance |
|
|
|
|
|
{ |
|
|
|
|
|
public Camera mainCamera; |
|
|
|
|
|
|
|
|
|
|
|
public MissionPack baseGame; |
|
|
|
|
|
|
|
|
|
|
|
public string modPath; |
|
|
|
|
|
|
|
|
|
|
|
public string arguments; |
|
|
|
|
|
|
|
|
|
|
|
public string libraryName; |
|
|
|
|
|
} |
|
|
|
|
|
} |