102 lines
3.1 KiB
C#
102 lines
3.1 KiB
C#
using System;
|
|
//using System.Collections;
|
|
//using System.Collections.Generic;
|
|
using System.Diagnostics;
|
|
using Sirenix.OdinInspector;
|
|
using UnityEditor;
|
|
//using UnityEditor.Rendering;
|
|
using UnityEngine;
|
|
|
|
namespace Beyond
|
|
{
|
|
public class DebugTests : MonoBehaviour
|
|
{
|
|
public float timeScale = 1f;
|
|
public float startFixedDeltaTime;
|
|
#if UNITY_EDITOR
|
|
public void SaveVersion(string v)
|
|
{
|
|
BuildVersionScriptable bv = new BuildVersionScriptable();
|
|
bv.version = v;
|
|
AssetDatabase.DeleteAsset("Assets/Resources/Build.asset");
|
|
AssetDatabase.CreateAsset(bv, "Assets/Resources/Build.asset");
|
|
AssetDatabase.SaveAssets();
|
|
}
|
|
private string ExecuteProcessTerminal(string argument)
|
|
{
|
|
string output = "";
|
|
try
|
|
{
|
|
UnityEngine.Debug.Log("============== Start Executing [" + argument + "] ===============");
|
|
ProcessStartInfo startInfo = new ProcessStartInfo("/bin/bash")
|
|
{
|
|
WorkingDirectory = "/Users/marcin/projects/beYond",
|
|
UseShellExecute = false,
|
|
RedirectStandardOutput = true
|
|
};
|
|
Process myProcess = new Process
|
|
{
|
|
StartInfo = startInfo
|
|
};
|
|
//myProcess.StartInfo.Arguments = argument;
|
|
myProcess.StartInfo.Arguments = " -c \"" + argument + " \"";
|
|
myProcess.Start();
|
|
output = myProcess.StandardOutput.ReadToEnd();
|
|
UnityEngine.Debug.Log("Result for [" + argument + "] is : \n" + output);
|
|
myProcess.WaitForExit();
|
|
UnityEngine.Debug.Log("============== End ===============");
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
UnityEngine.Debug.LogError(e);
|
|
}
|
|
|
|
return output;
|
|
}
|
|
|
|
[Button]
|
|
void ExecuteCommand()
|
|
{
|
|
var result = ExecuteProcessTerminal("svnversion -c");
|
|
if (!String.IsNullOrEmpty(result))
|
|
{
|
|
int id = result.IndexOf(':');
|
|
if (id > 0)
|
|
{
|
|
result = result.Substring(id+1);
|
|
}
|
|
|
|
id = result.IndexOf('M');
|
|
if (id > 0)
|
|
{
|
|
result = result.Substring(0, result.IndexOf('M'));
|
|
}
|
|
PlayerSettings.iOS.buildNumber = result;
|
|
SaveVersion(result);
|
|
|
|
}
|
|
}
|
|
#endif
|
|
[Button]
|
|
void GetVideoCanavas()
|
|
{
|
|
var instance = VideoCutsceneController.Instance;
|
|
}
|
|
|
|
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
startFixedDeltaTime = Time.fixedDeltaTime;
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
Time.timeScale = timeScale;
|
|
|
|
Time.fixedDeltaTime = startFixedDeltaTime * timeScale;
|
|
}
|
|
}
|
|
}
|