浏览代码

adding stormflag art assets and test scene

/main
David Woodruff 4 年前
当前提交
64008746
共有 606 个文件被更改,包括 6438 次插入1 次删除
  1. 1
      Assets/BossRoom/Scenes/MainMenu.unity
  2. 2
      Assets/BossRoom/Scripts/Server/Game/State/ServerCharSelectState.cs
  3. 1
      Packages/manifest.json
  4. 7
      Packages/packages-lock.json
  5. 3
      ProjectSettings/EditorBuildSettings.asset
  6. 8
      Assets/BossRoom/Editor.meta
  7. 8
      Assets/BossRoom/Material.meta
  8. 8
      Assets/BossRoom/Models.meta
  9. 8
      Assets/BossRoom/PostProcessing.meta
  10. 8
      Assets/BossRoom/Prefabs/Character.meta
  11. 8
      Assets/BossRoom/Prefabs/Dungeon.meta
  12. 8
      Assets/BossRoom/Prefabs/GameCam.meta
  13. 1001
      Assets/BossRoom/Scenes/Dungeon.unity
  14. 7
      Assets/BossRoom/Scenes/Dungeon.unity.meta
  15. 8
      Assets/BossRoom/Scenes/DungeonTest.meta
  16. 1001
      Assets/BossRoom/Scenes/DungeonTest.unity
  17. 7
      Assets/BossRoom/Scenes/DungeonTest.unity.meta
  18. 8
      Assets/BossRoom/Scripts/Development/dgtest.meta
  19. 8
      Assets/BossRoom/Shaders.meta
  20. 8
      Assets/BossRoom/Textures.meta
  21. 8
      Assets/BossRoom/Editor/MLAPI.meta
  22. 1001
      Assets/BossRoom/Editor/MLAPI/MLAPIEditor.cs
  23. 2
      Assets/BossRoom/Editor/MLAPI/MLAPIEditor.cs.meta
  24. 352
      Assets/BossRoom/Editor/MLAPI/MLAPIProfiler.cs
  25. 2
      Assets/BossRoom/Editor/MLAPI/MLAPIProfiler.cs.meta
  26. 97
      Assets/BossRoom/Editor/MLAPI/NetworkedAnimatorEditor.cs
  27. 2
      Assets/BossRoom/Editor/MLAPI/NetworkedAnimatorEditor.cs.meta
  28. 175
      Assets/BossRoom/Editor/MLAPI/NetworkedBehaviourEditor.cs
  29. 2
      Assets/BossRoom/Editor/MLAPI/NetworkedBehaviourEditor.cs.meta
  30. 82
      Assets/BossRoom/Editor/MLAPI/NetworkedObjectEditor.cs
  31. 2
      Assets/BossRoom/Editor/MLAPI/NetworkedObjectEditor.cs.meta
  32. 440
      Assets/BossRoom/Editor/MLAPI/NetworkingManagerEditor.cs
  33. 2
      Assets/BossRoom/Editor/MLAPI/NetworkingManagerEditor.cs.meta
  34. 60
      Assets/BossRoom/Editor/MLAPI/PostProcessScene.cs
  35. 2
      Assets/BossRoom/Editor/MLAPI/PostProcessScene.cs.meta
  36. 35
      Assets/BossRoom/Editor/MLAPI/TrackedObjectEditor.cs
  37. 2
      Assets/BossRoom/Editor/MLAPI/TrackedObjectEditor.cs.meta
  38. 77
      Assets/BossRoom/Material/BaseGreen.mat
  39. 8
      Assets/BossRoom/Material/BaseGreen.mat.meta
  40. 8
      Assets/BossRoom/Material/Characters.meta
  41. 78
      Assets/BossRoom/Material/Characters/Hero_Eyes_sheet.mat
  42. 8
      Assets/BossRoom/Material/Characters/Hero_Eyes_sheet.mat.meta
  43. 83
      Assets/BossRoom/Material/Characters/Hero_Mouth_sheet.mat
  44. 8
      Assets/BossRoom/Material/Characters/Hero_Mouth_sheet.mat.meta
  45. 8
      Assets/BossRoom/Material/Characters/Standard.meta
  46. 77
      Assets/BossRoom/Material/Characters/Standard/Hair_Archer_Boy.mat
  47. 8
      Assets/BossRoom/Material/Characters/Standard/Hair_Archer_Boy.mat.meta
  48. 77
      Assets/BossRoom/Material/Characters/Standard/Hair_Archer_Girl.mat
  49. 8
      Assets/BossRoom/Material/Characters/Standard/Hair_Archer_Girl.mat.meta
  50. 77
      Assets/BossRoom/Material/Characters/Standard/Hair_Mage_Boy.mat
  51. 8
      Assets/BossRoom/Material/Characters/Standard/Hair_Mage_Boy.mat.meta
  52. 77
      Assets/BossRoom/Material/Characters/Standard/Hair_Mage_Girl.mat
  53. 8
      Assets/BossRoom/Material/Characters/Standard/Hair_Mage_Girl.mat.meta
  54. 77
      Assets/BossRoom/Material/Characters/Standard/Hair_Rogue_Boy.mat
  55. 8
      Assets/BossRoom/Material/Characters/Standard/Hair_Rogue_Boy.mat.meta
  56. 77
      Assets/BossRoom/Material/Characters/Standard/Hair_Rogue_Girl.mat
  57. 8
      Assets/BossRoom/Material/Characters/Standard/Hair_Rogue_Girl.mat.meta
  58. 77
      Assets/BossRoom/Material/Characters/Standard/Hair_Tank_Boy.mat
  59. 8
      Assets/BossRoom/Material/Characters/Standard/Hair_Tank_Boy.mat.meta
  60. 77
      Assets/BossRoom/Material/Characters/Standard/Hair_Tank_Girl.mat
  61. 8
      Assets/BossRoom/Material/Characters/Standard/Hair_Tank_Girl.mat.meta
  62. 77
      Assets/BossRoom/Material/Characters/Standard/Head_Archer_Boy.mat
  63. 8
      Assets/BossRoom/Material/Characters/Standard/Head_Archer_Boy.mat.meta
  64. 77
      Assets/BossRoom/Material/Characters/Standard/Head_Archer_Girl.mat
  65. 8
      Assets/BossRoom/Material/Characters/Standard/Head_Archer_Girl.mat.meta
  66. 77
      Assets/BossRoom/Material/Characters/Standard/Head_Mage_Boy.mat
  67. 8
      Assets/BossRoom/Material/Characters/Standard/Head_Mage_Boy.mat.meta
  68. 77
      Assets/BossRoom/Material/Characters/Standard/Head_Mage_Girl.mat
  69. 8
      Assets/BossRoom/Material/Characters/Standard/Head_Mage_Girl.mat.meta
  70. 77
      Assets/BossRoom/Material/Characters/Standard/Head_Rogue_Boy.mat
  71. 8
      Assets/BossRoom/Material/Characters/Standard/Head_Rogue_Boy.mat.meta
  72. 77
      Assets/BossRoom/Material/Characters/Standard/Head_Rogue_Girl.mat
  73. 8
      Assets/BossRoom/Material/Characters/Standard/Head_Rogue_Girl.mat.meta
  74. 77
      Assets/BossRoom/Material/Characters/Standard/Head_Tank_Boy.mat
  75. 8
      Assets/BossRoom/Material/Characters/Standard/Head_Tank_Boy.mat.meta
  76. 77
      Assets/BossRoom/Material/Characters/Standard/Head_Tank_Girl.mat
  77. 8
      Assets/BossRoom/Material/Characters/Standard/Head_Tank_Girl.mat.meta
  78. 77
      Assets/BossRoom/Material/Characters/Standard/Torso_Archer.mat
  79. 8
      Assets/BossRoom/Material/Characters/Standard/Torso_Archer.mat.meta
  80. 77
      Assets/BossRoom/Material/Characters/Standard/Torso_Mage_Boy.mat
  81. 8
      Assets/BossRoom/Material/Characters/Standard/Torso_Mage_Boy.mat.meta
  82. 77
      Assets/BossRoom/Material/Characters/Standard/Torso_Mage_Girl.mat
  83. 8
      Assets/BossRoom/Material/Characters/Standard/Torso_Mage_Girl.mat.meta
  84. 77
      Assets/BossRoom/Material/Characters/Standard/Torso_Rogue.mat
  85. 8
      Assets/BossRoom/Material/Characters/Standard/Torso_Rogue.mat.meta
  86. 77
      Assets/BossRoom/Material/Characters/Standard/Torso_Tank.mat

1
Assets/BossRoom/Scenes/MainMenu.unity


- MainMenu
- CharSelect
- SampleScene
- DungeonTest
AllowRuntimeSceneChanges: 1
NetworkedPrefabs:
- Prefab: {fileID: 4600110157238723781, guid: bb87f9bac2595f8499c048016c4b2e1d, type: 3}

2
Assets/BossRoom/Scripts/Server/Game/State/ServerCharSelectState.cs


if( (Time.time - m_start_s) > 3 )
{
//temp: we don't have any logic or anything in CharSelect, so for now we just skip on to the next scene.
MLAPI.SceneManagement.NetworkSceneManager.SwitchScene("SampleScene");
MLAPI.SceneManagement.NetworkSceneManager.SwitchScene("DungeonTest");
}

1
Packages/manifest.json


{
"dependencies": {
"com.unity.cinemachine": "2.6.3",
"com.unity.collab-proxy": "1.3.9",
"com.unity.ide.rider": "2.0.7",
"com.unity.ide.visualstudio": "2.0.2",

7
Packages/packages-lock.json


},
"url": "https://packages.unity.com"
},
"com.unity.cinemachine": {
"version": "2.6.3",
"depth": 0,
"source": "registry",
"dependencies": {},
"url": "https://packages.unity.com"
},
"com.unity.collab-proxy": {
"version": "1.3.9",
"depth": 0,

3
ProjectSettings/EditorBuildSettings.asset


- enabled: 1
path: Assets/BossRoom/Scenes/SampleScene.unity
guid: 9fc0d4010bbf28b4594072e72b8655ab
- enabled: 1
path: Assets/BossRoom/Scenes/DungeonTest.unity
guid: 221dbbcb8b3e1534da77bedcae13e9e6
m_configObjects: {}

8
Assets/BossRoom/Editor.meta


fileFormatVersion: 2
guid: 4ba4f868ecb6b8346a1a5e3fba2d7104
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Assets/BossRoom/Material.meta


fileFormatVersion: 2
guid: 4895603bba5052d4591fa582295e3d5b
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Assets/BossRoom/Models.meta


fileFormatVersion: 2
guid: f9ac24ebd2ef4c04e82fd29019310ed0
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Assets/BossRoom/PostProcessing.meta


fileFormatVersion: 2
guid: e19028929512002428b390ba981267da
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Assets/BossRoom/Prefabs/Character.meta


fileFormatVersion: 2
guid: 2279023f9496c664782aaf2ed13ed494
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Assets/BossRoom/Prefabs/Dungeon.meta


fileFormatVersion: 2
guid: c236398f618a7504187f15da6e8de09a
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Assets/BossRoom/Prefabs/GameCam.meta


fileFormatVersion: 2
guid: 37e096cb557d9e947b6d633300b29645
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

1001
Assets/BossRoom/Scenes/Dungeon.unity
文件差异内容过多而无法显示
查看文件

7
Assets/BossRoom/Scenes/Dungeon.unity.meta


fileFormatVersion: 2
guid: a1cc7e97adaa94d4e957668b2113689e
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Assets/BossRoom/Scenes/DungeonTest.meta


fileFormatVersion: 2
guid: ddd35476314d4c4439197771e13c96dc
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

1001
Assets/BossRoom/Scenes/DungeonTest.unity
文件差异内容过多而无法显示
查看文件

7
Assets/BossRoom/Scenes/DungeonTest.unity.meta


fileFormatVersion: 2
guid: 221dbbcb8b3e1534da77bedcae13e9e6
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Assets/BossRoom/Scripts/Development/dgtest.meta


fileFormatVersion: 2
guid: 090b1d89eeb62e643967340872bca647
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Assets/BossRoom/Shaders.meta


fileFormatVersion: 2
guid: 3f33a566e74655b4eb396e1e08b33913
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Assets/BossRoom/Textures.meta


fileFormatVersion: 2
guid: a0a6c1ed2e8393d4d8b8cbe3f1ec9efa
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Assets/BossRoom/Editor/MLAPI.meta


fileFormatVersion: 2
guid: a8d7c4ead0356b0408957f0e2f675298
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

1001
Assets/BossRoom/Editor/MLAPI/MLAPIEditor.cs
文件差异内容过多而无法显示
查看文件

2
Assets/BossRoom/Editor/MLAPI/MLAPIEditor.cs.meta


guid: 679A906F235E3355ECBB0D09485500AF
fileFormatVersion: 2

352
Assets/BossRoom/Editor/MLAPI/MLAPIProfiler.cs


using System.Collections.Generic;
using System.IO;
using MLAPI.Profiling;
using MLAPI.Serialization;
using UnityEngine;
using BitStream = MLAPI.Serialization.BitStream;
namespace UnityEditor
{
public class MLAPIProfiler : EditorWindow
{
[MenuItem("Window/MLAPI Profiler")]
public static void ShowWindow()
{
GetWindow<MLAPIProfiler>();
}
GUIStyle wrapStyle
{
get
{
Color color = EditorStyles.label.normal.textColor;
GUIStyle style = EditorStyles.centeredGreyMiniLabel;
style.wordWrap = true;
style.normal.textColor = color;
return style;
}
}
float hoverAlpha = 0f;
float updateDelay = 1f;
int captureCount = 100;
float showMax = 0;
float showMin = 0;
AnimationCurve curve = AnimationCurve.Linear(0, 0, 1, 0);
readonly List<ProfilerTick> currentTicks = new List<ProfilerTick>();
float lastDrawn = 0;
class ProfilerContainer
{
public ProfilerTick[] ticks;
public byte[] ToBytes()
{
BitStream stream = new BitStream();
BitWriter writer = new BitWriter(stream);
writer.WriteUInt16Packed((ushort)ticks.Length);
for (int i = 0; i < ticks.Length; i++)
{
ticks[i].SerializeToStream(stream);
}
return stream.ToArray();
}
public static ProfilerContainer FromBytes(byte[] bytes)
{
ProfilerContainer container = new ProfilerContainer();
BitStream stream = new BitStream(bytes);
BitReader reader = new BitReader(stream);
ushort count = reader.ReadUInt16Packed();
container.ticks = new ProfilerTick[count];
for (int i = 0; i < count; i++)
{
container.ticks[i] = ProfilerTick.FromStream(stream);
}
return container;
}
}
private void StopRecording()
{
NetworkProfiler.Stop();
}
private void StartRecording()
{
if (NetworkProfiler.IsRunning)
StopRecording();
if (NetworkProfiler.Ticks != null && NetworkProfiler.Ticks.Count >= 2)
curve = AnimationCurve.Constant(NetworkProfiler.Ticks.ElementAt(0).Frame, NetworkProfiler.Ticks.ElementAt(NetworkProfiler.Ticks.Count - 1).Frame, 0);
else
curve = AnimationCurve.Constant(0, 1, 0);
lastDrawn = 0;
NetworkProfiler.Start(captureCount);
}
private void ClearDrawing()
{
currentTicks.Clear();
curve = AnimationCurve.Constant(0, 1, 0);
lastDrawn = 0;
}
private void ChangeRecordState()
{
if (NetworkProfiler.IsRunning) StopRecording();
else StartRecording();
}
TickEvent eventHover = null;
double lastSetup = 0;
private void OnGUI()
{
bool recording = NetworkProfiler.IsRunning;
float deltaTime = (float)(EditorApplication.timeSinceStartup - lastSetup);
lastSetup = EditorApplication.timeSinceStartup;
//Draw top bar
EditorGUILayout.BeginVertical();
EditorGUILayout.BeginHorizontal();
if (GUILayout.Button(recording ? "Stop" : "Capture")) ChangeRecordState();
if (GUILayout.Button("Clear")) ClearDrawing();
EditorGUILayout.Space();
EditorGUILayout.Space();
EditorGUILayout.Space();
if (GUILayout.Button("Import datafile"))
{
string path = EditorUtility.OpenFilePanel("Choose a NetworkProfiler file", "", "");
if (!string.IsNullOrEmpty(path))
{
ProfilerTick[] ticks = ProfilerContainer.FromBytes(File.ReadAllBytes(path)).ticks;
if (ticks.Length >= 2)
{
curve = AnimationCurve.Constant(ticks[0].EventId, ticks[(ticks.Length - 1)].EventId, 0);
showMax = ticks.Length;
showMin = ticks.Length - Mathf.Clamp(100, 0, ticks.Length);
}
else
curve = AnimationCurve.Constant(0, 1, 0);
currentTicks.Clear();
for (int i = 0; i < ticks.Length; i++)
{
currentTicks.Add(ticks[i]);
uint bytes = 0;
if (ticks[i].Events.Count > 0)
{
for (int j = 0; j < ticks[i].Events.Count; j++)
{
TickEvent tickEvent = ticks[i].Events[j];
bytes += tickEvent.Bytes;
}
}
curve.AddKey(ticks[i].EventId, bytes);
}
}
}
if (GUILayout.Button("Export datafile"))
{
int max = (int)showMax;
int min = (int)showMin;
int ticksInRange = max - min;
ProfilerTick[] ticks = new ProfilerTick[ticksInRange];
for (int i = min; i < max; i++) ticks[i - min] = currentTicks[i];
string path = EditorUtility.SaveFilePanel("Save NetworkProfiler data", "", "networkProfilerData", "");
if (!string.IsNullOrEmpty(path)) File.WriteAllBytes(path, new ProfilerContainer() { ticks = ticks }.ToBytes());
}
EditorGUILayout.EndHorizontal();
float prevHis = captureCount;
captureCount = EditorGUILayout.DelayedIntField("History count", captureCount);
if (captureCount <= 0)
captureCount = 1;
updateDelay = EditorGUILayout.Slider("Refresh delay", updateDelay, 0.1f, 10f);
EditorGUILayout.EndVertical();
if (prevHis != captureCount) StartRecording();
//Cache
if (NetworkProfiler.IsRunning)
{
if (Time.unscaledTime - lastDrawn > updateDelay)
{
lastDrawn = Time.unscaledTime;
currentTicks.Clear();
if (NetworkProfiler.Ticks.Count >= 2)
curve = AnimationCurve.Constant(NetworkProfiler.Ticks.ElementAt(0).EventId, NetworkProfiler.Ticks.ElementAt(NetworkProfiler.Ticks.Count - 1).EventId, 0);
for (int i = 0; i < NetworkProfiler.Ticks.Count; i++)
{
ProfilerTick tick = NetworkProfiler.Ticks.ElementAt(i);
currentTicks.Add(tick);
uint bytes = 0;
if (tick.Events.Count > 0)
{
for (int j = 0; j < tick.Events.Count; j++)
{
TickEvent tickEvent = tick.Events[j];
bytes += tickEvent.Bytes;
}
}
curve.AddKey(tick.EventId, bytes);
}
}
}
//Draw Animation curve and slider
curve = EditorGUILayout.CurveField(curve);
EditorGUILayout.MinMaxSlider(ref showMin, ref showMax, 0, currentTicks.Count);
//Verify slider values
if (showMin < 0)
showMin = 0;
if (showMax > currentTicks.Count)
showMax = currentTicks.Count;
if (showMin <= 0 && showMax <= 0)
{
showMin = 0;
showMax = currentTicks.Count;
}
//Draw main board
bool hover = false;
int nonEmptyTicks = 0;
int largestTickCount = 0;
int totalTicks = ((int)showMax - (int)showMin);
for (int i = (int)showMin; i < (int)showMax; i++)
{
if (currentTicks[i].Events.Count > 0) nonEmptyTicks++; //Count non empty ticks
if (currentTicks[i].Events.Count > largestTickCount) largestTickCount = currentTicks[i].Events.Count; //Get how many events the tick with most events has
}
int emptyTicks = totalTicks - nonEmptyTicks;
float equalWidth = position.width / totalTicks;
float propWidth = equalWidth * 0.3f;
float widthPerTick = ((position.width - emptyTicks * propWidth) / nonEmptyTicks);
float currentX = 0;
int emptyStreak = 0;
for (int i = (int)showMin; i < (int)showMax; i++)
{
ProfilerTick tick = currentTicks[i];
if (tick.Events.Count == 0 && i != totalTicks - 1)
{
emptyStreak++;
continue;
}
else if (emptyStreak > 0 || i == totalTicks - 1)
{
Rect dataRect = new Rect(currentX, 140f, propWidth * emptyStreak, position.height - 140f);
currentX += propWidth * emptyStreak;
if (emptyStreak >= 2) EditorGUI.LabelField(new Rect(dataRect.x, dataRect.y, dataRect.width, dataRect.height), emptyStreak.ToString(), wrapStyle);
emptyStreak = 0;
}
if (tick.Events.Count > 0)
{
float heightPerEvent = ((position.height - 140f) - (5f * largestTickCount)) / largestTickCount;
float currentY = 140f;
for (int j = 0; j < tick.Events.Count; j++)
{
TickEvent tickEvent = tick.Events[j];
Rect dataRect = new Rect(currentX, currentY, widthPerTick, heightPerEvent);
if (dataRect.Contains(Event.current.mousePosition))
{
hover = true;
eventHover = tickEvent;
}
EditorGUI.DrawRect(dataRect, TickTypeToColor(tickEvent.EventType, true));
EditorGUI.LabelField(new Rect(dataRect.x, dataRect.y, dataRect.width, dataRect.height / 2), tickEvent.EventType.ToString(), wrapStyle);
EditorGUI.LabelField(new Rect(dataRect.x, dataRect.y + dataRect.height / 2, dataRect.width, dataRect.height / 2), tickEvent.Bytes + "B", wrapStyle);
currentY += heightPerEvent + 5f;
}
}
EditorGUI.DrawRect(new Rect(currentX, 100, widthPerTick, 40), TickTypeToColor(tick.Type, false));
EditorGUI.LabelField(new Rect(currentX, 100, widthPerTick, 20), tick.Type.ToString(), wrapStyle);
EditorGUI.LabelField(new Rect(currentX, 120, widthPerTick, 20), tick.Frame.ToString(), wrapStyle);
currentX += widthPerTick;
}
//Calculate alpha
if (hover)
{
hoverAlpha += deltaTime * 10f;
if (hoverAlpha > 1f) hoverAlpha = 1f;
else if (hoverAlpha < 0f) hoverAlpha = 0f;
}
else
{
hoverAlpha -= deltaTime * 10f;
if (hoverAlpha > 1f) hoverAlpha = 1f;
else if (hoverAlpha < 0f) hoverAlpha = 0f;
}
//Draw hover thingy
if (eventHover != null)
{
Rect rect = new Rect(Event.current.mousePosition, new Vector2(500, 100));
EditorGUI.DrawRect(rect, GetEditorColorWithAlpha(hoverAlpha));
float heightPerField = (rect.height - 5) / 4;
EditorGUI.LabelField(new Rect(rect.x + 5, rect.y + 5, rect.width, rect.height), "EventType: " + eventHover.EventType.ToString(), GetStyleWithTextAlpha(EditorStyles.label, hoverAlpha));
EditorGUI.LabelField(new Rect(rect.x + 5, rect.y + heightPerField * 1 + 5, rect.width, rect.height), "Size: " + eventHover.Bytes + "B", GetStyleWithTextAlpha(EditorStyles.label, hoverAlpha));
EditorGUI.LabelField(new Rect(rect.x + 5, rect.y + heightPerField * 2 + 5, rect.width, rect.height), "Channel: " + eventHover.ChannelName, GetStyleWithTextAlpha(EditorStyles.label, hoverAlpha));
EditorGUI.LabelField(new Rect(rect.x + 5, rect.y + heightPerField * 3 + 5, rect.width, rect.height), "MessageType: " + eventHover.MessageType, GetStyleWithTextAlpha(EditorStyles.label, hoverAlpha));
}
Repaint();
}
private Color TickTypeToColor(TickType type, bool alpha)
{
switch (type)
{
case TickType.Event:
return new Color(0.58f, 0f, 0.56f, alpha ? 0.37f : 0.7f);
case TickType.Receive:
return new Color(0f, 0.85f, 0.85f, alpha ? 0.28f : 0.7f);
case TickType.Send:
return new Color(0, 0.55f, 1f, alpha ? 0.06f : 0.7f);
default:
return Color.clear;
}
}
private Color EditorColor
{
get
{
return EditorGUIUtility.isProSkin ? new Color32(56, 56, 56, 255) : new Color32(194, 194, 194, 255);
}
}
private Color GetEditorColorWithAlpha(float alpha)
{
return EditorGUIUtility.isProSkin ? new Color(0.22f, 0.22f, 0.22f, alpha) : new Color(0.76f, 0.76f, 0.76f, alpha);
}
private GUIStyle GetStyleWithTextAlpha(GUIStyle style, float alpha)
{
Color textColor = style.normal.textColor;
textColor.a = alpha;
GUIStyle newStyle = new GUIStyle(style);
newStyle.normal.textColor = textColor;
return newStyle;
}
}
}

2
Assets/BossRoom/Editor/MLAPI/MLAPIProfiler.cs.meta


guid: A1D18D5FCD416C69307DD4D60792C28D
fileFormatVersion: 2

97
Assets/BossRoom/Editor/MLAPI/NetworkedAnimatorEditor.cs


using System;
using MLAPI.Prototyping;
using UnityEditor.Animations;
using UnityEngine;
namespace UnityEditor
{
[CustomEditor(typeof(NetworkedAnimator), true)]
[CanEditMultipleObjects]
public class NetworkAnimatorEditor : Editor
{
private NetworkedAnimator networkedAnimatorTarget;
[NonSerialized]
private bool initialized;
private SerializedProperty animatorProperty;
private GUIContent animatorLabel;
void Init()
{
if (initialized)
return;
initialized = true;
networkedAnimatorTarget = target as NetworkedAnimator;
animatorProperty = serializedObject.FindProperty("_animator");
animatorLabel = new GUIContent("Animator", "The Animator component to synchronize.");
}
public override void OnInspectorGUI()
{
Init();
serializedObject.Update();
DrawControls();
serializedObject.ApplyModifiedProperties();
}
void DrawControls()
{
EditorGUI.BeginChangeCheck();
EditorGUILayout.PropertyField(animatorProperty, animatorLabel);
if (EditorGUI.EndChangeCheck())
networkedAnimatorTarget.ResetParameterOptions();
if (networkedAnimatorTarget.animator == null)
return;
var controller = networkedAnimatorTarget.animator.runtimeAnimatorController as AnimatorController;
if (controller != null)
{
var showWarning = false;
EditorGUI.indentLevel += 1;
int i = 0;
foreach (var p in controller.parameters)
{
if (i >= 32)
{
showWarning = true;
break;
}
bool oldSend = networkedAnimatorTarget.GetParameterAutoSend(i);
bool send = EditorGUILayout.Toggle(p.name, oldSend);
if (send != oldSend)
{
networkedAnimatorTarget.SetParameterAutoSend(i, send);
EditorUtility.SetDirty(target);
}
i += 1;
}
if (showWarning)
EditorGUILayout.HelpBox("NetworkAnimator can only select between the first 32 parameters in a mecanim controller", MessageType.Warning);
EditorGUI.indentLevel -= 1;
}
if (Application.isPlaying)
{
EditorGUILayout.Separator();
if (networkedAnimatorTarget.param0 != "")
EditorGUILayout.LabelField("Param 0", networkedAnimatorTarget.param0);
if (networkedAnimatorTarget.param1 != "")
EditorGUILayout.LabelField("Param 1", networkedAnimatorTarget.param1);
if (networkedAnimatorTarget.param2 != "")
EditorGUILayout.LabelField("Param 2", networkedAnimatorTarget.param2);
if (networkedAnimatorTarget.param3 != "")
EditorGUILayout.LabelField("Param 3", networkedAnimatorTarget.param3);
if (networkedAnimatorTarget.param4 != "")
EditorGUILayout.LabelField("Param 4", networkedAnimatorTarget.param4);
}
}
}
}

2
Assets/BossRoom/Editor/MLAPI/NetworkedAnimatorEditor.cs.meta


guid: 33E3DE666674D8B1E34E6C51B024BB47
fileFormatVersion: 2

175
Assets/BossRoom/Editor/MLAPI/NetworkedBehaviourEditor.cs


using System;
using System.Collections.Generic;
using System.Reflection;
using MLAPI;
using MLAPI.NetworkedVar;
using UnityEngine;
namespace UnityEditor
{
[CustomEditor(typeof(NetworkedBehaviour), true)]
[CanEditMultipleObjects]
public class NetworkedBehaviourEditor : Editor
{
private bool initialized;
private List<string> networkedVarNames = new List<string>();
private Dictionary<string, FieldInfo> networkedVarFields = new Dictionary<string, FieldInfo>();
private Dictionary<string, object> networkedVarObjects = new Dictionary<string, object>();
private GUIContent networkedVarLabelGuiContent;
private void Init(MonoScript script)
{
initialized = true;
networkedVarNames.Clear();
networkedVarFields.Clear();
networkedVarObjects.Clear();
networkedVarLabelGuiContent = new GUIContent("NetworkedVar", "This variable is a NetworkedVar. It can not be serialized and can only be changed during runtime.");
FieldInfo[] fields = script.GetClass().GetFields(BindingFlags.Public | BindingFlags.Instance | BindingFlags.FlattenHierarchy);
for (int i = 0; i < fields.Length; i++)
{
Type ft = fields[i].FieldType;
if (ft.IsGenericType && ft.GetGenericTypeDefinition() == typeof(NetworkedVar<>) && !fields[i].IsDefined(typeof(HideInInspector), true))
{
networkedVarNames.Add(fields[i].Name);
networkedVarFields.Add(fields[i].Name, fields[i]);
}
}
}
void RenderNetworkedVar(int index)
{
if (!networkedVarFields.ContainsKey(networkedVarNames[index]))
{
serializedObject.Update();
SerializedProperty scriptProperty = serializedObject.FindProperty("m_Script");
if (scriptProperty == null)
return;
MonoScript targetScript = scriptProperty.objectReferenceValue as MonoScript;
Init(targetScript);
}
object value = networkedVarFields[networkedVarNames[index]].GetValue(target);
if (value == null)
{
Type fieldType = networkedVarFields[networkedVarNames[index]].FieldType;
INetworkedVar var = (INetworkedVar) Activator.CreateInstance(fieldType, true);
networkedVarFields[networkedVarNames[index]].SetValue(target, var);
}
Type type = networkedVarFields[networkedVarNames[index]].GetValue(target).GetType();
Type genericType = type.GetGenericArguments()[0];
EditorGUILayout.BeginHorizontal();
if (genericType == typeof(string))
{
NetworkedVar<string> var = (NetworkedVar<string>)networkedVarFields[networkedVarNames[index]].GetValue(target);
var.Value = EditorGUILayout.TextField(networkedVarNames[index], var.Value);
}
else if (genericType.IsValueType)
{
MethodInfo method = typeof(NetworkedBehaviourEditor).GetMethod("RenderNetworkedVarValueType", BindingFlags.Public | BindingFlags.Instance | BindingFlags.FlattenHierarchy | BindingFlags.NonPublic);
MethodInfo genericMethod = method.MakeGenericMethod(genericType);
genericMethod.Invoke(this, new object[] { (object)index });
}
else
{
EditorGUILayout.LabelField("Type not renderable");
}
GUILayout.Label(networkedVarLabelGuiContent, EditorStyles.miniLabel, GUILayout.Width(EditorStyles.miniLabel.CalcSize(networkedVarLabelGuiContent).x));
EditorGUILayout.EndHorizontal();
}
void RenderNetworkedVarValueType<T>(int index) where T : struct
{
NetworkedVar<T> var = (NetworkedVar<T>)networkedVarFields[networkedVarNames[index]].GetValue(target);
Type type = typeof(T);
object val = var.Value;
string name = networkedVarNames[index];
if (NetworkingManager.Singleton != null && NetworkingManager.Singleton.IsListening)
{
if (type == typeof(int))
val = EditorGUILayout.IntField(name, (int)val);
else if (type == typeof(uint))
val = (uint)EditorGUILayout.LongField(name, (long)((uint)val));
else if (type == typeof(short))
val = (short)EditorGUILayout.IntField(name, (int)((short)val));
else if (type == typeof(ushort))
val = (ushort)EditorGUILayout.IntField(name, (int)((ushort)val));
else if (type == typeof(sbyte))
val = (sbyte)EditorGUILayout.IntField(name, (int)((sbyte)val));
else if (type == typeof(byte))
val = (byte)EditorGUILayout.IntField(name, (int)((byte)val));
else if (type == typeof(long))
val = EditorGUILayout.LongField(name, (long)val);
else if (type == typeof(ulong))
val = (ulong)EditorGUILayout.LongField(name, (long)((ulong)val));
else if (type == typeof(bool))
val = EditorGUILayout.Toggle(name, (bool)val);
else if (type == typeof(string))
val = EditorGUILayout.TextField(name, (string)val);
else if (type.IsEnum)
val = EditorGUILayout.EnumPopup(name, (Enum) val);
else
EditorGUILayout.LabelField("Type not renderable");
var.Value = (T)val;
}
else
{
EditorGUILayout.LabelField(name, EditorStyles.wordWrappedLabel);
EditorGUILayout.SelectableLabel(val.ToString(), EditorStyles.wordWrappedLabel);
}
}
public override void OnInspectorGUI()
{
if (!initialized)
{
serializedObject.Update();
SerializedProperty scriptProperty = serializedObject.FindProperty("m_Script");
if (scriptProperty == null)
return;
MonoScript targetScript = scriptProperty.objectReferenceValue as MonoScript;
Init(targetScript);
}
EditorGUI.BeginChangeCheck();
serializedObject.Update();
for (int i = 0; i < networkedVarNames.Count; i++)
RenderNetworkedVar(i);
SerializedProperty property = serializedObject.GetIterator();
bool expanded = true;
while (property.NextVisible(expanded))
{
if (property.propertyType == SerializedPropertyType.ObjectReference)
{
if (property.name == "m_Script")
EditorGUI.BeginDisabledGroup(true);
EditorGUILayout.PropertyField(property, true);
if (property.name == "m_Script")
EditorGUI.EndDisabledGroup();
}
else
{
EditorGUILayout.BeginHorizontal();
EditorGUILayout.PropertyField(property, true);
EditorGUILayout.EndHorizontal();
}
expanded = false;
}
serializedObject.ApplyModifiedProperties();
EditorGUI.EndChangeCheck();
}
}
}

2
Assets/BossRoom/Editor/MLAPI/NetworkedBehaviourEditor.cs.meta


guid: 0FA0F1F6CBFA156AFC196808CB99FFBA
fileFormatVersion: 2

82
Assets/BossRoom/Editor/MLAPI/NetworkedObjectEditor.cs


using System.Collections.Generic;
using MLAPI;
using UnityEngine;
namespace UnityEditor
{
[CustomEditor(typeof(NetworkedObject), true)]
[CanEditMultipleObjects]
public class NetworkedObjectEditor : Editor
{
private bool initialized;
private NetworkedObject networkedObject;
private bool showObservers;
private void Init()
{
if (initialized)
return;
initialized = true;
networkedObject = (NetworkedObject)target;
}
public override void OnInspectorGUI()
{
Init();
if (!networkedObject.IsSpawned && NetworkingManager.Singleton != null && NetworkingManager.Singleton.IsServer)
{
EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField(new GUIContent("Spawn", "Spawns the object across the network"));
if (GUILayout.Toggle(false, "Spawn", EditorStyles.miniButtonLeft))
{
networkedObject.Spawn();
EditorUtility.SetDirty(target);
}
EditorGUILayout.EndHorizontal();
}
else if (networkedObject.IsSpawned)
{
EditorGUILayout.LabelField("PrefabHashGenerator: ", networkedObject.PrefabHashGenerator, EditorStyles.label);
EditorGUILayout.LabelField("PrefabHash: ", networkedObject.PrefabHash.ToString(), EditorStyles.label);
EditorGUILayout.LabelField("InstanceId: ", networkedObject.NetworkedInstanceId.ToString(), EditorStyles.label);
EditorGUILayout.LabelField("NetworkId: ", networkedObject.NetworkId.ToString(), EditorStyles.label);
EditorGUILayout.LabelField("OwnerId: ", networkedObject.OwnerClientId.ToString(), EditorStyles.label);
EditorGUILayout.LabelField("IsSpawned: ", networkedObject.IsSpawned.ToString(), EditorStyles.label);
EditorGUILayout.LabelField("IsLocalPlayer: ", networkedObject.IsLocalPlayer.ToString(), EditorStyles.label);
EditorGUILayout.LabelField("IsOwner: ", networkedObject.IsOwner.ToString(), EditorStyles.label);
EditorGUILayout.LabelField("IsOwnedByServer: ", networkedObject.IsOwnedByServer.ToString(), EditorStyles.label);
EditorGUILayout.LabelField("IsPlayerObject: ", networkedObject.IsPlayerObject.ToString(), EditorStyles.label);
EditorGUILayout.LabelField("IsSceneObject: ", (networkedObject.IsSceneObject == null ? "Null" : networkedObject.IsSceneObject.Value.ToString()), EditorStyles.label);
if (NetworkingManager.Singleton != null && NetworkingManager.Singleton.IsServer)
{
showObservers = EditorGUILayout.Foldout(showObservers, "Observers");
if (showObservers)
{
HashSet<ulong>.Enumerator observerClientIds = networkedObject.GetObservers();
EditorGUI.indentLevel += 1;
while (observerClientIds.MoveNext())
{
if (NetworkingManager.Singleton.ConnectedClients[observerClientIds.Current].PlayerObject != null)
EditorGUILayout.ObjectField("ClientId: " + observerClientIds.Current, NetworkingManager.Singleton.ConnectedClients[observerClientIds.Current].PlayerObject, typeof(GameObject), false);
else
EditorGUILayout.TextField("ClientId: " + observerClientIds.Current, EditorStyles.label);
}
EditorGUI.indentLevel -= 1;
}
}
}
else
{
base.OnInspectorGUI();
EditorGUILayout.LabelField("PrefabHash: ", networkedObject.PrefabHash.ToString(), EditorStyles.label);
EditorGUILayout.LabelField("InstanceId: ", networkedObject.NetworkedInstanceId.ToString(), EditorStyles.label);
}
}
}
}

2
Assets/BossRoom/Editor/MLAPI/NetworkedObjectEditor.cs.meta


guid: 5F0BB29517B6EBFB054C1CDEEDBBE4E3
fileFormatVersion: 2

440
Assets/BossRoom/Editor/MLAPI/NetworkingManagerEditor.cs


using System;
using System.Collections.Generic;
using System.Reflection;
using UnityEditor;
using UnityEngine;
using UnityEditorInternal;
using MLAPI;
using MLAPI.Transports;
[CustomEditor(typeof(NetworkingManager), true)]
[CanEditMultipleObjects]
public class NetworkingManagerEditor : Editor
{
// Properties
private SerializedProperty dontDestroyOnLoadProperty;
private SerializedProperty runInBackgroundProperty;
private SerializedProperty logLevelProperty;
// NetworkConfig
private SerializedProperty networkConfigProperty;
// NetworkConfig fields
private SerializedProperty protocolVersionProperty;
private SerializedProperty allowRuntimeSceneChangesProperty;
private SerializedProperty networkTransportProperty;
private SerializedProperty receiveTickrateProperty;
private SerializedProperty maxReceiveEventsPerTickRateProperty;
private SerializedProperty eventTickrateProperty;
private SerializedProperty maxObjectUpdatesPerTickProperty;
private SerializedProperty clientConnectionBufferTimeoutProperty;
private SerializedProperty connectionApprovalProperty;
private SerializedProperty secondsHistoryProperty;
private SerializedProperty enableTimeResyncProperty;
private SerializedProperty timeResyncIntervalProperty;
private SerializedProperty enableNetworkedVarProperty;
private SerializedProperty ensureNetworkedVarLengthSafetyProperty;
private SerializedProperty createPlayerPrefabProperty;
private SerializedProperty forceSamePrefabsProperty;
private SerializedProperty usePrefabSyncProperty;
private SerializedProperty enableSceneManagementProperty;
private SerializedProperty recycleNetworkIdsProperty;
private SerializedProperty networkIdRecycleDelayProperty;
private SerializedProperty rpcHashSizeProperty;
private SerializedProperty loadSceneTimeOutProperty;
private SerializedProperty enableMessageBufferingProperty;
private SerializedProperty messageBufferTimeoutProperty;
private SerializedProperty enableEncryptionProperty;
private SerializedProperty signKeyExchangeProperty;
private SerializedProperty serverBase64PfxCertificateProperty;
private ReorderableList networkPrefabsList;
private ReorderableList registeredScenesList;
private NetworkingManager networkingManager;
private bool initialized;
private readonly List<Type> transportTypes = new List<Type>();
private string[] transportNames = new string[] { "Select transport..." };
private void ReloadTransports()
{
transportTypes.Clear();
Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
foreach (Assembly assembly in assemblies)
{
Type[] types = assembly.GetTypes();
foreach (Type type in types)
{
if (type.IsSubclassOf(typeof(Transport)))
{
transportTypes.Add(type);
}
}
}
transportNames = new string[transportTypes.Count + 1];
transportNames[0] = "Select transport...";
for (int i = 0; i < transportTypes.Count; i++)
{
transportNames[i + 1] = transportTypes[i].Name;
}
}
private void Init()
{
if (initialized)
return;
initialized = true;
networkingManager = (NetworkingManager)target;
// Base properties
dontDestroyOnLoadProperty = serializedObject.FindProperty("DontDestroy");
runInBackgroundProperty = serializedObject.FindProperty("RunInBackground");
logLevelProperty = serializedObject.FindProperty("LogLevel");
networkConfigProperty = serializedObject.FindProperty("NetworkConfig");
// NetworkConfig properties
protocolVersionProperty = networkConfigProperty.FindPropertyRelative("ProtocolVersion");
allowRuntimeSceneChangesProperty = networkConfigProperty.FindPropertyRelative("AllowRuntimeSceneChanges");
networkTransportProperty = networkConfigProperty.FindPropertyRelative("NetworkTransport");
receiveTickrateProperty = networkConfigProperty.FindPropertyRelative("ReceiveTickrate");
maxReceiveEventsPerTickRateProperty = networkConfigProperty.FindPropertyRelative("MaxReceiveEventsPerTickRate");
eventTickrateProperty = networkConfigProperty.FindPropertyRelative("EventTickrate");
maxObjectUpdatesPerTickProperty = networkConfigProperty.FindPropertyRelative("MaxObjectUpdatesPerTick");
clientConnectionBufferTimeoutProperty = networkConfigProperty.FindPropertyRelative("ClientConnectionBufferTimeout");
connectionApprovalProperty = networkConfigProperty.FindPropertyRelative("ConnectionApproval");
secondsHistoryProperty = networkConfigProperty.FindPropertyRelative("SecondsHistory");
enableTimeResyncProperty = networkConfigProperty.FindPropertyRelative("EnableTimeResync");
timeResyncIntervalProperty = networkConfigProperty.FindPropertyRelative("TimeResyncInterval");
enableNetworkedVarProperty = networkConfigProperty.FindPropertyRelative("EnableNetworkedVar");
ensureNetworkedVarLengthSafetyProperty = networkConfigProperty.FindPropertyRelative("EnsureNetworkedVarLengthSafety");
createPlayerPrefabProperty = networkConfigProperty.FindPropertyRelative("CreatePlayerPrefab");
forceSamePrefabsProperty = networkConfigProperty.FindPropertyRelative("ForceSamePrefabs");
usePrefabSyncProperty = networkConfigProperty.FindPropertyRelative("UsePrefabSync");
enableSceneManagementProperty = networkConfigProperty.FindPropertyRelative("EnableSceneManagement");
recycleNetworkIdsProperty = networkConfigProperty.FindPropertyRelative("RecycleNetworkIds");
networkIdRecycleDelayProperty = networkConfigProperty.FindPropertyRelative("NetworkIdRecycleDelay");
rpcHashSizeProperty = networkConfigProperty.FindPropertyRelative("RpcHashSize");
loadSceneTimeOutProperty = networkConfigProperty.FindPropertyRelative("LoadSceneTimeOut");
enableMessageBufferingProperty = networkConfigProperty.FindPropertyRelative("EnableMessageBuffering");
messageBufferTimeoutProperty = networkConfigProperty.FindPropertyRelative("MessageBufferTimeout");
enableEncryptionProperty = networkConfigProperty.FindPropertyRelative("EnableEncryption");
signKeyExchangeProperty = networkConfigProperty.FindPropertyRelative("SignKeyExchange");
serverBase64PfxCertificateProperty = networkConfigProperty.FindPropertyRelative("ServerBase64PfxCertificate");
ReloadTransports();
}
private void CheckNullProperties()
{
// Base properties
dontDestroyOnLoadProperty = serializedObject.FindProperty("DontDestroy");
runInBackgroundProperty = serializedObject.FindProperty("RunInBackground");
logLevelProperty = serializedObject.FindProperty("LogLevel");
networkConfigProperty = serializedObject.FindProperty("NetworkConfig");
// NetworkConfig properties
protocolVersionProperty = networkConfigProperty.FindPropertyRelative("ProtocolVersion");
allowRuntimeSceneChangesProperty = networkConfigProperty.FindPropertyRelative("AllowRuntimeSceneChanges");
networkTransportProperty = networkConfigProperty.FindPropertyRelative("NetworkTransport");
receiveTickrateProperty = networkConfigProperty.FindPropertyRelative("ReceiveTickrate");
maxReceiveEventsPerTickRateProperty = networkConfigProperty.FindPropertyRelative("MaxReceiveEventsPerTickRate");
eventTickrateProperty = networkConfigProperty.FindPropertyRelative("EventTickrate");
maxObjectUpdatesPerTickProperty = networkConfigProperty.FindPropertyRelative("MaxObjectUpdatesPerTick");
clientConnectionBufferTimeoutProperty = networkConfigProperty.FindPropertyRelative("ClientConnectionBufferTimeout");
connectionApprovalProperty = networkConfigProperty.FindPropertyRelative("ConnectionApproval");
secondsHistoryProperty = networkConfigProperty.FindPropertyRelative("SecondsHistory");
enableTimeResyncProperty = networkConfigProperty.FindPropertyRelative("EnableTimeResync");
timeResyncIntervalProperty = networkConfigProperty.FindPropertyRelative("TimeResyncInterval");
enableNetworkedVarProperty = networkConfigProperty.FindPropertyRelative("EnableNetworkedVar");
ensureNetworkedVarLengthSafetyProperty = networkConfigProperty.FindPropertyRelative("EnsureNetworkedVarLengthSafety");
createPlayerPrefabProperty = networkConfigProperty.FindPropertyRelative("CreatePlayerPrefab");
forceSamePrefabsProperty = networkConfigProperty.FindPropertyRelative("ForceSamePrefabs");
usePrefabSyncProperty = networkConfigProperty.FindPropertyRelative("UsePrefabSync");
enableSceneManagementProperty = networkConfigProperty.FindPropertyRelative("EnableSceneManagement");
recycleNetworkIdsProperty = networkConfigProperty.FindPropertyRelative("RecycleNetworkIds");
networkIdRecycleDelayProperty = networkConfigProperty.FindPropertyRelative("NetworkIdRecycleDelay");
rpcHashSizeProperty = networkConfigProperty.FindPropertyRelative("RpcHashSize");
loadSceneTimeOutProperty = networkConfigProperty.FindPropertyRelative("LoadSceneTimeOut");
enableMessageBufferingProperty = networkConfigProperty.FindPropertyRelative("EnableMessageBuffering");
messageBufferTimeoutProperty = networkConfigProperty.FindPropertyRelative("MessageBufferTimeout");
enableEncryptionProperty = networkConfigProperty.FindPropertyRelative("EnableEncryption");
signKeyExchangeProperty = networkConfigProperty.FindPropertyRelative("SignKeyExchange");
serverBase64PfxCertificateProperty = networkConfigProperty.FindPropertyRelative("ServerBase64PfxCertificate");
}
private void OnEnable()
{
networkPrefabsList = new ReorderableList(serializedObject, serializedObject.FindProperty("NetworkConfig").FindPropertyRelative("NetworkedPrefabs"), true, true, true, true);
networkPrefabsList.drawElementCallback = (Rect rect, int index, bool isActive, bool isFocused) =>
{
SerializedProperty element = networkPrefabsList.serializedProperty.GetArrayElementAtIndex(index);
int firstLabelWidth = 50;
int secondLabelWidth = 140;
float secondFieldWidth = 10;
int reduceFirstWidth = 45;
EditorGUI.LabelField(new Rect(rect.x, rect.y, firstLabelWidth, EditorGUIUtility.singleLineHeight), "Prefab");
EditorGUI.PropertyField(new Rect(rect.x + firstLabelWidth, rect.y, rect.width - firstLabelWidth - secondLabelWidth - secondFieldWidth - reduceFirstWidth,
EditorGUIUtility.singleLineHeight), element.FindPropertyRelative("Prefab"), GUIContent.none);
EditorGUI.LabelField(new Rect(rect.width - secondLabelWidth - secondFieldWidth, rect.y, secondLabelWidth, EditorGUIUtility.singleLineHeight), "Default Player Prefab");
int playerPrefabIndex = -1;
for (int i = 0; i < networkingManager.NetworkConfig.NetworkedPrefabs.Count; i++)
{
if (networkingManager.NetworkConfig.NetworkedPrefabs[i].PlayerPrefab)
{
playerPrefabIndex = i;
break;
}
}
using (new EditorGUI.DisabledScope(playerPrefabIndex != -1 && playerPrefabIndex != index))
{
EditorGUI.PropertyField(new Rect(rect.width - secondFieldWidth, rect.y, secondFieldWidth,
EditorGUIUtility.singleLineHeight), element.FindPropertyRelative("PlayerPrefab"), GUIContent.none);
}
};
networkPrefabsList.drawHeaderCallback = (Rect rect) => {
EditorGUI.LabelField(rect, "NetworkedPrefabs");
};
registeredScenesList = new ReorderableList(serializedObject, serializedObject.FindProperty("NetworkConfig").FindPropertyRelative("RegisteredScenes"), true, true, true, true);
registeredScenesList.drawElementCallback = (Rect rect, int index, bool isActive, bool isFocused) =>
{
SerializedProperty element = registeredScenesList.serializedProperty.GetArrayElementAtIndex(index);
int firstLabelWidth = 50;
int padding = 20;
EditorGUI.LabelField(new Rect(rect.x, rect.y, firstLabelWidth, EditorGUIUtility.singleLineHeight), "Name");
EditorGUI.PropertyField(new Rect(rect.x + firstLabelWidth, rect.y, rect.width - firstLabelWidth - padding,
EditorGUIUtility.singleLineHeight), element, GUIContent.none);
};
registeredScenesList.drawHeaderCallback = (Rect rect) => {
EditorGUI.LabelField(rect, "Registered Scene Names");
};
}
public override void OnInspectorGUI()
{
Init();
CheckNullProperties();
{
SerializedProperty iterator = serializedObject.GetIterator();
for (bool enterChildren = true; iterator.NextVisible(enterChildren); enterChildren = false)
{
using (new EditorGUI.DisabledScope("m_Script" == iterator.propertyPath))
{
EditorGUILayout.PropertyField(iterator, false);
}
}
}
if (!networkingManager.IsServer && !networkingManager.IsClient)
{
serializedObject.Update();
EditorGUILayout.PropertyField(dontDestroyOnLoadProperty);
EditorGUILayout.PropertyField(runInBackgroundProperty);
EditorGUILayout.PropertyField(logLevelProperty);
EditorGUILayout.Space();
networkPrefabsList.DoLayoutList();
using (new EditorGUI.DisabledScope(!networkingManager.NetworkConfig.EnableSceneManagement))
{
registeredScenesList.DoLayoutList();
EditorGUILayout.Space();
}
EditorGUILayout.LabelField("General", EditorStyles.boldLabel);
EditorGUILayout.PropertyField(protocolVersionProperty);
EditorGUILayout.PropertyField(networkTransportProperty);
if (networkTransportProperty.objectReferenceValue == null)
{
EditorGUILayout.HelpBox("You have no transport selected. A transport is required for the MLAPI to work. Which one do you want?", MessageType.Warning);
int selection = EditorGUILayout.Popup(0, transportNames);
if (selection > 0)
{
ReloadTransports();
Component transport = networkingManager.gameObject.GetComponent(transportTypes[selection - 1]);
if (transport == null)
{
transport = networkingManager.gameObject.AddComponent(transportTypes[selection - 1]);
}
networkTransportProperty.objectReferenceValue = transport;
Repaint();
}
}
EditorGUILayout.PropertyField(enableTimeResyncProperty);
using (new EditorGUI.DisabledScope(!networkingManager.NetworkConfig.EnableTimeResync))
{
EditorGUILayout.PropertyField(timeResyncIntervalProperty);
}
EditorGUILayout.LabelField("Performance", EditorStyles.boldLabel);
EditorGUILayout.PropertyField(receiveTickrateProperty);
EditorGUILayout.PropertyField(maxReceiveEventsPerTickRateProperty);
EditorGUILayout.PropertyField(eventTickrateProperty);
EditorGUILayout.PropertyField(enableNetworkedVarProperty);
using (new EditorGUI.DisabledScope(!networkingManager.NetworkConfig.EnableNetworkedVar))
{
EditorGUILayout.PropertyField(maxObjectUpdatesPerTickProperty);
EditorGUILayout.PropertyField(ensureNetworkedVarLengthSafetyProperty);
}
EditorGUILayout.LabelField("Connection", EditorStyles.boldLabel);
EditorGUILayout.PropertyField(connectionApprovalProperty);
using (new EditorGUI.DisabledScope(!networkingManager.NetworkConfig.ConnectionApproval))
{
EditorGUILayout.PropertyField(clientConnectionBufferTimeoutProperty);
}
EditorGUILayout.LabelField("Lag Compensation", EditorStyles.boldLabel);
EditorGUILayout.PropertyField(secondsHistoryProperty);
EditorGUILayout.LabelField("Spawning", EditorStyles.boldLabel);
EditorGUILayout.PropertyField(createPlayerPrefabProperty);
EditorGUILayout.PropertyField(forceSamePrefabsProperty);
using (new EditorGUI.DisabledScope(!networkingManager.NetworkConfig.EnableSceneManagement))
{
bool value = networkingManager.NetworkConfig.UsePrefabSync;
if (!networkingManager.NetworkConfig.EnableSceneManagement)
{
usePrefabSyncProperty.boolValue = true;
}
EditorGUILayout.PropertyField(usePrefabSyncProperty);
if (!networkingManager.NetworkConfig.EnableSceneManagement)
{
usePrefabSyncProperty.boolValue = value;
}
}
EditorGUILayout.PropertyField(recycleNetworkIdsProperty);
using (new EditorGUI.DisabledScope(!networkingManager.NetworkConfig.RecycleNetworkIds))
{
EditorGUILayout.PropertyField(networkIdRecycleDelayProperty);
}
EditorGUILayout.PropertyField(enableMessageBufferingProperty);
using (new EditorGUI.DisabledScope(!networkingManager.NetworkConfig.EnableMessageBuffering))
{
EditorGUILayout.PropertyField(messageBufferTimeoutProperty);
}
EditorGUILayout.LabelField("Bandwidth", EditorStyles.boldLabel);
EditorGUILayout.PropertyField(rpcHashSizeProperty);
EditorGUILayout.LabelField("Scene Management", EditorStyles.boldLabel);
EditorGUILayout.PropertyField(enableSceneManagementProperty);
using (new EditorGUI.DisabledScope(!networkingManager.NetworkConfig.EnableSceneManagement))
{
EditorGUILayout.PropertyField(loadSceneTimeOutProperty);
EditorGUILayout.PropertyField(allowRuntimeSceneChangesProperty);
}
EditorGUILayout.LabelField("Cryptography", EditorStyles.boldLabel);
EditorGUILayout.PropertyField(enableEncryptionProperty);
using (new EditorGUI.DisabledScope(!networkingManager.NetworkConfig.EnableEncryption))
{
EditorGUILayout.PropertyField(signKeyExchangeProperty);
EditorGUILayout.PropertyField(serverBase64PfxCertificateProperty);
}
serializedObject.ApplyModifiedProperties();
// Start buttons below
{
string buttonDisabledReasonSuffix = "";
if (!EditorApplication.isPlaying)
{
buttonDisabledReasonSuffix = ". This can only be done in play mode";
GUI.enabled = false;
}
if (GUILayout.Button(new GUIContent("Start Host", "Starts a host instance" + buttonDisabledReasonSuffix)))
{
networkingManager.StartHost();
}
if (GUILayout.Button(new GUIContent("Start Server", "Starts a server instance" + buttonDisabledReasonSuffix)))
{
networkingManager.StartServer();
}
if (GUILayout.Button(new GUIContent("Start Client", "Starts a client instance" + buttonDisabledReasonSuffix)))
{
networkingManager.StartClient();
}
if (!EditorApplication.isPlaying)
{
GUI.enabled = true;
}
}
}
else
{
string instanceType = "";
if (networkingManager.IsHost)
instanceType = "Host";
else if (networkingManager.IsServer)
instanceType = "Server";
else if (networkingManager.IsClient)
instanceType = "Client";
EditorGUILayout.HelpBox("You cannot edit the NetworkConfig when a " + instanceType + " is running.", MessageType.Info);
if (GUILayout.Button(new GUIContent("Stop " + instanceType, "Stops the " + instanceType + " instance.")))
{
if (networkingManager.IsHost)
networkingManager.StopHost();
else if (networkingManager.IsServer)
networkingManager.StopServer();
else if (networkingManager.IsClient)
networkingManager.StopClient();
}
}
}
}

2
Assets/BossRoom/Editor/MLAPI/NetworkingManagerEditor.cs.meta


guid: 7EEB644014BFE5F4AA173D8DCBFF4515
fileFormatVersion: 2

60
Assets/BossRoom/Editor/MLAPI/PostProcessScene.cs


using System.Collections.Generic;
using System.Linq;
using MLAPI;
using UnityEditor.Callbacks;
using UnityEngine;
namespace UnityEditor
{
public class NetworkScenePostProcess : MonoBehaviour
{
[PostProcessScene(int.MaxValue)]
public static void ProcessScene()
{
List<NetworkedObject> traverseSortedObjects = MonoBehaviour.FindObjectsOfType<NetworkedObject>().ToList();
traverseSortedObjects.Sort((x, y) =>
{
List<int> xSiblingIndex = x.TraversedSiblingIndex();
List<int> ySiblingIndex = y.TraversedSiblingIndex();
while (xSiblingIndex.Count > 0 && ySiblingIndex.Count > 0)
{
if (xSiblingIndex[0] < ySiblingIndex[0])
return -1;
if (xSiblingIndex[0] > ySiblingIndex[0])
return 1;
xSiblingIndex.RemoveAt(0);
ySiblingIndex.RemoveAt(0);
}
return 0;
});
for (ulong i = 0; i < (ulong)traverseSortedObjects.Count; i++)
traverseSortedObjects[(int)i].NetworkedInstanceId = i;
}
}
internal static class PrefabHelpers
{
internal static List<int> TraversedSiblingIndex(this NetworkedObject networkedObject)
{
List<int> paths = new List<int>();
Transform transform = networkedObject.transform;
while (transform != null)
{
paths.Add(transform.GetSiblingIndex());
transform = transform.parent;
}
paths.Reverse();
return paths;
}
}
}

2
Assets/BossRoom/Editor/MLAPI/PostProcessScene.cs.meta


guid: 6F831B20208550B7F6E59676E90A4226
fileFormatVersion: 2

35
Assets/BossRoom/Editor/MLAPI/TrackedObjectEditor.cs


using MLAPI;
using MLAPI.LagCompensation;
namespace UnityEditor
{
[CustomEditor(typeof(TrackedObject), true)]
[CanEditMultipleObjects]
public class TrackedObjectEditor : Editor
{
private TrackedObject trackedObject;
private bool initialized;
private void Init()
{
if (initialized)
return;
trackedObject = (TrackedObject)target;
initialized = true;
}
public override void OnInspectorGUI()
{
Init();
base.OnInspectorGUI();
if(NetworkingManager.Singleton != null && NetworkingManager.Singleton.IsServer)
<