You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
1.7 KiB
63 lines
1.7 KiB
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.PlayerNumber = gameInstance.playerNumber;
|
|
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 int playerNumber;
|
|
}
|
|
}
|