Add terminal

This commit is contained in:
Sofia 2020-08-07 00:37:23 +03:00
parent a086f02f93
commit 139b1a1807
14 changed files with 2761 additions and 17 deletions

8
Assets/Fonts.meta Normal file
View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 66c8084c1cd356a47a7845b1df763ff9
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: d203ccb39cd2eba42ab935f79171e4c7
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,21 @@
fileFormatVersion: 2
guid: 99344f7b7bdeaef47a87b408b736709a
TrueTypeFontImporter:
externalObjects: {}
serializedVersion: 4
fontSize: 16
forceTextureCase: -2
characterSpacing: 0
characterPadding: 1
includeFontData: 1
fontNames:
- Source Code Pro
fallbackFontReferences: []
customCharacters:
fontRenderingMode: 0
ascentCalculationMode: 1
useLegacyBoundsCalculation: 0
shouldRoundAdvanceValue: 1
userData:
assetBundleName:
assetBundleVariant:

8
Assets/Prefabs/UI.meta Normal file
View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 407d042de55a6044fa35a558a32dc0be
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 68b0b7d9f7cd54f4a9f3382b9452d809
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -16,7 +16,7 @@ LightingSettings:
m_AlbedoBoost: 1
m_IndirectOutputScale: 1
m_UsingShadowmask: 0
m_BakeBackend: 1
m_BakeBackend: 2
m_LightmapMaxSize: 1024
m_BakeResolution: 40
m_Padding: 2

View File

@ -97,7 +97,7 @@ LightmapSettings:
m_ExportTrainingData: 0
m_TrainingDataDestination: TrainingData
m_LightProbeSampleCountMultiplier: 4
m_LightingDataAsset: {fileID: 112000000, guid: d320c7848150f754dbf371825f1b378c, type: 2}
m_LightingDataAsset: {fileID: 112000000, guid: 34a8b00aa8bba4449a5285eb76698434, type: 2}
m_LightingSettings: {fileID: 4890085278179872738, guid: eab3e4c589c0a1147a910511c80f5e0c, type: 2}
--- !u!196 &4
NavMeshSettings:
@ -1499,7 +1499,7 @@ Mesh:
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: pb_Mesh25178
m_Name: pb_Mesh17100
serializedVersion: 10
m_SubMeshes:
- serializedVersion: 2
@ -3223,7 +3223,7 @@ Mesh:
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: pb_Mesh25122
m_Name: pb_Mesh17044
serializedVersion: 10
m_SubMeshes:
- serializedVersion: 2
@ -3923,7 +3923,7 @@ Mesh:
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: pb_Mesh25252
m_Name: pb_Mesh17174
serializedVersion: 10
m_SubMeshes:
- serializedVersion: 2
@ -4517,6 +4517,11 @@ Light:
m_UseBoundingSphereOverride: 0
m_ShadowRadius: 0
m_ShadowAngle: 0
--- !u!224 &267525579 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 170678578394383911, guid: 68b0b7d9f7cd54f4a9f3382b9452d809, type: 3}
m_PrefabInstance: {fileID: 170678578529524716}
m_PrefabAsset: {fileID: 0}
--- !u!1 &317469204
GameObject:
m_ObjectHideFlags: 0
@ -4587,7 +4592,7 @@ Mesh:
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: pb_Mesh24968
m_Name: pb_Mesh16890
serializedVersion: 10
m_SubMeshes:
- serializedVersion: 2
@ -5972,7 +5977,7 @@ Mesh:
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: pb_Mesh25228
m_Name: pb_Mesh17150
serializedVersion: 10
m_SubMeshes:
- serializedVersion: 2
@ -7916,7 +7921,7 @@ Mesh:
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: pb_Mesh25318
m_Name: pb_Mesh17240
serializedVersion: 10
m_SubMeshes:
- serializedVersion: 2
@ -11270,7 +11275,7 @@ Mesh:
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: pb_Mesh24928
m_Name: pb_Mesh16850
serializedVersion: 10
m_SubMeshes:
- serializedVersion: 2
@ -12733,7 +12738,7 @@ Mesh:
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: pb_Mesh25160
m_Name: pb_Mesh17082
serializedVersion: 10
m_SubMeshes:
- serializedVersion: 2
@ -16497,7 +16502,7 @@ Mesh:
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: pb_Mesh24954
m_Name: pb_Mesh16876
serializedVersion: 10
m_SubMeshes:
- serializedVersion: 2
@ -16945,13 +16950,24 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1687974937}
m_CullTransparentMesh: 0
--- !u!114 &1711551243 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 7391558912774766620, guid: 0bffd92c46c257840806f5e957954800, type: 3}
m_PrefabInstance: {fileID: 7391558912839012296}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f6e08271c272323469510daa22c35599, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!43 &1734066939
Mesh:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: pb_Mesh25206
m_Name: pb_Mesh17128
serializedVersion: 10
m_SubMeshes:
- serializedVersion: 2
@ -17200,6 +17216,7 @@ RectTransform:
m_LocalScale: {x: 0, y: 0, z: 0}
m_Children:
- {fileID: 459987321}
- {fileID: 267525579}
m_Father: {fileID: 187747573}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -17418,7 +17435,7 @@ Mesh:
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: pb_Mesh25276
m_Name: pb_Mesh17198
serializedVersion: 10
m_SubMeshes:
- serializedVersion: 2
@ -17674,7 +17691,7 @@ Mesh:
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: pb_Mesh25288
m_Name: pb_Mesh17210
serializedVersion: 10
m_SubMeshes:
- serializedVersion: 2
@ -17969,7 +17986,7 @@ Mesh:
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: pb_Mesh24908
m_Name: pb_Mesh16830
serializedVersion: 10
m_SubMeshes:
- serializedVersion: 2
@ -18133,7 +18150,7 @@ Mesh:
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: pb_Mesh25072
m_Name: pb_Mesh16994
serializedVersion: 10
m_SubMeshes:
- serializedVersion: 2
@ -18383,6 +18400,127 @@ Light:
m_UseBoundingSphereOverride: 0
m_ShadowRadius: 0
m_ShadowAngle: 0
--- !u!1001 &170678578529524716
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 1734890299}
m_Modifications:
- target: {fileID: 170678578394383910, guid: 68b0b7d9f7cd54f4a9f3382b9452d809, type: 3}
propertyPath: m_Name
value: TerminalRoot
objectReference: {fileID: 0}
- target: {fileID: 170678578394383911, guid: 68b0b7d9f7cd54f4a9f3382b9452d809, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 170678578394383911, guid: 68b0b7d9f7cd54f4a9f3382b9452d809, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 170678578394383911, guid: 68b0b7d9f7cd54f4a9f3382b9452d809, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 170678578394383911, guid: 68b0b7d9f7cd54f4a9f3382b9452d809, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 170678578394383911, guid: 68b0b7d9f7cd54f4a9f3382b9452d809, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 170678578394383911, guid: 68b0b7d9f7cd54f4a9f3382b9452d809, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 170678578394383911, guid: 68b0b7d9f7cd54f4a9f3382b9452d809, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 170678578394383911, guid: 68b0b7d9f7cd54f4a9f3382b9452d809, type: 3}
propertyPath: m_RootOrder
value: 1
objectReference: {fileID: 0}
- target: {fileID: 170678578394383911, guid: 68b0b7d9f7cd54f4a9f3382b9452d809, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 170678578394383911, guid: 68b0b7d9f7cd54f4a9f3382b9452d809, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 170678578394383911, guid: 68b0b7d9f7cd54f4a9f3382b9452d809, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 170678578394383911, guid: 68b0b7d9f7cd54f4a9f3382b9452d809, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 170678578394383911, guid: 68b0b7d9f7cd54f4a9f3382b9452d809, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 170678578394383911, guid: 68b0b7d9f7cd54f4a9f3382b9452d809, type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 170678578394383911, guid: 68b0b7d9f7cd54f4a9f3382b9452d809, type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 170678578394383911, guid: 68b0b7d9f7cd54f4a9f3382b9452d809, type: 3}
propertyPath: m_AnchorMin.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 170678578394383911, guid: 68b0b7d9f7cd54f4a9f3382b9452d809, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 170678578394383911, guid: 68b0b7d9f7cd54f4a9f3382b9452d809, type: 3}
propertyPath: m_AnchorMax.x
value: 1
objectReference: {fileID: 0}
- target: {fileID: 170678578394383911, guid: 68b0b7d9f7cd54f4a9f3382b9452d809, type: 3}
propertyPath: m_AnchorMax.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 170678578394383911, guid: 68b0b7d9f7cd54f4a9f3382b9452d809, type: 3}
propertyPath: m_Pivot.x
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 170678578394383911, guid: 68b0b7d9f7cd54f4a9f3382b9452d809, type: 3}
propertyPath: m_Pivot.y
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 170678579363757820, guid: 68b0b7d9f7cd54f4a9f3382b9452d809, type: 3}
propertyPath: m_Color.r
value: 0
objectReference: {fileID: 0}
- target: {fileID: 170678579363757820, guid: 68b0b7d9f7cd54f4a9f3382b9452d809, type: 3}
propertyPath: m_Color.g
value: 0
objectReference: {fileID: 0}
- target: {fileID: 170678579363757820, guid: 68b0b7d9f7cd54f4a9f3382b9452d809, type: 3}
propertyPath: m_Color.b
value: 0
objectReference: {fileID: 0}
- target: {fileID: 170678579363757820, guid: 68b0b7d9f7cd54f4a9f3382b9452d809, type: 3}
propertyPath: m_Color.a
value: 0.7294118
objectReference: {fileID: 0}
- target: {fileID: 2654296452177192280, guid: 68b0b7d9f7cd54f4a9f3382b9452d809, type: 3}
propertyPath: EventSystem
value:
objectReference: {fileID: 529416813}
- target: {fileID: 2654296452177192280, guid: 68b0b7d9f7cd54f4a9f3382b9452d809, type: 3}
propertyPath: Player
value:
objectReference: {fileID: 1711551243}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 68b0b7d9f7cd54f4a9f3382b9452d809, type: 3}
--- !u!1001 &7391558912839012296
PrefabInstance:
m_ObjectHideFlags: 0

View File

@ -11,7 +11,6 @@ namespace NeonTea.Quakeball.Animation {
public Vector3 ScaleLerpSpeed = new Vector3(100, 100, 100);
private void Update() {
transform.position.x = Mathf.Lerp(transform.position.x, Followed.position.x, PositionLerpSpeed.x);
}
}
}

View File

@ -0,0 +1,82 @@
using System.Collections.Generic;
using System;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.EventSystems;
using NeonTea.Quakeball.Player;
using TMPro;
namespace NeonTea.Quakeball.Interface {
public class Terminal : MonoBehaviour {
public RectTransform TerminalPanel;
public TMP_InputField InputField;
public TMP_Text TextField;
public LocalPlayer Player;
private InputAction ToggleTerminalAction;
private InputAction SubmitTerminal;
private float DesiredTerminalPos;
private bool IsOpen = false;
private List<string> Messages = new List<string>();
private string Text = "";
public static string INFO_COLOR = "#FE8";
void Start() {
ToggleTerminalAction = new InputAction("Toggle Terminal", binding: "<Keyboard>/backquote");
ToggleTerminalAction.Enable();
ToggleTerminalAction.performed += ToggleTerminal;
SubmitTerminal = new InputAction("Terminal Submit", binding: "<Keyboard>/enter");
SubmitTerminal.Enable();
SubmitTerminal.performed += Submit;
DesiredTerminalPos = (TerminalPanel.rect.height / 2) * (IsOpen ? -1 : 1);
InputField.restoreOriginalTextOnEscape = false;
AddMessage($"<color={INFO_COLOR}>Welcome to Quakeball!</color>");
}
public void ToggleTerminal(InputAction.CallbackContext context) {
IsOpen = !IsOpen;
DesiredTerminalPos = (TerminalPanel.rect.height / 2) * (IsOpen ? -1 : 1);
if (IsOpen) {
InputField.text = "";
}
InputField.readOnly = true;
if (Player != null) {
Player.DisableInput = IsOpen;
}
}
void Update() {
Vector3 pos = TerminalPanel.anchoredPosition;
pos.y = Mathf.Lerp(pos.y, DesiredTerminalPos, Time.deltaTime * 10);
TerminalPanel.anchoredPosition = pos;
if (IsOpened() && EventSystem.current.currentSelectedGameObject != InputField) {
InputField.Select();
InputField.ActivateInputField();
InputField.readOnly = false;
}
}
public void AddMessage(string message) {
Messages.Add(message);
Text = String.Join("\n", Messages.ToArray());
TextField.text = Text;
}
private void Submit(InputAction.CallbackContext context) {
if (IsOpened()) {
AddMessage(InputField.text);
InputField.text = "";
}
}
private bool IsOpened() {
return IsOpen && (TerminalPanel.anchoredPosition.y + TerminalPanel.rect.height / 2) < 10;
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4d9576204ac42494d87c1f9956cc3cc8
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -7,6 +7,7 @@ namespace NeonTea.Quakeball.Player {
public class LocalPlayer : MonoBehaviour {
public Transform Camera;
public float PlayerUpdateFrequency = 1;
public bool DisableInput = false;
private float Lean = 0;