Fix server build
This commit is contained in:
parent
779716b66e
commit
9af055f81f
@ -10,6 +10,7 @@ GameObject:
|
|||||||
m_Component:
|
m_Component:
|
||||||
- component: {fileID: 170678578394383911}
|
- component: {fileID: 170678578394383911}
|
||||||
- component: {fileID: 2654296452177192280}
|
- component: {fileID: 2654296452177192280}
|
||||||
|
- component: {fileID: 212299720352295742}
|
||||||
m_Layer: 5
|
m_Layer: 5
|
||||||
m_Name: TerminalRoot
|
m_Name: TerminalRoot
|
||||||
m_TagString: Terminal
|
m_TagString: Terminal
|
||||||
@ -55,6 +56,20 @@ MonoBehaviour:
|
|||||||
Player: {fileID: 0}
|
Player: {fileID: 0}
|
||||||
LinesVisibleAtOnce: 32
|
LinesVisibleAtOnce: 32
|
||||||
TerminalScrollbar: {fileID: 4580324269108703239}
|
TerminalScrollbar: {fileID: 4580324269108703239}
|
||||||
|
--- !u!114 &212299720352295742
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 170678578394383910}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 482c31472342e654698a9cb423b2ff5f, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
SleepBeforeInputMillis: 2000
|
||||||
|
Terminal: {fileID: 2654296452177192280}
|
||||||
--- !u!1 &170678579363757794
|
--- !u!1 &170678579363757794
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -400,7 +415,7 @@ MonoBehaviour:
|
|||||||
m_TargetGraphic: {fileID: 2282722458285268294}
|
m_TargetGraphic: {fileID: 2282722458285268294}
|
||||||
m_HandleRect: {fileID: 4556893897637480247}
|
m_HandleRect: {fileID: 4556893897637480247}
|
||||||
m_Direction: 2
|
m_Direction: 2
|
||||||
m_Value: 1
|
m_Value: 0
|
||||||
m_Size: 1
|
m_Size: 1
|
||||||
m_NumberOfSteps: 0
|
m_NumberOfSteps: 0
|
||||||
m_OnValueChanged:
|
m_OnValueChanged:
|
||||||
|
@ -174,6 +174,15 @@ namespace NeonTea.Quakeball.Interface {
|
|||||||
Messages[idx] = message;
|
Messages[idx] = message;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<string> GetMessagesSince(ref int startIndex) {
|
||||||
|
List<string> messages = new List<string>();
|
||||||
|
for (int i = startIndex; i < Messages.Count; i++) {
|
||||||
|
messages.Add(Messages[i]);
|
||||||
|
}
|
||||||
|
startIndex = Messages.Count;
|
||||||
|
return messages;
|
||||||
|
}
|
||||||
|
|
||||||
private void Scroll(int amount) {
|
private void Scroll(int amount) {
|
||||||
if (IsOpened() && PreviousRuns.Count > 0) {
|
if (IsOpened() && PreviousRuns.Count > 0) {
|
||||||
JustScrolled = true;
|
JustScrolled = true;
|
||||||
|
52
Assets/Scripts/Interface/TerminalStdio.cs
Normal file
52
Assets/Scripts/Interface/TerminalStdio.cs
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Concurrent;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
|
namespace NeonTea.Quakeball.Interface {
|
||||||
|
public class TerminalStdio : UnityEngine.MonoBehaviour {
|
||||||
|
public int SleepBeforeInputMillis;
|
||||||
|
public Terminal Terminal;
|
||||||
|
|
||||||
|
private Thread StdioThread;
|
||||||
|
private int MessageIndex = 0;
|
||||||
|
private ConcurrentQueue<string> Commands = new ConcurrentQueue<string>();
|
||||||
|
|
||||||
|
private void Awake() {
|
||||||
|
StdioThread = new Thread(new ThreadStart(StdioMain));
|
||||||
|
StdioThread.IsBackground = true;
|
||||||
|
StdioThread.Start();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Update() {
|
||||||
|
string cmd;
|
||||||
|
while (Commands.TryDequeue(out cmd)) {
|
||||||
|
Terminal.Run(cmd);
|
||||||
|
}
|
||||||
|
List<string> prints = Terminal.GetMessagesSince(ref MessageIndex);
|
||||||
|
if (prints.Count > 0) {
|
||||||
|
foreach (string print in prints) {
|
||||||
|
Console.Out.Write($"{print}\n");
|
||||||
|
}
|
||||||
|
Console.Out.Write("[Quakeball]: ");
|
||||||
|
Console.Out.Flush();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void StdioMain() {
|
||||||
|
Console.Out.WriteLine($"Console thread started, waiting a {SleepBeforeInputMillis} ms for everything to start up.");
|
||||||
|
Thread.Sleep(SleepBeforeInputMillis);
|
||||||
|
Console.Out.WriteLine("#########################");
|
||||||
|
Console.Out.WriteLine("# Welcome to Quakeball! #");
|
||||||
|
Console.Out.WriteLine("#########################");
|
||||||
|
Console.Out.WriteLine(" (Try writing \"help\"!)");
|
||||||
|
Console.Out.Write("\n[Quakeball]: ");
|
||||||
|
while (true) {
|
||||||
|
string cmd = Console.In.ReadLine().Trim();
|
||||||
|
if (cmd != null && cmd.Length > 0) {
|
||||||
|
Commands.Enqueue(cmd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
11
Assets/Scripts/Interface/TerminalStdio.cs.meta
Normal file
11
Assets/Scripts/Interface/TerminalStdio.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 482c31472342e654698a9cb423b2ff5f
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
Loading…
Reference in New Issue
Block a user