Add NetChaperone
This commit is contained in:
parent
a06adb809e
commit
f2e872e7aa
File diff suppressed because one or more lines are too long
45
Assets/Prefabs/NetChaperone.prefab
Normal file
45
Assets/Prefabs/NetChaperone.prefab
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!1 &8225376946869818923
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 1599217288880773178}
|
||||||
|
- component: {fileID: 8631085319058959107}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: NetChaperone
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &1599217288880773178
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 8225376946869818923}
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: 28.784727, y: -94.90361, z: 121.21231}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 0}
|
||||||
|
m_RootOrder: 0
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!114 &8631085319058959107
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 8225376946869818923}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 74110215548fa9145b867baf649d14b0, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
7
Assets/Prefabs/NetChaperone.prefab.meta
Normal file
7
Assets/Prefabs/NetChaperone.prefab.meta
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 1a03b85f19189674187c9966f5f557e3
|
||||||
|
PrefabImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -38,7 +38,7 @@ RenderSettings:
|
|||||||
m_ReflectionIntensity: 1
|
m_ReflectionIntensity: 1
|
||||||
m_CustomReflection: {fileID: 0}
|
m_CustomReflection: {fileID: 0}
|
||||||
m_Sun: {fileID: 0}
|
m_Sun: {fileID: 0}
|
||||||
m_IndirectSpecularColor: {r: 0.17393494, g: 0.2174847, b: 0.299652, a: 1}
|
m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1}
|
||||||
m_UseRadianceAmbientProbe: 0
|
m_UseRadianceAmbientProbe: 0
|
||||||
--- !u!157 &3
|
--- !u!157 &3
|
||||||
LightmapSettings:
|
LightmapSettings:
|
||||||
@ -18607,6 +18607,63 @@ PrefabInstance:
|
|||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
m_RemovedComponents: []
|
m_RemovedComponents: []
|
||||||
m_SourcePrefab: {fileID: 100100000, guid: 68b0b7d9f7cd54f4a9f3382b9452d809, type: 3}
|
m_SourcePrefab: {fileID: 100100000, guid: 68b0b7d9f7cd54f4a9f3382b9452d809, type: 3}
|
||||||
|
--- !u!1001 &1741123247839759509
|
||||||
|
PrefabInstance:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Modification:
|
||||||
|
m_TransformParent: {fileID: 0}
|
||||||
|
m_Modifications:
|
||||||
|
- target: {fileID: 1599217288880773178, guid: 1a03b85f19189674187c9966f5f557e3, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.x
|
||||||
|
value: 28.784727
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 1599217288880773178, guid: 1a03b85f19189674187c9966f5f557e3, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.y
|
||||||
|
value: -94.90361
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 1599217288880773178, guid: 1a03b85f19189674187c9966f5f557e3, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.z
|
||||||
|
value: 121.21231
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 1599217288880773178, guid: 1a03b85f19189674187c9966f5f557e3, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 1599217288880773178, guid: 1a03b85f19189674187c9966f5f557e3, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 1599217288880773178, guid: 1a03b85f19189674187c9966f5f557e3, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 1599217288880773178, guid: 1a03b85f19189674187c9966f5f557e3, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.w
|
||||||
|
value: 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 1599217288880773178, guid: 1a03b85f19189674187c9966f5f557e3, type: 3}
|
||||||
|
propertyPath: m_RootOrder
|
||||||
|
value: 8
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 1599217288880773178, guid: 1a03b85f19189674187c9966f5f557e3, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 1599217288880773178, guid: 1a03b85f19189674187c9966f5f557e3, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 1599217288880773178, guid: 1a03b85f19189674187c9966f5f557e3, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 8225376946869818923, guid: 1a03b85f19189674187c9966f5f557e3, type: 3}
|
||||||
|
propertyPath: m_Name
|
||||||
|
value: NetChaperone
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
m_RemovedComponents: []
|
||||||
|
m_SourcePrefab: {fileID: 100100000, guid: 1a03b85f19189674187c9966f5f557e3, type: 3}
|
||||||
--- !u!1001 &7391558912839012296
|
--- !u!1001 &7391558912839012296
|
||||||
PrefabInstance:
|
PrefabInstance:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
45
Assets/Scripts/Net/NetChaperone.cs
Normal file
45
Assets/Scripts/Net/NetChaperone.cs
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
using System;
|
||||||
|
using NeonTea.Quakeball.Interface;
|
||||||
|
using NeonTea.Quakeball.TeaNet.Peers;
|
||||||
|
|
||||||
|
namespace NeonTea.Quakeball.Net {
|
||||||
|
public class NetChaperone : MonoBehaviour, PeerMessageListener {
|
||||||
|
|
||||||
|
private Terminal Terminal;
|
||||||
|
|
||||||
|
private void Start() {
|
||||||
|
if (Terminal.Singleton != null) {
|
||||||
|
Terminal = Terminal.Singleton;
|
||||||
|
Terminal.RegisterCommand("host", Host);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool Host(string[] args) {
|
||||||
|
if (args.Length > 2) {
|
||||||
|
Terminal.AddMessage($"<color={Terminal.ERROR_COLOR}>Can't accept more than 2 arguments.</color>");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
string addr = "0.0.0.0";
|
||||||
|
string portstr = "8080";
|
||||||
|
if (args.Length == 1) {
|
||||||
|
portstr = args[0];
|
||||||
|
} else if (args.Length == 2) {
|
||||||
|
addr = args[0];
|
||||||
|
portstr = args[1];
|
||||||
|
}
|
||||||
|
int port;
|
||||||
|
if (!Int32.TryParse(portstr, out port)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Net.Singleton.StartServer(addr, port, this);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Message(string msg) {
|
||||||
|
Terminal.AddMessage(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Err(string err) { }
|
||||||
|
}
|
||||||
|
}
|
11
Assets/Scripts/Net/NetChaperone.cs.meta
Normal file
11
Assets/Scripts/Net/NetChaperone.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 74110215548fa9145b867baf649d14b0
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
Loading…
Reference in New Issue
Block a user