13
.releaserc.yml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"plugins": [
|
||||||
|
["@semantic-release/commit-analyzer", {
|
||||||
|
"preset": "angular",
|
||||||
|
"releaseRules": [
|
||||||
|
{"type": "breaking", "release": "major"},
|
||||||
|
{"type": "feature", "release": "minor"},
|
||||||
|
]
|
||||||
|
}],
|
||||||
|
'@semantic-release/release-notes-generator',
|
||||||
|
'@semantic-release/github'
|
||||||
|
]
|
||||||
|
}
|
@ -1,4 +1,3 @@
|
|||||||
using System;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace Mirror
|
namespace Mirror
|
||||||
@ -6,18 +5,21 @@ namespace Mirror
|
|||||||
[DisallowMultipleComponent]
|
[DisallowMultipleComponent]
|
||||||
[AddComponentMenu("Network/NetworkAnimator")]
|
[AddComponentMenu("Network/NetworkAnimator")]
|
||||||
[RequireComponent(typeof(NetworkIdentity))]
|
[RequireComponent(typeof(NetworkIdentity))]
|
||||||
[RequireComponent(typeof(Animator))]
|
|
||||||
[HelpURL("https://vis2k.github.io/Mirror/Components/NetworkAnimator")]
|
[HelpURL("https://vis2k.github.io/Mirror/Components/NetworkAnimator")]
|
||||||
public class NetworkAnimator : NetworkBehaviour
|
public class NetworkAnimator : NetworkBehaviour
|
||||||
{
|
{
|
||||||
// configuration
|
// configuration
|
||||||
[SerializeField] Animator m_Animator;
|
[SerializeField] Animator m_Animator;
|
||||||
[SerializeField] uint m_ParameterSendBits;
|
[SerializeField] uint m_ParameterSendBits;
|
||||||
|
// Note: not an object[] array because otherwise initialization is real annoying
|
||||||
|
int[] lastIntParameters;
|
||||||
|
float[] lastFloatParameters;
|
||||||
|
bool[] lastBoolParameters;
|
||||||
|
|
||||||
// properties
|
// properties
|
||||||
public Animator animator
|
public Animator animator
|
||||||
{
|
{
|
||||||
get { return m_Animator; }
|
get => m_Animator;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
m_Animator = value;
|
m_Animator = value;
|
||||||
@ -42,9 +44,9 @@ public bool GetParameterAutoSend(int index)
|
|||||||
return (m_ParameterSendBits & (uint)(1 << index)) != 0;
|
return (m_ParameterSendBits & (uint)(1 << index)) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int m_AnimationHash;
|
int m_AnimationHash;
|
||||||
int m_TransitionHash;
|
int m_TransitionHash;
|
||||||
float m_SendTimer;
|
float m_SendTimer;
|
||||||
|
|
||||||
bool sendMessagesAllowed
|
bool sendMessagesAllowed
|
||||||
{
|
{
|
||||||
@ -135,9 +137,10 @@ void CheckSendRate()
|
|||||||
m_SendTimer = Time.time + syncInterval;
|
m_SendTimer = Time.time + syncInterval;
|
||||||
|
|
||||||
NetworkWriter writer = new NetworkWriter();
|
NetworkWriter writer = new NetworkWriter();
|
||||||
WriteParameters(writer, true);
|
if (WriteParameters(writer, true))
|
||||||
|
{
|
||||||
SendAnimationParametersMessage(writer.ToArray());
|
SendAnimationParametersMessage(writer.ToArray());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -194,12 +197,20 @@ internal void HandleAnimTriggerMsg(int hash)
|
|||||||
m_Animator.SetTrigger(hash);
|
m_Animator.SetTrigger(hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WriteParameters(NetworkWriter writer, bool autoSend)
|
bool WriteParameters(NetworkWriter writer, bool autoSend)
|
||||||
{
|
{
|
||||||
// store the animator parameters in a variable - the "Animator.parameters" getter allocates
|
// store the animator parameters in a variable - the "Animator.parameters" getter allocates
|
||||||
// a new parameter array every time it is accessed so we should avoid doing it in a loop
|
// a new parameter array every time it is accessed so we should avoid doing it in a loop
|
||||||
AnimatorControllerParameter[] parameters = m_Animator.parameters;
|
AnimatorControllerParameter[] parameters = m_Animator.parameters;
|
||||||
|
if (lastIntParameters == null) lastIntParameters = new int[parameters.Length];
|
||||||
|
if (lastFloatParameters == null) lastFloatParameters = new float[parameters.Length];
|
||||||
|
if (lastBoolParameters == null) lastBoolParameters = new bool[parameters.Length];
|
||||||
|
|
||||||
|
uint dirtyBits = 0;
|
||||||
|
// Save the position in the writer where to insert the dirty bits
|
||||||
|
int dirtyBitsPosition = writer.Position;
|
||||||
|
// Reserve the space for the bits
|
||||||
|
writer.Write(dirtyBits);
|
||||||
for (int i = 0; i < parameters.Length; i++)
|
for (int i = 0; i < parameters.Length; i++)
|
||||||
{
|
{
|
||||||
if (autoSend && !GetParameterAutoSend(i))
|
if (autoSend && !GetParameterAutoSend(i))
|
||||||
@ -208,17 +219,43 @@ void WriteParameters(NetworkWriter writer, bool autoSend)
|
|||||||
AnimatorControllerParameter par = parameters[i];
|
AnimatorControllerParameter par = parameters[i];
|
||||||
if (par.type == AnimatorControllerParameterType.Int)
|
if (par.type == AnimatorControllerParameterType.Int)
|
||||||
{
|
{
|
||||||
writer.WritePackedUInt32((uint)m_Animator.GetInteger(par.nameHash));
|
int newIntValue = m_Animator.GetInteger(par.nameHash);
|
||||||
|
if (newIntValue != lastIntParameters[i])
|
||||||
|
{
|
||||||
|
writer.WritePackedUInt32((uint) newIntValue);
|
||||||
|
dirtyBits |= 1u << i;
|
||||||
|
lastIntParameters[i] = newIntValue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (par.type == AnimatorControllerParameterType.Float)
|
else if (par.type == AnimatorControllerParameterType.Float)
|
||||||
{
|
{
|
||||||
writer.Write(m_Animator.GetFloat(par.nameHash));
|
float newFloatValue = m_Animator.GetFloat(par.nameHash);
|
||||||
|
if (Mathf.Abs(newFloatValue - lastFloatParameters[i]) > 0.001f)
|
||||||
|
{
|
||||||
|
writer.Write(newFloatValue);
|
||||||
|
dirtyBits |= 1u << i;
|
||||||
|
lastFloatParameters[i] = newFloatValue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (par.type == AnimatorControllerParameterType.Bool)
|
else if (par.type == AnimatorControllerParameterType.Bool)
|
||||||
{
|
{
|
||||||
writer.Write(m_Animator.GetBool(par.nameHash));
|
bool newBoolValue = m_Animator.GetBool(par.nameHash);
|
||||||
|
if (newBoolValue != lastBoolParameters[i])
|
||||||
|
{
|
||||||
|
writer.Write(newBoolValue);
|
||||||
|
dirtyBits |= 1u << i;
|
||||||
|
lastBoolParameters[i] = newBoolValue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Save the position we were at to return to after writing dirtyBits
|
||||||
|
int messageEndPosition = writer.Position;
|
||||||
|
// Write the dirty bits into the reserved position
|
||||||
|
writer.Position = dirtyBitsPosition;
|
||||||
|
writer.Write(dirtyBits);
|
||||||
|
// Return to the end position, so that serialization includes parameter data.
|
||||||
|
writer.Position = messageEndPosition;
|
||||||
|
return dirtyBits != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReadParameters(NetworkReader reader, bool autoSend)
|
void ReadParameters(NetworkReader reader, bool autoSend)
|
||||||
@ -227,16 +264,19 @@ void ReadParameters(NetworkReader reader, bool autoSend)
|
|||||||
// a new parameter array every time it is accessed so we should avoid doing it in a loop
|
// a new parameter array every time it is accessed so we should avoid doing it in a loop
|
||||||
AnimatorControllerParameter[] parameters = m_Animator.parameters;
|
AnimatorControllerParameter[] parameters = m_Animator.parameters;
|
||||||
|
|
||||||
|
uint dirtyBits = reader.ReadUInt32();
|
||||||
for (int i = 0; i < parameters.Length; i++)
|
for (int i = 0; i < parameters.Length; i++)
|
||||||
{
|
{
|
||||||
if (autoSend && !GetParameterAutoSend(i))
|
if (autoSend && !GetParameterAutoSend(i))
|
||||||
continue;
|
continue;
|
||||||
|
if ((dirtyBits & (1 << i)) == 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
AnimatorControllerParameter par = parameters[i];
|
AnimatorControllerParameter par = parameters[i];
|
||||||
if (par.type == AnimatorControllerParameterType.Int)
|
if (par.type == AnimatorControllerParameterType.Int)
|
||||||
{
|
{
|
||||||
int newValue = (int)reader.ReadPackedUInt32();
|
int newIntValue = (int)reader.ReadPackedUInt32();
|
||||||
m_Animator.SetInteger(par.nameHash, newValue);
|
m_Animator.SetInteger(par.nameHash, newIntValue);
|
||||||
}
|
}
|
||||||
else if (par.type == AnimatorControllerParameterType.Float)
|
else if (par.type == AnimatorControllerParameterType.Float)
|
||||||
{
|
{
|
||||||
@ -293,7 +333,7 @@ public void SetTrigger(int hash)
|
|||||||
{
|
{
|
||||||
if (hasAuthority && localPlayerAuthority)
|
if (hasAuthority && localPlayerAuthority)
|
||||||
{
|
{
|
||||||
if (NetworkClient.allClients.Count > 0 && ClientScene.readyConnection != null)
|
if (NetworkClient.singleton != null && ClientScene.readyConnection != null)
|
||||||
{
|
{
|
||||||
CmdOnAnimationTriggerServerMessage(hash);
|
CmdOnAnimationTriggerServerMessage(hash);
|
||||||
}
|
}
|
||||||
@ -306,12 +346,11 @@ public void SetTrigger(int hash)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------ server message handlers -------------------
|
#region server message handlers
|
||||||
|
|
||||||
[Command]
|
[Command]
|
||||||
void CmdOnAnimationServerMessage(int stateHash, float normalizedTime, byte[] parameters)
|
void CmdOnAnimationServerMessage(int stateHash, float normalizedTime, byte[] parameters)
|
||||||
{
|
{
|
||||||
if (LogFilter.Debug) { Debug.Log("OnAnimationMessage for netId=" + netId); }
|
if (LogFilter.Debug) Debug.Log("OnAnimationMessage for netId=" + netId);
|
||||||
|
|
||||||
// handle and broadcast
|
// handle and broadcast
|
||||||
HandleAnimMsg(stateHash, normalizedTime, new NetworkReader(parameters));
|
HandleAnimMsg(stateHash, normalizedTime, new NetworkReader(parameters));
|
||||||
@ -333,8 +372,9 @@ void CmdOnAnimationTriggerServerMessage(int hash)
|
|||||||
HandleAnimTriggerMsg(hash);
|
HandleAnimTriggerMsg(hash);
|
||||||
RpcOnAnimationTriggerClientMessage(hash);
|
RpcOnAnimationTriggerClientMessage(hash);
|
||||||
}
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
// ------------------ client message handlers -------------------
|
#region client message handlers
|
||||||
[ClientRpc]
|
[ClientRpc]
|
||||||
void RpcOnAnimationClientMessage(int stateHash, float normalizedTime, byte[] parameters)
|
void RpcOnAnimationClientMessage(int stateHash, float normalizedTime, byte[] parameters)
|
||||||
{
|
{
|
||||||
@ -353,5 +393,6 @@ void RpcOnAnimationTriggerClientMessage(int hash)
|
|||||||
{
|
{
|
||||||
HandleAnimTriggerMsg(hash);
|
HandleAnimTriggerMsg(hash);
|
||||||
}
|
}
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ namespace Mirror
|
|||||||
[HelpURL("https://vis2k.github.io/Mirror/Components/NetworkLobbyManager")]
|
[HelpURL("https://vis2k.github.io/Mirror/Components/NetworkLobbyManager")]
|
||||||
public class NetworkLobbyManager : NetworkManager
|
public class NetworkLobbyManager : NetworkManager
|
||||||
{
|
{
|
||||||
struct PendingPlayer
|
public struct PendingPlayer
|
||||||
{
|
{
|
||||||
public NetworkConnection conn;
|
public NetworkConnection conn;
|
||||||
public GameObject lobbyPlayer;
|
public GameObject lobbyPlayer;
|
||||||
@ -29,8 +29,8 @@ struct PendingPlayer
|
|||||||
public string GameplayScene;
|
public string GameplayScene;
|
||||||
|
|
||||||
// runtime data
|
// runtime data
|
||||||
[FormerlySerializedAs("m_PendingPlayers")] List<PendingPlayer> pendingPlayers = new List<PendingPlayer>();
|
[FormerlySerializedAs("m_PendingPlayers")] public List<PendingPlayer> pendingPlayers = new List<PendingPlayer>();
|
||||||
List<NetworkLobbyPlayer> lobbySlots = new List<NetworkLobbyPlayer>();
|
public List<NetworkLobbyPlayer> lobbySlots = new List<NetworkLobbyPlayer>();
|
||||||
|
|
||||||
public bool allPlayersReady;
|
public bool allPlayersReady;
|
||||||
|
|
||||||
@ -39,7 +39,7 @@ public override void OnValidate()
|
|||||||
// always >= 0
|
// always >= 0
|
||||||
maxConnections = Mathf.Max(maxConnections, 0);
|
maxConnections = Mathf.Max(maxConnections, 0);
|
||||||
|
|
||||||
// always <= maxConnections
|
// always <= maxConnections
|
||||||
minPlayers = Mathf.Min(minPlayers, maxConnections);
|
minPlayers = Mathf.Min(minPlayers, maxConnections);
|
||||||
|
|
||||||
// always >= 0
|
// always >= 0
|
||||||
@ -195,7 +195,13 @@ public override void OnServerDisconnect(NetworkConnection conn)
|
|||||||
OnLobbyServerDisconnect(conn);
|
OnLobbyServerDisconnect(conn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[System.Obsolete("Use OnServerAddPlayer(NetworkConnection conn, AddPlayerMessage extraMessage) instead")]
|
||||||
public override void OnServerAddPlayer(NetworkConnection conn)
|
public override void OnServerAddPlayer(NetworkConnection conn)
|
||||||
|
{
|
||||||
|
OnServerAddPlayer(conn, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnServerAddPlayer(NetworkConnection conn, AddPlayerMessage extraMessage)
|
||||||
{
|
{
|
||||||
if (SceneManager.GetActiveScene().name != LobbyScene) return;
|
if (SceneManager.GetActiveScene().name != LobbyScene) return;
|
||||||
|
|
||||||
@ -203,7 +209,7 @@ public override void OnServerAddPlayer(NetworkConnection conn)
|
|||||||
|
|
||||||
allPlayersReady = false;
|
allPlayersReady = false;
|
||||||
|
|
||||||
if (LogFilter.Debug) Debug.LogFormat("NetworkLobbyManager:OnServerAddPlayer playerPrefab:{0}", lobbyPlayerPrefab.name);
|
if (LogFilter.Debug) Debug.LogFormat("NetworkLobbyManager.OnServerAddPlayer playerPrefab:{0}", lobbyPlayerPrefab.name);
|
||||||
|
|
||||||
GameObject newLobbyGameObject = OnLobbyServerCreateLobbyPlayer(conn);
|
GameObject newLobbyGameObject = OnLobbyServerCreateLobbyPlayer(conn);
|
||||||
if (newLobbyGameObject == null)
|
if (newLobbyGameObject == null)
|
||||||
@ -400,17 +406,17 @@ public override void OnClientSceneChanged(NetworkConnection conn)
|
|||||||
|
|
||||||
#region lobby server virtuals
|
#region lobby server virtuals
|
||||||
|
|
||||||
public virtual void OnLobbyStartHost() { }
|
public virtual void OnLobbyStartHost() {}
|
||||||
|
|
||||||
public virtual void OnLobbyStopHost() { }
|
public virtual void OnLobbyStopHost() {}
|
||||||
|
|
||||||
public virtual void OnLobbyStartServer() { }
|
public virtual void OnLobbyStartServer() {}
|
||||||
|
|
||||||
public virtual void OnLobbyServerConnect(NetworkConnection conn) { }
|
public virtual void OnLobbyServerConnect(NetworkConnection conn) {}
|
||||||
|
|
||||||
public virtual void OnLobbyServerDisconnect(NetworkConnection conn) { }
|
public virtual void OnLobbyServerDisconnect(NetworkConnection conn) {}
|
||||||
|
|
||||||
public virtual void OnLobbyServerSceneChanged(string sceneName) { }
|
public virtual void OnLobbyServerSceneChanged(string sceneName) {}
|
||||||
|
|
||||||
public virtual GameObject OnLobbyServerCreateLobbyPlayer(NetworkConnection conn)
|
public virtual GameObject OnLobbyServerCreateLobbyPlayer(NetworkConnection conn)
|
||||||
{
|
{
|
||||||
@ -438,22 +444,22 @@ public virtual void OnLobbyServerPlayersReady()
|
|||||||
|
|
||||||
#region lobby client virtuals
|
#region lobby client virtuals
|
||||||
|
|
||||||
public virtual void OnLobbyClientEnter() { }
|
public virtual void OnLobbyClientEnter() {}
|
||||||
|
|
||||||
public virtual void OnLobbyClientExit() { }
|
public virtual void OnLobbyClientExit() {}
|
||||||
|
|
||||||
public virtual void OnLobbyClientConnect(NetworkConnection conn) { }
|
public virtual void OnLobbyClientConnect(NetworkConnection conn) {}
|
||||||
|
|
||||||
public virtual void OnLobbyClientDisconnect(NetworkConnection conn) { }
|
public virtual void OnLobbyClientDisconnect(NetworkConnection conn) {}
|
||||||
|
|
||||||
public virtual void OnLobbyStartClient(NetworkClient lobbyClient) { }
|
public virtual void OnLobbyStartClient(NetworkClient lobbyClient) {}
|
||||||
|
|
||||||
public virtual void OnLobbyStopClient() { }
|
public virtual void OnLobbyStopClient() {}
|
||||||
|
|
||||||
public virtual void OnLobbyClientSceneChanged(NetworkConnection conn) { }
|
public virtual void OnLobbyClientSceneChanged(NetworkConnection conn) {}
|
||||||
|
|
||||||
// for users to handle adding a player failed on the server
|
// for users to handle adding a player failed on the server
|
||||||
public virtual void OnLobbyClientAddPlayerFailed() { }
|
public virtual void OnLobbyClientAddPlayerFailed() {}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
using System;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.SceneManagement;
|
using UnityEngine.SceneManagement;
|
||||||
|
|
||||||
@ -62,11 +61,11 @@ public void CmdSendLevelLoaded()
|
|||||||
|
|
||||||
#region lobby client virtuals
|
#region lobby client virtuals
|
||||||
|
|
||||||
public virtual void OnClientEnterLobby() { }
|
public virtual void OnClientEnterLobby() {}
|
||||||
|
|
||||||
public virtual void OnClientExitLobby() { }
|
public virtual void OnClientExitLobby() {}
|
||||||
|
|
||||||
public virtual void OnClientReady(bool readyState) { }
|
public virtual void OnClientReady(bool readyState) {}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@ -88,7 +87,7 @@ public virtual void OnGUI()
|
|||||||
|
|
||||||
GUILayout.BeginArea(new Rect(20f + (Index * 100), 200f, 90f, 130f));
|
GUILayout.BeginArea(new Rect(20f + (Index * 100), 200f, 90f, 130f));
|
||||||
|
|
||||||
GUILayout.Label(String.Format("Player [{0}]", Index + 1));
|
GUILayout.Label($"Player [{Index + 1}]");
|
||||||
|
|
||||||
if (ReadyToBegin)
|
if (ReadyToBegin)
|
||||||
GUILayout.Label("Ready");
|
GUILayout.Label("Ready");
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
@ -20,7 +19,7 @@ public enum CheckMethod
|
|||||||
|
|
||||||
// how often to refresh the list of observers, in seconds
|
// how often to refresh the list of observers, in seconds
|
||||||
[Tooltip("How often (in seconds) that this object should update the set of players that can see it.")]
|
[Tooltip("How often (in seconds) that this object should update the set of players that can see it.")]
|
||||||
public float visUpdateInterval = 1.0f;
|
public float visUpdateInterval = 1;
|
||||||
|
|
||||||
[Tooltip("Which method to use for checking proximity of players.\n\nPhysics3D uses 3D physics to determine proximity.\n\nPhysics2D uses 2D physics to determine proximity.")]
|
[Tooltip("Which method to use for checking proximity of players.\n\nPhysics3D uses 3D physics to determine proximity.\n\nPhysics2D uses 2D physics to determine proximity.")]
|
||||||
public CheckMethod checkMethod = CheckMethod.Physics3D;
|
public CheckMethod checkMethod = CheckMethod.Physics3D;
|
||||||
@ -30,10 +29,18 @@ public enum CheckMethod
|
|||||||
|
|
||||||
// ~0 means 'Everything'. layers are used anyway, might as well expose them to the user.
|
// ~0 means 'Everything'. layers are used anyway, might as well expose them to the user.
|
||||||
[Tooltip("Select only the Player's layer to avoid unnecessary SphereCasts against the Terrain, etc.")]
|
[Tooltip("Select only the Player's layer to avoid unnecessary SphereCasts against the Terrain, etc.")]
|
||||||
public LayerMask castLayers = ~0;
|
public LayerMask castLayers = ~0;
|
||||||
|
|
||||||
float m_VisUpdateTime;
|
float m_VisUpdateTime;
|
||||||
|
|
||||||
|
// OverlapSphereNonAlloc array to avoid allocations.
|
||||||
|
// -> static so we don't create one per component
|
||||||
|
// -> this is worth it because proximity checking happens for just about
|
||||||
|
// every entity on the server!
|
||||||
|
// -> should be big enough to work in just about all cases
|
||||||
|
static Collider[] hitsBuffer3D = new Collider[10000];
|
||||||
|
static Collider2D[] hitsBuffer2D = new Collider2D[10000];
|
||||||
|
|
||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
if (!NetworkServer.active)
|
if (!NetworkServer.active)
|
||||||
@ -78,10 +85,13 @@ public override bool OnRebuildObservers(HashSet<NetworkConnection> observers, bo
|
|||||||
{
|
{
|
||||||
case CheckMethod.Physics3D:
|
case CheckMethod.Physics3D:
|
||||||
{
|
{
|
||||||
Collider[] hits = Physics.OverlapSphere(transform.position, visRange, castLayers);
|
// cast without allocating GC for maximum performance
|
||||||
for (int i = 0; i < hits.Length; i++)
|
int hitCount = Physics.OverlapSphereNonAlloc(transform.position, visRange, hitsBuffer3D, castLayers);
|
||||||
|
if (hitCount == hitsBuffer3D.Length) Debug.LogWarning("NetworkProximityChecker's OverlapSphere test for " + name + " has filled the whole buffer(" + hitsBuffer3D.Length + "). Some results might have been omitted. Consider increasing buffer size.");
|
||||||
|
|
||||||
|
for (int i = 0; i < hitCount; i++)
|
||||||
{
|
{
|
||||||
Collider hit = hits[i];
|
Collider hit = hitsBuffer3D[i];
|
||||||
// collider might be on pelvis, often the NetworkIdentity is in a parent
|
// collider might be on pelvis, often the NetworkIdentity is in a parent
|
||||||
// (looks in the object itself and then parents)
|
// (looks in the object itself and then parents)
|
||||||
NetworkIdentity identity = hit.GetComponentInParent<NetworkIdentity>();
|
NetworkIdentity identity = hit.GetComponentInParent<NetworkIdentity>();
|
||||||
@ -96,10 +106,13 @@ public override bool OnRebuildObservers(HashSet<NetworkConnection> observers, bo
|
|||||||
|
|
||||||
case CheckMethod.Physics2D:
|
case CheckMethod.Physics2D:
|
||||||
{
|
{
|
||||||
Collider2D[] hits = Physics2D.OverlapCircleAll(transform.position, visRange, castLayers);
|
// cast without allocating GC for maximum performance
|
||||||
for (int i = 0; i < hits.Length; i++)
|
int hitCount = Physics2D.OverlapCircleNonAlloc(transform.position, visRange, hitsBuffer2D, castLayers);
|
||||||
|
if (hitCount == hitsBuffer2D.Length) Debug.LogWarning("NetworkProximityChecker's OverlapCircle test for " + name + " has filled the whole buffer(" + hitsBuffer2D.Length + "). Some results might have been omitted. Consider increasing buffer size.");
|
||||||
|
|
||||||
|
for (int i = 0; i < hitCount; i++)
|
||||||
{
|
{
|
||||||
Collider2D hit = hits[i];
|
Collider2D hit = hitsBuffer2D[i];
|
||||||
// collider might be on pelvis, often the NetworkIdentity is in a parent
|
// collider might be on pelvis, often the NetworkIdentity is in a parent
|
||||||
// (looks in the object itself and then parents)
|
// (looks in the object itself and then parents)
|
||||||
NetworkIdentity identity = hit.GetComponentInParent<NetworkIdentity>();
|
NetworkIdentity identity = hit.GetComponentInParent<NetworkIdentity>();
|
@ -9,4 +9,4 @@ public class NetworkTransform : NetworkTransformBase
|
|||||||
{
|
{
|
||||||
protected override Transform targetComponent => transform;
|
protected override Transform targetComponent => transform;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
// * Only way for smooth movement is to use a fixed movement speed during
|
// * Only way for smooth movement is to use a fixed movement speed during
|
||||||
// interpolation. interpolation over time is never that good.
|
// interpolation. interpolation over time is never that good.
|
||||||
//
|
//
|
||||||
using System;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace Mirror
|
namespace Mirror
|
||||||
@ -29,7 +28,7 @@ public abstract class NetworkTransformBase : NetworkBehaviour
|
|||||||
// to save bandwidth in the first place.
|
// to save bandwidth in the first place.
|
||||||
// -> can still be modified in the Inspector while the game is running,
|
// -> can still be modified in the Inspector while the game is running,
|
||||||
// but would cause errors immediately and be pretty obvious.
|
// but would cause errors immediately and be pretty obvious.
|
||||||
[Tooltip("Compresses 16 Byte Quaternion into None=12, Some=6, Much=3, Lots=2 Byte")]
|
[Tooltip("Compresses 16 Byte Quaternion into None=12, Much=3, Lots=2 Byte")]
|
||||||
[SerializeField] Compression compressRotation = Compression.Much;
|
[SerializeField] Compression compressRotation = Compression.Much;
|
||||||
public enum Compression { None, Much, Lots }; // easily understandable and funny
|
public enum Compression { None, Much, Lots }; // easily understandable and funny
|
||||||
|
|
||||||
@ -77,14 +76,14 @@ static void SerializeIntoWriter(NetworkWriter writer, Vector3 position, Quaterni
|
|||||||
else if (compressRotation == Compression.Much)
|
else if (compressRotation == Compression.Much)
|
||||||
{
|
{
|
||||||
// write 3 byte. scaling [0,360] to [0,255]
|
// write 3 byte. scaling [0,360] to [0,255]
|
||||||
writer.Write(Utils.ScaleFloatToByte(euler.x, 0, 360, byte.MinValue, byte.MaxValue));
|
writer.Write(FloatBytePacker.ScaleFloatToByte(euler.x, 0, 360, byte.MinValue, byte.MaxValue));
|
||||||
writer.Write(Utils.ScaleFloatToByte(euler.y, 0, 360, byte.MinValue, byte.MaxValue));
|
writer.Write(FloatBytePacker.ScaleFloatToByte(euler.y, 0, 360, byte.MinValue, byte.MaxValue));
|
||||||
writer.Write(Utils.ScaleFloatToByte(euler.z, 0, 360, byte.MinValue, byte.MaxValue));
|
writer.Write(FloatBytePacker.ScaleFloatToByte(euler.z, 0, 360, byte.MinValue, byte.MaxValue));
|
||||||
}
|
}
|
||||||
else if (compressRotation == Compression.Lots)
|
else if (compressRotation == Compression.Lots)
|
||||||
{
|
{
|
||||||
// write 2 byte, 5 bits for each float
|
// write 2 byte, 5 bits for each float
|
||||||
writer.Write(Utils.PackThreeFloatsIntoUShort(euler.x, euler.y, euler.z, 0, 360));
|
writer.Write(FloatBytePacker.PackThreeFloatsIntoUShort(euler.x, euler.y, euler.z, 0, 360));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,19 +127,18 @@ void DeserializeFromReader(NetworkReader reader)
|
|||||||
else if (compressRotation == Compression.Much)
|
else if (compressRotation == Compression.Much)
|
||||||
{
|
{
|
||||||
// read 3 byte. scaling [0,255] to [0,360]
|
// read 3 byte. scaling [0,255] to [0,360]
|
||||||
float x = Utils.ScaleByteToFloat(reader.ReadByte(), byte.MinValue, byte.MaxValue, 0, 360);
|
float x = FloatBytePacker.ScaleByteToFloat(reader.ReadByte(), byte.MinValue, byte.MaxValue, 0, 360);
|
||||||
float y = Utils.ScaleByteToFloat(reader.ReadByte(), byte.MinValue, byte.MaxValue, 0, 360);
|
float y = FloatBytePacker.ScaleByteToFloat(reader.ReadByte(), byte.MinValue, byte.MaxValue, 0, 360);
|
||||||
float z = Utils.ScaleByteToFloat(reader.ReadByte(), byte.MinValue, byte.MaxValue, 0, 360);
|
float z = FloatBytePacker.ScaleByteToFloat(reader.ReadByte(), byte.MinValue, byte.MaxValue, 0, 360);
|
||||||
temp.rotation = Quaternion.Euler(x, y, z);
|
temp.rotation = Quaternion.Euler(x, y, z);
|
||||||
}
|
}
|
||||||
else if (compressRotation == Compression.Lots)
|
else if (compressRotation == Compression.Lots)
|
||||||
{
|
{
|
||||||
// read 2 byte, 5 bits per float
|
// read 2 byte, 5 bits per float
|
||||||
float[] xyz = Utils.UnpackUShortIntoThreeFloats(reader.ReadUInt16(), 0, 360);
|
float[] xyz = FloatBytePacker.UnpackUShortIntoThreeFloats(reader.ReadUInt16(), 0, 360);
|
||||||
temp.rotation = Quaternion.Euler(xyz[0], xyz[1], xyz[2]);
|
temp.rotation = Quaternion.Euler(xyz[0], xyz[1], xyz[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// timestamp
|
|
||||||
temp.timeStamp = Time.time;
|
temp.timeStamp = Time.time;
|
||||||
|
|
||||||
// movement speed: based on how far it moved since last time
|
// movement speed: based on how far it moved since last time
|
||||||
@ -153,10 +151,10 @@ void DeserializeFromReader(NetworkReader reader)
|
|||||||
if (start == null)
|
if (start == null)
|
||||||
{
|
{
|
||||||
start = new DataPoint{
|
start = new DataPoint{
|
||||||
timeStamp=Time.time - syncInterval,
|
timeStamp = Time.time - syncInterval,
|
||||||
position=targetComponent.transform.position,
|
position = targetComponent.transform.position,
|
||||||
rotation=targetComponent.transform.rotation,
|
rotation = targetComponent.transform.rotation,
|
||||||
movementSpeed=temp.movementSpeed
|
movementSpeed = temp.movementSpeed
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
// -> second or nth data point? then update previous, but:
|
// -> second or nth data point? then update previous, but:
|
||||||
@ -298,10 +296,16 @@ bool HasMovedOrRotated()
|
|||||||
bool rotated = lastRotation != targetComponent.transform.rotation;
|
bool rotated = lastRotation != targetComponent.transform.rotation;
|
||||||
|
|
||||||
// save last for next frame to compare
|
// save last for next frame to compare
|
||||||
lastPosition = targetComponent.transform.position;
|
// (only if change was detected. otherwise slow moving objects might
|
||||||
lastRotation = targetComponent.transform.rotation;
|
// never sync because of C#'s float comparison tolerance. see also:
|
||||||
|
// https://github.com/vis2k/Mirror/pull/428)
|
||||||
return moved || rotated;
|
bool change = moved || rotated;
|
||||||
|
if (change)
|
||||||
|
{
|
||||||
|
lastPosition = targetComponent.transform.position;
|
||||||
|
lastRotation = targetComponent.transform.rotation;
|
||||||
|
}
|
||||||
|
return change;
|
||||||
}
|
}
|
||||||
|
|
||||||
// set position carefully depending on the target component
|
// set position carefully depending on the target component
|
||||||
|
@ -13,7 +13,7 @@ public class NetworkAnimatorEditor : Editor
|
|||||||
[NonSerialized] bool m_Initialized;
|
[NonSerialized] bool m_Initialized;
|
||||||
|
|
||||||
SerializedProperty m_AnimatorProperty;
|
SerializedProperty m_AnimatorProperty;
|
||||||
GUIContent m_AnimatorLabel;
|
GUIContent m_AnimatorLabel = new GUIContent("Animator", "The Animator component to synchronize.");
|
||||||
|
|
||||||
void Init()
|
void Init()
|
||||||
{
|
{
|
||||||
@ -24,7 +24,6 @@ void Init()
|
|||||||
m_AnimSync = target as NetworkAnimator;
|
m_AnimSync = target as NetworkAnimator;
|
||||||
|
|
||||||
m_AnimatorProperty = serializedObject.FindProperty("m_Animator");
|
m_AnimatorProperty = serializedObject.FindProperty("m_Animator");
|
||||||
m_AnimatorLabel = new GUIContent("Animator", "The Animator component to synchronize.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnInspectorGUI()
|
public override void OnInspectorGUI()
|
||||||
@ -63,7 +62,7 @@ void DrawControls()
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool oldSend = m_AnimSync.GetParameterAutoSend(i);
|
bool oldSend = m_AnimSync.GetParameterAutoSend(i);
|
||||||
bool send = EditorGUILayout.Toggle(p.name, oldSend);
|
bool send = EditorGUILayout.Toggle("Sync " + p.name, oldSend);
|
||||||
if (send != oldSend)
|
if (send != oldSend)
|
||||||
{
|
{
|
||||||
m_AnimSync.SetParameterAutoSend(i, send);
|
m_AnimSync.SetParameterAutoSend(i, send);
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
@ -12,9 +11,9 @@ public class NetworkIdentityEditor : Editor
|
|||||||
SerializedProperty m_ServerOnlyProperty;
|
SerializedProperty m_ServerOnlyProperty;
|
||||||
SerializedProperty m_LocalPlayerAuthorityProperty;
|
SerializedProperty m_LocalPlayerAuthorityProperty;
|
||||||
|
|
||||||
GUIContent m_ServerOnlyLabel;
|
GUIContent m_ServerOnlyLabel = new GUIContent("Server Only", "True if the object should only exist on the server.");
|
||||||
GUIContent m_LocalPlayerAuthorityLabel;
|
GUIContent m_LocalPlayerAuthorityLabel = new GUIContent("Local Player Authority", "True if this object will be controlled by a player on a client.");
|
||||||
GUIContent m_SpawnLabel;
|
GUIContent m_SpawnLabel = new GUIContent("Spawn Object", "This causes an unspawned server object to be spawned on clients");
|
||||||
|
|
||||||
NetworkIdentity m_NetworkIdentity;
|
NetworkIdentity m_NetworkIdentity;
|
||||||
bool m_Initialized;
|
bool m_Initialized;
|
||||||
@ -31,10 +30,6 @@ void Init()
|
|||||||
|
|
||||||
m_ServerOnlyProperty = serializedObject.FindProperty("m_ServerOnly");
|
m_ServerOnlyProperty = serializedObject.FindProperty("m_ServerOnly");
|
||||||
m_LocalPlayerAuthorityProperty = serializedObject.FindProperty("m_LocalPlayerAuthority");
|
m_LocalPlayerAuthorityProperty = serializedObject.FindProperty("m_LocalPlayerAuthority");
|
||||||
|
|
||||||
m_ServerOnlyLabel = new GUIContent("Server Only", "True if the object should only exist on the server.");
|
|
||||||
m_LocalPlayerAuthorityLabel = new GUIContent("Local Player Authority", "True if this object will be controlled by a player on a client.");
|
|
||||||
m_SpawnLabel = new GUIContent("Spawn Object", "This causes an unspawned server object to be spawned on clients");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnInspectorGUI()
|
public override void OnInspectorGUI()
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
@ -216,7 +215,7 @@ void GetNetworkInformation(GameObject gameObject)
|
|||||||
m_Info = new List<NetworkIdentityInfo>
|
m_Info = new List<NetworkIdentityInfo>
|
||||||
{
|
{
|
||||||
GetAssetId(),
|
GetAssetId(),
|
||||||
GetString("Scene ID", m_Identity.sceneId.ToString())
|
GetString("Scene ID", m_Identity.sceneId.ToString("X"))
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!Application.isPlaying)
|
if (!Application.isPlaying)
|
||||||
@ -278,4 +277,4 @@ static NetworkIdentityInfo GetBoolean(string name, bool value)
|
|||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,6 @@
|
|||||||
using System;
|
|
||||||
using System.IO;
|
|
||||||
using System.Reflection;
|
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEditorInternal;
|
using UnityEditorInternal;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityObject = UnityEngine.Object;
|
|
||||||
|
|
||||||
namespace Mirror
|
namespace Mirror
|
||||||
{
|
{
|
||||||
@ -113,4 +109,4 @@ internal void RemoveButton(ReorderableList list)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
using System.Text;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEditor.Callbacks;
|
using UnityEditor.Callbacks;
|
||||||
@ -10,168 +8,20 @@ namespace Mirror
|
|||||||
{
|
{
|
||||||
public class NetworkScenePostProcess : MonoBehaviour
|
public class NetworkScenePostProcess : MonoBehaviour
|
||||||
{
|
{
|
||||||
// persistent sceneId assignment to fix readstring bug that occurs when restarting the editor and
|
// helper function to check if a NetworkIdentity is in the active scene
|
||||||
// connecting to a build again. sceneids were then different because FindObjectsOfType's order
|
static bool InActiveScene(NetworkIdentity identity) =>
|
||||||
// is not guranteed to be the same.
|
identity.gameObject.scene == SceneManager.GetActiveScene();
|
||||||
// -> we need something unique and persistent, aka always the same when pressing play/building the first time
|
|
||||||
// -> Unity has no built in unique id for GameObjects in the scene
|
|
||||||
|
|
||||||
// helper function to figure out a unique, persistent scene id for a GameObject in the hierarchy
|
|
||||||
// -> Unity's instanceId is unique but not persistent
|
|
||||||
// -> hashing the whole GameObject is not enough either since a duplicate would have the same hash
|
|
||||||
// -> we definitely need the transform sibling index in the hierarchy
|
|
||||||
// -> so we might as well use just that
|
|
||||||
// -> transforms have children too so we need a list of sibling indices like 0->3->5
|
|
||||||
public static List<int> SiblingPathFor(Transform t)
|
|
||||||
{
|
|
||||||
List<int> result = new List<int>();
|
|
||||||
while (t != null)
|
|
||||||
{
|
|
||||||
result.Add(t.GetSiblingIndex());
|
|
||||||
t = t.parent;
|
|
||||||
}
|
|
||||||
|
|
||||||
result.Reverse(); // parent to child instead of child to parent order
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
// we need to compare by using the whole sibling list
|
|
||||||
// comparing the string won't work work because:
|
|
||||||
// "1->2"
|
|
||||||
// "20->2"
|
|
||||||
// would compare '1' vs '2', then '-' vs '0'
|
|
||||||
//
|
|
||||||
// tests:
|
|
||||||
// CompareSiblingPaths(new List<int>(){0}, new List<int>(){0}) => 0
|
|
||||||
// CompareSiblingPaths(new List<int>(){0}, new List<int>(){1}) => -1
|
|
||||||
// CompareSiblingPaths(new List<int>(){1}, new List<int>(){0}) => 1
|
|
||||||
// CompareSiblingPaths(new List<int>(){0,1}, new List<int>(){0,2}) => -1
|
|
||||||
// CompareSiblingPaths(new List<int>(){0,2}, new List<int>(){0,1}) => 1
|
|
||||||
// CompareSiblingPaths(new List<int>(){1}, new List<int>(){0,1}) => 1
|
|
||||||
// CompareSiblingPaths(new List<int>(){1}, new List<int>(){2,1}) => -1
|
|
||||||
public static int CompareSiblingPaths(List<int> left, List<int> right)
|
|
||||||
{
|
|
||||||
// compare [0], remove it, compare next, etc.
|
|
||||||
while (left.Count > 0 && right.Count > 0)
|
|
||||||
{
|
|
||||||
if (left[0] < right[0])
|
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
else if (left[0] > right[0])
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// equal, so they are both children of the same transform
|
|
||||||
// -> which also means that they both must have one more
|
|
||||||
// entry, so we can remove both without checking size
|
|
||||||
left.RemoveAt(0);
|
|
||||||
right.RemoveAt(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// equal if both were empty or both had the same entry without any
|
|
||||||
// more children (should never happen in practice)
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int CompareNetworkIdentitySiblingPaths(NetworkIdentity left, NetworkIdentity right)
|
|
||||||
{
|
|
||||||
return CompareSiblingPaths(SiblingPathFor(left.transform), SiblingPathFor(right.transform));
|
|
||||||
}
|
|
||||||
|
|
||||||
// we might have inactive scenes in the Editor's build settings, which
|
|
||||||
// aren't actually included in builds.
|
|
||||||
// so we have to only count the active ones when in Editor, otherwise
|
|
||||||
// editor and build sceneIds might get out of sync.
|
|
||||||
public static int GetSceneCount()
|
|
||||||
{
|
|
||||||
#if UNITY_EDITOR
|
|
||||||
return EditorBuildSettings.scenes.Count(scene => scene.enabled);
|
|
||||||
#else
|
|
||||||
return SceneManager.sceneCountInBuildSettings;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
[PostProcessScene]
|
[PostProcessScene]
|
||||||
public static void OnPostProcessScene()
|
public static void OnPostProcessScene()
|
||||||
{
|
{
|
||||||
// vis2k: MISMATCHING SCENEID BUG FIX
|
// find all NetworkIdentities in this scene
|
||||||
// problem:
|
// => but really only from this scene. this avoids weird situations
|
||||||
// * FindObjectsOfType order is not guaranteed. restarting the
|
// like in NetworkZones when we destroy the local player and
|
||||||
// editor results in a different order
|
// load another scene afterwards, yet the local player is still
|
||||||
// * connecting to a build again would cause UNET to deserialize
|
// in the FindObjectsOfType result with scene=DontDestroyOnLoad
|
||||||
// the wrong objects, causing all kinds of weird errors like
|
// for some reason
|
||||||
// 'ReadString out of range'
|
foreach (NetworkIdentity identity in FindObjectsOfType<NetworkIdentity>().Where(InActiveScene))
|
||||||
//
|
|
||||||
// solution:
|
|
||||||
// sort by sibling-index path, e.g. [0,1,2] vs [1]
|
|
||||||
// this is the only deterministic way to sort a list of objects in
|
|
||||||
// the scene.
|
|
||||||
// -> it's the same result every single time, even after restarts
|
|
||||||
//
|
|
||||||
// note: there is a reason why we 'sort by' sibling path instead of
|
|
||||||
// using it as sceneId directly. networkmanager etc. use Dont-
|
|
||||||
// DestroyOnLoad, which changes the hierarchy:
|
|
||||||
//
|
|
||||||
// World:
|
|
||||||
// NetworkManager
|
|
||||||
// Player
|
|
||||||
//
|
|
||||||
// ..becomes..
|
|
||||||
//
|
|
||||||
// World:
|
|
||||||
// Player
|
|
||||||
// DontDestroyOnLoad:
|
|
||||||
// NetworkManager
|
|
||||||
//
|
|
||||||
// so the player's siblingindex would be decreased by one.
|
|
||||||
// -> this is a problem because when building, OnPostProcessScene
|
|
||||||
// is called before any dontdestroyonload happens, but when
|
|
||||||
// entering play mode, it's called after
|
|
||||||
// -> hence sceneids would differ by one
|
|
||||||
//
|
|
||||||
// => but if we only SORT it, then it doesn't matter if one
|
|
||||||
// inbetween disappeared. as long as no NetworkIdentity used
|
|
||||||
// DontDestroyOnLoad.
|
|
||||||
//
|
|
||||||
// note: assigning a GUID in NetworkIdentity.OnValidate would be way
|
|
||||||
// cooler, but OnValidate isn't called for other unopened scenes
|
|
||||||
// when building or pressing play, so the bug would still happen
|
|
||||||
// there.
|
|
||||||
//
|
|
||||||
// note: this can still fail if DontDestroyOnLoad is called for a
|
|
||||||
// NetworkIdentity - but no one should ever do that anyway.
|
|
||||||
List<NetworkIdentity> identities = FindObjectsOfType<NetworkIdentity>().ToList();
|
|
||||||
identities.Sort(CompareNetworkIdentitySiblingPaths);
|
|
||||||
|
|
||||||
// sceneId assignments need to work with additive scene loading, so
|
|
||||||
// it can't always start at 1,2,3,4,..., otherwise there will be
|
|
||||||
// sceneId duplicates.
|
|
||||||
// -> we need an offset to start at 1000+1,+2,+3, etc.
|
|
||||||
// -> the most robust way is to split uint value range by sceneCount
|
|
||||||
// -> only if more than one scene. otherwise use offset 0 to avoid
|
|
||||||
// DivisionByZero if no scene in build settings, and to avoid
|
|
||||||
// different offsets in editor/build if scene wasn't added to
|
|
||||||
// build settings.
|
|
||||||
uint offsetPerScene = 0;
|
|
||||||
if (SceneManager.sceneCountInBuildSettings > 1)
|
|
||||||
{
|
|
||||||
offsetPerScene = uint.MaxValue / (uint)GetSceneCount();
|
|
||||||
|
|
||||||
// make sure that there aren't more sceneIds than offsetPerScene
|
|
||||||
// -> only if we have multiple scenes. otherwise offset is 0, in
|
|
||||||
// which case it doesn't matter.
|
|
||||||
if (identities.Count >= offsetPerScene)
|
|
||||||
{
|
|
||||||
Debug.LogWarning(">=" + offsetPerScene + " NetworkIdentities in scene. Additive scene loading will cause duplicate ids.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
uint nextSceneId = 1;
|
|
||||||
foreach (NetworkIdentity identity in identities)
|
|
||||||
{
|
{
|
||||||
// if we had a [ConflictComponent] attribute that would be better than this check.
|
// if we had a [ConflictComponent] attribute that would be better than this check.
|
||||||
// also there is no context about which scene this is in.
|
// also there is no context about which scene this is in.
|
||||||
@ -182,13 +32,22 @@ public static void OnPostProcessScene()
|
|||||||
if (identity.isClient || identity.isServer)
|
if (identity.isClient || identity.isServer)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
uint offset = (uint)identity.gameObject.scene.buildIndex * offsetPerScene;
|
// valid scene id? then set scene path part
|
||||||
identity.ForceSceneId(offset + nextSceneId++);
|
// otherwise it might be an unopened scene that still has null
|
||||||
if (LogFilter.Debug) { Debug.Log("PostProcess sceneid assigned: name=" + identity.name + " scene=" + identity.gameObject.scene.name + " sceneid=" + identity.sceneId); }
|
// sceneIds. builds are interrupted if they contain 0 sceneIds,
|
||||||
|
// but it's still possible that we call LoadScene in Editor
|
||||||
|
// for a previously unopened scene.
|
||||||
|
// => throwing an exception would only show it for one object
|
||||||
|
// because this function would return afterwards.
|
||||||
|
if (identity.sceneId != 0)
|
||||||
|
{
|
||||||
|
identity.SetSceneIdSceneHashPartInternal();
|
||||||
|
}
|
||||||
|
else Debug.LogError("Scene " + identity.gameObject.scene.path + " needs to be opened and resaved, because the scene object " + identity.name + " has no valid sceneId yet.");
|
||||||
|
|
||||||
// disable it AFTER assigning the sceneId.
|
// disable it
|
||||||
// -> this way NetworkIdentity.OnDisable adds itself to the
|
// note: NetworkIdentity.OnDisable adds itself to the
|
||||||
// spawnableObjects dictionary (only if sceneId != 0)
|
// spawnableObjects dictionary (only if sceneId != 0)
|
||||||
identity.gameObject.SetActive(false);
|
identity.gameObject.SetActive(false);
|
||||||
|
|
||||||
// safety check for prefabs with more than one NetworkIdentity
|
// safety check for prefabs with more than one NetworkIdentity
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
namespace Mirror
|
namespace Mirror
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace Mirror
|
namespace Mirror
|
||||||
@ -53,4 +53,4 @@ protected SceneAsset GetSceneObject(string sceneObjectName)
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: cad1d2d7f70fb4e509408b6733c359d2
|
guid: d9f8e6274119b4ce29e498cfb8aca8a4
|
||||||
folderAsset: yes
|
folderAsset: yes
|
||||||
DefaultImporter:
|
DefaultImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
201
Assets/Mirror/Editor/Weaver/CompilationFinishedHook.cs
Normal file
@ -0,0 +1,201 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEditor.Compilation;
|
||||||
|
using UnityEngine;
|
||||||
|
using Assembly = System.Reflection.Assembly;
|
||||||
|
|
||||||
|
namespace Mirror.Weaver
|
||||||
|
{
|
||||||
|
public class CompilationFinishedHook
|
||||||
|
{
|
||||||
|
const string MirrorRuntimeAssemblyName = "Mirror";
|
||||||
|
const string MirrorWeaverAssemblyName = "Mirror.Weaver";
|
||||||
|
|
||||||
|
public static Action<string> OnWeaverMessage; // delegate for subscription to Weaver debug messages
|
||||||
|
public static Action<string> OnWeaverWarning; // delegate for subscription to Weaver warning messages
|
||||||
|
public static Action<string> OnWeaverError; // delete for subscription to Weaver error messages
|
||||||
|
|
||||||
|
public static bool WeaverEnabled { get; set; } // controls whether we weave any assemblies when CompilationPipeline delegates are invoked
|
||||||
|
public static bool UnityLogEnabled = true; // controls weather Weaver errors are reported direct to the Unity console (tests enable this)
|
||||||
|
public static bool WeaveFailed { get; private set; } // holds the result status of our latest Weave operation
|
||||||
|
|
||||||
|
// debug message handler that also calls OnMessageMethod delegate
|
||||||
|
static void HandleMessage(string msg)
|
||||||
|
{
|
||||||
|
if (UnityLogEnabled) Debug.Log(msg);
|
||||||
|
if (OnWeaverMessage != null) OnWeaverMessage.Invoke(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
// warning message handler that also calls OnWarningMethod delegate
|
||||||
|
static void HandleWarning(string msg)
|
||||||
|
{
|
||||||
|
if (UnityLogEnabled) Debug.LogWarning(msg);
|
||||||
|
if (OnWeaverWarning != null) OnWeaverWarning.Invoke(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
// error message handler that also calls OnErrorMethod delegate
|
||||||
|
static void HandleError(string msg)
|
||||||
|
{
|
||||||
|
if (UnityLogEnabled) Debug.LogError(msg);
|
||||||
|
if (OnWeaverError != null) OnWeaverError.Invoke(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
[InitializeOnLoadMethod]
|
||||||
|
static void OnInitializeOnLoad()
|
||||||
|
{
|
||||||
|
CompilationPipeline.assemblyCompilationFinished += OnCompilationFinished;
|
||||||
|
}
|
||||||
|
|
||||||
|
static string FindMirrorRuntime()
|
||||||
|
{
|
||||||
|
UnityEditor.Compilation.Assembly[] assemblies = CompilationPipeline.GetAssemblies();
|
||||||
|
|
||||||
|
foreach (UnityEditor.Compilation.Assembly assembly in assemblies)
|
||||||
|
{
|
||||||
|
if (assembly.name == MirrorRuntimeAssemblyName)
|
||||||
|
{
|
||||||
|
return assembly.outputPath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
// get all dependency directories
|
||||||
|
static HashSet<string> GetDependencyDirectories(AssemblyName[] dependencies)
|
||||||
|
{
|
||||||
|
// Since this assembly is already loaded in the domain this is a
|
||||||
|
// no-op and returns the already loaded assembly
|
||||||
|
return new HashSet<string>(
|
||||||
|
dependencies.Select(dependency => Path.GetDirectoryName(Assembly.Load(dependency).Location))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// get all non-dynamic assembly directories
|
||||||
|
static HashSet<string> GetNonDynamicAssemblyDirectories(Assembly[] assemblies)
|
||||||
|
{
|
||||||
|
HashSet<string> paths = new HashSet<string>();
|
||||||
|
|
||||||
|
foreach (Assembly assembly in assemblies)
|
||||||
|
{
|
||||||
|
if (!assembly.IsDynamic)
|
||||||
|
{
|
||||||
|
// need to check if file exists to avoid potential
|
||||||
|
// FileNotFoundException in Assembly.Load
|
||||||
|
string assemblyName = assembly.GetName().Name;
|
||||||
|
if (File.Exists(assemblyName))
|
||||||
|
{
|
||||||
|
paths.Add(Path.GetDirectoryName(Assembly.Load(assemblyName).Location));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return paths;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool CompilerMessagesContainError(CompilerMessage[] messages)
|
||||||
|
{
|
||||||
|
return messages.Any(msg => msg.type == CompilerMessageType.Error);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void OnCompilationFinished(string assemblyPath, CompilerMessage[] messages)
|
||||||
|
{
|
||||||
|
// Do nothing if there were compile errors on the target
|
||||||
|
if (CompilerMessagesContainError(messages))
|
||||||
|
{
|
||||||
|
Debug.Log("Weaver: stop because compile errors on target");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Should not run on the editor only assemblies
|
||||||
|
if (assemblyPath.Contains("-Editor") || assemblyPath.Contains(".Editor"))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// don't weave mirror files
|
||||||
|
string assemblyName = Path.GetFileNameWithoutExtension(assemblyPath);
|
||||||
|
if (assemblyName == MirrorRuntimeAssemblyName || assemblyName == MirrorWeaverAssemblyName)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// find Mirror.dll
|
||||||
|
string mirrorRuntimeDll = FindMirrorRuntime();
|
||||||
|
if (string.IsNullOrEmpty(mirrorRuntimeDll))
|
||||||
|
{
|
||||||
|
Debug.LogError("Failed to find Mirror runtime assembly");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!File.Exists(mirrorRuntimeDll))
|
||||||
|
{
|
||||||
|
// this is normal, it happens with any assembly that is built before mirror
|
||||||
|
// such as unity packages or your own assemblies
|
||||||
|
// those don't need to be weaved
|
||||||
|
// if any assembly depends on mirror, then it will be built after
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// find UnityEngine.CoreModule.dll
|
||||||
|
string unityEngineCoreModuleDLL = UnityEditorInternal.InternalEditorUtility.GetEngineCoreModuleAssemblyPath();
|
||||||
|
if (string.IsNullOrEmpty(unityEngineCoreModuleDLL))
|
||||||
|
{
|
||||||
|
Debug.LogError("Failed to find UnityEngine assembly");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// find all assemblies and the currently compiling assembly
|
||||||
|
Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
|
||||||
|
Assembly targetAssembly = assemblies.FirstOrDefault(asm => asm.GetName().Name == Path.GetFileNameWithoutExtension(assemblyPath));
|
||||||
|
|
||||||
|
// prepare variables
|
||||||
|
HashSet<string> dependencyPaths = new HashSet<string>();
|
||||||
|
|
||||||
|
// found this assembly in assemblies?
|
||||||
|
if (targetAssembly != null)
|
||||||
|
{
|
||||||
|
// get all dependencies for the target assembly
|
||||||
|
AssemblyName[] dependencies = targetAssembly.GetReferencedAssemblies();
|
||||||
|
|
||||||
|
// does the target assembly depend on Mirror at all?
|
||||||
|
// otherwise there is nothing to weave anyway.
|
||||||
|
bool usesMirror = dependencies.Any(dependency => dependency.Name == MirrorRuntimeAssemblyName);
|
||||||
|
if (!usesMirror)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// get all the directories
|
||||||
|
dependencyPaths = GetDependencyDirectories(dependencies);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Target assembly not found in current domain, trying to load it to check references
|
||||||
|
// will lead to trouble in the build pipeline, so lets assume it should go to weaver.
|
||||||
|
// Add all assemblies in current domain to dependency list since there could be a
|
||||||
|
// dependency lurking there (there might be generated assemblies so ignore file not found exceptions).
|
||||||
|
// (can happen in runtime test framework on editor platform and when doing full library reimport)
|
||||||
|
dependencyPaths = GetNonDynamicAssemblyDirectories(assemblies);
|
||||||
|
}
|
||||||
|
|
||||||
|
// construct full path to Project/Library/ScriptAssemblies
|
||||||
|
string projectDirectory = Directory.GetParent(Application.dataPath).ToString();
|
||||||
|
string outputDirectory = Path.Combine(projectDirectory, Path.GetDirectoryName(assemblyPath));
|
||||||
|
|
||||||
|
//if (UnityLogEnabled) Debug.Log("Weaving: " + assemblyPath); // uncomment to easily observe weave targets
|
||||||
|
if (Program.Process(unityEngineCoreModuleDLL, mirrorRuntimeDll, outputDirectory, new[] { assemblyPath }, dependencyPaths.ToArray(), HandleWarning, HandleError))
|
||||||
|
{
|
||||||
|
WeaveFailed = false;
|
||||||
|
Debug.Log("Weaving succeeded for: " + assemblyPath);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
WeaveFailed = true;
|
||||||
|
if (UnityLogEnabled) Debug.LogError("Weaving failed for: " + assemblyPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: c764a8a81af7e41539c3cdc06aa036be
|
guid: de2aeb2e8068f421a9a1febe408f7051
|
||||||
MonoImporter:
|
MonoImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
@ -102,4 +102,4 @@ public static bool CanBeResolved(this TypeReference parent)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
11
Assets/Mirror/Editor/Weaver/Extensions.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 562a5cf0254cc45738e9aa549a7100b2
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -85,16 +85,16 @@ public static string PrettyPrintType(TypeReference type)
|
|||||||
return type.Name;
|
return type.Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ReaderParameters ReaderParameters(string assemblyPath, IEnumerable<string> extraPaths, IAssemblyResolver assemblyResolver, string unityEngineDLLPath, string unityUNetDLLPath)
|
public static ReaderParameters ReaderParameters(string assemblyPath, IEnumerable<string> extraPaths, IAssemblyResolver assemblyResolver, string unityEngineDLLPath, string mirrorNetDLLPath)
|
||||||
{
|
{
|
||||||
ReaderParameters parameters = new ReaderParameters();
|
ReaderParameters parameters = new ReaderParameters() {ReadWrite = true};
|
||||||
if (assemblyResolver == null)
|
if (assemblyResolver == null)
|
||||||
assemblyResolver = new DefaultAssemblyResolver();
|
assemblyResolver = new DefaultAssemblyResolver();
|
||||||
AddSearchDirectoryHelper helper = new AddSearchDirectoryHelper(assemblyResolver);
|
AddSearchDirectoryHelper helper = new AddSearchDirectoryHelper(assemblyResolver);
|
||||||
helper.AddSearchDirectory(Path.GetDirectoryName(assemblyPath));
|
helper.AddSearchDirectory(Path.GetDirectoryName(assemblyPath));
|
||||||
helper.AddSearchDirectory(UnityEngineDLLDirectoryName());
|
helper.AddSearchDirectory(UnityEngineDLLDirectoryName());
|
||||||
helper.AddSearchDirectory(Path.GetDirectoryName(unityEngineDLLPath));
|
helper.AddSearchDirectory(Path.GetDirectoryName(unityEngineDLLPath));
|
||||||
helper.AddSearchDirectory(Path.GetDirectoryName(unityUNetDLLPath));
|
helper.AddSearchDirectory(Path.GetDirectoryName(mirrorNetDLLPath));
|
||||||
if (extraPaths != null)
|
if (extraPaths != null)
|
||||||
{
|
{
|
||||||
foreach (var path in extraPaths)
|
foreach (var path in extraPaths)
|
11
Assets/Mirror/Editor/Weaver/Helpers.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 6c4ed76daf48547c5abb7c58f8d20886
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
14
Assets/Mirror/Editor/Weaver/Mirror.Weaver.asmdef
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"name": "Mirror.Weaver",
|
||||||
|
"references": [],
|
||||||
|
"optionalUnityReferences": [],
|
||||||
|
"includePlatforms": [
|
||||||
|
"Editor"
|
||||||
|
],
|
||||||
|
"excludePlatforms": [],
|
||||||
|
"allowUnsafeCode": true,
|
||||||
|
"overrideReferences": false,
|
||||||
|
"precompiledReferences": [],
|
||||||
|
"autoReferenced": true,
|
||||||
|
"defineConstraints": []
|
||||||
|
}
|
7
Assets/Mirror/Editor/Weaver/Mirror.Weaver.asmdef.meta
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 5710c1f859f1945b6bc9b33cff6b43fc
|
||||||
|
AssemblyDefinitionImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
8
Assets/Mirror/Editor/Weaver/Processors.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: e538d627280d2471b8c72fdea822ca49
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -12,13 +12,6 @@ public static class CommandProcessor
|
|||||||
// generates code like:
|
// generates code like:
|
||||||
public void CallCmdThrust(float thrusting, int spin)
|
public void CallCmdThrust(float thrusting, int spin)
|
||||||
{
|
{
|
||||||
Debug.LogError("Call Command function CmdThrust");
|
|
||||||
if (!NetworkClient.active)
|
|
||||||
{
|
|
||||||
Debug.LogError("Command function CmdThrust called on server.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isServer)
|
if (isServer)
|
||||||
{
|
{
|
||||||
// we are ON the server, invoke directly
|
// we are ON the server, invoke directly
|
||||||
@ -49,14 +42,12 @@ public static MethodDefinition ProcessCommandCall(TypeDefinition td, MethodDefin
|
|||||||
|
|
||||||
NetworkBehaviourProcessor.WriteSetupLocals(cmdWorker);
|
NetworkBehaviourProcessor.WriteSetupLocals(cmdWorker);
|
||||||
|
|
||||||
if (Weaver.generateLogErrors)
|
if (Weaver.GenerateLogErrors)
|
||||||
{
|
{
|
||||||
cmdWorker.Append(cmdWorker.Create(OpCodes.Ldstr, "Call Command function " + md.Name));
|
cmdWorker.Append(cmdWorker.Create(OpCodes.Ldstr, "Call Command function " + md.Name));
|
||||||
cmdWorker.Append(cmdWorker.Create(OpCodes.Call, Weaver.logErrorReference));
|
cmdWorker.Append(cmdWorker.Create(OpCodes.Call, Weaver.logErrorReference));
|
||||||
}
|
}
|
||||||
|
|
||||||
NetworkBehaviourProcessor.WriteClientActiveCheck(cmdWorker, md.Name, label, "Command function");
|
|
||||||
|
|
||||||
// local client check
|
// local client check
|
||||||
Instruction localClientLabel = cmdWorker.Create(OpCodes.Nop);
|
Instruction localClientLabel = cmdWorker.Create(OpCodes.Nop);
|
||||||
cmdWorker.Append(cmdWorker.Create(OpCodes.Ldarg_0));
|
cmdWorker.Append(cmdWorker.Create(OpCodes.Ldarg_0));
|
||||||
@ -143,15 +134,13 @@ public static bool ProcessMethodsValidateCommand(TypeDefinition td, MethodDefini
|
|||||||
{
|
{
|
||||||
if (md.Name.Length > 2 && md.Name.Substring(0, 3) != "Cmd")
|
if (md.Name.Length > 2 && md.Name.Substring(0, 3) != "Cmd")
|
||||||
{
|
{
|
||||||
Log.Error("Command function [" + td.FullName + ":" + md.Name + "] doesnt have 'Cmd' prefix");
|
Weaver.Error("Command function [" + td.FullName + ":" + md.Name + "] doesnt have 'Cmd' prefix");
|
||||||
Weaver.fail = true;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (md.IsStatic)
|
if (md.IsStatic)
|
||||||
{
|
{
|
||||||
Log.Error("Command function [" + td.FullName + ":" + md.Name + "] cant be a static method");
|
Weaver.Error("Command function [" + td.FullName + ":" + md.Name + "] cant be a static method");
|
||||||
Weaver.fail = true;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -160,4 +149,4 @@ public static bool ProcessMethodsValidateCommand(TypeDefinition td, MethodDefini
|
|||||||
NetworkBehaviourProcessor.ProcessMethodsValidateParameters(td, md, ca, "Command");
|
NetworkBehaviourProcessor.ProcessMethodsValidateParameters(td, md, ca, "Command");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 73f6c9cdbb9e54f65b3a0a35cc8e55c2
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -13,7 +13,7 @@ public static void Process(TypeDefinition td)
|
|||||||
Weaver.ResetRecursionCount();
|
Weaver.ResetRecursionCount();
|
||||||
|
|
||||||
GenerateSerialization(td);
|
GenerateSerialization(td);
|
||||||
if (Weaver.fail)
|
if (Weaver.WeavingFailed)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -41,8 +41,7 @@ static void GenerateSerialization(TypeDefinition td)
|
|||||||
{
|
{
|
||||||
if (field.FieldType.FullName == td.FullName)
|
if (field.FieldType.FullName == td.FullName)
|
||||||
{
|
{
|
||||||
Weaver.fail = true;
|
Weaver.Error("GenerateSerialization for " + td.Name + " [" + field.FullName + "]. [MessageBase] member cannot be self referencing.");
|
||||||
Log.Error("GenerateSerialization for " + td.Name + " [" + field.FullName + "]. [MessageBase] member cannot be self referencing.");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -51,7 +50,7 @@ static void GenerateSerialization(TypeDefinition td)
|
|||||||
MethodAttributes.Public | MethodAttributes.Virtual | MethodAttributes.HideBySig,
|
MethodAttributes.Public | MethodAttributes.Virtual | MethodAttributes.HideBySig,
|
||||||
Weaver.voidType);
|
Weaver.voidType);
|
||||||
|
|
||||||
serializeFunc.Parameters.Add(new ParameterDefinition("writer", ParameterAttributes.None, Weaver.scriptDef.MainModule.ImportReference(Weaver.NetworkWriterType)));
|
serializeFunc.Parameters.Add(new ParameterDefinition("writer", ParameterAttributes.None, Weaver.CurrentAssembly.MainModule.ImportReference(Weaver.NetworkWriterType)));
|
||||||
ILProcessor serWorker = serializeFunc.Body.GetILProcessor();
|
ILProcessor serWorker = serializeFunc.Body.GetILProcessor();
|
||||||
|
|
||||||
foreach (FieldDefinition field in td.Fields)
|
foreach (FieldDefinition field in td.Fields)
|
||||||
@ -61,15 +60,13 @@ static void GenerateSerialization(TypeDefinition td)
|
|||||||
|
|
||||||
if (field.FieldType.Resolve().HasGenericParameters)
|
if (field.FieldType.Resolve().HasGenericParameters)
|
||||||
{
|
{
|
||||||
Weaver.fail = true;
|
Weaver.Error("GenerateSerialization for " + td.Name + " [" + field.FieldType + "/" + field.FieldType.FullName + "]. [MessageBase] member cannot have generic parameters.");
|
||||||
Log.Error("GenerateSerialization for " + td.Name + " [" + field.FieldType + "/" + field.FieldType.FullName + "]. [MessageBase] member cannot have generic parameters.");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (field.FieldType.Resolve().IsInterface)
|
if (field.FieldType.Resolve().IsInterface)
|
||||||
{
|
{
|
||||||
Weaver.fail = true;
|
Weaver.Error("GenerateSerialization for " + td.Name + " [" + field.FieldType + "/" + field.FieldType.FullName + "]. [MessageBase] member cannot be an interface.");
|
||||||
Log.Error("GenerateSerialization for " + td.Name + " [" + field.FieldType + "/" + field.FieldType.FullName + "]. [MessageBase] member cannot be an interface.");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,8 +80,7 @@ static void GenerateSerialization(TypeDefinition td)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Weaver.fail = true;
|
Weaver.Error("GenerateSerialization for " + td.Name + " unknown type [" + field.FieldType + "/" + field.FieldType.FullName + "]. [MessageBase] member variables must be basic types.");
|
||||||
Log.Error("GenerateSerialization for " + td.Name + " unknown type [" + field.FieldType + "/" + field.FieldType.FullName + "]. [MessageBase] member variables must be basic types.");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -111,7 +107,7 @@ static void GenerateDeSerialization(TypeDefinition td)
|
|||||||
MethodAttributes.Public | MethodAttributes.Virtual | MethodAttributes.HideBySig,
|
MethodAttributes.Public | MethodAttributes.Virtual | MethodAttributes.HideBySig,
|
||||||
Weaver.voidType);
|
Weaver.voidType);
|
||||||
|
|
||||||
serializeFunc.Parameters.Add(new ParameterDefinition("reader", ParameterAttributes.None, Weaver.scriptDef.MainModule.ImportReference(Weaver.NetworkReaderType)));
|
serializeFunc.Parameters.Add(new ParameterDefinition("reader", ParameterAttributes.None, Weaver.CurrentAssembly.MainModule.ImportReference(Weaver.NetworkReaderType)));
|
||||||
ILProcessor serWorker = serializeFunc.Body.GetILProcessor();
|
ILProcessor serWorker = serializeFunc.Body.GetILProcessor();
|
||||||
|
|
||||||
foreach (FieldDefinition field in td.Fields)
|
foreach (FieldDefinition field in td.Fields)
|
||||||
@ -129,8 +125,7 @@ static void GenerateDeSerialization(TypeDefinition td)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Weaver.fail = true;
|
Weaver.Error("GenerateDeSerialization for " + td.Name + " unknown type [" + field.FieldType + "]. [SyncVar] member variables must be basic types.");
|
||||||
Log.Error("GenerateDeSerialization for " + td.Name + " unknown type [" + field.FieldType + "]. [SyncVar] member variables must be basic types.");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 3544c9f00f6e5443ea3c30873c5a06ef
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -20,15 +20,13 @@ static void ProcessSyncVars(TypeDefinition td)
|
|||||||
{
|
{
|
||||||
if (ca.AttributeType.FullName == Weaver.SyncVarType.FullName)
|
if (ca.AttributeType.FullName == Weaver.SyncVarType.FullName)
|
||||||
{
|
{
|
||||||
Log.Error("Script " + td.FullName + " uses [SyncVar] " + fd.Name + " but is not a NetworkBehaviour.");
|
Weaver.Error("Script " + td.FullName + " uses [SyncVar] " + fd.Name + " but is not a NetworkBehaviour.");
|
||||||
Weaver.fail = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SyncObjectProcessor.ImplementsSyncObject(fd.FieldType))
|
if (SyncObjectInitializer.ImplementsSyncObject(fd.FieldType))
|
||||||
{
|
{
|
||||||
Log.Error(string.Format("Script {0} defines field {1} with type {2}, but it's not a NetworkBehaviour", td.FullName, fd.Name, Helpers.PrettyPrintType(fd.FieldType)));
|
Weaver.Error(string.Format("Script {0} defines field {1} with type {2}, but it's not a NetworkBehaviour", td.FullName, fd.Name, Helpers.PrettyPrintType(fd.FieldType)));
|
||||||
Weaver.fail = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -42,20 +40,17 @@ static void ProcessMethods(TypeDefinition td)
|
|||||||
{
|
{
|
||||||
if (ca.AttributeType.FullName == Weaver.CommandType.FullName)
|
if (ca.AttributeType.FullName == Weaver.CommandType.FullName)
|
||||||
{
|
{
|
||||||
Log.Error("Script " + td.FullName + " uses [Command] " + md.Name + " but is not a NetworkBehaviour.");
|
Weaver.Error("Script " + td.FullName + " uses [Command] " + md.Name + " but is not a NetworkBehaviour.");
|
||||||
Weaver.fail = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ca.AttributeType.FullName == Weaver.ClientRpcType.FullName)
|
if (ca.AttributeType.FullName == Weaver.ClientRpcType.FullName)
|
||||||
{
|
{
|
||||||
Log.Error("Script " + td.FullName + " uses [ClientRpc] " + md.Name + " but is not a NetworkBehaviour.");
|
Weaver.Error("Script " + td.FullName + " uses [ClientRpc] " + md.Name + " but is not a NetworkBehaviour.");
|
||||||
Weaver.fail = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ca.AttributeType.FullName == Weaver.TargetRpcType.FullName)
|
if (ca.AttributeType.FullName == Weaver.TargetRpcType.FullName)
|
||||||
{
|
{
|
||||||
Log.Error("Script " + td.FullName + " uses [TargetRpc] " + md.Name + " but is not a NetworkBehaviour.");
|
Weaver.Error("Script " + td.FullName + " uses [TargetRpc] " + md.Name + " but is not a NetworkBehaviour.");
|
||||||
Weaver.fail = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
string attributeName = ca.Constructor.DeclaringType.ToString();
|
string attributeName = ca.Constructor.DeclaringType.ToString();
|
||||||
@ -63,24 +58,20 @@ static void ProcessMethods(TypeDefinition td)
|
|||||||
switch (attributeName)
|
switch (attributeName)
|
||||||
{
|
{
|
||||||
case "Mirror.ServerAttribute":
|
case "Mirror.ServerAttribute":
|
||||||
Log.Error("Script " + td.FullName + " uses the attribute [Server] on the method " + md.Name + " but is not a NetworkBehaviour.");
|
Weaver.Error("Script " + td.FullName + " uses the attribute [Server] on the method " + md.Name + " but is not a NetworkBehaviour.");
|
||||||
Weaver.fail = true;
|
|
||||||
break;
|
break;
|
||||||
case "Mirror.ServerCallbackAttribute":
|
case "Mirror.ServerCallbackAttribute":
|
||||||
Log.Error("Script " + td.FullName + " uses the attribute [ServerCallback] on the method " + md.Name + " but is not a NetworkBehaviour.");
|
Weaver.Error("Script " + td.FullName + " uses the attribute [ServerCallback] on the method " + md.Name + " but is not a NetworkBehaviour.");
|
||||||
Weaver.fail = true;
|
|
||||||
break;
|
break;
|
||||||
case "Mirror.ClientAttribute":
|
case "Mirror.ClientAttribute":
|
||||||
Log.Error("Script " + td.FullName + " uses the attribute [Client] on the method " + md.Name + " but is not a NetworkBehaviour.");
|
Weaver.Error("Script " + td.FullName + " uses the attribute [Client] on the method " + md.Name + " but is not a NetworkBehaviour.");
|
||||||
Weaver.fail = true;
|
|
||||||
break;
|
break;
|
||||||
case "Mirror.ClientCallbackAttribute":
|
case "Mirror.ClientCallbackAttribute":
|
||||||
Log.Error("Script " + td.FullName + " uses the attribute [ClientCallback] on the method " + md.Name + " but is not a NetworkBehaviour.");
|
Weaver.Error("Script " + td.FullName + " uses the attribute [ClientCallback] on the method " + md.Name + " but is not a NetworkBehaviour.");
|
||||||
Weaver.fail = true;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 35c16722912b64af894e4f6668f2e54c
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -37,8 +37,7 @@ public void Process()
|
|||||||
{
|
{
|
||||||
if (m_td.HasGenericParameters)
|
if (m_td.HasGenericParameters)
|
||||||
{
|
{
|
||||||
Weaver.fail = true;
|
Weaver.Error("NetworkBehaviour " + m_td.Name + " cannot have generic parameters");
|
||||||
Log.Error("NetworkBehaviour " + m_td.Name + " cannot have generic parameters");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Weaver.DLog(m_td, "Process Start");
|
Weaver.DLog(m_td, "Process Start");
|
||||||
@ -49,7 +48,7 @@ public void Process()
|
|||||||
ProcessMethods();
|
ProcessMethods();
|
||||||
|
|
||||||
SyncEventProcessor.ProcessEvents(m_td, m_Events, m_EventInvocationFuncs);
|
SyncEventProcessor.ProcessEvents(m_td, m_Events, m_EventInvocationFuncs);
|
||||||
if (Weaver.fail)
|
if (Weaver.WeavingFailed)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -57,7 +56,7 @@ public void Process()
|
|||||||
|
|
||||||
Weaver.ResetRecursionCount();
|
Weaver.ResetRecursionCount();
|
||||||
GenerateSerialization();
|
GenerateSerialization();
|
||||||
if (Weaver.fail)
|
if (Weaver.WeavingFailed)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -104,7 +103,7 @@ public static void WriteServerActiveCheck(ILProcessor worker, string mdName, Ins
|
|||||||
public static void WriteSetupLocals(ILProcessor worker)
|
public static void WriteSetupLocals(ILProcessor worker)
|
||||||
{
|
{
|
||||||
worker.Body.InitLocals = true;
|
worker.Body.InitLocals = true;
|
||||||
worker.Body.Variables.Add(new VariableDefinition(Weaver.scriptDef.MainModule.ImportReference(Weaver.NetworkWriterType)));
|
worker.Body.Variables.Add(new VariableDefinition(Weaver.CurrentAssembly.MainModule.ImportReference(Weaver.NetworkWriterType)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void WriteCreateWriter(ILProcessor worker)
|
public static void WriteCreateWriter(ILProcessor worker)
|
||||||
@ -129,8 +128,7 @@ public static bool WriteArguments(ILProcessor worker, MethodDefinition md, strin
|
|||||||
MethodReference writeFunc = Weaver.GetWriteFunc(pd.ParameterType);
|
MethodReference writeFunc = Weaver.GetWriteFunc(pd.ParameterType);
|
||||||
if (writeFunc == null)
|
if (writeFunc == null)
|
||||||
{
|
{
|
||||||
Log.Error("WriteArguments for " + md.Name + " type " + pd.ParameterType + " not supported");
|
Weaver.Error("WriteArguments for " + md.Name + " type " + pd.ParameterType + " not supported");
|
||||||
Weaver.fail = true;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// use built-in writer func on writer object
|
// use built-in writer func on writer object
|
||||||
@ -142,7 +140,7 @@ public static bool WriteArguments(ILProcessor worker, MethodDefinition md, strin
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// mark / check type as processed //////////////////////////////////////
|
#region mark / check type as processed
|
||||||
public const string ProcessedFunctionName = "MirrorProcessed";
|
public const string ProcessedFunctionName = "MirrorProcessed";
|
||||||
|
|
||||||
// by adding an empty MirrorProcessed() function
|
// by adding an empty MirrorProcessed() function
|
||||||
@ -161,7 +159,7 @@ public static void MarkAsProcessed(TypeDefinition td)
|
|||||||
td.Methods.Add(versionMethod);
|
td.Methods.Add(versionMethod);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
////////////////////////////////////////////////////////////////////////
|
#endregion
|
||||||
|
|
||||||
void GenerateConstants()
|
void GenerateConstants()
|
||||||
{
|
{
|
||||||
@ -193,8 +191,7 @@ void GenerateConstants()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Log.Error("No cctor for " + m_td.Name);
|
Weaver.Error("No cctor for " + m_td.Name);
|
||||||
Weaver.fail = true;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -226,8 +223,7 @@ void GenerateConstants()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Weaver.fail = true;
|
Weaver.Error("No ctor for " + m_td.Name);
|
||||||
Log.Error("No ctor for " + m_td.Name);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -237,8 +233,7 @@ void GenerateConstants()
|
|||||||
|
|
||||||
if (ctor == null)
|
if (ctor == null)
|
||||||
{
|
{
|
||||||
Weaver.fail = true;
|
Weaver.Error("No ctor for " + m_td.Name);
|
||||||
Log.Error("No ctor for " + m_td.Name);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -267,8 +262,8 @@ void GenerateConstants()
|
|||||||
|
|
||||||
foreach (FieldDefinition fd in m_SyncObjects)
|
foreach (FieldDefinition fd in m_SyncObjects)
|
||||||
{
|
{
|
||||||
SyncListProcessor.GenerateSyncListInstanceInitializer(ctorWorker, fd);
|
SyncListInitializer.GenerateSyncListInstanceInitializer(ctorWorker, fd);
|
||||||
SyncObjectProcessor.GenerateSyncObjectInitializer(ctorWorker, fd);
|
SyncObjectInitializer.GenerateSyncObjectInitializer(ctorWorker, fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
cctorWorker.Append(cctorWorker.Create(OpCodes.Ret));
|
cctorWorker.Append(cctorWorker.Create(OpCodes.Ret));
|
||||||
@ -320,7 +315,7 @@ void GenerateSerialization()
|
|||||||
MethodAttributes.Public | MethodAttributes.Virtual | MethodAttributes.HideBySig,
|
MethodAttributes.Public | MethodAttributes.Virtual | MethodAttributes.HideBySig,
|
||||||
Weaver.boolType);
|
Weaver.boolType);
|
||||||
|
|
||||||
serialize.Parameters.Add(new ParameterDefinition("writer", ParameterAttributes.None, Weaver.scriptDef.MainModule.ImportReference(Weaver.NetworkWriterType)));
|
serialize.Parameters.Add(new ParameterDefinition("writer", ParameterAttributes.None, Weaver.CurrentAssembly.MainModule.ImportReference(Weaver.NetworkWriterType)));
|
||||||
serialize.Parameters.Add(new ParameterDefinition("forceAll", ParameterAttributes.None, Weaver.boolType));
|
serialize.Parameters.Add(new ParameterDefinition("forceAll", ParameterAttributes.None, Weaver.boolType));
|
||||||
ILProcessor serWorker = serialize.Body.GetILProcessor();
|
ILProcessor serWorker = serialize.Body.GetILProcessor();
|
||||||
|
|
||||||
@ -330,7 +325,7 @@ void GenerateSerialization()
|
|||||||
VariableDefinition dirtyLocal = new VariableDefinition(Weaver.boolType);
|
VariableDefinition dirtyLocal = new VariableDefinition(Weaver.boolType);
|
||||||
serialize.Body.Variables.Add(dirtyLocal);
|
serialize.Body.Variables.Add(dirtyLocal);
|
||||||
|
|
||||||
MethodReference baseSerialize = Resolvers.ResolveMethodInParents(m_td.BaseType, Weaver.scriptDef, "OnSerialize");
|
MethodReference baseSerialize = Resolvers.ResolveMethodInParents(m_td.BaseType, Weaver.CurrentAssembly, "OnSerialize");
|
||||||
if (baseSerialize != null)
|
if (baseSerialize != null)
|
||||||
{
|
{
|
||||||
serWorker.Append(serWorker.Create(OpCodes.Ldarg_0)); // base
|
serWorker.Append(serWorker.Create(OpCodes.Ldarg_0)); // base
|
||||||
@ -358,8 +353,7 @@ void GenerateSerialization()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Weaver.fail = true;
|
Weaver.Error("GenerateSerialization for " + m_td.Name + " unknown type [" + syncVar.FieldType + "]. Mirror [SyncVar] member variables must be basic types.");
|
||||||
Log.Error("GenerateSerialization for " + m_td.Name + " unknown type [" + syncVar.FieldType + "]. UNet [SyncVar] member variables must be basic types.");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -407,8 +401,7 @@ void GenerateSerialization()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Log.Error("GenerateSerialization for " + m_td.Name + " unknown type [" + syncVar.FieldType + "]. UNet [SyncVar] member variables must be basic types.");
|
Weaver.Error("GenerateSerialization for " + m_td.Name + " unknown type [" + syncVar.FieldType + "]. Mirror [SyncVar] member variables must be basic types.");
|
||||||
Weaver.fail = true;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -420,7 +413,7 @@ void GenerateSerialization()
|
|||||||
dirtyBit += 1;
|
dirtyBit += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Weaver.generateLogErrors)
|
if (Weaver.GenerateLogErrors)
|
||||||
{
|
{
|
||||||
serWorker.Append(serWorker.Create(OpCodes.Ldstr, "Injected Serialize " + m_td.Name));
|
serWorker.Append(serWorker.Create(OpCodes.Ldstr, "Injected Serialize " + m_td.Name));
|
||||||
serWorker.Append(serWorker.Create(OpCodes.Call, Weaver.logErrorReference));
|
serWorker.Append(serWorker.Create(OpCodes.Call, Weaver.logErrorReference));
|
||||||
@ -493,8 +486,7 @@ void DeserializeField(FieldDefinition syncVar, ILProcessor serWorker)
|
|||||||
MethodReference readFunc = Weaver.GetReadFunc(syncVar.FieldType);
|
MethodReference readFunc = Weaver.GetReadFunc(syncVar.FieldType);
|
||||||
if (readFunc == null)
|
if (readFunc == null)
|
||||||
{
|
{
|
||||||
Log.Error("GenerateDeSerialization for " + m_td.Name + " unknown type [" + syncVar.FieldType + "]. UNet [SyncVar] member variables must be basic types.");
|
Weaver.Error("GenerateDeSerialization for " + m_td.Name + " unknown type [" + syncVar.FieldType + "]. Mirror [SyncVar] member variables must be basic types.");
|
||||||
Weaver.fail = true;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -538,11 +530,11 @@ void GenerateDeSerialization()
|
|||||||
MethodAttributes.Public | MethodAttributes.Virtual | MethodAttributes.HideBySig,
|
MethodAttributes.Public | MethodAttributes.Virtual | MethodAttributes.HideBySig,
|
||||||
Weaver.voidType);
|
Weaver.voidType);
|
||||||
|
|
||||||
serialize.Parameters.Add(new ParameterDefinition("reader", ParameterAttributes.None, Weaver.scriptDef.MainModule.ImportReference(Weaver.NetworkReaderType)));
|
serialize.Parameters.Add(new ParameterDefinition("reader", ParameterAttributes.None, Weaver.CurrentAssembly.MainModule.ImportReference(Weaver.NetworkReaderType)));
|
||||||
serialize.Parameters.Add(new ParameterDefinition("initialState", ParameterAttributes.None, Weaver.boolType));
|
serialize.Parameters.Add(new ParameterDefinition("initialState", ParameterAttributes.None, Weaver.boolType));
|
||||||
ILProcessor serWorker = serialize.Body.GetILProcessor();
|
ILProcessor serWorker = serialize.Body.GetILProcessor();
|
||||||
|
|
||||||
MethodReference baseDeserialize = Resolvers.ResolveMethodInParents(m_td.BaseType, Weaver.scriptDef, "OnDeserialize");
|
MethodReference baseDeserialize = Resolvers.ResolveMethodInParents(m_td.BaseType, Weaver.CurrentAssembly, "OnDeserialize");
|
||||||
if (baseDeserialize != null)
|
if (baseDeserialize != null)
|
||||||
{
|
{
|
||||||
serWorker.Append(serWorker.Create(OpCodes.Ldarg_0)); // base
|
serWorker.Append(serWorker.Create(OpCodes.Ldarg_0)); // base
|
||||||
@ -595,7 +587,7 @@ void GenerateDeSerialization()
|
|||||||
dirtyBit += 1;
|
dirtyBit += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Weaver.generateLogErrors)
|
if (Weaver.GenerateLogErrors)
|
||||||
{
|
{
|
||||||
serWorker.Append(serWorker.Create(OpCodes.Ldstr, "Injected Deserialize " + m_td.Name));
|
serWorker.Append(serWorker.Create(OpCodes.Ldstr, "Injected Deserialize " + m_td.Name));
|
||||||
serWorker.Append(serWorker.Create(OpCodes.Call, Weaver.logErrorReference));
|
serWorker.Append(serWorker.Create(OpCodes.Call, Weaver.logErrorReference));
|
||||||
@ -635,8 +627,7 @@ public static bool ProcessNetworkReaderParameters(TypeDefinition td, MethodDefin
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Log.Error("ProcessNetworkReaderParameters for " + td.Name + ":" + md.Name + " type " + arg.ParameterType + " not supported");
|
Weaver.Error("ProcessNetworkReaderParameters for " + td.Name + ":" + md.Name + " type " + arg.ParameterType + " not supported");
|
||||||
Weaver.fail = true;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -646,27 +637,24 @@ public static bool ProcessNetworkReaderParameters(TypeDefinition td, MethodDefin
|
|||||||
public static void AddInvokeParameters(ICollection<ParameterDefinition> collection)
|
public static void AddInvokeParameters(ICollection<ParameterDefinition> collection)
|
||||||
{
|
{
|
||||||
collection.Add(new ParameterDefinition("obj", ParameterAttributes.None, Weaver.NetworkBehaviourType2));
|
collection.Add(new ParameterDefinition("obj", ParameterAttributes.None, Weaver.NetworkBehaviourType2));
|
||||||
collection.Add(new ParameterDefinition("reader", ParameterAttributes.None, Weaver.scriptDef.MainModule.ImportReference(Weaver.NetworkReaderType)));
|
collection.Add(new ParameterDefinition("reader", ParameterAttributes.None, Weaver.CurrentAssembly.MainModule.ImportReference(Weaver.NetworkReaderType)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool ProcessMethodsValidateFunction(TypeDefinition td, MethodReference md, string actionType)
|
public static bool ProcessMethodsValidateFunction(TypeDefinition td, MethodReference md, string actionType)
|
||||||
{
|
{
|
||||||
if (md.ReturnType.FullName == Weaver.IEnumeratorType.FullName)
|
if (md.ReturnType.FullName == Weaver.IEnumeratorType.FullName)
|
||||||
{
|
{
|
||||||
Log.Error(actionType + " function [" + td.FullName + ":" + md.Name + "] cannot be a coroutine");
|
Weaver.Error(actionType + " function [" + td.FullName + ":" + md.Name + "] cannot be a coroutine");
|
||||||
Weaver.fail = true;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (md.ReturnType.FullName != Weaver.voidType.FullName)
|
if (md.ReturnType.FullName != Weaver.voidType.FullName)
|
||||||
{
|
{
|
||||||
Log.Error(actionType + " function [" + td.FullName + ":" + md.Name + "] must have a void return type.");
|
Weaver.Error(actionType + " function [" + td.FullName + ":" + md.Name + "] must have a void return type.");
|
||||||
Weaver.fail = true;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (md.HasGenericParameters)
|
if (md.HasGenericParameters)
|
||||||
{
|
{
|
||||||
Log.Error(actionType + " [" + td.FullName + ":" + md.Name + "] cannot have generic parameters");
|
Weaver.Error(actionType + " [" + td.FullName + ":" + md.Name + "] cannot have generic parameters");
|
||||||
Weaver.fail = true;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -679,46 +667,40 @@ public static bool ProcessMethodsValidateParameters(TypeDefinition td, MethodRef
|
|||||||
var p = md.Parameters[i];
|
var p = md.Parameters[i];
|
||||||
if (p.IsOut)
|
if (p.IsOut)
|
||||||
{
|
{
|
||||||
Log.Error(actionType + " function [" + td.FullName + ":" + md.Name + "] cannot have out parameters");
|
Weaver.Error(actionType + " function [" + td.FullName + ":" + md.Name + "] cannot have out parameters");
|
||||||
Weaver.fail = true;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (p.IsOptional)
|
if (p.IsOptional)
|
||||||
{
|
{
|
||||||
Log.Error(actionType + "function [" + td.FullName + ":" + md.Name + "] cannot have optional parameters");
|
Weaver.Error(actionType + "function [" + td.FullName + ":" + md.Name + "] cannot have optional parameters");
|
||||||
Weaver.fail = true;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (p.ParameterType.Resolve().IsAbstract)
|
if (p.ParameterType.Resolve().IsAbstract)
|
||||||
{
|
{
|
||||||
Log.Error(actionType + " function [" + td.FullName + ":" + md.Name + "] cannot have abstract parameters");
|
Weaver.Error(actionType + " function [" + td.FullName + ":" + md.Name + "] cannot have abstract parameters");
|
||||||
Weaver.fail = true;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (p.ParameterType.IsByReference)
|
if (p.ParameterType.IsByReference)
|
||||||
{
|
{
|
||||||
Log.Error(actionType + " function [" + td.FullName + ":" + md.Name + "] cannot have ref parameters");
|
Weaver.Error(actionType + " function [" + td.FullName + ":" + md.Name + "] cannot have ref parameters");
|
||||||
Weaver.fail = true;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// TargetRPC is an exception to this rule and can have a NetworkConnection as first parameter
|
// TargetRPC is an exception to this rule and can have a NetworkConnection as first parameter
|
||||||
if (p.ParameterType.FullName == Weaver.NetworkConnectionType.FullName &&
|
if (p.ParameterType.FullName == Weaver.NetworkConnectionType.FullName &&
|
||||||
!(ca.AttributeType.FullName == Weaver.TargetRpcType.FullName && i == 0))
|
!(ca.AttributeType.FullName == Weaver.TargetRpcType.FullName && i == 0))
|
||||||
{
|
{
|
||||||
Log.Error(actionType + " [" + td.FullName + ":" + md.Name + "] cannot use a NetworkConnection as a parameter. To access a player object's connection on the server use connectionToClient");
|
Weaver.Error(actionType + " [" + td.FullName + ":" + md.Name + "] cannot use a NetworkConnection as a parameter. To access a player object's connection on the server use connectionToClient");
|
||||||
Log.Error("Name: " + ca.AttributeType.FullName + " parameter: " + md.Parameters[0].ParameterType.FullName);
|
Weaver.Error("Name: " + ca.AttributeType.FullName + " parameter: " + md.Parameters[0].ParameterType.FullName);
|
||||||
Weaver.fail = true;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (p.ParameterType.Resolve().IsDerivedFrom(Weaver.ComponentType))
|
if (p.ParameterType.Resolve().IsDerivedFrom(Weaver.ComponentType))
|
||||||
{
|
{
|
||||||
if (p.ParameterType.FullName != Weaver.NetworkIdentityType.FullName)
|
if (p.ParameterType.FullName != Weaver.NetworkIdentityType.FullName)
|
||||||
{
|
{
|
||||||
Log.Error(actionType + " function [" + td.FullName + ":" + md.Name + "] parameter [" + p.Name +
|
Weaver.Error(actionType + " function [" + td.FullName + ":" + md.Name + "] parameter [" + p.Name +
|
||||||
"] is of the type [" +
|
"] is of the type [" +
|
||||||
p.ParameterType.Name +
|
p.ParameterType.Name +
|
||||||
"] which is a Component. You cannot pass a Component to a remote call. Try passing data from within the component.");
|
"] which is a Component. You cannot pass a Component to a remote call. Try passing data from within the component.");
|
||||||
Weaver.fail = true;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -743,8 +725,7 @@ void ProcessMethods()
|
|||||||
|
|
||||||
if (names.Contains(md.Name))
|
if (names.Contains(md.Name))
|
||||||
{
|
{
|
||||||
Log.Error("Duplicate Command name [" + m_td.FullName + ":" + md.Name + "]");
|
Weaver.Error("Duplicate Command name [" + m_td.FullName + ":" + md.Name + "]");
|
||||||
Weaver.fail = true;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
names.Add(md.Name);
|
names.Add(md.Name);
|
||||||
@ -760,7 +741,7 @@ void ProcessMethods()
|
|||||||
if (cmdCallFunc != null)
|
if (cmdCallFunc != null)
|
||||||
{
|
{
|
||||||
m_CmdCallFuncs.Add(cmdCallFunc);
|
m_CmdCallFuncs.Add(cmdCallFunc);
|
||||||
Weaver.lists.replaceMethods[md.FullName] = cmdCallFunc;
|
Weaver.WeaveLists.replaceMethods[md.FullName] = cmdCallFunc;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -772,8 +753,7 @@ void ProcessMethods()
|
|||||||
|
|
||||||
if (names.Contains(md.Name))
|
if (names.Contains(md.Name))
|
||||||
{
|
{
|
||||||
Log.Error("Duplicate Target Rpc name [" + m_td.FullName + ":" + md.Name + "]");
|
Weaver.Error("Duplicate Target Rpc name [" + m_td.FullName + ":" + md.Name + "]");
|
||||||
Weaver.fail = true;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
names.Add(md.Name);
|
names.Add(md.Name);
|
||||||
@ -789,7 +769,7 @@ void ProcessMethods()
|
|||||||
if (rpcCallFunc != null)
|
if (rpcCallFunc != null)
|
||||||
{
|
{
|
||||||
m_TargetRpcCallFuncs.Add(rpcCallFunc);
|
m_TargetRpcCallFuncs.Add(rpcCallFunc);
|
||||||
Weaver.lists.replaceMethods[md.FullName] = rpcCallFunc;
|
Weaver.WeaveLists.replaceMethods[md.FullName] = rpcCallFunc;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -801,8 +781,7 @@ void ProcessMethods()
|
|||||||
|
|
||||||
if (names.Contains(md.Name))
|
if (names.Contains(md.Name))
|
||||||
{
|
{
|
||||||
Log.Error("Duplicate ClientRpc name [" + m_td.FullName + ":" + md.Name + "]");
|
Weaver.Error("Duplicate ClientRpc name [" + m_td.FullName + ":" + md.Name + "]");
|
||||||
Weaver.fail = true;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
names.Add(md.Name);
|
names.Add(md.Name);
|
||||||
@ -818,7 +797,7 @@ void ProcessMethods()
|
|||||||
if (rpcCallFunc != null)
|
if (rpcCallFunc != null)
|
||||||
{
|
{
|
||||||
m_RpcCallFuncs.Add(rpcCallFunc);
|
m_RpcCallFuncs.Add(rpcCallFunc);
|
||||||
Weaver.lists.replaceMethods[md.FullName] = rpcCallFunc;
|
Weaver.WeaveLists.replaceMethods[md.FullName] = rpcCallFunc;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 8118d606be3214e5d99943ec39530dd8
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -38,13 +38,9 @@ public static MethodDefinition ProcessRpcInvoke(TypeDefinition td, MethodDefinit
|
|||||||
/* generates code like:
|
/* generates code like:
|
||||||
public void CallRpcTest (int param)
|
public void CallRpcTest (int param)
|
||||||
{
|
{
|
||||||
if (!NetworkServer.get_active ()) {
|
NetworkWriter writer = new NetworkWriter ();
|
||||||
Debug.LogError ((object)"RPC Function RpcTest called on client.");
|
writer.WritePackedUInt32((uint)param);
|
||||||
} else {
|
base.SendRPCInternal(typeof(class),"RpcTest", writer, 0);
|
||||||
NetworkWriter writer = new NetworkWriter ();
|
|
||||||
writer.WritePackedUInt32((uint)param);
|
|
||||||
base.SendRPCInternal(typeof(class),"RpcTest", writer, 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
public static MethodDefinition ProcessRpcCall(TypeDefinition td, MethodDefinition md, CustomAttribute ca)
|
public static MethodDefinition ProcessRpcCall(TypeDefinition td, MethodDefinition md, CustomAttribute ca)
|
||||||
@ -64,8 +60,6 @@ public static MethodDefinition ProcessRpcCall(TypeDefinition td, MethodDefinitio
|
|||||||
|
|
||||||
NetworkBehaviourProcessor.WriteSetupLocals(rpcWorker);
|
NetworkBehaviourProcessor.WriteSetupLocals(rpcWorker);
|
||||||
|
|
||||||
NetworkBehaviourProcessor.WriteServerActiveCheck(rpcWorker, md.Name, label, "RPC Function");
|
|
||||||
|
|
||||||
NetworkBehaviourProcessor.WriteCreateWriter(rpcWorker);
|
NetworkBehaviourProcessor.WriteCreateWriter(rpcWorker);
|
||||||
|
|
||||||
// write all the arguments that the user passed to the Rpc call
|
// write all the arguments that the user passed to the Rpc call
|
||||||
@ -97,15 +91,13 @@ public static bool ProcessMethodsValidateRpc(TypeDefinition td, MethodDefinition
|
|||||||
{
|
{
|
||||||
if (md.Name.Length > 2 && md.Name.Substring(0, 3) != "Rpc")
|
if (md.Name.Length > 2 && md.Name.Substring(0, 3) != "Rpc")
|
||||||
{
|
{
|
||||||
Log.Error("Rpc function [" + td.FullName + ":" + md.Name + "] doesnt have 'Rpc' prefix");
|
Weaver.Error("Rpc function [" + td.FullName + ":" + md.Name + "] doesnt have 'Rpc' prefix");
|
||||||
Weaver.fail = true;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (md.IsStatic)
|
if (md.IsStatic)
|
||||||
{
|
{
|
||||||
Log.Error("ClientRpc function [" + td.FullName + ":" + md.Name + "] cant be a static method");
|
Weaver.Error("ClientRpc function [" + td.FullName + ":" + md.Name + "] cant be a static method");
|
||||||
Weaver.fail = true;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
11
Assets/Mirror/Editor/Weaver/Processors/RpcProcessor.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: a3cb7051ff41947e59bba58bdd2b73fc
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -21,8 +21,7 @@ public static MethodDefinition ProcessEventInvoke(TypeDefinition td, EventDefini
|
|||||||
}
|
}
|
||||||
if (eventField == null)
|
if (eventField == null)
|
||||||
{
|
{
|
||||||
Weaver.DLog(td, "ERROR: no event field?!");
|
Weaver.Error("[" + td.Name + "] ERROR: no event field?!");
|
||||||
Weaver.fail = true;
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,7 +50,7 @@ public static MethodDefinition ProcessEventInvoke(TypeDefinition td, EventDefini
|
|||||||
cmdWorker.Append(cmdWorker.Create(OpCodes.Ldfld, eventField));
|
cmdWorker.Append(cmdWorker.Create(OpCodes.Ldfld, eventField));
|
||||||
|
|
||||||
// read the event arguments
|
// read the event arguments
|
||||||
MethodReference invoke = Resolvers.ResolveMethod(eventField.FieldType, Weaver.scriptDef, "Invoke");
|
MethodReference invoke = Resolvers.ResolveMethod(eventField.FieldType, Weaver.CurrentAssembly, "Invoke");
|
||||||
if (!NetworkBehaviourProcessor.ProcessNetworkReaderParameters(td, invoke.Resolve(), cmdWorker, false))
|
if (!NetworkBehaviourProcessor.ProcessNetworkReaderParameters(td, invoke.Resolve(), cmdWorker, false))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
@ -66,7 +65,7 @@ public static MethodDefinition ProcessEventInvoke(TypeDefinition td, EventDefini
|
|||||||
|
|
||||||
public static MethodDefinition ProcessEventCall(TypeDefinition td, EventDefinition ed, CustomAttribute ca)
|
public static MethodDefinition ProcessEventCall(TypeDefinition td, EventDefinition ed, CustomAttribute ca)
|
||||||
{
|
{
|
||||||
MethodReference invoke = Resolvers.ResolveMethod(ed.EventType, Weaver.scriptDef, "Invoke");
|
MethodReference invoke = Resolvers.ResolveMethod(ed.EventType, Weaver.CurrentAssembly, "Invoke");
|
||||||
MethodDefinition evt = new MethodDefinition("Call" + ed.Name, MethodAttributes.Public |
|
MethodDefinition evt = new MethodDefinition("Call" + ed.Name, MethodAttributes.Public |
|
||||||
MethodAttributes.HideBySig,
|
MethodAttributes.HideBySig,
|
||||||
Weaver.voidType);
|
Weaver.voidType);
|
||||||
@ -114,15 +113,13 @@ public static void ProcessEvents(TypeDefinition td, List<EventDefinition> events
|
|||||||
{
|
{
|
||||||
if (ed.Name.Length > 4 && ed.Name.Substring(0, 5) != "Event")
|
if (ed.Name.Length > 4 && ed.Name.Substring(0, 5) != "Event")
|
||||||
{
|
{
|
||||||
Log.Error("Event [" + td.FullName + ":" + ed.FullName + "] doesnt have 'Event' prefix");
|
Weaver.Error("Event [" + td.FullName + ":" + ed.FullName + "] doesnt have 'Event' prefix");
|
||||||
Weaver.fail = true;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ed.EventType.Resolve().HasGenericParameters)
|
if (ed.EventType.Resolve().HasGenericParameters)
|
||||||
{
|
{
|
||||||
Log.Error("Event [" + td.FullName + ":" + ed.FullName + "] cannot have generic parameters");
|
Weaver.Error("Event [" + td.FullName + ":" + ed.FullName + "] cannot have generic parameters");
|
||||||
Weaver.fail = true;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,7 +138,7 @@ public static void ProcessEvents(TypeDefinition td, List<EventDefinition> events
|
|||||||
MethodDefinition eventCallFunc = ProcessEventCall(td, ed, ca);
|
MethodDefinition eventCallFunc = ProcessEventCall(td, ed, ca);
|
||||||
td.Methods.Add(eventCallFunc);
|
td.Methods.Add(eventCallFunc);
|
||||||
|
|
||||||
Weaver.lists.replaceEvents[ed.Name] = eventCallFunc; // original weaver compares .Name, not EventDefinition.
|
Weaver.WeaveLists.replaceEvents[ed.Name] = eventCallFunc; // original weaver compares .Name, not EventDefinition.
|
||||||
|
|
||||||
Weaver.DLog(td, " Event: " + ed.Name);
|
Weaver.DLog(td, " Event: " + ed.Name);
|
||||||
break;
|
break;
|
||||||
@ -150,4 +147,4 @@ public static void ProcessEvents(TypeDefinition td, List<EventDefinition> events
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: a5d8b25543a624384944b599e5a832a8
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
namespace Mirror.Weaver
|
namespace Mirror.Weaver
|
||||||
{
|
{
|
||||||
public static class SyncListProcessor
|
public static class SyncListInitializer
|
||||||
{
|
{
|
||||||
// generates 'syncListInt = new SyncListInt()' if user didn't do that yet
|
// generates 'syncListInt = new SyncListInt()' if user didn't do that yet
|
||||||
public static void GenerateSyncListInstanceInitializer(ILProcessor ctorWorker, FieldDefinition fd)
|
public static void GenerateSyncListInstanceInitializer(ILProcessor ctorWorker, FieldDefinition fd)
|
||||||
@ -31,12 +31,11 @@ public static void GenerateSyncListInstanceInitializer(ILProcessor ctorWorker, F
|
|||||||
MethodReference listCtor;
|
MethodReference listCtor;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
listCtor = Weaver.scriptDef.MainModule.ImportReference(fd.FieldType.Resolve().Methods.First<MethodDefinition>(x => x.Name == ".ctor" && !x.HasParameters));
|
listCtor = Weaver.CurrentAssembly.MainModule.ImportReference(fd.FieldType.Resolve().Methods.First<MethodDefinition>(x => x.Name == ".ctor" && !x.HasParameters));
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
Weaver.fail = true;
|
Weaver.Error("Missing parameter-less constructor for:" + fd.FieldType.Name);
|
||||||
Log.Error("Missing parameter-less constructor for:" + fd.FieldType.Name);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,4 +44,4 @@ public static void GenerateSyncListInstanceInitializer(ILProcessor ctorWorker, F
|
|||||||
ctorWorker.Append(ctorWorker.Create(OpCodes.Stfld, fd));
|
ctorWorker.Append(ctorWorker.Create(OpCodes.Stfld, fd));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 97068e5d8cc14490b85933feb119d827
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -12,17 +12,16 @@ public static void Process(TypeDefinition td)
|
|||||||
GenericInstanceType gt = (GenericInstanceType)td.BaseType;
|
GenericInstanceType gt = (GenericInstanceType)td.BaseType;
|
||||||
if (gt.GenericArguments.Count == 0)
|
if (gt.GenericArguments.Count == 0)
|
||||||
{
|
{
|
||||||
Weaver.fail = true;
|
Weaver.Error("SyncListStructProcessor no generic args");
|
||||||
Log.Error("SyncListStructProcessor no generic args");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
TypeReference itemType = Weaver.scriptDef.MainModule.ImportReference(gt.GenericArguments[0]);
|
TypeReference itemType = Weaver.CurrentAssembly.MainModule.ImportReference(gt.GenericArguments[0]);
|
||||||
|
|
||||||
Weaver.DLog(td, "SyncListStructProcessor Start item:" + itemType.FullName);
|
Weaver.DLog(td, "SyncListStructProcessor Start item:" + itemType.FullName);
|
||||||
|
|
||||||
Weaver.ResetRecursionCount();
|
Weaver.ResetRecursionCount();
|
||||||
MethodReference writeItemFunc = GenerateSerialization(td, itemType);
|
MethodReference writeItemFunc = GenerateSerialization(td, itemType);
|
||||||
if (Weaver.fail)
|
if (Weaver.WeavingFailed)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -51,14 +50,13 @@ static MethodReference GenerateSerialization(TypeDefinition td, TypeReference it
|
|||||||
MethodAttributes.HideBySig,
|
MethodAttributes.HideBySig,
|
||||||
Weaver.voidType);
|
Weaver.voidType);
|
||||||
|
|
||||||
serializeFunc.Parameters.Add(new ParameterDefinition("writer", ParameterAttributes.None, Weaver.scriptDef.MainModule.ImportReference(Weaver.NetworkWriterType)));
|
serializeFunc.Parameters.Add(new ParameterDefinition("writer", ParameterAttributes.None, Weaver.CurrentAssembly.MainModule.ImportReference(Weaver.NetworkWriterType)));
|
||||||
serializeFunc.Parameters.Add(new ParameterDefinition("item", ParameterAttributes.None, itemType));
|
serializeFunc.Parameters.Add(new ParameterDefinition("item", ParameterAttributes.None, itemType));
|
||||||
ILProcessor serWorker = serializeFunc.Body.GetILProcessor();
|
ILProcessor serWorker = serializeFunc.Body.GetILProcessor();
|
||||||
|
|
||||||
if (itemType.IsGenericInstance)
|
if (itemType.IsGenericInstance)
|
||||||
{
|
{
|
||||||
Weaver.fail = true;
|
Weaver.Error("GenerateSerialization for " + Helpers.PrettyPrintType(itemType) + " failed. Struct passed into SyncListStruct<T> can't have generic parameters");
|
||||||
Log.Error("GenerateSerialization for " + Helpers.PrettyPrintType(itemType) + " failed. Struct passed into SyncListStruct<T> can't have generic parameters");
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,20 +65,18 @@ static MethodReference GenerateSerialization(TypeDefinition td, TypeReference it
|
|||||||
if (field.IsStatic || field.IsPrivate || field.IsSpecialName)
|
if (field.IsStatic || field.IsPrivate || field.IsSpecialName)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
FieldReference importedField = Weaver.scriptDef.MainModule.ImportReference(field);
|
FieldReference importedField = Weaver.CurrentAssembly.MainModule.ImportReference(field);
|
||||||
TypeDefinition ft = importedField.FieldType.Resolve();
|
TypeDefinition ft = importedField.FieldType.Resolve();
|
||||||
|
|
||||||
if (ft.HasGenericParameters)
|
if (ft.HasGenericParameters)
|
||||||
{
|
{
|
||||||
Weaver.fail = true;
|
Weaver.Error("GenerateSerialization for " + td.Name + " [" + ft + "/" + ft.FullName + "]. [SyncListStruct] member cannot have generic parameters.");
|
||||||
Log.Error("GenerateSerialization for " + td.Name + " [" + ft + "/" + ft.FullName + "]. [SyncListStruct] member cannot have generic parameters.");
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ft.IsInterface)
|
if (ft.IsInterface)
|
||||||
{
|
{
|
||||||
Weaver.fail = true;
|
Weaver.Error("GenerateSerialization for " + td.Name + " [" + ft + "/" + ft.FullName + "]. [SyncListStruct] member cannot be an interface.");
|
||||||
Log.Error("GenerateSerialization for " + td.Name + " [" + ft + "/" + ft.FullName + "]. [SyncListStruct] member cannot be an interface.");
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,8 +90,7 @@ static MethodReference GenerateSerialization(TypeDefinition td, TypeReference it
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Weaver.fail = true;
|
Weaver.Error("GenerateSerialization for " + td.Name + " unknown type [" + ft + "/" + ft.FullName + "]. [SyncListStruct] member variables must be basic types.");
|
||||||
Log.Error("GenerateSerialization for " + td.Name + " unknown type [" + ft + "/" + ft.FullName + "]. [SyncListStruct] member variables must be basic types.");
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -120,7 +115,7 @@ static MethodReference GenerateDeserialization(TypeDefinition td, TypeReference
|
|||||||
MethodAttributes.HideBySig,
|
MethodAttributes.HideBySig,
|
||||||
itemType);
|
itemType);
|
||||||
|
|
||||||
serializeFunc.Parameters.Add(new ParameterDefinition("reader", ParameterAttributes.None, Weaver.scriptDef.MainModule.ImportReference(Weaver.NetworkReaderType)));
|
serializeFunc.Parameters.Add(new ParameterDefinition("reader", ParameterAttributes.None, Weaver.CurrentAssembly.MainModule.ImportReference(Weaver.NetworkReaderType)));
|
||||||
|
|
||||||
ILProcessor serWorker = serializeFunc.Body.GetILProcessor();
|
ILProcessor serWorker = serializeFunc.Body.GetILProcessor();
|
||||||
|
|
||||||
@ -136,7 +131,7 @@ static MethodReference GenerateDeserialization(TypeDefinition td, TypeReference
|
|||||||
if (field.IsStatic || field.IsPrivate || field.IsSpecialName)
|
if (field.IsStatic || field.IsPrivate || field.IsSpecialName)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
FieldReference importedField = Weaver.scriptDef.MainModule.ImportReference(field);
|
FieldReference importedField = Weaver.CurrentAssembly.MainModule.ImportReference(field);
|
||||||
TypeDefinition ft = importedField.FieldType.Resolve();
|
TypeDefinition ft = importedField.FieldType.Resolve();
|
||||||
|
|
||||||
MethodReference readerFunc = Weaver.GetReadFunc(field.FieldType);
|
MethodReference readerFunc = Weaver.GetReadFunc(field.FieldType);
|
||||||
@ -149,8 +144,7 @@ static MethodReference GenerateDeserialization(TypeDefinition td, TypeReference
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Weaver.fail = true;
|
Weaver.Error("GenerateDeserialization for " + td.Name + " unknown type [" + ft + "]. [SyncListStruct] member variables must be basic types.");
|
||||||
Log.Error("GenerateDeserialization for " + td.Name + " unknown type [" + ft + "]. [SyncListStruct] member variables must be basic types.");
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 93397916cae0248bc9294f863fa49f81
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
namespace Mirror.Weaver
|
namespace Mirror.Weaver
|
||||||
{
|
{
|
||||||
public static class SyncObjectProcessor
|
public static class SyncObjectInitializer
|
||||||
{
|
{
|
||||||
public static bool ImplementsSyncObject(TypeReference typeRef)
|
public static bool ImplementsSyncObject(TypeReference typeRef)
|
||||||
{
|
{
|
||||||
@ -40,4 +40,4 @@ public static void GenerateSyncObjectInitializer(ILProcessor methodWorker, Field
|
|||||||
methodWorker.Append(methodWorker.Create(OpCodes.Call, Weaver.InitSyncObjectReference));
|
methodWorker.Append(methodWorker.Create(OpCodes.Call, Weaver.InitSyncObjectReference));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: d02219b00b3674e59a2151f41e791688
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -31,20 +31,17 @@ public static bool CheckForHookFunction(TypeDefinition td, FieldDefinition syncV
|
|||||||
{
|
{
|
||||||
if (m.Parameters[0].ParameterType != syncVar.FieldType)
|
if (m.Parameters[0].ParameterType != syncVar.FieldType)
|
||||||
{
|
{
|
||||||
Log.Error("SyncVar Hook function " + hookFunctionName + " has wrong type signature for " + td.Name);
|
Weaver.Error("SyncVar Hook function " + hookFunctionName + " has wrong type signature for " + td.Name);
|
||||||
Weaver.fail = true;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
foundMethod = m;
|
foundMethod = m;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
Log.Error("SyncVar Hook function " + hookFunctionName + " must have one argument " + td.Name);
|
Weaver.Error("SyncVar Hook function " + hookFunctionName + " must have one argument " + td.Name);
|
||||||
Weaver.fail = true;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Log.Error("SyncVar Hook function " + hookFunctionName + " not found for " + td.Name);
|
Weaver.Error("SyncVar Hook function " + hookFunctionName + " not found for " + td.Name);
|
||||||
Weaver.fail = true;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -222,7 +219,7 @@ public static void ProcessSyncVar(TypeDefinition td, FieldDefinition fd, Diction
|
|||||||
td.Methods.Add(get);
|
td.Methods.Add(get);
|
||||||
td.Methods.Add(set);
|
td.Methods.Add(set);
|
||||||
td.Properties.Add(propertyDefinition);
|
td.Properties.Add(propertyDefinition);
|
||||||
Weaver.lists.replacementSetterProperties[fd] = set;
|
Weaver.WeaveLists.replacementSetterProperties[fd] = set;
|
||||||
|
|
||||||
// replace getter field if GameObject/NetworkIdentity so it uses
|
// replace getter field if GameObject/NetworkIdentity so it uses
|
||||||
// netId instead
|
// netId instead
|
||||||
@ -231,7 +228,7 @@ public static void ProcessSyncVar(TypeDefinition td, FieldDefinition fd, Diction
|
|||||||
if (fd.FieldType.FullName == Weaver.gameObjectType.FullName ||
|
if (fd.FieldType.FullName == Weaver.gameObjectType.FullName ||
|
||||||
fd.FieldType.FullName == Weaver.NetworkIdentityType.FullName)
|
fd.FieldType.FullName == Weaver.NetworkIdentityType.FullName)
|
||||||
{
|
{
|
||||||
Weaver.lists.replacementGetterProperties[fd] = get;
|
Weaver.WeaveLists.replacementGetterProperties[fd] = get;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -256,61 +253,54 @@ public static void ProcessSyncVars(TypeDefinition td, List<FieldDefinition> sync
|
|||||||
|
|
||||||
if (resolvedField.IsDerivedFrom(Weaver.NetworkBehaviourType))
|
if (resolvedField.IsDerivedFrom(Weaver.NetworkBehaviourType))
|
||||||
{
|
{
|
||||||
Log.Error("SyncVar [" + fd.FullName + "] cannot be derived from NetworkBehaviour.");
|
Weaver.Error("SyncVar [" + fd.FullName + "] cannot be derived from NetworkBehaviour.");
|
||||||
Weaver.fail = true;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (resolvedField.IsDerivedFrom(Weaver.ScriptableObjectType))
|
if (resolvedField.IsDerivedFrom(Weaver.ScriptableObjectType))
|
||||||
{
|
{
|
||||||
Log.Error("SyncVar [" + fd.FullName + "] cannot be derived from ScriptableObject.");
|
Weaver.Error("SyncVar [" + fd.FullName + "] cannot be derived from ScriptableObject.");
|
||||||
Weaver.fail = true;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((fd.Attributes & FieldAttributes.Static) != 0)
|
if ((fd.Attributes & FieldAttributes.Static) != 0)
|
||||||
{
|
{
|
||||||
Log.Error("SyncVar [" + fd.FullName + "] cannot be static.");
|
Weaver.Error("SyncVar [" + fd.FullName + "] cannot be static.");
|
||||||
Weaver.fail = true;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (resolvedField.HasGenericParameters)
|
if (resolvedField.HasGenericParameters)
|
||||||
{
|
{
|
||||||
Log.Error("SyncVar [" + fd.FullName + "] cannot have generic parameters.");
|
Weaver.Error("SyncVar [" + fd.FullName + "] cannot have generic parameters.");
|
||||||
Weaver.fail = true;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (resolvedField.IsInterface)
|
if (resolvedField.IsInterface)
|
||||||
{
|
{
|
||||||
Log.Error("SyncVar [" + fd.FullName + "] cannot be an interface.");
|
Weaver.Error("SyncVar [" + fd.FullName + "] cannot be an interface.");
|
||||||
Weaver.fail = true;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var fieldModuleName = resolvedField.Module.Name;
|
var fieldModuleName = resolvedField.Module.Name;
|
||||||
if (fieldModuleName != Weaver.scriptDef.MainModule.Name &&
|
if (fieldModuleName != Weaver.CurrentAssembly.MainModule.Name &&
|
||||||
fieldModuleName != Weaver.m_UnityAssemblyDefinition.MainModule.Name &&
|
fieldModuleName != Weaver.UnityAssembly.MainModule.Name &&
|
||||||
fieldModuleName != Weaver.m_UNetAssemblyDefinition.MainModule.Name &&
|
fieldModuleName != Weaver.NetAssembly.MainModule.Name &&
|
||||||
fieldModuleName != Weaver.corLib.Name &&
|
fieldModuleName != Weaver.CorLibModule.Name &&
|
||||||
fieldModuleName != "System.Runtime.dll" && // this is only for Metro, built-in types are not in corlib on metro
|
fieldModuleName != "System.Runtime.dll" && // this is only for Metro, built-in types are not in corlib on metro
|
||||||
fieldModuleName != "netstandard.dll" // handle built-in types when weaving new C#7 compiler assemblies
|
fieldModuleName != "netstandard.dll" // handle built-in types when weaving new C#7 compiler assemblies
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
Log.Error("SyncVar [" + fd.FullName + "] from " + resolvedField.Module.ToString() + " cannot be a different module.");
|
Weaver.Error("SyncVar [" + fd.FullName + "] from " + resolvedField.Module.ToString() + " cannot be a different module.");
|
||||||
Weaver.fail = true;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fd.FieldType.IsArray)
|
if (fd.FieldType.IsArray)
|
||||||
{
|
{
|
||||||
Log.Error("SyncVar [" + fd.FullName + "] cannot be an array. Use a SyncList instead.");
|
Weaver.Error("SyncVar [" + fd.FullName + "] cannot be an array. Use a SyncList instead.");
|
||||||
Weaver.fail = true;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SyncObjectProcessor.ImplementsSyncObject(fd.FieldType))
|
if (SyncObjectInitializer.ImplementsSyncObject(fd.FieldType))
|
||||||
{
|
{
|
||||||
Log.Warning(string.Format("Script class [{0}] has [SyncVar] attribute on SyncList field {1}, SyncLists should not be marked with SyncVar.", td.FullName, fd.Name));
|
Log.Warning(string.Format("Script class [{0}] has [SyncVar] attribute on SyncList field {1}, SyncLists should not be marked with SyncVar.", td.FullName, fd.Name));
|
||||||
break;
|
break;
|
||||||
@ -324,8 +314,7 @@ public static void ProcessSyncVars(TypeDefinition td, List<FieldDefinition> sync
|
|||||||
|
|
||||||
if (dirtyBitCounter == k_SyncVarLimit)
|
if (dirtyBitCounter == k_SyncVarLimit)
|
||||||
{
|
{
|
||||||
Log.Error("Script class [" + td.FullName + "] has too many SyncVars (" + k_SyncVarLimit + "). (This could include base classes)");
|
Weaver.Error("Script class [" + td.FullName + "] has too many SyncVars (" + k_SyncVarLimit + "). (This could include base classes)");
|
||||||
Weaver.fail = true;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -334,8 +323,7 @@ public static void ProcessSyncVars(TypeDefinition td, List<FieldDefinition> sync
|
|||||||
|
|
||||||
if (fd.FieldType.FullName.Contains("Mirror.SyncListStruct"))
|
if (fd.FieldType.FullName.Contains("Mirror.SyncListStruct"))
|
||||||
{
|
{
|
||||||
Log.Error("SyncListStruct member variable [" + fd.FullName + "] must use a dervied class, like \"class MySyncList : SyncListStruct<MyStruct> {}\".");
|
Weaver.Error("SyncListStruct member variable [" + fd.FullName + "] must use a dervied class, like \"class MySyncList : SyncListStruct<MyStruct> {}\".");
|
||||||
Weaver.fail = true;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -343,8 +331,7 @@ public static void ProcessSyncVars(TypeDefinition td, List<FieldDefinition> sync
|
|||||||
{
|
{
|
||||||
if (fd.IsStatic)
|
if (fd.IsStatic)
|
||||||
{
|
{
|
||||||
Log.Error("SyncList [" + td.FullName + ":" + fd.FullName + "] cannot be a static");
|
Weaver.Error("SyncList [" + td.FullName + ":" + fd.FullName + "] cannot be a static");
|
||||||
Weaver.fail = true;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -361,4 +348,4 @@ public static void ProcessSyncVars(TypeDefinition td, List<FieldDefinition> sync
|
|||||||
Weaver.SetNumSyncVars(td.FullName, numSyncVars);
|
Weaver.SetNumSyncVars(td.FullName, numSyncVars);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: f52c39bddd95d42b88f9cd554dfd9198
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -8,6 +8,13 @@ public static class TargetRpcProcessor
|
|||||||
{
|
{
|
||||||
const string k_TargetRpcPrefix = "InvokeTargetRpc";
|
const string k_TargetRpcPrefix = "InvokeTargetRpc";
|
||||||
|
|
||||||
|
// helper functions to check if the method has a NetworkConnection parameter
|
||||||
|
public static bool HasNetworkConnectionParameter(MethodDefinition md)
|
||||||
|
{
|
||||||
|
return md.Parameters.Count > 0 &&
|
||||||
|
md.Parameters[0].ParameterType.FullName == Weaver.NetworkConnectionType.FullName;
|
||||||
|
}
|
||||||
|
|
||||||
public static MethodDefinition ProcessTargetRpcInvoke(TypeDefinition td, MethodDefinition md)
|
public static MethodDefinition ProcessTargetRpcInvoke(TypeDefinition td, MethodDefinition md)
|
||||||
{
|
{
|
||||||
MethodDefinition rpc = new MethodDefinition(RpcProcessor.k_RpcPrefix + md.Name, MethodAttributes.Family |
|
MethodDefinition rpc = new MethodDefinition(RpcProcessor.k_RpcPrefix + md.Name, MethodAttributes.Family |
|
||||||
@ -24,10 +31,16 @@ public static MethodDefinition ProcessTargetRpcInvoke(TypeDefinition td, MethodD
|
|||||||
rpcWorker.Append(rpcWorker.Create(OpCodes.Ldarg_0));
|
rpcWorker.Append(rpcWorker.Create(OpCodes.Ldarg_0));
|
||||||
rpcWorker.Append(rpcWorker.Create(OpCodes.Castclass, td));
|
rpcWorker.Append(rpcWorker.Create(OpCodes.Castclass, td));
|
||||||
|
|
||||||
//ClientScene.readyconnection
|
// NetworkConnection parameter is optional
|
||||||
rpcWorker.Append(rpcWorker.Create(OpCodes.Call, Weaver.ReadyConnectionReference));
|
bool hasNetworkConnection = HasNetworkConnectionParameter(md);
|
||||||
|
if (hasNetworkConnection)
|
||||||
|
{
|
||||||
|
//ClientScene.readyconnection
|
||||||
|
rpcWorker.Append(rpcWorker.Create(OpCodes.Call, Weaver.ReadyConnectionReference));
|
||||||
|
}
|
||||||
|
|
||||||
if (!NetworkBehaviourProcessor.ProcessNetworkReaderParameters(td, md, rpcWorker, true))
|
// process reader parameters and skip first one if first one is NetworkConnection
|
||||||
|
if (!NetworkBehaviourProcessor.ProcessNetworkReaderParameters(td, md, rpcWorker, hasNetworkConnection))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
// invoke actual command function
|
// invoke actual command function
|
||||||
@ -42,15 +55,17 @@ public static MethodDefinition ProcessTargetRpcInvoke(TypeDefinition td, MethodD
|
|||||||
/* generates code like:
|
/* generates code like:
|
||||||
public void CallTargetTest (NetworkConnection conn, int param)
|
public void CallTargetTest (NetworkConnection conn, int param)
|
||||||
{
|
{
|
||||||
if (!NetworkServer.get_active ()) {
|
NetworkWriter writer = new NetworkWriter ();
|
||||||
Debug.LogError((object)"TargetRPC Function TargetTest called on client.");
|
writer.WritePackedUInt32 ((uint)param);
|
||||||
} else if (((?)conn) is ULocalConnectionToServer) {
|
base.SendTargetRPCInternal (conn, typeof(class), "TargetTest", val);
|
||||||
Debug.LogError((object)"TargetRPC Function TargetTest called on connection to server");
|
}
|
||||||
} else {
|
|
||||||
NetworkWriter writer = new NetworkWriter ();
|
or if optional:
|
||||||
writer.WritePackedUInt32 ((uint)param);
|
public void CallTargetTest (int param)
|
||||||
base.SendTargetRPCInternal (conn, typeof(class), "TargetTest", val);
|
{
|
||||||
}
|
NetworkWriter writer = new NetworkWriter ();
|
||||||
|
writer.WritePackedUInt32 ((uint)param);
|
||||||
|
base.SendTargetRPCInternal (null, typeof(class), "TargetTest", val);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
public static MethodDefinition ProcessTargetRpcCall(TypeDefinition td, MethodDefinition md, CustomAttribute ca)
|
public static MethodDefinition ProcessTargetRpcCall(TypeDefinition td, MethodDefinition md, CustomAttribute ca)
|
||||||
@ -59,35 +74,24 @@ public static MethodDefinition ProcessTargetRpcCall(TypeDefinition td, MethodDef
|
|||||||
MethodAttributes.HideBySig,
|
MethodAttributes.HideBySig,
|
||||||
Weaver.voidType);
|
Weaver.voidType);
|
||||||
|
|
||||||
// add paramters
|
// add parameters
|
||||||
foreach (ParameterDefinition pd in md.Parameters)
|
foreach (ParameterDefinition pd in md.Parameters)
|
||||||
{
|
{
|
||||||
rpc.Parameters.Add(new ParameterDefinition(pd.Name, ParameterAttributes.None, pd.ParameterType));
|
rpc.Parameters.Add(new ParameterDefinition(pd.Name, ParameterAttributes.None, pd.ParameterType));
|
||||||
}
|
}
|
||||||
|
|
||||||
ILProcessor rpcWorker = rpc.Body.GetILProcessor();
|
ILProcessor rpcWorker = rpc.Body.GetILProcessor();
|
||||||
Instruction label = rpcWorker.Create(OpCodes.Nop);
|
|
||||||
|
|
||||||
NetworkBehaviourProcessor.WriteSetupLocals(rpcWorker);
|
NetworkBehaviourProcessor.WriteSetupLocals(rpcWorker);
|
||||||
|
|
||||||
NetworkBehaviourProcessor.WriteServerActiveCheck(rpcWorker, md.Name, label, "TargetRPC Function");
|
|
||||||
|
|
||||||
Instruction labelConnectionCheck = rpcWorker.Create(OpCodes.Nop);
|
|
||||||
|
|
||||||
// check specifically for ULocalConnectionToServer so a host is not trying to send
|
|
||||||
// an TargetRPC to the "server" from it's local client.
|
|
||||||
rpcWorker.Append(rpcWorker.Create(OpCodes.Ldarg_1));
|
|
||||||
rpcWorker.Append(rpcWorker.Create(OpCodes.Isinst, Weaver.ULocalConnectionToServerType));
|
|
||||||
rpcWorker.Append(rpcWorker.Create(OpCodes.Brfalse, labelConnectionCheck));
|
|
||||||
rpcWorker.Append(rpcWorker.Create(OpCodes.Ldstr, string.Format("TargetRPC Function {0} called on connection to server", md.Name)));
|
|
||||||
rpcWorker.Append(rpcWorker.Create(OpCodes.Call, Weaver.logErrorReference));
|
|
||||||
rpcWorker.Append(rpcWorker.Create(OpCodes.Ret));
|
|
||||||
rpcWorker.Append(labelConnectionCheck);
|
|
||||||
|
|
||||||
NetworkBehaviourProcessor.WriteCreateWriter(rpcWorker);
|
NetworkBehaviourProcessor.WriteCreateWriter(rpcWorker);
|
||||||
|
|
||||||
|
// NetworkConnection parameter is optional
|
||||||
|
bool hasNetworkConnection = HasNetworkConnectionParameter(md);
|
||||||
|
|
||||||
// write all the arguments that the user passed to the TargetRpc call
|
// write all the arguments that the user passed to the TargetRpc call
|
||||||
if (!NetworkBehaviourProcessor.WriteArguments(rpcWorker, md, "TargetRPC", true))
|
// (skip first one if first one is NetworkConnection)
|
||||||
|
if (!NetworkBehaviourProcessor.WriteArguments(rpcWorker, md, "TargetRPC", hasNetworkConnection))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
var rpcName = md.Name;
|
var rpcName = md.Name;
|
||||||
@ -99,7 +103,14 @@ public static MethodDefinition ProcessTargetRpcCall(TypeDefinition td, MethodDef
|
|||||||
|
|
||||||
// invoke SendInternal and return
|
// invoke SendInternal and return
|
||||||
rpcWorker.Append(rpcWorker.Create(OpCodes.Ldarg_0)); // this
|
rpcWorker.Append(rpcWorker.Create(OpCodes.Ldarg_0)); // this
|
||||||
rpcWorker.Append(rpcWorker.Create(OpCodes.Ldarg_1)); // connection
|
if (HasNetworkConnectionParameter(md))
|
||||||
|
{
|
||||||
|
rpcWorker.Append(rpcWorker.Create(OpCodes.Ldarg_1)); // connection
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rpcWorker.Append(rpcWorker.Create(OpCodes.Ldnull)); // null
|
||||||
|
}
|
||||||
rpcWorker.Append(rpcWorker.Create(OpCodes.Ldtoken, td));
|
rpcWorker.Append(rpcWorker.Create(OpCodes.Ldtoken, td));
|
||||||
rpcWorker.Append(rpcWorker.Create(OpCodes.Call, Weaver.getTypeFromHandleReference)); // invokerClass
|
rpcWorker.Append(rpcWorker.Create(OpCodes.Call, Weaver.getTypeFromHandleReference)); // invokerClass
|
||||||
rpcWorker.Append(rpcWorker.Create(OpCodes.Ldstr, rpcName));
|
rpcWorker.Append(rpcWorker.Create(OpCodes.Ldstr, rpcName));
|
||||||
@ -119,15 +130,13 @@ public static bool ProcessMethodsValidateTargetRpc(TypeDefinition td, MethodDefi
|
|||||||
|
|
||||||
if (md.Name.Length > prefixLen && md.Name.Substring(0, prefixLen) != targetPrefix)
|
if (md.Name.Length > prefixLen && md.Name.Substring(0, prefixLen) != targetPrefix)
|
||||||
{
|
{
|
||||||
Log.Error("Target Rpc function [" + td.FullName + ":" + md.Name + "] doesnt have 'Target' prefix");
|
Weaver.Error("Target Rpc function [" + td.FullName + ":" + md.Name + "] doesnt have 'Target' prefix");
|
||||||
Weaver.fail = true;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (md.IsStatic)
|
if (md.IsStatic)
|
||||||
{
|
{
|
||||||
Log.Error("TargetRpc function [" + td.FullName + ":" + md.Name + "] cant be a static method");
|
Weaver.Error("TargetRpc function [" + td.FullName + ":" + md.Name + "] cant be a static method");
|
||||||
Weaver.fail = true;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -136,22 +145,8 @@ public static bool ProcessMethodsValidateTargetRpc(TypeDefinition td, MethodDefi
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (md.Parameters.Count < 1)
|
|
||||||
{
|
|
||||||
Log.Error("Target Rpc function [" + td.FullName + ":" + md.Name + "] must have a NetworkConnection as the first parameter");
|
|
||||||
Weaver.fail = true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (md.Parameters[0].ParameterType.FullName != Weaver.NetworkConnectionType.FullName)
|
|
||||||
{
|
|
||||||
Log.Error("Target Rpc function [" + td.FullName + ":" + md.Name + "] first parameter must be a NetworkConnection");
|
|
||||||
Weaver.fail = true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// validate
|
// validate
|
||||||
return NetworkBehaviourProcessor.ProcessMethodsValidateParameters(td, md, ca, "Target Rpc");
|
return NetworkBehaviourProcessor.ProcessMethodsValidateParameters(td, md, ca, "Target Rpc");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: fb3ce6c6f3f2942ae88178b86f5a8282
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -23,15 +23,15 @@ public static void Error(string msg)
|
|||||||
|
|
||||||
public class Program
|
public class Program
|
||||||
{
|
{
|
||||||
public static bool Process(string unityEngine, string unetDLL, string outputDirectory, string[] assemblies, string[] extraAssemblyPaths, IAssemblyResolver assemblyResolver, Action<string> printWarning, Action<string> printError)
|
public static bool Process(string unityEngine, string netDLL, string outputDirectory, string[] assemblies, string[] extraAssemblyPaths, Action<string> printWarning, Action<string> printError)
|
||||||
{
|
{
|
||||||
CheckDLLPath(unityEngine);
|
CheckDLLPath(unityEngine);
|
||||||
CheckDLLPath(unetDLL);
|
CheckDLLPath(netDLL);
|
||||||
CheckOutputDirectory(outputDirectory);
|
CheckOutputDirectory(outputDirectory);
|
||||||
CheckAssemblies(assemblies);
|
CheckAssemblies(assemblies);
|
||||||
Log.WarningMethod = printWarning;
|
Log.WarningMethod = printWarning;
|
||||||
Log.ErrorMethod = printError;
|
Log.ErrorMethod = printError;
|
||||||
return Weaver.WeaveAssemblies(assemblies, extraAssemblyPaths, assemblyResolver, outputDirectory, unityEngine, unetDLL);
|
return Weaver.WeaveAssemblies(assemblies, extraAssemblyPaths, null, outputDirectory, unityEngine, netDLL);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void CheckDLLPath(string path)
|
private static void CheckDLLPath(string path)
|
11
Assets/Mirror/Editor/Weaver/Program.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 2a21c60c40a4c4d679c2b71a7c40882e
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -15,8 +15,7 @@ public static MethodReference ResolveMethod(TypeReference tr, AssemblyDefinition
|
|||||||
//Console.WriteLine("ResolveMethod " + t.ToString () + " " + name);
|
//Console.WriteLine("ResolveMethod " + t.ToString () + " " + name);
|
||||||
if (tr == null)
|
if (tr == null)
|
||||||
{
|
{
|
||||||
Log.Error("Type missing for " + name);
|
Weaver.Error("Type missing for " + name);
|
||||||
Weaver.fail = true;
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
foreach (MethodDefinition methodRef in tr.Resolve().Methods)
|
foreach (MethodDefinition methodRef in tr.Resolve().Methods)
|
||||||
@ -26,15 +25,14 @@ public static MethodReference ResolveMethod(TypeReference tr, AssemblyDefinition
|
|||||||
return scriptDef.MainModule.ImportReference(methodRef);
|
return scriptDef.MainModule.ImportReference(methodRef);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Log.Error("ResolveMethod failed " + tr.Name + "::" + name + " " + tr.Resolve());
|
Weaver.Error("ResolveMethod failed " + tr.Name + "::" + name + " " + tr.Resolve());
|
||||||
|
|
||||||
// why did it fail!?
|
// why did it fail!?
|
||||||
foreach (MethodDefinition methodRef in tr.Resolve().Methods)
|
foreach (MethodDefinition methodRef in tr.Resolve().Methods)
|
||||||
{
|
{
|
||||||
Log.Error("Method " + methodRef.Name);
|
Weaver.Error("Method " + methodRef.Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
Weaver.fail = true;
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,8 +41,7 @@ public static MethodReference ResolveMethodInParents(TypeReference tr, AssemblyD
|
|||||||
{
|
{
|
||||||
if (tr == null)
|
if (tr == null)
|
||||||
{
|
{
|
||||||
Log.Error("Type missing for " + name);
|
Weaver.Error("Type missing for " + name);
|
||||||
Weaver.fail = true;
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
foreach (MethodDefinition methodRef in tr.Resolve().Methods)
|
foreach (MethodDefinition methodRef in tr.Resolve().Methods)
|
||||||
@ -74,8 +71,7 @@ public static MethodReference ResolveMethodWithArg(TypeReference tr, AssemblyDef
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Log.Error("ResolveMethodWithArg failed " + tr.Name + "::" + name + " " + argTypeFullName);
|
Weaver.Error("ResolveMethodWithArg failed " + tr.Name + "::" + name + " " + argTypeFullName);
|
||||||
Weaver.fail = true;
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -121,8 +117,7 @@ public static GenericInstanceMethod ResolveMethodGeneric(TypeReference t, Assemb
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.Error("ResolveMethodGeneric failed " + t.Name + "::" + name + " " + genericType);
|
Weaver.Error("ResolveMethodGeneric failed " + t.Name + "::" + name + " " + genericType);
|
||||||
Weaver.fail = true;
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,4 +145,4 @@ public static MethodReference ResolveProperty(TypeReference tr, AssemblyDefiniti
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
11
Assets/Mirror/Editor/Weaver/Resolvers.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 3039a59c76aec43c797ad66930430367
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
@ -38,14 +38,29 @@ class WeaverLists
|
|||||||
|
|
||||||
class Weaver
|
class Weaver
|
||||||
{
|
{
|
||||||
// UNetwork types
|
public static WeaverLists WeaveLists { get; private set; }
|
||||||
|
public static AssemblyDefinition CurrentAssembly { get; private set; }
|
||||||
|
public static ModuleDefinition CorLibModule { get; private set; }
|
||||||
|
public static AssemblyDefinition UnityAssembly { get; private set; }
|
||||||
|
public static AssemblyDefinition NetAssembly { get; private set; }
|
||||||
|
public static bool WeavingFailed { get; private set; }
|
||||||
|
public static bool GenerateLogErrors { get; set; }
|
||||||
|
|
||||||
|
// private properties
|
||||||
|
static bool DebugLogEnabled = true;
|
||||||
|
|
||||||
|
// this is used to prevent stack overflows when generating serialization code when there are self-referencing types.
|
||||||
|
// All the utility classes use GetWriteFunc() to generate serialization code, so the recursion check is implemented there instead of in each utility class.
|
||||||
|
// A NetworkBehaviour with the max SyncVars (64) can legitimately increment this value to 65 - so max must be higher than that
|
||||||
|
const int MaxRecursionCount = 128;
|
||||||
|
static int RecursionCount;
|
||||||
|
|
||||||
|
// Network types
|
||||||
public static TypeReference NetworkBehaviourType;
|
public static TypeReference NetworkBehaviourType;
|
||||||
public static TypeReference NetworkBehaviourType2;
|
public static TypeReference NetworkBehaviourType2;
|
||||||
public static TypeReference MonoBehaviourType;
|
public static TypeReference MonoBehaviourType;
|
||||||
public static TypeReference ScriptableObjectType;
|
public static TypeReference ScriptableObjectType;
|
||||||
public static TypeReference NetworkConnectionType;
|
public static TypeReference NetworkConnectionType;
|
||||||
public static TypeReference ULocalConnectionToServerType;
|
|
||||||
public static TypeReference ULocalConnectionToClientType;
|
|
||||||
|
|
||||||
public static TypeReference MessageBaseType;
|
public static TypeReference MessageBaseType;
|
||||||
public static TypeReference SyncListStructType;
|
public static TypeReference SyncListStructType;
|
||||||
@ -63,7 +78,7 @@ class Weaver
|
|||||||
public static MethodReference NetworkWriterCtor;
|
public static MethodReference NetworkWriterCtor;
|
||||||
public static MethodReference NetworkReaderCtor;
|
public static MethodReference NetworkReaderCtor;
|
||||||
public static MethodReference getComponentReference;
|
public static MethodReference getComponentReference;
|
||||||
public static MethodReference getUNetIdReference;
|
public static MethodReference getNetIdReference;
|
||||||
public static TypeReference NetworkIdentityType;
|
public static TypeReference NetworkIdentityType;
|
||||||
public static TypeReference IEnumeratorType;
|
public static TypeReference IEnumeratorType;
|
||||||
|
|
||||||
@ -156,60 +171,50 @@ class Weaver
|
|||||||
public static MethodReference sendTargetRpcInternal;
|
public static MethodReference sendTargetRpcInternal;
|
||||||
public static MethodReference sendEventInternal;
|
public static MethodReference sendEventInternal;
|
||||||
|
|
||||||
public static WeaverLists lists;
|
|
||||||
|
|
||||||
public static AssemblyDefinition scriptDef;
|
|
||||||
public static ModuleDefinition corLib;
|
|
||||||
public static AssemblyDefinition m_UnityAssemblyDefinition;
|
|
||||||
public static AssemblyDefinition m_UNetAssemblyDefinition;
|
|
||||||
|
|
||||||
static bool m_DebugFlag = true;
|
|
||||||
|
|
||||||
public static bool fail;
|
|
||||||
public static bool generateLogErrors = false;
|
|
||||||
|
|
||||||
// this is used to prevent stack overflows when generating serialization code when there are self-referencing types.
|
|
||||||
// All the utility classes use GetWriteFunc() to generate serialization code, so the recursion check is implemented there instead of in each utility class.
|
|
||||||
// A NetworkBehaviour with the max SyncVars (32) can legitimately increment this value to 65 - so max must be higher than that
|
|
||||||
const int MaxRecursionCount = 128;
|
|
||||||
static int s_RecursionCount;
|
|
||||||
public static void ResetRecursionCount()
|
public static void ResetRecursionCount()
|
||||||
{
|
{
|
||||||
s_RecursionCount = 0;
|
RecursionCount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void DLog(TypeDefinition td, string fmt, params object[] args)
|
public static void DLog(TypeDefinition td, string fmt, params object[] args)
|
||||||
{
|
{
|
||||||
if (!m_DebugFlag)
|
if (!DebugLogEnabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Console.WriteLine("[" + td.Name + "] " + String.Format(fmt, args));
|
Console.WriteLine("[" + td.Name + "] " + String.Format(fmt, args));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// display weaver error
|
||||||
|
// and mark process as failed
|
||||||
|
public static void Error(string message)
|
||||||
|
{
|
||||||
|
Log.Error(message);
|
||||||
|
WeavingFailed = true;
|
||||||
|
}
|
||||||
|
|
||||||
public static int GetSyncVarStart(string className)
|
public static int GetSyncVarStart(string className)
|
||||||
{
|
{
|
||||||
return lists.numSyncVars.ContainsKey(className)
|
return WeaveLists.numSyncVars.ContainsKey(className)
|
||||||
? lists.numSyncVars[className]
|
? WeaveLists.numSyncVars[className]
|
||||||
: 0;
|
: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SetNumSyncVars(string className, int num)
|
public static void SetNumSyncVars(string className, int num)
|
||||||
{
|
{
|
||||||
lists.numSyncVars[className] = num;
|
WeaveLists.numSyncVars[className] = num;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MethodReference GetWriteFunc(TypeReference variable)
|
public static MethodReference GetWriteFunc(TypeReference variable)
|
||||||
{
|
{
|
||||||
if (s_RecursionCount++ > MaxRecursionCount)
|
if (RecursionCount++ > MaxRecursionCount)
|
||||||
{
|
{
|
||||||
Log.Error("GetWriteFunc recursion depth exceeded for " + variable.Name + ". Check for self-referencing member variables.");
|
Error("GetWriteFunc recursion depth exceeded for " + variable.Name + ". Check for self-referencing member variables.");
|
||||||
fail = true;
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lists.writeFuncs.ContainsKey(variable.FullName))
|
if (WeaveLists.writeFuncs.ContainsKey(variable.FullName))
|
||||||
{
|
{
|
||||||
MethodReference foundFunc = lists.writeFuncs[variable.FullName];
|
MethodReference foundFunc = WeaveLists.writeFuncs[variable.FullName];
|
||||||
if (foundFunc.Parameters[0].ParameterType.IsArray == variable.IsArray)
|
if (foundFunc.Parameters[0].ParameterType.IsArray == variable.IsArray)
|
||||||
{
|
{
|
||||||
return foundFunc;
|
return foundFunc;
|
||||||
@ -219,7 +224,7 @@ public static MethodReference GetWriteFunc(TypeReference variable)
|
|||||||
if (variable.IsByReference)
|
if (variable.IsByReference)
|
||||||
{
|
{
|
||||||
// error??
|
// error??
|
||||||
Log.Error("GetWriteFunc variable.IsByReference error.");
|
Error("GetWriteFunc variable.IsByReference error.");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -256,18 +261,18 @@ public static MethodReference GetWriteFunc(TypeReference variable)
|
|||||||
|
|
||||||
public static void RegisterWriteFunc(string name, MethodDefinition newWriterFunc)
|
public static void RegisterWriteFunc(string name, MethodDefinition newWriterFunc)
|
||||||
{
|
{
|
||||||
lists.writeFuncs[name] = newWriterFunc;
|
WeaveLists.writeFuncs[name] = newWriterFunc;
|
||||||
lists.generatedWriteFunctions.Add(newWriterFunc);
|
WeaveLists.generatedWriteFunctions.Add(newWriterFunc);
|
||||||
|
|
||||||
ConfirmGeneratedCodeClass(scriptDef.MainModule);
|
ConfirmGeneratedCodeClass(CurrentAssembly.MainModule);
|
||||||
lists.generateContainerClass.Methods.Add(newWriterFunc);
|
WeaveLists.generateContainerClass.Methods.Add(newWriterFunc);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MethodReference GetReadFunc(TypeReference variable)
|
public static MethodReference GetReadFunc(TypeReference variable)
|
||||||
{
|
{
|
||||||
if (lists.readFuncs.ContainsKey(variable.FullName))
|
if (WeaveLists.readFuncs.ContainsKey(variable.FullName))
|
||||||
{
|
{
|
||||||
MethodReference foundFunc = lists.readFuncs[variable.FullName];
|
MethodReference foundFunc = WeaveLists.readFuncs[variable.FullName];
|
||||||
if (foundFunc.ReturnType.IsArray == variable.IsArray)
|
if (foundFunc.ReturnType.IsArray == variable.IsArray)
|
||||||
{
|
{
|
||||||
return foundFunc;
|
return foundFunc;
|
||||||
@ -277,14 +282,14 @@ public static MethodReference GetReadFunc(TypeReference variable)
|
|||||||
TypeDefinition td = variable.Resolve();
|
TypeDefinition td = variable.Resolve();
|
||||||
if (td == null)
|
if (td == null)
|
||||||
{
|
{
|
||||||
Log.Error("GetReadFunc unsupported type " + variable.FullName);
|
Error("GetReadFunc unsupported type " + variable.FullName);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (variable.IsByReference)
|
if (variable.IsByReference)
|
||||||
{
|
{
|
||||||
// error??
|
// error??
|
||||||
Log.Error("GetReadFunc variable.IsByReference error.");
|
Error("GetReadFunc variable.IsByReference error.");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -321,11 +326,11 @@ public static MethodReference GetReadFunc(TypeReference variable)
|
|||||||
|
|
||||||
public static void RegisterReadFunc(string name, MethodDefinition newReaderFunc)
|
public static void RegisterReadFunc(string name, MethodDefinition newReaderFunc)
|
||||||
{
|
{
|
||||||
lists.readFuncs[name] = newReaderFunc;
|
WeaveLists.readFuncs[name] = newReaderFunc;
|
||||||
lists.generatedReadFunctions.Add(newReaderFunc);
|
WeaveLists.generatedReadFunctions.Add(newReaderFunc);
|
||||||
|
|
||||||
ConfirmGeneratedCodeClass(scriptDef.MainModule);
|
ConfirmGeneratedCodeClass(CurrentAssembly.MainModule);
|
||||||
lists.generateContainerClass.Methods.Add(newReaderFunc);
|
WeaveLists.generateContainerClass.Methods.Add(newReaderFunc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static MethodDefinition GenerateArrayReadFunc(TypeReference variable, MethodReference elementReadFunc)
|
static MethodDefinition GenerateArrayReadFunc(TypeReference variable, MethodReference elementReadFunc)
|
||||||
@ -352,7 +357,7 @@ static MethodDefinition GenerateArrayReadFunc(TypeReference variable, MethodRefe
|
|||||||
MethodAttributes.HideBySig,
|
MethodAttributes.HideBySig,
|
||||||
variable);
|
variable);
|
||||||
|
|
||||||
readerFunc.Parameters.Add(new ParameterDefinition("reader", ParameterAttributes.None, scriptDef.MainModule.ImportReference(NetworkReaderType)));
|
readerFunc.Parameters.Add(new ParameterDefinition("reader", ParameterAttributes.None, CurrentAssembly.MainModule.ImportReference(NetworkReaderType)));
|
||||||
|
|
||||||
readerFunc.Body.Variables.Add(new VariableDefinition(int32Type));
|
readerFunc.Body.Variables.Add(new VariableDefinition(int32Type));
|
||||||
readerFunc.Body.Variables.Add(new VariableDefinition(variable));
|
readerFunc.Body.Variables.Add(new VariableDefinition(variable));
|
||||||
@ -435,8 +440,8 @@ static MethodDefinition GenerateArrayWriteFunc(TypeReference variable, MethodRef
|
|||||||
MethodAttributes.HideBySig,
|
MethodAttributes.HideBySig,
|
||||||
voidType);
|
voidType);
|
||||||
|
|
||||||
writerFunc.Parameters.Add(new ParameterDefinition("writer", ParameterAttributes.None, scriptDef.MainModule.ImportReference(NetworkWriterType)));
|
writerFunc.Parameters.Add(new ParameterDefinition("writer", ParameterAttributes.None, CurrentAssembly.MainModule.ImportReference(NetworkWriterType)));
|
||||||
writerFunc.Parameters.Add(new ParameterDefinition("value", ParameterAttributes.None, scriptDef.MainModule.ImportReference(variable)));
|
writerFunc.Parameters.Add(new ParameterDefinition("value", ParameterAttributes.None, CurrentAssembly.MainModule.ImportReference(variable)));
|
||||||
|
|
||||||
writerFunc.Body.Variables.Add(new VariableDefinition(uint16Type));
|
writerFunc.Body.Variables.Add(new VariableDefinition(uint16Type));
|
||||||
writerFunc.Body.Variables.Add(new VariableDefinition(uint16Type));
|
writerFunc.Body.Variables.Add(new VariableDefinition(uint16Type));
|
||||||
@ -523,8 +528,8 @@ static MethodDefinition GenerateWriterFunction(TypeReference variable)
|
|||||||
MethodAttributes.HideBySig,
|
MethodAttributes.HideBySig,
|
||||||
voidType);
|
voidType);
|
||||||
|
|
||||||
writerFunc.Parameters.Add(new ParameterDefinition("writer", ParameterAttributes.None, scriptDef.MainModule.ImportReference(NetworkWriterType)));
|
writerFunc.Parameters.Add(new ParameterDefinition("writer", ParameterAttributes.None, CurrentAssembly.MainModule.ImportReference(NetworkWriterType)));
|
||||||
writerFunc.Parameters.Add(new ParameterDefinition("value", ParameterAttributes.None, scriptDef.MainModule.ImportReference(variable)));
|
writerFunc.Parameters.Add(new ParameterDefinition("value", ParameterAttributes.None, CurrentAssembly.MainModule.ImportReference(variable)));
|
||||||
|
|
||||||
ILProcessor worker = writerFunc.Body.GetILProcessor();
|
ILProcessor worker = writerFunc.Body.GetILProcessor();
|
||||||
|
|
||||||
@ -536,15 +541,13 @@ static MethodDefinition GenerateWriterFunction(TypeReference variable)
|
|||||||
|
|
||||||
if (field.FieldType.Resolve().HasGenericParameters)
|
if (field.FieldType.Resolve().HasGenericParameters)
|
||||||
{
|
{
|
||||||
Weaver.fail = true;
|
Weaver.Error("WriteReadFunc for " + field.Name + " [" + field.FieldType + "/" + field.FieldType.FullName + "]. Cannot have generic parameters.");
|
||||||
Log.Error("WriteReadFunc for " + field.Name + " [" + field.FieldType + "/" + field.FieldType.FullName + "]. Cannot have generic parameters.");
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (field.FieldType.Resolve().IsInterface)
|
if (field.FieldType.Resolve().IsInterface)
|
||||||
{
|
{
|
||||||
Weaver.fail = true;
|
Weaver.Error("WriteReadFunc for " + field.Name + " [" + field.FieldType + "/" + field.FieldType.FullName + "]. Cannot be an interface.");
|
||||||
Log.Error("WriteReadFunc for " + field.Name + " [" + field.FieldType + "/" + field.FieldType.FullName + "]. Cannot be an interface.");
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -559,8 +562,7 @@ static MethodDefinition GenerateWriterFunction(TypeReference variable)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Log.Error("WriteReadFunc for " + field.Name + " type " + field.FieldType + " no supported");
|
Weaver.Error("WriteReadFunc for " + field.Name + " type " + field.FieldType + " no supported");
|
||||||
fail = true;
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -574,10 +576,9 @@ static MethodDefinition GenerateWriterFunction(TypeReference variable)
|
|||||||
|
|
||||||
static MethodDefinition GenerateReadFunction(TypeReference variable)
|
static MethodDefinition GenerateReadFunction(TypeReference variable)
|
||||||
{
|
{
|
||||||
if (s_RecursionCount++ > MaxRecursionCount)
|
if (RecursionCount++ > MaxRecursionCount)
|
||||||
{
|
{
|
||||||
Log.Error("GetReadFunc recursion depth exceeded for " + variable.Name + ". Check for self-referencing member variables.");
|
Weaver.Error("GetReadFunc recursion depth exceeded for " + variable.Name + ". Check for self-referencing member variables.");
|
||||||
fail = true;
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -607,7 +608,7 @@ static MethodDefinition GenerateReadFunction(TypeReference variable)
|
|||||||
readerFunc.Body.Variables.Add(new VariableDefinition(variable));
|
readerFunc.Body.Variables.Add(new VariableDefinition(variable));
|
||||||
readerFunc.Body.InitLocals = true;
|
readerFunc.Body.InitLocals = true;
|
||||||
|
|
||||||
readerFunc.Parameters.Add(new ParameterDefinition("reader", ParameterAttributes.None, scriptDef.MainModule.ImportReference(NetworkReaderType)));
|
readerFunc.Parameters.Add(new ParameterDefinition("reader", ParameterAttributes.None, CurrentAssembly.MainModule.ImportReference(NetworkReaderType)));
|
||||||
|
|
||||||
ILProcessor worker = readerFunc.Body.GetILProcessor();
|
ILProcessor worker = readerFunc.Body.GetILProcessor();
|
||||||
|
|
||||||
@ -650,8 +651,7 @@ static MethodDefinition GenerateReadFunction(TypeReference variable)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Log.Error("GetReadFunc for " + field.Name + " type " + field.FieldType + " no supported");
|
Weaver.Error("GetReadFunc for " + field.Name + " type " + field.FieldType + " no supported");
|
||||||
fail = true;
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -693,7 +693,7 @@ static void ProcessInstructionMethod(ModuleDefinition moduleDef, TypeDefinition
|
|||||||
// that's why we use dict<string,method>.
|
// that's why we use dict<string,method>.
|
||||||
// TODO maybe replaceEvents[md] would work too?
|
// TODO maybe replaceEvents[md] would work too?
|
||||||
MethodDefinition replacement;
|
MethodDefinition replacement;
|
||||||
if (lists.replaceEvents.TryGetValue(opField.Name, out replacement))
|
if (WeaveLists.replaceEvents.TryGetValue(opField.Name, out replacement))
|
||||||
{
|
{
|
||||||
instr.Operand = replacement;
|
instr.Operand = replacement;
|
||||||
inst.OpCode = OpCodes.Nop;
|
inst.OpCode = OpCodes.Nop;
|
||||||
@ -709,7 +709,7 @@ static void ProcessInstructionMethod(ModuleDefinition moduleDef, TypeDefinition
|
|||||||
// that's why we use dict<string,method>.
|
// that's why we use dict<string,method>.
|
||||||
// TODO maybe replaceMethods[md] would work too?
|
// TODO maybe replaceMethods[md] would work too?
|
||||||
MethodDefinition replacement;
|
MethodDefinition replacement;
|
||||||
if (lists.replaceMethods.TryGetValue(opMethodRef.FullName, out replacement))
|
if (WeaveLists.replaceMethods.TryGetValue(opMethodRef.FullName, out replacement))
|
||||||
{
|
{
|
||||||
//DLog(td, " replacing " + md.Name + ":" + i);
|
//DLog(td, " replacing " + md.Name + ":" + i);
|
||||||
instr.Operand = replacement;
|
instr.Operand = replacement;
|
||||||
@ -720,19 +720,19 @@ static void ProcessInstructionMethod(ModuleDefinition moduleDef, TypeDefinition
|
|||||||
|
|
||||||
static void ConfirmGeneratedCodeClass(ModuleDefinition moduleDef)
|
static void ConfirmGeneratedCodeClass(ModuleDefinition moduleDef)
|
||||||
{
|
{
|
||||||
if (lists.generateContainerClass == null)
|
if (WeaveLists.generateContainerClass == null)
|
||||||
{
|
{
|
||||||
lists.generateContainerClass = new TypeDefinition("Mirror", "GeneratedNetworkCode",
|
WeaveLists.generateContainerClass = new TypeDefinition("Mirror", "GeneratedNetworkCode",
|
||||||
TypeAttributes.BeforeFieldInit | TypeAttributes.Class | TypeAttributes.AnsiClass | TypeAttributes.Public | TypeAttributes.AutoClass,
|
TypeAttributes.BeforeFieldInit | TypeAttributes.Class | TypeAttributes.AnsiClass | TypeAttributes.Public | TypeAttributes.AutoClass,
|
||||||
objectType);
|
objectType);
|
||||||
|
|
||||||
const MethodAttributes methodAttributes = MethodAttributes.Public | MethodAttributes.HideBySig | MethodAttributes.SpecialName | MethodAttributes.RTSpecialName;
|
const MethodAttributes methodAttributes = MethodAttributes.Public | MethodAttributes.HideBySig | MethodAttributes.SpecialName | MethodAttributes.RTSpecialName;
|
||||||
MethodDefinition method = new MethodDefinition(".ctor", methodAttributes, voidType);
|
MethodDefinition method = new MethodDefinition(".ctor", methodAttributes, voidType);
|
||||||
method.Body.Instructions.Add(Instruction.Create(OpCodes.Ldarg_0));
|
method.Body.Instructions.Add(Instruction.Create(OpCodes.Ldarg_0));
|
||||||
method.Body.Instructions.Add(Instruction.Create(OpCodes.Call, Resolvers.ResolveMethod(objectType, scriptDef, ".ctor")));
|
method.Body.Instructions.Add(Instruction.Create(OpCodes.Call, Resolvers.ResolveMethod(objectType, CurrentAssembly, ".ctor")));
|
||||||
method.Body.Instructions.Add(Instruction.Create(OpCodes.Ret));
|
method.Body.Instructions.Add(Instruction.Create(OpCodes.Ret));
|
||||||
|
|
||||||
lists.generateContainerClass.Methods.Add(method);
|
WeaveLists.generateContainerClass.Methods.Add(method);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -745,7 +745,7 @@ static void ProcessInstructionSetterField(TypeDefinition td, MethodDefinition md
|
|||||||
|
|
||||||
// does it set a field that we replaced?
|
// does it set a field that we replaced?
|
||||||
MethodDefinition replacement;
|
MethodDefinition replacement;
|
||||||
if (lists.replacementSetterProperties.TryGetValue(opField, out replacement))
|
if (WeaveLists.replacementSetterProperties.TryGetValue(opField, out replacement))
|
||||||
{
|
{
|
||||||
//replace with property
|
//replace with property
|
||||||
//DLog(td, " replacing " + md.Name + ":" + i);
|
//DLog(td, " replacing " + md.Name + ":" + i);
|
||||||
@ -764,7 +764,7 @@ static void ProcessInstructionGetterField(TypeDefinition td, MethodDefinition md
|
|||||||
|
|
||||||
// does it set a field that we replaced?
|
// does it set a field that we replaced?
|
||||||
MethodDefinition replacement;
|
MethodDefinition replacement;
|
||||||
if (lists.replacementGetterProperties.TryGetValue(opField, out replacement))
|
if (WeaveLists.replacementGetterProperties.TryGetValue(opField, out replacement))
|
||||||
{
|
{
|
||||||
//replace with property
|
//replace with property
|
||||||
//DLog(td, " replacing " + md.Name + ":" + i);
|
//DLog(td, " replacing " + md.Name + ":" + i);
|
||||||
@ -972,19 +972,19 @@ static void ProcessSitesModule(ModuleDefinition moduleDef)
|
|||||||
ProcessSiteClass(moduleDef, td);
|
ProcessSiteClass(moduleDef, td);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (lists.generateContainerClass != null)
|
if (WeaveLists.generateContainerClass != null)
|
||||||
{
|
{
|
||||||
moduleDef.Types.Add(lists.generateContainerClass);
|
moduleDef.Types.Add(WeaveLists.generateContainerClass);
|
||||||
scriptDef.MainModule.ImportReference(lists.generateContainerClass);
|
CurrentAssembly.MainModule.ImportReference(WeaveLists.generateContainerClass);
|
||||||
|
|
||||||
foreach (MethodDefinition f in lists.generatedReadFunctions)
|
foreach (MethodDefinition f in WeaveLists.generatedReadFunctions)
|
||||||
{
|
{
|
||||||
scriptDef.MainModule.ImportReference(f);
|
CurrentAssembly.MainModule.ImportReference(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (MethodDefinition f in lists.generatedWriteFunctions)
|
foreach (MethodDefinition f in WeaveLists.generatedWriteFunctions)
|
||||||
{
|
{
|
||||||
scriptDef.MainModule.ImportReference(f);
|
CurrentAssembly.MainModule.ImportReference(f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Console.WriteLine(" ProcessSitesModule " + moduleDef.Name + " elapsed time:" + (DateTime.Now - startTime));
|
Console.WriteLine(" ProcessSitesModule " + moduleDef.Name + " elapsed time:" + (DateTime.Now - startTime));
|
||||||
@ -992,7 +992,7 @@ static void ProcessSitesModule(ModuleDefinition moduleDef)
|
|||||||
|
|
||||||
static void ProcessPropertySites()
|
static void ProcessPropertySites()
|
||||||
{
|
{
|
||||||
ProcessSitesModule(scriptDef.MainModule);
|
ProcessSitesModule(CurrentAssembly.MainModule);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool ProcessNetworkBehaviourType(TypeDefinition td)
|
static bool ProcessNetworkBehaviourType(TypeDefinition td)
|
||||||
@ -1010,29 +1010,29 @@ static bool ProcessNetworkBehaviourType(TypeDefinition td)
|
|||||||
|
|
||||||
static void SetupUnityTypes()
|
static void SetupUnityTypes()
|
||||||
{
|
{
|
||||||
vector2Type = m_UnityAssemblyDefinition.MainModule.GetType("UnityEngine.Vector2");
|
vector2Type = UnityAssembly.MainModule.GetType("UnityEngine.Vector2");
|
||||||
vector3Type = m_UnityAssemblyDefinition.MainModule.GetType("UnityEngine.Vector3");
|
vector3Type = UnityAssembly.MainModule.GetType("UnityEngine.Vector3");
|
||||||
vector4Type = m_UnityAssemblyDefinition.MainModule.GetType("UnityEngine.Vector4");
|
vector4Type = UnityAssembly.MainModule.GetType("UnityEngine.Vector4");
|
||||||
colorType = m_UnityAssemblyDefinition.MainModule.GetType("UnityEngine.Color");
|
colorType = UnityAssembly.MainModule.GetType("UnityEngine.Color");
|
||||||
color32Type = m_UnityAssemblyDefinition.MainModule.GetType("UnityEngine.Color32");
|
color32Type = UnityAssembly.MainModule.GetType("UnityEngine.Color32");
|
||||||
quaternionType = m_UnityAssemblyDefinition.MainModule.GetType("UnityEngine.Quaternion");
|
quaternionType = UnityAssembly.MainModule.GetType("UnityEngine.Quaternion");
|
||||||
rectType = m_UnityAssemblyDefinition.MainModule.GetType("UnityEngine.Rect");
|
rectType = UnityAssembly.MainModule.GetType("UnityEngine.Rect");
|
||||||
planeType = m_UnityAssemblyDefinition.MainModule.GetType("UnityEngine.Plane");
|
planeType = UnityAssembly.MainModule.GetType("UnityEngine.Plane");
|
||||||
rayType = m_UnityAssemblyDefinition.MainModule.GetType("UnityEngine.Ray");
|
rayType = UnityAssembly.MainModule.GetType("UnityEngine.Ray");
|
||||||
matrixType = m_UnityAssemblyDefinition.MainModule.GetType("UnityEngine.Matrix4x4");
|
matrixType = UnityAssembly.MainModule.GetType("UnityEngine.Matrix4x4");
|
||||||
gameObjectType = m_UnityAssemblyDefinition.MainModule.GetType("UnityEngine.GameObject");
|
gameObjectType = UnityAssembly.MainModule.GetType("UnityEngine.GameObject");
|
||||||
transformType = m_UnityAssemblyDefinition.MainModule.GetType("UnityEngine.Transform");
|
transformType = UnityAssembly.MainModule.GetType("UnityEngine.Transform");
|
||||||
unityObjectType = m_UnityAssemblyDefinition.MainModule.GetType("UnityEngine.Object");
|
unityObjectType = UnityAssembly.MainModule.GetType("UnityEngine.Object");
|
||||||
|
|
||||||
NetworkClientType = m_UNetAssemblyDefinition.MainModule.GetType("Mirror.NetworkClient");
|
NetworkClientType = NetAssembly.MainModule.GetType("Mirror.NetworkClient");
|
||||||
NetworkServerType = m_UNetAssemblyDefinition.MainModule.GetType("Mirror.NetworkServer");
|
NetworkServerType = NetAssembly.MainModule.GetType("Mirror.NetworkServer");
|
||||||
|
|
||||||
SyncVarType = m_UNetAssemblyDefinition.MainModule.GetType("Mirror.SyncVarAttribute");
|
SyncVarType = NetAssembly.MainModule.GetType("Mirror.SyncVarAttribute");
|
||||||
CommandType = m_UNetAssemblyDefinition.MainModule.GetType("Mirror.CommandAttribute");
|
CommandType = NetAssembly.MainModule.GetType("Mirror.CommandAttribute");
|
||||||
ClientRpcType = m_UNetAssemblyDefinition.MainModule.GetType("Mirror.ClientRpcAttribute");
|
ClientRpcType = NetAssembly.MainModule.GetType("Mirror.ClientRpcAttribute");
|
||||||
TargetRpcType = m_UNetAssemblyDefinition.MainModule.GetType("Mirror.TargetRpcAttribute");
|
TargetRpcType = NetAssembly.MainModule.GetType("Mirror.TargetRpcAttribute");
|
||||||
SyncEventType = m_UNetAssemblyDefinition.MainModule.GetType("Mirror.SyncEventAttribute");
|
SyncEventType = NetAssembly.MainModule.GetType("Mirror.SyncEventAttribute");
|
||||||
SyncObjectType = m_UNetAssemblyDefinition.MainModule.GetType("Mirror.SyncObject");
|
SyncObjectType = NetAssembly.MainModule.GetType("Mirror.SyncObject");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SetupCorLib()
|
static void SetupCorLib()
|
||||||
@ -1040,15 +1040,15 @@ static void SetupCorLib()
|
|||||||
AssemblyNameReference name = AssemblyNameReference.Parse("mscorlib");
|
AssemblyNameReference name = AssemblyNameReference.Parse("mscorlib");
|
||||||
ReaderParameters parameters = new ReaderParameters
|
ReaderParameters parameters = new ReaderParameters
|
||||||
{
|
{
|
||||||
AssemblyResolver = scriptDef.MainModule.AssemblyResolver,
|
AssemblyResolver = CurrentAssembly.MainModule.AssemblyResolver,
|
||||||
};
|
};
|
||||||
corLib = scriptDef.MainModule.AssemblyResolver.Resolve(name, parameters).MainModule;
|
CorLibModule = CurrentAssembly.MainModule.AssemblyResolver.Resolve(name, parameters).MainModule;
|
||||||
}
|
}
|
||||||
|
|
||||||
static TypeReference ImportCorLibType(string fullName)
|
static TypeReference ImportCorLibType(string fullName)
|
||||||
{
|
{
|
||||||
TypeDefinition type = corLib.GetType(fullName) ?? corLib.ExportedTypes.First(t => t.FullName == fullName).Resolve();
|
TypeDefinition type = CorLibModule.GetType(fullName) ?? CorLibModule.ExportedTypes.First(t => t.FullName == fullName).Resolve();
|
||||||
return scriptDef.MainModule.ImportReference(type);
|
return CurrentAssembly.MainModule.ImportReference(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SetupTargetTypes()
|
static void SetupTargetTypes()
|
||||||
@ -1076,108 +1076,102 @@ static void SetupTargetTypes()
|
|||||||
IEnumeratorType = ImportCorLibType("System.Collections.IEnumerator");
|
IEnumeratorType = ImportCorLibType("System.Collections.IEnumerator");
|
||||||
guidType = ImportCorLibType("System.Guid");
|
guidType = ImportCorLibType("System.Guid");
|
||||||
|
|
||||||
NetworkReaderType = m_UNetAssemblyDefinition.MainModule.GetType("Mirror.NetworkReader");
|
NetworkReaderType = NetAssembly.MainModule.GetType("Mirror.NetworkReader");
|
||||||
NetworkReaderDef = NetworkReaderType.Resolve();
|
NetworkReaderDef = NetworkReaderType.Resolve();
|
||||||
|
|
||||||
NetworkReaderCtor = Resolvers.ResolveMethod(NetworkReaderDef, scriptDef, ".ctor");
|
NetworkReaderCtor = Resolvers.ResolveMethod(NetworkReaderDef, CurrentAssembly, ".ctor");
|
||||||
|
|
||||||
NetworkWriterType = m_UNetAssemblyDefinition.MainModule.GetType("Mirror.NetworkWriter");
|
NetworkWriterType = NetAssembly.MainModule.GetType("Mirror.NetworkWriter");
|
||||||
NetworkWriterDef = NetworkWriterType.Resolve();
|
NetworkWriterDef = NetworkWriterType.Resolve();
|
||||||
|
|
||||||
NetworkWriterCtor = Resolvers.ResolveMethod(NetworkWriterDef, scriptDef, ".ctor");
|
NetworkWriterCtor = Resolvers.ResolveMethod(NetworkWriterDef, CurrentAssembly, ".ctor");
|
||||||
|
|
||||||
NetworkServerGetActive = Resolvers.ResolveMethod(NetworkServerType, scriptDef, "get_active");
|
NetworkServerGetActive = Resolvers.ResolveMethod(NetworkServerType, CurrentAssembly, "get_active");
|
||||||
NetworkServerGetLocalClientActive = Resolvers.ResolveMethod(NetworkServerType, scriptDef, "get_localClientActive");
|
NetworkServerGetLocalClientActive = Resolvers.ResolveMethod(NetworkServerType, CurrentAssembly, "get_localClientActive");
|
||||||
NetworkClientGetActive = Resolvers.ResolveMethod(NetworkClientType, scriptDef, "get_active");
|
NetworkClientGetActive = Resolvers.ResolveMethod(NetworkClientType, CurrentAssembly, "get_active");
|
||||||
|
|
||||||
NetworkReaderReadInt32 = Resolvers.ResolveMethod(NetworkReaderType, scriptDef, "ReadInt32");
|
NetworkReaderReadInt32 = Resolvers.ResolveMethod(NetworkReaderType, CurrentAssembly, "ReadInt32");
|
||||||
|
|
||||||
NetworkWriterWriteInt32 = Resolvers.ResolveMethodWithArg(NetworkWriterType, scriptDef, "Write", int32Type);
|
NetworkWriterWriteInt32 = Resolvers.ResolveMethodWithArg(NetworkWriterType, CurrentAssembly, "Write", int32Type);
|
||||||
NetworkWriterWriteInt16 = Resolvers.ResolveMethodWithArg(NetworkWriterType, scriptDef, "Write", int16Type);
|
NetworkWriterWriteInt16 = Resolvers.ResolveMethodWithArg(NetworkWriterType, CurrentAssembly, "Write", int16Type);
|
||||||
|
|
||||||
NetworkReaderReadPacked32 = Resolvers.ResolveMethod(NetworkReaderType, scriptDef, "ReadPackedUInt32");
|
NetworkReaderReadPacked32 = Resolvers.ResolveMethod(NetworkReaderType, CurrentAssembly, "ReadPackedUInt32");
|
||||||
NetworkReaderReadPacked64 = Resolvers.ResolveMethod(NetworkReaderType, scriptDef, "ReadPackedUInt64");
|
NetworkReaderReadPacked64 = Resolvers.ResolveMethod(NetworkReaderType, CurrentAssembly, "ReadPackedUInt64");
|
||||||
NetworkReaderReadByte = Resolvers.ResolveMethod(NetworkReaderType, scriptDef, "ReadByte");
|
NetworkReaderReadByte = Resolvers.ResolveMethod(NetworkReaderType, CurrentAssembly, "ReadByte");
|
||||||
|
|
||||||
NetworkWriterWritePacked32 = Resolvers.ResolveMethod(NetworkWriterType, scriptDef, "WritePackedUInt32");
|
NetworkWriterWritePacked32 = Resolvers.ResolveMethod(NetworkWriterType, CurrentAssembly, "WritePackedUInt32");
|
||||||
NetworkWriterWritePacked64 = Resolvers.ResolveMethod(NetworkWriterType, scriptDef, "WritePackedUInt64");
|
NetworkWriterWritePacked64 = Resolvers.ResolveMethod(NetworkWriterType, CurrentAssembly, "WritePackedUInt64");
|
||||||
|
|
||||||
NetworkReadUInt16 = Resolvers.ResolveMethod(NetworkReaderType, scriptDef, "ReadUInt16");
|
NetworkReadUInt16 = Resolvers.ResolveMethod(NetworkReaderType, CurrentAssembly, "ReadUInt16");
|
||||||
NetworkWriteUInt16 = Resolvers.ResolveMethodWithArg(NetworkWriterType, scriptDef, "Write", uint16Type);
|
NetworkWriteUInt16 = Resolvers.ResolveMethodWithArg(NetworkWriterType, CurrentAssembly, "Write", uint16Type);
|
||||||
|
|
||||||
CmdDelegateReference = m_UNetAssemblyDefinition.MainModule.GetType("Mirror.NetworkBehaviour/CmdDelegate");
|
CmdDelegateReference = NetAssembly.MainModule.GetType("Mirror.NetworkBehaviour/CmdDelegate");
|
||||||
CmdDelegateConstructor = Resolvers.ResolveMethod(CmdDelegateReference, scriptDef, ".ctor");
|
CmdDelegateConstructor = Resolvers.ResolveMethod(CmdDelegateReference, CurrentAssembly, ".ctor");
|
||||||
scriptDef.MainModule.ImportReference(gameObjectType);
|
CurrentAssembly.MainModule.ImportReference(gameObjectType);
|
||||||
scriptDef.MainModule.ImportReference(transformType);
|
CurrentAssembly.MainModule.ImportReference(transformType);
|
||||||
|
|
||||||
TypeReference unetViewTmp = m_UNetAssemblyDefinition.MainModule.GetType("Mirror.NetworkIdentity");
|
TypeReference netViewTmp = NetAssembly.MainModule.GetType("Mirror.NetworkIdentity");
|
||||||
NetworkIdentityType = scriptDef.MainModule.ImportReference(unetViewTmp);
|
NetworkIdentityType = CurrentAssembly.MainModule.ImportReference(netViewTmp);
|
||||||
|
|
||||||
NetworkBehaviourType = m_UNetAssemblyDefinition.MainModule.GetType("Mirror.NetworkBehaviour");
|
NetworkBehaviourType = NetAssembly.MainModule.GetType("Mirror.NetworkBehaviour");
|
||||||
NetworkBehaviourType2 = scriptDef.MainModule.ImportReference(NetworkBehaviourType);
|
NetworkBehaviourType2 = CurrentAssembly.MainModule.ImportReference(NetworkBehaviourType);
|
||||||
NetworkConnectionType = m_UNetAssemblyDefinition.MainModule.GetType("Mirror.NetworkConnection");
|
NetworkConnectionType = NetAssembly.MainModule.GetType("Mirror.NetworkConnection");
|
||||||
|
|
||||||
MonoBehaviourType = m_UnityAssemblyDefinition.MainModule.GetType("UnityEngine.MonoBehaviour");
|
MonoBehaviourType = UnityAssembly.MainModule.GetType("UnityEngine.MonoBehaviour");
|
||||||
ScriptableObjectType = m_UnityAssemblyDefinition.MainModule.GetType("UnityEngine.ScriptableObject");
|
ScriptableObjectType = UnityAssembly.MainModule.GetType("UnityEngine.ScriptableObject");
|
||||||
|
|
||||||
NetworkConnectionType = m_UNetAssemblyDefinition.MainModule.GetType("Mirror.NetworkConnection");
|
NetworkConnectionType = NetAssembly.MainModule.GetType("Mirror.NetworkConnection");
|
||||||
NetworkConnectionType = scriptDef.MainModule.ImportReference(NetworkConnectionType);
|
NetworkConnectionType = CurrentAssembly.MainModule.ImportReference(NetworkConnectionType);
|
||||||
|
|
||||||
ULocalConnectionToServerType = m_UNetAssemblyDefinition.MainModule.GetType("Mirror.ULocalConnectionToServer");
|
MessageBaseType = NetAssembly.MainModule.GetType("Mirror.MessageBase");
|
||||||
ULocalConnectionToServerType = scriptDef.MainModule.ImportReference(ULocalConnectionToServerType);
|
SyncListStructType = NetAssembly.MainModule.GetType("Mirror.SyncListSTRUCT`1");
|
||||||
|
|
||||||
ULocalConnectionToClientType = m_UNetAssemblyDefinition.MainModule.GetType("Mirror.ULocalConnectionToClient");
|
NetworkBehaviourDirtyBitsReference = Resolvers.ResolveProperty(NetworkBehaviourType, CurrentAssembly, "syncVarDirtyBits");
|
||||||
ULocalConnectionToClientType = scriptDef.MainModule.ImportReference(ULocalConnectionToClientType);
|
|
||||||
|
|
||||||
MessageBaseType = m_UNetAssemblyDefinition.MainModule.GetType("Mirror.MessageBase");
|
ComponentType = UnityAssembly.MainModule.GetType("UnityEngine.Component");
|
||||||
SyncListStructType = m_UNetAssemblyDefinition.MainModule.GetType("Mirror.SyncListSTRUCT`1");
|
ClientSceneType = NetAssembly.MainModule.GetType("Mirror.ClientScene");
|
||||||
|
ReadyConnectionReference = Resolvers.ResolveMethod(ClientSceneType, CurrentAssembly, "get_readyConnection");
|
||||||
NetworkBehaviourDirtyBitsReference = Resolvers.ResolveProperty(NetworkBehaviourType, scriptDef, "syncVarDirtyBits");
|
|
||||||
|
|
||||||
ComponentType = m_UnityAssemblyDefinition.MainModule.GetType("UnityEngine.Component");
|
|
||||||
ClientSceneType = m_UNetAssemblyDefinition.MainModule.GetType("Mirror.ClientScene");
|
|
||||||
ReadyConnectionReference = Resolvers.ResolveMethod(ClientSceneType, scriptDef, "get_readyConnection");
|
|
||||||
|
|
||||||
// get specialized GetComponent<NetworkIdentity>()
|
// get specialized GetComponent<NetworkIdentity>()
|
||||||
getComponentReference = Resolvers.ResolveMethodGeneric(ComponentType, scriptDef, "GetComponent", NetworkIdentityType);
|
getComponentReference = Resolvers.ResolveMethodGeneric(ComponentType, CurrentAssembly, "GetComponent", NetworkIdentityType);
|
||||||
|
|
||||||
getUNetIdReference = Resolvers.ResolveMethod(unetViewTmp, scriptDef, "get_netId");
|
getNetIdReference = Resolvers.ResolveMethod(netViewTmp, CurrentAssembly, "get_netId");
|
||||||
|
|
||||||
gameObjectInequality = Resolvers.ResolveMethod(unityObjectType, scriptDef, "op_Inequality");
|
gameObjectInequality = Resolvers.ResolveMethod(unityObjectType, CurrentAssembly, "op_Inequality");
|
||||||
|
|
||||||
UBehaviourIsServer = Resolvers.ResolveMethod(NetworkBehaviourType, scriptDef, "get_isServer");
|
UBehaviourIsServer = Resolvers.ResolveMethod(NetworkBehaviourType, CurrentAssembly, "get_isServer");
|
||||||
setSyncVarReference = Resolvers.ResolveMethod(NetworkBehaviourType, scriptDef, "SetSyncVar");
|
setSyncVarReference = Resolvers.ResolveMethod(NetworkBehaviourType, CurrentAssembly, "SetSyncVar");
|
||||||
setSyncVarHookGuard = Resolvers.ResolveMethod(NetworkBehaviourType, scriptDef, "set_syncVarHookGuard");
|
setSyncVarHookGuard = Resolvers.ResolveMethod(NetworkBehaviourType, CurrentAssembly, "set_syncVarHookGuard");
|
||||||
getSyncVarHookGuard = Resolvers.ResolveMethod(NetworkBehaviourType, scriptDef, "get_syncVarHookGuard");
|
getSyncVarHookGuard = Resolvers.ResolveMethod(NetworkBehaviourType, CurrentAssembly, "get_syncVarHookGuard");
|
||||||
|
|
||||||
setSyncVarGameObjectReference = Resolvers.ResolveMethod(NetworkBehaviourType, scriptDef, "SetSyncVarGameObject");
|
setSyncVarGameObjectReference = Resolvers.ResolveMethod(NetworkBehaviourType, CurrentAssembly, "SetSyncVarGameObject");
|
||||||
getSyncVarGameObjectReference = Resolvers.ResolveMethod(NetworkBehaviourType, scriptDef, "GetSyncVarGameObject");
|
getSyncVarGameObjectReference = Resolvers.ResolveMethod(NetworkBehaviourType, CurrentAssembly, "GetSyncVarGameObject");
|
||||||
setSyncVarNetworkIdentityReference = Resolvers.ResolveMethod(NetworkBehaviourType, scriptDef, "SetSyncVarNetworkIdentity");
|
setSyncVarNetworkIdentityReference = Resolvers.ResolveMethod(NetworkBehaviourType, CurrentAssembly, "SetSyncVarNetworkIdentity");
|
||||||
getSyncVarNetworkIdentityReference = Resolvers.ResolveMethod(NetworkBehaviourType, scriptDef, "GetSyncVarNetworkIdentity");
|
getSyncVarNetworkIdentityReference = Resolvers.ResolveMethod(NetworkBehaviourType, CurrentAssembly, "GetSyncVarNetworkIdentity");
|
||||||
registerCommandDelegateReference = Resolvers.ResolveMethod(NetworkBehaviourType, scriptDef, "RegisterCommandDelegate");
|
registerCommandDelegateReference = Resolvers.ResolveMethod(NetworkBehaviourType, CurrentAssembly, "RegisterCommandDelegate");
|
||||||
registerRpcDelegateReference = Resolvers.ResolveMethod(NetworkBehaviourType, scriptDef, "RegisterRpcDelegate");
|
registerRpcDelegateReference = Resolvers.ResolveMethod(NetworkBehaviourType, CurrentAssembly, "RegisterRpcDelegate");
|
||||||
registerEventDelegateReference = Resolvers.ResolveMethod(NetworkBehaviourType, scriptDef, "RegisterEventDelegate");
|
registerEventDelegateReference = Resolvers.ResolveMethod(NetworkBehaviourType, CurrentAssembly, "RegisterEventDelegate");
|
||||||
getTypeReference = Resolvers.ResolveMethod(objectType, scriptDef, "GetType");
|
getTypeReference = Resolvers.ResolveMethod(objectType, CurrentAssembly, "GetType");
|
||||||
getTypeFromHandleReference = Resolvers.ResolveMethod(typeType, scriptDef, "GetTypeFromHandle");
|
getTypeFromHandleReference = Resolvers.ResolveMethod(typeType, CurrentAssembly, "GetTypeFromHandle");
|
||||||
logErrorReference = Resolvers.ResolveMethod(m_UnityAssemblyDefinition.MainModule.GetType("UnityEngine.Debug"), scriptDef, "LogError");
|
logErrorReference = Resolvers.ResolveMethod(UnityAssembly.MainModule.GetType("UnityEngine.Debug"), CurrentAssembly, "LogError");
|
||||||
logWarningReference = Resolvers.ResolveMethod(m_UnityAssemblyDefinition.MainModule.GetType("UnityEngine.Debug"), scriptDef, "LogWarning");
|
logWarningReference = Resolvers.ResolveMethod(UnityAssembly.MainModule.GetType("UnityEngine.Debug"), CurrentAssembly, "LogWarning");
|
||||||
sendCommandInternal = Resolvers.ResolveMethod(NetworkBehaviourType, scriptDef, "SendCommandInternal");
|
sendCommandInternal = Resolvers.ResolveMethod(NetworkBehaviourType, CurrentAssembly, "SendCommandInternal");
|
||||||
sendRpcInternal = Resolvers.ResolveMethod(NetworkBehaviourType, scriptDef, "SendRPCInternal");
|
sendRpcInternal = Resolvers.ResolveMethod(NetworkBehaviourType, CurrentAssembly, "SendRPCInternal");
|
||||||
sendTargetRpcInternal = Resolvers.ResolveMethod(NetworkBehaviourType, scriptDef, "SendTargetRPCInternal");
|
sendTargetRpcInternal = Resolvers.ResolveMethod(NetworkBehaviourType, CurrentAssembly, "SendTargetRPCInternal");
|
||||||
sendEventInternal = Resolvers.ResolveMethod(NetworkBehaviourType, scriptDef, "SendEventInternal");
|
sendEventInternal = Resolvers.ResolveMethod(NetworkBehaviourType, CurrentAssembly, "SendEventInternal");
|
||||||
|
|
||||||
SyncObjectType = scriptDef.MainModule.ImportReference(SyncObjectType);
|
SyncObjectType = CurrentAssembly.MainModule.ImportReference(SyncObjectType);
|
||||||
InitSyncObjectReference = Resolvers.ResolveMethod(NetworkBehaviourType, scriptDef, "InitSyncObject");
|
InitSyncObjectReference = Resolvers.ResolveMethod(NetworkBehaviourType, CurrentAssembly, "InitSyncObject");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SetupReadFunctions()
|
static void SetupReadFunctions()
|
||||||
{
|
{
|
||||||
lists.readFuncs = new Dictionary<string, MethodReference>
|
WeaveLists.readFuncs = new Dictionary<string, MethodReference>
|
||||||
{
|
{
|
||||||
{ singleType.FullName, Resolvers.ResolveMethod(NetworkReaderType, scriptDef, "ReadSingle") },
|
{ singleType.FullName, Resolvers.ResolveMethod(NetworkReaderType, CurrentAssembly, "ReadSingle") },
|
||||||
{ doubleType.FullName, Resolvers.ResolveMethod(NetworkReaderType, scriptDef, "ReadDouble") },
|
{ doubleType.FullName, Resolvers.ResolveMethod(NetworkReaderType, CurrentAssembly, "ReadDouble") },
|
||||||
{ boolType.FullName, Resolvers.ResolveMethod(NetworkReaderType, scriptDef, "ReadBoolean") },
|
{ boolType.FullName, Resolvers.ResolveMethod(NetworkReaderType, CurrentAssembly, "ReadBoolean") },
|
||||||
{ stringType.FullName, Resolvers.ResolveMethod(NetworkReaderType, scriptDef, "ReadString") },
|
{ stringType.FullName, Resolvers.ResolveMethod(NetworkReaderType, CurrentAssembly, "ReadString") },
|
||||||
{ int64Type.FullName, NetworkReaderReadPacked64 },
|
{ int64Type.FullName, NetworkReaderReadPacked64 },
|
||||||
{ uint64Type.FullName, NetworkReaderReadPacked64 },
|
{ uint64Type.FullName, NetworkReaderReadPacked64 },
|
||||||
{ int32Type.FullName, NetworkReaderReadPacked32 },
|
{ int32Type.FullName, NetworkReaderReadPacked32 },
|
||||||
@ -1187,33 +1181,33 @@ static void SetupReadFunctions()
|
|||||||
{ byteType.FullName, NetworkReaderReadPacked32 },
|
{ byteType.FullName, NetworkReaderReadPacked32 },
|
||||||
{ sbyteType.FullName, NetworkReaderReadPacked32 },
|
{ sbyteType.FullName, NetworkReaderReadPacked32 },
|
||||||
{ charType.FullName, NetworkReaderReadPacked32 },
|
{ charType.FullName, NetworkReaderReadPacked32 },
|
||||||
{ decimalType.FullName, Resolvers.ResolveMethod(NetworkReaderType, scriptDef, "ReadDecimal") },
|
{ decimalType.FullName, Resolvers.ResolveMethod(NetworkReaderType, CurrentAssembly, "ReadDecimal") },
|
||||||
{ vector2Type.FullName, Resolvers.ResolveMethod(NetworkReaderType, scriptDef, "ReadVector2") },
|
{ vector2Type.FullName, Resolvers.ResolveMethod(NetworkReaderType, CurrentAssembly, "ReadVector2") },
|
||||||
{ vector3Type.FullName, Resolvers.ResolveMethod(NetworkReaderType, scriptDef, "ReadVector3") },
|
{ vector3Type.FullName, Resolvers.ResolveMethod(NetworkReaderType, CurrentAssembly, "ReadVector3") },
|
||||||
{ vector4Type.FullName, Resolvers.ResolveMethod(NetworkReaderType, scriptDef, "ReadVector4") },
|
{ vector4Type.FullName, Resolvers.ResolveMethod(NetworkReaderType, CurrentAssembly, "ReadVector4") },
|
||||||
{ colorType.FullName, Resolvers.ResolveMethod(NetworkReaderType, scriptDef, "ReadColor") },
|
{ colorType.FullName, Resolvers.ResolveMethod(NetworkReaderType, CurrentAssembly, "ReadColor") },
|
||||||
{ color32Type.FullName, Resolvers.ResolveMethod(NetworkReaderType, scriptDef, "ReadColor32") },
|
{ color32Type.FullName, Resolvers.ResolveMethod(NetworkReaderType, CurrentAssembly, "ReadColor32") },
|
||||||
{ quaternionType.FullName, Resolvers.ResolveMethod(NetworkReaderType, scriptDef, "ReadQuaternion") },
|
{ quaternionType.FullName, Resolvers.ResolveMethod(NetworkReaderType, CurrentAssembly, "ReadQuaternion") },
|
||||||
{ rectType.FullName, Resolvers.ResolveMethod(NetworkReaderType, scriptDef, "ReadRect") },
|
{ rectType.FullName, Resolvers.ResolveMethod(NetworkReaderType, CurrentAssembly, "ReadRect") },
|
||||||
{ planeType.FullName, Resolvers.ResolveMethod(NetworkReaderType, scriptDef, "ReadPlane") },
|
{ planeType.FullName, Resolvers.ResolveMethod(NetworkReaderType, CurrentAssembly, "ReadPlane") },
|
||||||
{ rayType.FullName, Resolvers.ResolveMethod(NetworkReaderType, scriptDef, "ReadRay") },
|
{ rayType.FullName, Resolvers.ResolveMethod(NetworkReaderType, CurrentAssembly, "ReadRay") },
|
||||||
{ matrixType.FullName, Resolvers.ResolveMethod(NetworkReaderType, scriptDef, "ReadMatrix4x4") },
|
{ matrixType.FullName, Resolvers.ResolveMethod(NetworkReaderType, CurrentAssembly, "ReadMatrix4x4") },
|
||||||
{ guidType.FullName, Resolvers.ResolveMethod(NetworkReaderType, scriptDef, "ReadGuid") },
|
{ guidType.FullName, Resolvers.ResolveMethod(NetworkReaderType, CurrentAssembly, "ReadGuid") },
|
||||||
{ gameObjectType.FullName, Resolvers.ResolveMethod(NetworkReaderType, scriptDef, "ReadGameObject") },
|
{ gameObjectType.FullName, Resolvers.ResolveMethod(NetworkReaderType, CurrentAssembly, "ReadGameObject") },
|
||||||
{ NetworkIdentityType.FullName, Resolvers.ResolveMethod(NetworkReaderType, scriptDef, "ReadNetworkIdentity") },
|
{ NetworkIdentityType.FullName, Resolvers.ResolveMethod(NetworkReaderType, CurrentAssembly, "ReadNetworkIdentity") },
|
||||||
{ transformType.FullName, Resolvers.ResolveMethod(NetworkReaderType, scriptDef, "ReadTransform") },
|
{ transformType.FullName, Resolvers.ResolveMethod(NetworkReaderType, CurrentAssembly, "ReadTransform") },
|
||||||
{ "System.Byte[]", Resolvers.ResolveMethod(NetworkReaderType, scriptDef, "ReadBytesAndSize") },
|
{ "System.Byte[]", Resolvers.ResolveMethod(NetworkReaderType, CurrentAssembly, "ReadBytesAndSize") },
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SetupWriteFunctions()
|
static void SetupWriteFunctions()
|
||||||
{
|
{
|
||||||
lists.writeFuncs = new Dictionary<string, MethodReference>
|
WeaveLists.writeFuncs = new Dictionary<string, MethodReference>
|
||||||
{
|
{
|
||||||
{ singleType.FullName, Resolvers.ResolveMethodWithArg(NetworkWriterType, scriptDef, "Write", singleType) },
|
{ singleType.FullName, Resolvers.ResolveMethodWithArg(NetworkWriterType, CurrentAssembly, "Write", singleType) },
|
||||||
{ doubleType.FullName, Resolvers.ResolveMethodWithArg(NetworkWriterType, scriptDef, "Write", doubleType) },
|
{ doubleType.FullName, Resolvers.ResolveMethodWithArg(NetworkWriterType, CurrentAssembly, "Write", doubleType) },
|
||||||
{ boolType.FullName, Resolvers.ResolveMethodWithArg(NetworkWriterType, scriptDef, "Write", boolType) },
|
{ boolType.FullName, Resolvers.ResolveMethodWithArg(NetworkWriterType, CurrentAssembly, "Write", boolType) },
|
||||||
{ stringType.FullName, Resolvers.ResolveMethodWithArg(NetworkWriterType, scriptDef, "Write", stringType) },
|
{ stringType.FullName, Resolvers.ResolveMethodWithArg(NetworkWriterType, CurrentAssembly, "Write", stringType) },
|
||||||
{ int64Type.FullName, NetworkWriterWritePacked64 },
|
{ int64Type.FullName, NetworkWriterWritePacked64 },
|
||||||
{ uint64Type.FullName, NetworkWriterWritePacked64 },
|
{ uint64Type.FullName, NetworkWriterWritePacked64 },
|
||||||
{ int32Type.FullName, NetworkWriterWritePacked32 },
|
{ int32Type.FullName, NetworkWriterWritePacked32 },
|
||||||
@ -1223,22 +1217,22 @@ static void SetupWriteFunctions()
|
|||||||
{ byteType.FullName, NetworkWriterWritePacked32 },
|
{ byteType.FullName, NetworkWriterWritePacked32 },
|
||||||
{ sbyteType.FullName, NetworkWriterWritePacked32 },
|
{ sbyteType.FullName, NetworkWriterWritePacked32 },
|
||||||
{ charType.FullName, NetworkWriterWritePacked32 },
|
{ charType.FullName, NetworkWriterWritePacked32 },
|
||||||
{ decimalType.FullName, Resolvers.ResolveMethodWithArg(NetworkWriterType, scriptDef, "Write", decimalType) },
|
{ decimalType.FullName, Resolvers.ResolveMethodWithArg(NetworkWriterType, CurrentAssembly, "Write", decimalType) },
|
||||||
{ vector2Type.FullName, Resolvers.ResolveMethodWithArg(NetworkWriterType, scriptDef, "Write", vector2Type) },
|
{ vector2Type.FullName, Resolvers.ResolveMethodWithArg(NetworkWriterType, CurrentAssembly, "Write", vector2Type) },
|
||||||
{ vector3Type.FullName, Resolvers.ResolveMethodWithArg(NetworkWriterType, scriptDef, "Write", vector3Type) },
|
{ vector3Type.FullName, Resolvers.ResolveMethodWithArg(NetworkWriterType, CurrentAssembly, "Write", vector3Type) },
|
||||||
{ vector4Type.FullName, Resolvers.ResolveMethodWithArg(NetworkWriterType, scriptDef, "Write", vector4Type) },
|
{ vector4Type.FullName, Resolvers.ResolveMethodWithArg(NetworkWriterType, CurrentAssembly, "Write", vector4Type) },
|
||||||
{ colorType.FullName, Resolvers.ResolveMethodWithArg(NetworkWriterType, scriptDef, "Write", colorType) },
|
{ colorType.FullName, Resolvers.ResolveMethodWithArg(NetworkWriterType, CurrentAssembly, "Write", colorType) },
|
||||||
{ color32Type.FullName, Resolvers.ResolveMethodWithArg(NetworkWriterType, scriptDef, "Write", color32Type) },
|
{ color32Type.FullName, Resolvers.ResolveMethodWithArg(NetworkWriterType, CurrentAssembly, "Write", color32Type) },
|
||||||
{ quaternionType.FullName, Resolvers.ResolveMethodWithArg(NetworkWriterType, scriptDef, "Write", quaternionType) },
|
{ quaternionType.FullName, Resolvers.ResolveMethodWithArg(NetworkWriterType, CurrentAssembly, "Write", quaternionType) },
|
||||||
{ rectType.FullName, Resolvers.ResolveMethodWithArg(NetworkWriterType, scriptDef, "Write", rectType) },
|
{ rectType.FullName, Resolvers.ResolveMethodWithArg(NetworkWriterType, CurrentAssembly, "Write", rectType) },
|
||||||
{ planeType.FullName, Resolvers.ResolveMethodWithArg(NetworkWriterType, scriptDef, "Write", planeType) },
|
{ planeType.FullName, Resolvers.ResolveMethodWithArg(NetworkWriterType, CurrentAssembly, "Write", planeType) },
|
||||||
{ rayType.FullName, Resolvers.ResolveMethodWithArg(NetworkWriterType, scriptDef, "Write", rayType) },
|
{ rayType.FullName, Resolvers.ResolveMethodWithArg(NetworkWriterType, CurrentAssembly, "Write", rayType) },
|
||||||
{ matrixType.FullName, Resolvers.ResolveMethodWithArg(NetworkWriterType, scriptDef, "Write", matrixType) },
|
{ matrixType.FullName, Resolvers.ResolveMethodWithArg(NetworkWriterType, CurrentAssembly, "Write", matrixType) },
|
||||||
{ guidType.FullName, Resolvers.ResolveMethodWithArg(NetworkWriterType, scriptDef, "Write", guidType) },
|
{ guidType.FullName, Resolvers.ResolveMethodWithArg(NetworkWriterType, CurrentAssembly, "Write", guidType) },
|
||||||
{ gameObjectType.FullName, Resolvers.ResolveMethodWithArg(NetworkWriterType, scriptDef, "Write", gameObjectType) },
|
{ gameObjectType.FullName, Resolvers.ResolveMethodWithArg(NetworkWriterType, CurrentAssembly, "Write", gameObjectType) },
|
||||||
{ NetworkIdentityType.FullName, Resolvers.ResolveMethodWithArg(NetworkWriterType, scriptDef, "Write", NetworkIdentityType) },
|
{ NetworkIdentityType.FullName, Resolvers.ResolveMethodWithArg(NetworkWriterType, CurrentAssembly, "Write", NetworkIdentityType) },
|
||||||
{ transformType.FullName, Resolvers.ResolveMethodWithArg(NetworkWriterType, scriptDef, "Write", transformType) },
|
{ transformType.FullName, Resolvers.ResolveMethodWithArg(NetworkWriterType, CurrentAssembly, "Write", transformType) },
|
||||||
{ "System.Byte[]", Resolvers.ResolveMethodWithArg(NetworkWriterType, scriptDef, "WriteBytesAndSize", "System.Byte[]") }
|
{ "System.Byte[]", Resolvers.ResolveMethodWithArg(NetworkWriterType, CurrentAssembly, "WriteBytesAndSize", "System.Byte[]") }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1252,14 +1246,13 @@ public static bool IsValidTypeToGenerate(TypeDefinition variable)
|
|||||||
// a valid type is a simple class or struct. so we generate only code for types we dont know, and if they are not inside
|
// a valid type is a simple class or struct. so we generate only code for types we dont know, and if they are not inside
|
||||||
// this assembly it must mean that we are trying to serialize a variable outside our scope. and this will fail.
|
// this assembly it must mean that we are trying to serialize a variable outside our scope. and this will fail.
|
||||||
|
|
||||||
string assembly = scriptDef.MainModule.Name;
|
string assembly = CurrentAssembly.MainModule.Name;
|
||||||
if (variable.Module.Name != assembly)
|
if (variable.Module.Name != assembly)
|
||||||
{
|
{
|
||||||
Log.Error("parameter [" + variable.Name +
|
Weaver.Error("parameter [" + variable.Name +
|
||||||
"] is of the type [" +
|
"] is of the type [" +
|
||||||
variable.FullName +
|
variable.FullName +
|
||||||
"] is not a valid type, please make sure to use a valid type.");
|
"] is not a valid type, please make sure to use a valid type.");
|
||||||
fail = true;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -1392,128 +1385,123 @@ static bool CheckSyncListStruct(TypeDefinition td)
|
|||||||
return didWork;
|
return didWork;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool Weave(string assName, IEnumerable<string> dependencies, IAssemblyResolver assemblyResolver, string unityEngineDLLPath, string unityUNetDLLPath, string outputDir)
|
static bool Weave(string assName, IEnumerable<string> dependencies, IAssemblyResolver assemblyResolver, string unityEngineDLLPath, string mirrorNetDLLPath, string outputDir)
|
||||||
{
|
{
|
||||||
ReaderParameters readParams = Helpers.ReaderParameters(assName, dependencies, assemblyResolver, unityEngineDLLPath, unityUNetDLLPath);
|
ReaderParameters readParams = Helpers.ReaderParameters(assName, dependencies, assemblyResolver, unityEngineDLLPath, mirrorNetDLLPath);
|
||||||
scriptDef = AssemblyDefinition.ReadAssembly(assName, readParams);
|
|
||||||
|
|
||||||
SetupTargetTypes();
|
string pdbToDelete = null;
|
||||||
SetupReadFunctions();
|
using (CurrentAssembly = AssemblyDefinition.ReadAssembly(assName, readParams))
|
||||||
SetupWriteFunctions();
|
|
||||||
|
|
||||||
ModuleDefinition moduleDefinition = scriptDef.MainModule;
|
|
||||||
Console.WriteLine("Script Module: {0}", moduleDefinition.Name);
|
|
||||||
|
|
||||||
// Process each NetworkBehaviour
|
|
||||||
bool didWork = false;
|
|
||||||
|
|
||||||
// We need to do 2 passes, because SyncListStructs might be referenced from other modules, so we must make sure we generate them first.
|
|
||||||
for (int pass = 0; pass < 2; pass++)
|
|
||||||
{
|
{
|
||||||
System.Diagnostics.Stopwatch watch = System.Diagnostics.Stopwatch.StartNew();
|
SetupTargetTypes();
|
||||||
foreach (TypeDefinition td in moduleDefinition.Types)
|
SetupReadFunctions();
|
||||||
|
SetupWriteFunctions();
|
||||||
|
|
||||||
|
ModuleDefinition moduleDefinition = CurrentAssembly.MainModule;
|
||||||
|
Console.WriteLine("Script Module: {0}", moduleDefinition.Name);
|
||||||
|
|
||||||
|
// Process each NetworkBehaviour
|
||||||
|
bool didWork = false;
|
||||||
|
|
||||||
|
// We need to do 2 passes, because SyncListStructs might be referenced from other modules, so we must make sure we generate them first.
|
||||||
|
for (int pass = 0; pass < 2; pass++)
|
||||||
{
|
{
|
||||||
if (td.IsClass && td.BaseType.CanBeResolved())
|
System.Diagnostics.Stopwatch watch = System.Diagnostics.Stopwatch.StartNew();
|
||||||
|
foreach (TypeDefinition td in moduleDefinition.Types)
|
||||||
{
|
{
|
||||||
try
|
if (td.IsClass && td.BaseType.CanBeResolved())
|
||||||
{
|
{
|
||||||
if (pass == 0)
|
try
|
||||||
{
|
{
|
||||||
didWork |= CheckSyncListStruct(td);
|
if (pass == 0)
|
||||||
|
{
|
||||||
|
didWork |= CheckSyncListStruct(td);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
didWork |= CheckNetworkBehaviour(td);
|
||||||
|
didWork |= CheckMessageBase(td);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
didWork |= CheckNetworkBehaviour(td);
|
if (CurrentAssembly.MainModule.SymbolReader != null)
|
||||||
didWork |= CheckMessageBase(td);
|
CurrentAssembly.MainModule.SymbolReader.Dispose();
|
||||||
|
Weaver.Error(ex.Message);
|
||||||
|
throw ex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
|
||||||
|
if (WeavingFailed)
|
||||||
{
|
{
|
||||||
if (scriptDef.MainModule.SymbolReader != null)
|
if (CurrentAssembly.MainModule.SymbolReader != null)
|
||||||
scriptDef.MainModule.SymbolReader.Dispose();
|
CurrentAssembly.MainModule.SymbolReader.Dispose();
|
||||||
fail = true;
|
return false;
|
||||||
throw ex;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
watch.Stop();
|
||||||
if (fail)
|
Console.WriteLine("Pass: " + pass + " took " + watch.ElapsedMilliseconds + " milliseconds");
|
||||||
{
|
|
||||||
if (scriptDef.MainModule.SymbolReader != null)
|
|
||||||
scriptDef.MainModule.SymbolReader.Dispose();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
watch.Stop();
|
|
||||||
Console.WriteLine("Pass: " + pass + " took " + watch.ElapsedMilliseconds + " milliseconds");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (didWork)
|
|
||||||
{
|
|
||||||
// this must be done for ALL code, not just NetworkBehaviours
|
|
||||||
try
|
|
||||||
{
|
|
||||||
ProcessPropertySites();
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
Log.Error("ProcessPropertySites exception: " + e);
|
|
||||||
if (scriptDef.MainModule.SymbolReader != null)
|
|
||||||
scriptDef.MainModule.SymbolReader.Dispose();
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fail)
|
if (didWork)
|
||||||
{
|
{
|
||||||
//Log.Error("Failed phase II.");
|
// this must be done for ALL code, not just NetworkBehaviours
|
||||||
if (scriptDef.MainModule.SymbolReader != null)
|
|
||||||
scriptDef.MainModule.SymbolReader.Dispose();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
string dest = Helpers.DestinationFileFor(outputDir, assName);
|
|
||||||
//Console.WriteLine ("Output:" + dest);
|
|
||||||
|
|
||||||
WriterParameters writeParams = Helpers.GetWriterParameters(readParams);
|
|
||||||
|
|
||||||
// PdbWriterProvider uses ISymUnmanagedWriter2 COM interface but Mono can't invoke a method on it and crashes (actually it first throws the following exception and then crashes).
|
|
||||||
// One solution would be to convert UNetWeaver to exe file and run it on .NET on Windows (I have tested that and it works).
|
|
||||||
// However it's much more simple to just write mdb file.
|
|
||||||
// System.NullReferenceException: Object reference not set to an instance of an object
|
|
||||||
// at(wrapper cominterop - invoke) Mono.Cecil.Pdb.ISymUnmanagedWriter2:DefineDocument(string, System.Guid &, System.Guid &, System.Guid &, Mono.Cecil.Pdb.ISymUnmanagedDocumentWriter &)
|
|
||||||
// at Mono.Cecil.Pdb.SymWriter.DefineDocument(System.String url, Guid language, Guid languageVendor, Guid documentType)[0x00000] in < filename unknown >:0
|
|
||||||
if (writeParams.SymbolWriterProvider is PdbWriterProvider)
|
|
||||||
{
|
|
||||||
writeParams.SymbolWriterProvider = new MdbWriterProvider();
|
|
||||||
// old pdb file is out of date so delete it. symbols will be stored in mdb
|
|
||||||
string pdb = Path.ChangeExtension(assName, ".pdb");
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
File.Delete(pdb);
|
ProcessPropertySites();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
// workaround until Unity fixes C#7 compiler compability with the UNET weaver
|
Log.Error("ProcessPropertySites exception: " + e);
|
||||||
UnityEngine.Debug.LogWarning(string.Format("Unable to delete file {0}: {1}", pdb, ex.Message));
|
if (CurrentAssembly.MainModule.SymbolReader != null)
|
||||||
|
CurrentAssembly.MainModule.SymbolReader.Dispose();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (WeavingFailed)
|
||||||
|
{
|
||||||
|
//Log.Error("Failed phase II.");
|
||||||
|
if (CurrentAssembly.MainModule.SymbolReader != null)
|
||||||
|
CurrentAssembly.MainModule.SymbolReader.Dispose();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
string dest = Helpers.DestinationFileFor(outputDir, assName);
|
||||||
|
//Console.WriteLine ("Output:" + dest);
|
||||||
|
|
||||||
|
WriterParameters writeParams = Helpers.GetWriterParameters(readParams);
|
||||||
|
CurrentAssembly.Write(dest, writeParams);
|
||||||
|
|
||||||
|
// PdbWriterProvider uses ISymUnmanagedWriter2 COM interface but Mono can't invoke a method on it and crashes (actually it first throws the following exception and then crashes).
|
||||||
|
// One solution would be to convert UNetWeaver to exe file and run it on .NET on Windows (I have tested that and it works).
|
||||||
|
// However it's much more simple to just write mdb file.
|
||||||
|
// System.NullReferenceException: Object reference not set to an instance of an object
|
||||||
|
// at(wrapper cominterop - invoke) Mono.Cecil.Pdb.ISymUnmanagedWriter2:DefineDocument(string, System.Guid &, System.Guid &, System.Guid &, Mono.Cecil.Pdb.ISymUnmanagedDocumentWriter &)
|
||||||
|
// at Mono.Cecil.Pdb.SymWriter.DefineDocument(System.String url, Guid language, Guid languageVendor, Guid documentType)[0x00000] in < filename unknown >:0
|
||||||
|
if (writeParams.SymbolWriterProvider is PdbWriterProvider)
|
||||||
|
{
|
||||||
|
writeParams.SymbolWriterProvider = new MdbWriterProvider();
|
||||||
|
// old pdb file is out of date so delete it. symbols will be stored in mdb
|
||||||
|
pdbToDelete = Path.ChangeExtension(assName, ".pdb");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
scriptDef.Write(dest, writeParams);
|
if (CurrentAssembly.MainModule.SymbolReader != null)
|
||||||
|
CurrentAssembly.MainModule.SymbolReader.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scriptDef.MainModule.SymbolReader != null)
|
if (pdbToDelete != null)
|
||||||
scriptDef.MainModule.SymbolReader.Dispose();
|
File.Delete(pdbToDelete);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool WeaveAssemblies(IEnumerable<string> assemblies, IEnumerable<string> dependencies, IAssemblyResolver assemblyResolver, string outputDir, string unityEngineDLLPath, string unityUNetDLLPath)
|
public static bool WeaveAssemblies(IEnumerable<string> assemblies, IEnumerable<string> dependencies, IAssemblyResolver assemblyResolver, string outputDir, string unityEngineDLLPath, string mirrorNetDLLPath)
|
||||||
{
|
{
|
||||||
fail = false;
|
WeavingFailed = false;
|
||||||
lists = new WeaverLists();
|
WeaveLists = new WeaverLists();
|
||||||
|
|
||||||
m_UnityAssemblyDefinition = AssemblyDefinition.ReadAssembly(unityEngineDLLPath);
|
UnityAssembly = AssemblyDefinition.ReadAssembly(unityEngineDLLPath);
|
||||||
m_UNetAssemblyDefinition = AssemblyDefinition.ReadAssembly(unityUNetDLLPath);
|
NetAssembly = AssemblyDefinition.ReadAssembly(mirrorNetDLLPath);
|
||||||
|
|
||||||
SetupUnityTypes();
|
SetupUnityTypes();
|
||||||
|
|
||||||
@ -1521,7 +1509,7 @@ public static bool WeaveAssemblies(IEnumerable<string> assemblies, IEnumerable<s
|
|||||||
{
|
{
|
||||||
foreach (string ass in assemblies)
|
foreach (string ass in assemblies)
|
||||||
{
|
{
|
||||||
if (!Weave(ass, dependencies, assemblyResolver, unityEngineDLLPath, unityUNetDLLPath, outputDir))
|
if (!Weave(ass, dependencies, assemblyResolver, unityEngineDLLPath, mirrorNetDLLPath, outputDir))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1532,7 +1520,7 @@ public static bool WeaveAssemblies(IEnumerable<string> assemblies, IEnumerable<s
|
|||||||
Log.Error("Exception :" + e);
|
Log.Error("Exception :" + e);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
corLib = null;
|
CorLibModule = null;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
11
Assets/Mirror/Editor/Weaver/Weaver.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: de160f52931054064852f2afd7e7a86f
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -1,7 +1,4 @@
|
|||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using Mirror;
|
|
||||||
|
|
||||||
namespace Mirror.Examples.Basic
|
namespace Mirror.Examples.Basic
|
||||||
{
|
{
|
||||||
@ -18,7 +15,7 @@ public class Player : NetworkBehaviour
|
|||||||
public override void OnStartServer()
|
public override void OnStartServer()
|
||||||
{
|
{
|
||||||
base.OnStartServer();
|
base.OnStartServer();
|
||||||
InvokeRepeating("UpdateData", 1, 1);
|
InvokeRepeating(nameof(UpdateData), 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateData()
|
public void UpdateData()
|
||||||
@ -31,7 +28,7 @@ public void Update()
|
|||||||
if (isLocalPlayer)
|
if (isLocalPlayer)
|
||||||
text.color = Color.red;
|
text.color = Color.red;
|
||||||
|
|
||||||
text.text = string.Format("Player {0}\ndata={1}", netId, data);
|
text.text = $"Player {netId}\ndata={data}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# Lobby Example
|
# Lobby Example
|
||||||
|
|
||||||
In Buld Settings, remove all scenes and add all of the scenes from the Examples\Lobbey\Scenes folder in the following order:
|
In Build Settings, remove all scenes and add all of the scenes from the Examples\Lobby\Scenes folder in the following order:
|
||||||
|
|
||||||
- Offline
|
- Offline
|
||||||
- Lobby
|
- Lobby
|
||||||
|
@ -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.1802836, g: 0.22571391, b: 0.3069226, a: 1}
|
m_IndirectSpecularColor: {r: 0.4616949, g: 0.5124162, b: 0.5899328, a: 1}
|
||||||
m_UseRadianceAmbientProbe: 0
|
m_UseRadianceAmbientProbe: 0
|
||||||
--- !u!157 &3
|
--- !u!157 &3
|
||||||
LightmapSettings:
|
LightmapSettings:
|
||||||
@ -50,7 +50,6 @@ LightmapSettings:
|
|||||||
m_BounceScale: 1
|
m_BounceScale: 1
|
||||||
m_IndirectOutputScale: 1
|
m_IndirectOutputScale: 1
|
||||||
m_AlbedoBoost: 1
|
m_AlbedoBoost: 1
|
||||||
m_TemporalCoherenceThreshold: 1
|
|
||||||
m_EnvironmentLightingMode: 0
|
m_EnvironmentLightingMode: 0
|
||||||
m_EnableBakedLightmaps: 1
|
m_EnableBakedLightmaps: 1
|
||||||
m_EnableRealtimeLightmaps: 1
|
m_EnableRealtimeLightmaps: 1
|
||||||
@ -118,7 +117,8 @@ NavMeshSettings:
|
|||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
m_PrefabInternal: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
serializedVersion: 6
|
serializedVersion: 6
|
||||||
m_Component:
|
m_Component:
|
||||||
- component: {fileID: 29930035}
|
- component: {fileID: 29930035}
|
||||||
@ -135,22 +135,24 @@ GameObject:
|
|||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
m_PrefabInternal: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 29930032}
|
m_GameObject: {fileID: 29930032}
|
||||||
m_Enabled: 1
|
m_Enabled: 1
|
||||||
m_EditorHideFlags: 0
|
m_EditorHideFlags: 0
|
||||||
m_Script: {fileID: 11500000, guid: 9b91ecbcc199f4492b9a91e820070131, type: 3}
|
m_Script: {fileID: 11500000, guid: 9b91ecbcc199f4492b9a91e820070131, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
m_SceneId: 0
|
|
||||||
m_ServerOnly: 1
|
m_ServerOnly: 1
|
||||||
m_LocalPlayerAuthority: 0
|
m_LocalPlayerAuthority: 0
|
||||||
m_AssetId:
|
m_AssetId:
|
||||||
|
m_SceneId: 6047645
|
||||||
--- !u!114 &29930034
|
--- !u!114 &29930034
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
m_PrefabInternal: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 29930032}
|
m_GameObject: {fileID: 29930032}
|
||||||
m_Enabled: 1
|
m_Enabled: 1
|
||||||
m_EditorHideFlags: 0
|
m_EditorHideFlags: 0
|
||||||
@ -159,12 +161,13 @@ MonoBehaviour:
|
|||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
syncInterval: 0.1
|
syncInterval: 0.1
|
||||||
prizePrefab: {fileID: 114251241889735402, guid: 52f1c9ea06cfd154cb68ff9d1b66fc13,
|
prizePrefab: {fileID: 114251241889735402, guid: 52f1c9ea06cfd154cb68ff9d1b66fc13,
|
||||||
type: 2}
|
type: 3}
|
||||||
--- !u!4 &29930035
|
--- !u!4 &29930035
|
||||||
Transform:
|
Transform:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
m_PrefabInternal: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 29930032}
|
m_GameObject: {fileID: 29930032}
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
@ -177,7 +180,8 @@ Transform:
|
|||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
m_PrefabInternal: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
serializedVersion: 6
|
serializedVersion: 6
|
||||||
m_Component:
|
m_Component:
|
||||||
- component: {fileID: 151116942}
|
- component: {fileID: 151116942}
|
||||||
@ -193,7 +197,8 @@ GameObject:
|
|||||||
Light:
|
Light:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
m_PrefabInternal: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 151116940}
|
m_GameObject: {fileID: 151116940}
|
||||||
m_Enabled: 1
|
m_Enabled: 1
|
||||||
serializedVersion: 8
|
serializedVersion: 8
|
||||||
@ -230,7 +235,8 @@ Light:
|
|||||||
Transform:
|
Transform:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
m_PrefabInternal: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 151116940}
|
m_GameObject: {fileID: 151116940}
|
||||||
m_LocalRotation: {x: 0.7071068, y: 0, z: 0, w: 0.7071068}
|
m_LocalRotation: {x: 0.7071068, y: 0, z: 0, w: 0.7071068}
|
||||||
m_LocalPosition: {x: 0, y: 10, z: 0}
|
m_LocalPosition: {x: 0, y: 10, z: 0}
|
||||||
@ -243,7 +249,8 @@ Transform:
|
|||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
m_PrefabInternal: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
serializedVersion: 6
|
serializedVersion: 6
|
||||||
m_Component:
|
m_Component:
|
||||||
- component: {fileID: 204334130}
|
- component: {fileID: 204334130}
|
||||||
@ -259,7 +266,8 @@ GameObject:
|
|||||||
Transform:
|
Transform:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
m_PrefabInternal: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 204334129}
|
m_GameObject: {fileID: 204334129}
|
||||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||||
m_LocalPosition: {x: 0, y: 0, z: -15}
|
m_LocalPosition: {x: 0, y: 0, z: -15}
|
||||||
@ -272,7 +280,8 @@ Transform:
|
|||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
m_PrefabInternal: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 204334129}
|
m_GameObject: {fileID: 204334129}
|
||||||
m_Enabled: 1
|
m_Enabled: 1
|
||||||
m_EditorHideFlags: 0
|
m_EditorHideFlags: 0
|
||||||
@ -283,7 +292,8 @@ MonoBehaviour:
|
|||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
m_PrefabInternal: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
serializedVersion: 6
|
serializedVersion: 6
|
||||||
m_Component:
|
m_Component:
|
||||||
- component: {fileID: 263230755}
|
- component: {fileID: 263230755}
|
||||||
@ -299,7 +309,8 @@ GameObject:
|
|||||||
Transform:
|
Transform:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
m_PrefabInternal: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 263230754}
|
m_GameObject: {fileID: 263230754}
|
||||||
m_LocalRotation: {x: 0, y: 0.38268343, z: 0, w: 0.92387956}
|
m_LocalRotation: {x: 0, y: 0.38268343, z: 0, w: 0.92387956}
|
||||||
m_LocalPosition: {x: -15, y: 0, z: -15}
|
m_LocalPosition: {x: -15, y: 0, z: -15}
|
||||||
@ -312,7 +323,8 @@ Transform:
|
|||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
m_PrefabInternal: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 263230754}
|
m_GameObject: {fileID: 263230754}
|
||||||
m_Enabled: 1
|
m_Enabled: 1
|
||||||
m_EditorHideFlags: 0
|
m_EditorHideFlags: 0
|
||||||
@ -323,7 +335,8 @@ MonoBehaviour:
|
|||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
m_PrefabInternal: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
serializedVersion: 6
|
serializedVersion: 6
|
||||||
m_Component:
|
m_Component:
|
||||||
- component: {fileID: 290557150}
|
- component: {fileID: 290557150}
|
||||||
@ -339,7 +352,8 @@ GameObject:
|
|||||||
Transform:
|
Transform:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
m_PrefabInternal: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 290557149}
|
m_GameObject: {fileID: 290557149}
|
||||||
m_LocalRotation: {x: 0, y: 0.7071068, z: 0, w: 0.7071068}
|
m_LocalRotation: {x: 0, y: 0.7071068, z: 0, w: 0.7071068}
|
||||||
m_LocalPosition: {x: -15, y: 0, z: 0}
|
m_LocalPosition: {x: -15, y: 0, z: 0}
|
||||||
@ -352,7 +366,8 @@ Transform:
|
|||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
m_PrefabInternal: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 290557149}
|
m_GameObject: {fileID: 290557149}
|
||||||
m_Enabled: 1
|
m_Enabled: 1
|
||||||
m_EditorHideFlags: 0
|
m_EditorHideFlags: 0
|
||||||
@ -363,7 +378,8 @@ MonoBehaviour:
|
|||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
m_PrefabInternal: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
serializedVersion: 6
|
serializedVersion: 6
|
||||||
m_Component:
|
m_Component:
|
||||||
- component: {fileID: 733367780}
|
- component: {fileID: 733367780}
|
||||||
@ -379,7 +395,8 @@ GameObject:
|
|||||||
Transform:
|
Transform:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
m_PrefabInternal: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 733367779}
|
m_GameObject: {fileID: 733367779}
|
||||||
m_LocalRotation: {x: -0, y: 1, z: -0, w: 0}
|
m_LocalRotation: {x: -0, y: 1, z: -0, w: 0}
|
||||||
m_LocalPosition: {x: 0, y: 0, z: 15}
|
m_LocalPosition: {x: 0, y: 0, z: 15}
|
||||||
@ -392,7 +409,8 @@ Transform:
|
|||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
m_PrefabInternal: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 733367779}
|
m_GameObject: {fileID: 733367779}
|
||||||
m_Enabled: 1
|
m_Enabled: 1
|
||||||
m_EditorHideFlags: 0
|
m_EditorHideFlags: 0
|
||||||
@ -403,7 +421,8 @@ MonoBehaviour:
|
|||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
m_PrefabInternal: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
serializedVersion: 6
|
serializedVersion: 6
|
||||||
m_Component:
|
m_Component:
|
||||||
- component: {fileID: 990635330}
|
- component: {fileID: 990635330}
|
||||||
@ -419,7 +438,8 @@ GameObject:
|
|||||||
Transform:
|
Transform:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
m_PrefabInternal: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 990635329}
|
m_GameObject: {fileID: 990635329}
|
||||||
m_LocalRotation: {x: 0, y: 0.92387956, z: 0, w: 0.38268343}
|
m_LocalRotation: {x: 0, y: 0.92387956, z: 0, w: 0.38268343}
|
||||||
m_LocalPosition: {x: -15, y: 0, z: 15}
|
m_LocalPosition: {x: -15, y: 0, z: 15}
|
||||||
@ -432,7 +452,8 @@ Transform:
|
|||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
m_PrefabInternal: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 990635329}
|
m_GameObject: {fileID: 990635329}
|
||||||
m_Enabled: 1
|
m_Enabled: 1
|
||||||
m_EditorHideFlags: 0
|
m_EditorHideFlags: 0
|
||||||
@ -443,7 +464,8 @@ MonoBehaviour:
|
|||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
m_PrefabInternal: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
serializedVersion: 6
|
serializedVersion: 6
|
||||||
m_Component:
|
m_Component:
|
||||||
- component: {fileID: 1050066545}
|
- component: {fileID: 1050066545}
|
||||||
@ -460,14 +482,16 @@ GameObject:
|
|||||||
AudioListener:
|
AudioListener:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
m_PrefabInternal: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 1050066542}
|
m_GameObject: {fileID: 1050066542}
|
||||||
m_Enabled: 1
|
m_Enabled: 1
|
||||||
--- !u!20 &1050066544
|
--- !u!20 &1050066544
|
||||||
Camera:
|
Camera:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
m_PrefabInternal: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 1050066542}
|
m_GameObject: {fileID: 1050066542}
|
||||||
m_Enabled: 1
|
m_Enabled: 1
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
@ -476,6 +500,7 @@ Camera:
|
|||||||
m_projectionMatrixMode: 1
|
m_projectionMatrixMode: 1
|
||||||
m_SensorSize: {x: 36, y: 24}
|
m_SensorSize: {x: 36, y: 24}
|
||||||
m_LensShift: {x: 0, y: 0}
|
m_LensShift: {x: 0, y: 0}
|
||||||
|
m_GateFitMode: 2
|
||||||
m_FocalLength: 50
|
m_FocalLength: 50
|
||||||
m_NormalizedViewPortRect:
|
m_NormalizedViewPortRect:
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
@ -507,7 +532,8 @@ Camera:
|
|||||||
Transform:
|
Transform:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
m_PrefabInternal: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 1050066542}
|
m_GameObject: {fileID: 1050066542}
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
m_LocalPosition: {x: 0, y: 2, z: -10}
|
m_LocalPosition: {x: 0, y: 2, z: -10}
|
||||||
@ -520,7 +546,8 @@ Transform:
|
|||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
m_PrefabInternal: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
serializedVersion: 6
|
serializedVersion: 6
|
||||||
m_Component:
|
m_Component:
|
||||||
- component: {fileID: 1305256745}
|
- component: {fileID: 1305256745}
|
||||||
@ -542,7 +569,8 @@ GameObject:
|
|||||||
BoxCollider:
|
BoxCollider:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
m_PrefabInternal: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 1305256737}
|
m_GameObject: {fileID: 1305256737}
|
||||||
m_Material: {fileID: 0}
|
m_Material: {fileID: 0}
|
||||||
m_IsTrigger: 0
|
m_IsTrigger: 0
|
||||||
@ -554,7 +582,8 @@ BoxCollider:
|
|||||||
BoxCollider:
|
BoxCollider:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
m_PrefabInternal: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 1305256737}
|
m_GameObject: {fileID: 1305256737}
|
||||||
m_Material: {fileID: 0}
|
m_Material: {fileID: 0}
|
||||||
m_IsTrigger: 0
|
m_IsTrigger: 0
|
||||||
@ -566,7 +595,8 @@ BoxCollider:
|
|||||||
BoxCollider:
|
BoxCollider:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
m_PrefabInternal: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 1305256737}
|
m_GameObject: {fileID: 1305256737}
|
||||||
m_Material: {fileID: 0}
|
m_Material: {fileID: 0}
|
||||||
m_IsTrigger: 0
|
m_IsTrigger: 0
|
||||||
@ -578,7 +608,8 @@ BoxCollider:
|
|||||||
BoxCollider:
|
BoxCollider:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
m_PrefabInternal: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 1305256737}
|
m_GameObject: {fileID: 1305256737}
|
||||||
m_Material: {fileID: 0}
|
m_Material: {fileID: 0}
|
||||||
m_IsTrigger: 0
|
m_IsTrigger: 0
|
||||||
@ -590,7 +621,8 @@ BoxCollider:
|
|||||||
MeshRenderer:
|
MeshRenderer:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
m_PrefabInternal: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 1305256737}
|
m_GameObject: {fileID: 1305256737}
|
||||||
m_Enabled: 1
|
m_Enabled: 1
|
||||||
m_CastShadows: 1
|
m_CastShadows: 1
|
||||||
@ -600,6 +632,7 @@ MeshRenderer:
|
|||||||
m_LightProbeUsage: 1
|
m_LightProbeUsage: 1
|
||||||
m_ReflectionProbeUsage: 1
|
m_ReflectionProbeUsage: 1
|
||||||
m_RenderingLayerMask: 4294967295
|
m_RenderingLayerMask: 4294967295
|
||||||
|
m_RendererPriority: 0
|
||||||
m_Materials:
|
m_Materials:
|
||||||
- {fileID: 2100000, guid: 3201636fa507dad448e9a36d66a80825, type: 2}
|
- {fileID: 2100000, guid: 3201636fa507dad448e9a36d66a80825, type: 2}
|
||||||
m_StaticBatchInfo:
|
m_StaticBatchInfo:
|
||||||
@ -625,7 +658,8 @@ MeshRenderer:
|
|||||||
MeshCollider:
|
MeshCollider:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
m_PrefabInternal: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 1305256737}
|
m_GameObject: {fileID: 1305256737}
|
||||||
m_Material: {fileID: 0}
|
m_Material: {fileID: 0}
|
||||||
m_IsTrigger: 0
|
m_IsTrigger: 0
|
||||||
@ -633,20 +667,21 @@ MeshCollider:
|
|||||||
serializedVersion: 3
|
serializedVersion: 3
|
||||||
m_Convex: 0
|
m_Convex: 0
|
||||||
m_CookingOptions: 14
|
m_CookingOptions: 14
|
||||||
m_SkinWidth: 0.01
|
|
||||||
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
|
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
--- !u!33 &1305256744
|
--- !u!33 &1305256744
|
||||||
MeshFilter:
|
MeshFilter:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
m_PrefabInternal: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 1305256737}
|
m_GameObject: {fileID: 1305256737}
|
||||||
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
|
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
--- !u!4 &1305256745
|
--- !u!4 &1305256745
|
||||||
Transform:
|
Transform:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
m_PrefabInternal: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 1305256737}
|
m_GameObject: {fileID: 1305256737}
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
@ -659,7 +694,8 @@ Transform:
|
|||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
m_PrefabInternal: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
serializedVersion: 6
|
serializedVersion: 6
|
||||||
m_Component:
|
m_Component:
|
||||||
- component: {fileID: 1445635740}
|
- component: {fileID: 1445635740}
|
||||||
@ -674,7 +710,8 @@ GameObject:
|
|||||||
Transform:
|
Transform:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
m_PrefabInternal: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 1445635739}
|
m_GameObject: {fileID: 1445635739}
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
m_LocalPosition: {x: 0, y: 1.08, z: 0}
|
m_LocalPosition: {x: 0, y: 1.08, z: 0}
|
||||||
@ -695,7 +732,8 @@ Transform:
|
|||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
m_PrefabInternal: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
serializedVersion: 6
|
serializedVersion: 6
|
||||||
m_Component:
|
m_Component:
|
||||||
- component: {fileID: 1760045337}
|
- component: {fileID: 1760045337}
|
||||||
@ -711,7 +749,8 @@ GameObject:
|
|||||||
Transform:
|
Transform:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
m_PrefabInternal: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 1760045336}
|
m_GameObject: {fileID: 1760045336}
|
||||||
m_LocalRotation: {x: 0, y: 0.3826836, z: -0, w: -0.92387944}
|
m_LocalRotation: {x: 0, y: 0.3826836, z: -0, w: -0.92387944}
|
||||||
m_LocalPosition: {x: 15, y: 0, z: -15}
|
m_LocalPosition: {x: 15, y: 0, z: -15}
|
||||||
@ -724,7 +763,8 @@ Transform:
|
|||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
m_PrefabInternal: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 1760045336}
|
m_GameObject: {fileID: 1760045336}
|
||||||
m_Enabled: 1
|
m_Enabled: 1
|
||||||
m_EditorHideFlags: 0
|
m_EditorHideFlags: 0
|
||||||
@ -735,7 +775,8 @@ MonoBehaviour:
|
|||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
m_PrefabInternal: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
serializedVersion: 6
|
serializedVersion: 6
|
||||||
m_Component:
|
m_Component:
|
||||||
- component: {fileID: 1975674813}
|
- component: {fileID: 1975674813}
|
||||||
@ -751,7 +792,8 @@ GameObject:
|
|||||||
Transform:
|
Transform:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
m_PrefabInternal: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 1975674812}
|
m_GameObject: {fileID: 1975674812}
|
||||||
m_LocalRotation: {x: 0, y: 0.7071068, z: -0, w: -0.7071068}
|
m_LocalRotation: {x: 0, y: 0.7071068, z: -0, w: -0.7071068}
|
||||||
m_LocalPosition: {x: 15, y: 0, z: 0}
|
m_LocalPosition: {x: 15, y: 0, z: 0}
|
||||||
@ -764,7 +806,8 @@ Transform:
|
|||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
m_PrefabInternal: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 1975674812}
|
m_GameObject: {fileID: 1975674812}
|
||||||
m_Enabled: 1
|
m_Enabled: 1
|
||||||
m_EditorHideFlags: 0
|
m_EditorHideFlags: 0
|
||||||
@ -775,7 +818,8 @@ MonoBehaviour:
|
|||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
m_PrefabInternal: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
serializedVersion: 6
|
serializedVersion: 6
|
||||||
m_Component:
|
m_Component:
|
||||||
- component: {fileID: 2127619492}
|
- component: {fileID: 2127619492}
|
||||||
@ -791,7 +835,8 @@ GameObject:
|
|||||||
Transform:
|
Transform:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
m_PrefabInternal: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 2127619491}
|
m_GameObject: {fileID: 2127619491}
|
||||||
m_LocalRotation: {x: 0, y: 0.9238796, z: -0, w: -0.38268325}
|
m_LocalRotation: {x: 0, y: 0.9238796, z: -0, w: -0.38268325}
|
||||||
m_LocalPosition: {x: 15, y: 0, z: 15}
|
m_LocalPosition: {x: 15, y: 0, z: 15}
|
||||||
@ -804,7 +849,8 @@ Transform:
|
|||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
m_PrefabInternal: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 2127619491}
|
m_GameObject: {fileID: 2127619491}
|
||||||
m_Enabled: 1
|
m_Enabled: 1
|
||||||
m_EditorHideFlags: 0
|
m_EditorHideFlags: 0
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.Rendering;
|
using UnityEngine.Rendering;
|
||||||
|
|
||||||
namespace Mirror.Examples.NetworkLobby
|
namespace Mirror.Examples.NetworkLobby
|
||||||
@ -26,7 +26,7 @@ public override bool OnLobbyServerSceneLoadedForPlayer(GameObject lobbyPlayer, G
|
|||||||
showStartButton is a local bool that's needed because OnLobbyServerPlayersReady is only fired when
|
showStartButton is a local bool that's needed because OnLobbyServerPlayersReady is only fired when
|
||||||
all players are ready, but if a player cancels their ready state there's no callback to set it back to false
|
all players are ready, but if a player cancels their ready state there's no callback to set it back to false
|
||||||
Therefore, allPlayersReady is used in combination with showStartButton to show/hide the Start button correctly.
|
Therefore, allPlayersReady is used in combination with showStartButton to show/hide the Start button correctly.
|
||||||
Setting showStartButton false when the button is pressed hides it in the game scene since NetworkLobbyManager
|
Setting showStartButton false when the button is pressed hides it in the game scene since NetworkLobbyManager
|
||||||
is set as DontDestroyOnLoad = true.
|
is set as DontDestroyOnLoad = true.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using Mirror;
|
|
||||||
using UnityEngine.SceneManagement;
|
using UnityEngine.SceneManagement;
|
||||||
|
|
||||||
namespace Mirror.Examples.NetworkLobby
|
namespace Mirror.Examples.NetworkLobby
|
||||||
@ -20,7 +19,7 @@ This demonstrates how to set the parent of the LobbyPlayerPrefab to an arbitrary
|
|||||||
something more visual for each player in that layout, such as a name, avatar, etc.
|
something more visual for each player in that layout, such as a name, avatar, etc.
|
||||||
|
|
||||||
Note: LobbyPlayer prefab will be marked DontDestroyOnLoad and carried forward to the game scene.
|
Note: LobbyPlayer prefab will be marked DontDestroyOnLoad and carried forward to the game scene.
|
||||||
Because of this, NetworkLobbyManager must automatically set the parent to null
|
Because of this, NetworkLobbyManager must automatically set the parent to null
|
||||||
in ServerChangeScene and OnClientChangeScene.
|
in ServerChangeScene and OnClientChangeScene.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -28,12 +27,6 @@ in ServerChangeScene and OnClientChangeScene.
|
|||||||
gameObject.transform.SetParent(GameObject.Find("Players").transform);
|
gameObject.transform.SetParent(GameObject.Find("Players").transform);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ClientLoadedScene(Scene arg0, LoadSceneMode arg1)
|
|
||||||
{
|
|
||||||
NetworkLobbyManager lobby = NetworkManager.singleton as NetworkLobbyManager;
|
|
||||||
base.ClientLoadedScene(arg0, arg1);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void OnClientEnterLobby()
|
public override void OnClientEnterLobby()
|
||||||
{
|
{
|
||||||
if (LogFilter.Debug) Debug.LogFormat("OnClientEnterLobby {0}", SceneManager.GetActiveScene().name);
|
if (LogFilter.Debug) Debug.LogFormat("OnClientEnterLobby {0}", SceneManager.GetActiveScene().name);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace Mirror.Examples.NetworkLobby
|
namespace Mirror.Examples.NetworkLobby
|
||||||
{
|
{
|
||||||
@ -70,7 +70,7 @@ void FixedUpdate()
|
|||||||
{
|
{
|
||||||
if (!isLocalPlayer || characterController == null) return;
|
if (!isLocalPlayer || characterController == null) return;
|
||||||
|
|
||||||
transform.Rotate(0f, turn * Time.deltaTime, 0f);
|
transform.Rotate(0f, turn * Time.fixedDeltaTime, 0f);
|
||||||
|
|
||||||
direction = transform.TransformDirection((Vector3.ClampMagnitude(new Vector3(horiz, 0f, vert), 1f) * moveSpeed));
|
direction = transform.TransformDirection((Vector3.ClampMagnitude(new Vector3(horiz, 0f, vert), 1f) * moveSpeed));
|
||||||
characterController.SimpleMove(direction * Time.fixedDeltaTime);
|
characterController.SimpleMove(direction * Time.fixedDeltaTime);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace Mirror.Examples.NetworkLobby
|
namespace Mirror.Examples.NetworkLobby
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace Mirror.Examples.NetworkLobby
|
namespace Mirror.Examples.NetworkLobby
|
||||||
{
|
{
|
||||||
|
@ -1,216 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 88b1ead8370bd4ea1806795824f0551d
|
|
||||||
ModelImporter:
|
|
||||||
serializedVersion: 22
|
|
||||||
fileIDToRecycleName:
|
|
||||||
100000: Body
|
|
||||||
100002: Bot.Armature
|
|
||||||
100004: Bot.Mesh
|
|
||||||
100006: CameraTarget
|
|
||||||
100008: Cannon.L
|
|
||||||
100010: Cannon.L_end
|
|
||||||
100012: Cannon.R
|
|
||||||
100014: Cannon.R_end
|
|
||||||
100016: Eye
|
|
||||||
100018: Eye.Spacer
|
|
||||||
100020: Eye_end
|
|
||||||
100022: Leg.1.Front.FK.L
|
|
||||||
100024: Leg.1.Front.FK.R
|
|
||||||
100026: Leg.1.Front.IK.L
|
|
||||||
100028: Leg.1.Front.IK.R
|
|
||||||
100030: Leg.1.Rear.FK.L
|
|
||||||
100032: Leg.1.Rear.FK.R
|
|
||||||
100034: Leg.1.Rear.IK.L
|
|
||||||
100036: Leg.1.Rear.IK.R
|
|
||||||
100038: Leg.2.Front.FK.L
|
|
||||||
100040: Leg.2.Front.FK.R
|
|
||||||
100042: Leg.2.Front.IK.L
|
|
||||||
100044: Leg.2.Front.IK.R
|
|
||||||
100046: Leg.2.Rear.FK.L
|
|
||||||
100048: Leg.2.Rear.FK.R
|
|
||||||
100050: Leg.2.Rear.IK.L
|
|
||||||
100052: Leg.2.Rear.IK.R
|
|
||||||
100054: Leg.3.Front.FK.L
|
|
||||||
100056: Leg.3.Front.FK.L_end
|
|
||||||
100058: Leg.3.Front.FK.R
|
|
||||||
100060: Leg.3.Front.FK.R_end
|
|
||||||
100062: Leg.3.Front.IK.L
|
|
||||||
100064: Leg.3.Front.IK.L_end
|
|
||||||
100066: Leg.3.Front.IK.R
|
|
||||||
100068: Leg.3.Front.IK.R_end
|
|
||||||
100070: Leg.3.Rear.FK.L
|
|
||||||
100072: Leg.3.Rear.FK.L_end
|
|
||||||
100074: Leg.3.Rear.FK.R
|
|
||||||
100076: Leg.3.Rear.FK.R_end
|
|
||||||
100078: Leg.3.Rear.IK.L
|
|
||||||
100080: Leg.3.Rear.IK.L_end
|
|
||||||
100082: Leg.3.Rear.IK.R
|
|
||||||
100084: Leg.3.Rear.IK.R_end
|
|
||||||
100086: //RootNode
|
|
||||||
100088: Root
|
|
||||||
100090: Switch.IKFK.Front.L
|
|
||||||
100092: Switch.IKFK.Front.L_end
|
|
||||||
100094: Switch.IKFK.Front.R
|
|
||||||
100096: Switch.IKFK.Front.R_end
|
|
||||||
100098: Switch.IKFK.Rear.L
|
|
||||||
100100: Switch.IKFK.Rear.L_end
|
|
||||||
100102: Switch.IKFK.Rear.R
|
|
||||||
100104: Switch.IKFK.Rear.R_end
|
|
||||||
100106: Target.Leg.3.Front.IK.L
|
|
||||||
100108: Target.Leg.3.Front.IK.L_end
|
|
||||||
100110: Target.Leg.3.Front.IK.R
|
|
||||||
100112: Target.Leg.3.Front.IK.R_end
|
|
||||||
100114: Target.Leg.3.Rear.IK.L
|
|
||||||
100116: Target.Leg.3.Rear.IK.L_end
|
|
||||||
100118: Target.Leg.3.Rear.IK.R
|
|
||||||
100120: Target.Leg.3.Rear.IK.R_end
|
|
||||||
100122: WID.Arrow
|
|
||||||
400000: Body
|
|
||||||
400002: Bot.Armature
|
|
||||||
400004: Bot.Mesh
|
|
||||||
400006: CameraTarget
|
|
||||||
400008: Cannon.L
|
|
||||||
400010: Cannon.L_end
|
|
||||||
400012: Cannon.R
|
|
||||||
400014: Cannon.R_end
|
|
||||||
400016: Eye
|
|
||||||
400018: Eye.Spacer
|
|
||||||
400020: Eye_end
|
|
||||||
400022: Leg.1.Front.FK.L
|
|
||||||
400024: Leg.1.Front.FK.R
|
|
||||||
400026: Leg.1.Front.IK.L
|
|
||||||
400028: Leg.1.Front.IK.R
|
|
||||||
400030: Leg.1.Rear.FK.L
|
|
||||||
400032: Leg.1.Rear.FK.R
|
|
||||||
400034: Leg.1.Rear.IK.L
|
|
||||||
400036: Leg.1.Rear.IK.R
|
|
||||||
400038: Leg.2.Front.FK.L
|
|
||||||
400040: Leg.2.Front.FK.R
|
|
||||||
400042: Leg.2.Front.IK.L
|
|
||||||
400044: Leg.2.Front.IK.R
|
|
||||||
400046: Leg.2.Rear.FK.L
|
|
||||||
400048: Leg.2.Rear.FK.R
|
|
||||||
400050: Leg.2.Rear.IK.L
|
|
||||||
400052: Leg.2.Rear.IK.R
|
|
||||||
400054: Leg.3.Front.FK.L
|
|
||||||
400056: Leg.3.Front.FK.L_end
|
|
||||||
400058: Leg.3.Front.FK.R
|
|
||||||
400060: Leg.3.Front.FK.R_end
|
|
||||||
400062: Leg.3.Front.IK.L
|
|
||||||
400064: Leg.3.Front.IK.L_end
|
|
||||||
400066: Leg.3.Front.IK.R
|
|
||||||
400068: Leg.3.Front.IK.R_end
|
|
||||||
400070: Leg.3.Rear.FK.L
|
|
||||||
400072: Leg.3.Rear.FK.L_end
|
|
||||||
400074: Leg.3.Rear.FK.R
|
|
||||||
400076: Leg.3.Rear.FK.R_end
|
|
||||||
400078: Leg.3.Rear.IK.L
|
|
||||||
400080: Leg.3.Rear.IK.L_end
|
|
||||||
400082: Leg.3.Rear.IK.R
|
|
||||||
400084: Leg.3.Rear.IK.R_end
|
|
||||||
400086: //RootNode
|
|
||||||
400088: Root
|
|
||||||
400090: Switch.IKFK.Front.L
|
|
||||||
400092: Switch.IKFK.Front.L_end
|
|
||||||
400094: Switch.IKFK.Front.R
|
|
||||||
400096: Switch.IKFK.Front.R_end
|
|
||||||
400098: Switch.IKFK.Rear.L
|
|
||||||
400100: Switch.IKFK.Rear.L_end
|
|
||||||
400102: Switch.IKFK.Rear.R
|
|
||||||
400104: Switch.IKFK.Rear.R_end
|
|
||||||
400106: Target.Leg.3.Front.IK.L
|
|
||||||
400108: Target.Leg.3.Front.IK.L_end
|
|
||||||
400110: Target.Leg.3.Front.IK.R
|
|
||||||
400112: Target.Leg.3.Front.IK.R_end
|
|
||||||
400114: Target.Leg.3.Rear.IK.L
|
|
||||||
400116: Target.Leg.3.Rear.IK.L_end
|
|
||||||
400118: Target.Leg.3.Rear.IK.R
|
|
||||||
400120: Target.Leg.3.Rear.IK.R_end
|
|
||||||
400122: WID.Arrow
|
|
||||||
2100000: Bot
|
|
||||||
2300000: WID.Arrow
|
|
||||||
3300000: WID.Arrow
|
|
||||||
4300000: Bot.Mesh
|
|
||||||
4300002: WID.Arrow
|
|
||||||
9500000: //RootNode
|
|
||||||
13700000: Bot.Mesh
|
|
||||||
externalObjects: {}
|
|
||||||
materials:
|
|
||||||
importMaterials: 1
|
|
||||||
materialName: 0
|
|
||||||
materialSearch: 1
|
|
||||||
materialLocation: 1
|
|
||||||
animations:
|
|
||||||
legacyGenerateAnimations: 4
|
|
||||||
bakeSimulation: 0
|
|
||||||
resampleCurves: 1
|
|
||||||
optimizeGameObjects: 0
|
|
||||||
motionNodeName:
|
|
||||||
rigImportErrors:
|
|
||||||
rigImportWarnings:
|
|
||||||
animationImportErrors:
|
|
||||||
animationImportWarnings:
|
|
||||||
animationRetargetingWarnings:
|
|
||||||
animationDoRetargetingWarnings: 0
|
|
||||||
importAnimatedCustomProperties: 0
|
|
||||||
animationCompression: 1
|
|
||||||
animationRotationError: 0.5
|
|
||||||
animationPositionError: 0.5
|
|
||||||
animationScaleError: 0.5
|
|
||||||
animationWrapMode: 0
|
|
||||||
extraExposedTransformPaths: []
|
|
||||||
extraUserProperties: []
|
|
||||||
clipAnimations: []
|
|
||||||
isReadable: 1
|
|
||||||
meshes:
|
|
||||||
lODScreenPercentages: []
|
|
||||||
globalScale: 0.33
|
|
||||||
meshCompression: 0
|
|
||||||
addColliders: 0
|
|
||||||
importVisibility: 1
|
|
||||||
importBlendShapes: 1
|
|
||||||
importCameras: 1
|
|
||||||
importLights: 1
|
|
||||||
swapUVChannels: 0
|
|
||||||
generateSecondaryUV: 0
|
|
||||||
useFileUnits: 1
|
|
||||||
optimizeMeshForGPU: 1
|
|
||||||
keepQuads: 0
|
|
||||||
weldVertices: 1
|
|
||||||
preserveHierarchy: 0
|
|
||||||
indexFormat: 0
|
|
||||||
secondaryUVAngleDistortion: 8
|
|
||||||
secondaryUVAreaDistortion: 15.000001
|
|
||||||
secondaryUVHardAngle: 88
|
|
||||||
secondaryUVPackMargin: 4
|
|
||||||
useFileScale: 1
|
|
||||||
tangentSpace:
|
|
||||||
normalSmoothAngle: 60
|
|
||||||
normalImportMode: 0
|
|
||||||
tangentImportMode: 1
|
|
||||||
normalCalculationMode: 4
|
|
||||||
importAnimation: 1
|
|
||||||
copyAvatar: 0
|
|
||||||
humanDescription:
|
|
||||||
serializedVersion: 2
|
|
||||||
human: []
|
|
||||||
skeleton: []
|
|
||||||
armTwist: 0.5
|
|
||||||
foreArmTwist: 0.5
|
|
||||||
upperLegTwist: 0.5
|
|
||||||
legTwist: 0.5
|
|
||||||
armStretch: 0.05
|
|
||||||
legStretch: 0.05
|
|
||||||
feetSpacing: 0
|
|
||||||
rootMotionBoneName:
|
|
||||||
rootMotionBoneRotation: {x: 0, y: 0, z: 0, w: 1}
|
|
||||||
hasTranslationDoF: 0
|
|
||||||
hasExtraRoot: 0
|
|
||||||
skeletonHasParents: 1
|
|
||||||
lastHumanDescriptionAvatarSource: {instanceID: 0}
|
|
||||||
animationType: 2
|
|
||||||
humanoidOversampling: 1
|
|
||||||
additionalBone: 0
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
Before Width: | Height: | Size: 238 KiB |
Before Width: | Height: | Size: 1.3 MiB |
Before Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 367 KiB |
@ -1,31 +0,0 @@
|
|||||||
BA-2 (Blast All Bot Mark 2)
|
|
||||||
By: Quandtum
|
|
||||||
License: CC-0
|
|
||||||
Blender Version: 2.66a, r55057
|
|
||||||
Model Version: 1.1
|
|
||||||
|
|
||||||
3D preview available @ http://p3d.in/i67jh
|
|
||||||
|
|
||||||
What is included:
|
|
||||||
1 x BA-2 base mesh (3380 vertices, 6964 Edges, 3616 faces, 6696 Tris, UV unwrapped)
|
|
||||||
1 x Diffuse map (2048 x 2048)
|
|
||||||
1 x Normal map (2048 x 2048)
|
|
||||||
1 x Bump map (2048 x 2048)
|
|
||||||
1 x Specular map (2048 x 2048)
|
|
||||||
1 x Emission map (2048 x 2048)
|
|
||||||
1 x Animation armature
|
|
||||||
|
|
||||||
Complete model is not manifold, but rather a composition of manifold "parts". Each part is manifold and all parts were combined into a single mesh named "Bot.Mesh".
|
|
||||||
|
|
||||||
Maps included are all large 2048 x 2048. Reason is they can be reduced but not grown, resize them to fit as needed.
|
|
||||||
|
|
||||||
Texture samples sourced from:
|
|
||||||
http://www.plaintextures.com/
|
|
||||||
http://www.goodtextures.com/
|
|
||||||
Textures were otherwise hand painted.
|
|
||||||
|
|
||||||
There is admittingly an error in the bump/normal mapping in the emission areas. They are not very noticable, and with the emission map enabled they are concealed.
|
|
||||||
|
|
||||||
Revision History:
|
|
||||||
Version 1.0 - 01/21/2013; Initial release.
|
|
||||||
Version 1.1 - Sat Mar 23 14:36:46 CDT 2013; Updated branding.
|
|
@ -1,25 +0,0 @@
|
|||||||
using UnityEngine;
|
|
||||||
using Mirror;
|
|
||||||
|
|
||||||
namespace Mirror.Examples.Movement
|
|
||||||
{
|
|
||||||
public class Move : NetworkBehaviour
|
|
||||||
{
|
|
||||||
public CharacterController controller;
|
|
||||||
public float speed = 300;
|
|
||||||
public float rotationSpeed = 400;
|
|
||||||
|
|
||||||
void Update()
|
|
||||||
{
|
|
||||||
// movement for local player
|
|
||||||
if (!isLocalPlayer) return;
|
|
||||||
|
|
||||||
// rotate
|
|
||||||
transform.Rotate(0, Input.GetAxis("Horizontal") * rotationSpeed * Time.deltaTime, 0);
|
|
||||||
|
|
||||||
// move
|
|
||||||
Vector3 forward = transform.TransformDirection(Vector3.forward);
|
|
||||||
controller.SimpleMove(forward * Input.GetAxis("Vertical") * speed * Time.deltaTime);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,22 +1,12 @@
|
|||||||
%YAML 1.1
|
%YAML 1.1
|
||||||
%TAG !u! tag:unity3d.com,2011:
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
--- !u!1001 &100100000
|
|
||||||
Prefab:
|
|
||||||
m_ObjectHideFlags: 1
|
|
||||||
serializedVersion: 2
|
|
||||||
m_Modification:
|
|
||||||
m_TransformParent: {fileID: 0}
|
|
||||||
m_Modifications: []
|
|
||||||
m_RemovedComponents: []
|
|
||||||
m_ParentPrefab: {fileID: 0}
|
|
||||||
m_RootGameObject: {fileID: 1240244544407914}
|
|
||||||
m_IsPrefabParent: 1
|
|
||||||
--- !u!1 &1240244544407914
|
--- !u!1 &1240244544407914
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_PrefabParentObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
m_PrefabInternal: {fileID: 100100000}
|
m_PrefabInstance: {fileID: 0}
|
||||||
serializedVersion: 5
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
m_Component:
|
m_Component:
|
||||||
- component: {fileID: 4118252415362944}
|
- component: {fileID: 4118252415362944}
|
||||||
- component: {fileID: 212641192162007874}
|
- component: {fileID: 212641192162007874}
|
||||||
@ -34,9 +24,10 @@ GameObject:
|
|||||||
m_IsActive: 1
|
m_IsActive: 1
|
||||||
--- !u!4 &4118252415362944
|
--- !u!4 &4118252415362944
|
||||||
Transform:
|
Transform:
|
||||||
m_ObjectHideFlags: 1
|
m_ObjectHideFlags: 0
|
||||||
m_PrefabParentObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
m_PrefabInternal: {fileID: 100100000}
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 1240244544407914}
|
m_GameObject: {fileID: 1240244544407914}
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
@ -45,97 +36,12 @@ Transform:
|
|||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 0
|
m_RootOrder: 0
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!50 &50389918509199184
|
|
||||||
Rigidbody2D:
|
|
||||||
serializedVersion: 4
|
|
||||||
m_ObjectHideFlags: 1
|
|
||||||
m_PrefabParentObject: {fileID: 0}
|
|
||||||
m_PrefabInternal: {fileID: 100100000}
|
|
||||||
m_GameObject: {fileID: 1240244544407914}
|
|
||||||
m_BodyType: 0
|
|
||||||
m_Simulated: 1
|
|
||||||
m_UseFullKinematicContacts: 0
|
|
||||||
m_UseAutoMass: 0
|
|
||||||
m_Mass: 1
|
|
||||||
m_LinearDrag: 0
|
|
||||||
m_AngularDrag: 0.05
|
|
||||||
m_GravityScale: 0
|
|
||||||
m_Material: {fileID: 0}
|
|
||||||
m_Interpolate: 1
|
|
||||||
m_SleepingMode: 1
|
|
||||||
m_CollisionDetection: 1
|
|
||||||
m_Constraints: 4
|
|
||||||
--- !u!61 &61279767645666242
|
|
||||||
BoxCollider2D:
|
|
||||||
m_ObjectHideFlags: 1
|
|
||||||
m_PrefabParentObject: {fileID: 0}
|
|
||||||
m_PrefabInternal: {fileID: 100100000}
|
|
||||||
m_GameObject: {fileID: 1240244544407914}
|
|
||||||
m_Enabled: 1
|
|
||||||
m_Density: 1
|
|
||||||
m_Material: {fileID: 0}
|
|
||||||
m_IsTrigger: 0
|
|
||||||
m_UsedByEffector: 0
|
|
||||||
m_UsedByComposite: 0
|
|
||||||
m_Offset: {x: 0, y: 0}
|
|
||||||
m_SpriteTilingProperty:
|
|
||||||
border: {x: 0, y: 0, z: 0, w: 0}
|
|
||||||
pivot: {x: 0.5, y: 0.5}
|
|
||||||
oldSize: {x: 2, y: 4}
|
|
||||||
newSize: {x: 1, y: 1}
|
|
||||||
adaptiveTilingThreshold: 0.5
|
|
||||||
drawMode: 0
|
|
||||||
adaptiveTiling: 0
|
|
||||||
m_AutoTiling: 0
|
|
||||||
serializedVersion: 2
|
|
||||||
m_Size: {x: 2, y: 4}
|
|
||||||
m_EdgeRadius: 0
|
|
||||||
--- !u!114 &114104497298166850
|
|
||||||
MonoBehaviour:
|
|
||||||
m_ObjectHideFlags: 1
|
|
||||||
m_PrefabParentObject: {fileID: 0}
|
|
||||||
m_PrefabInternal: {fileID: 100100000}
|
|
||||||
m_GameObject: {fileID: 1240244544407914}
|
|
||||||
m_Enabled: 1
|
|
||||||
m_EditorHideFlags: 0
|
|
||||||
m_Script: {fileID: 11500000, guid: 9b91ecbcc199f4492b9a91e820070131, type: 3}
|
|
||||||
m_Name:
|
|
||||||
m_EditorClassIdentifier:
|
|
||||||
m_SceneId: 0
|
|
||||||
m_ServerOnly: 0
|
|
||||||
m_LocalPlayerAuthority: 1
|
|
||||||
m_AssetId: b1651eaf8c7564a1c86031dfbb8a7b28
|
|
||||||
--- !u!114 &114398896143473162
|
|
||||||
MonoBehaviour:
|
|
||||||
m_ObjectHideFlags: 1
|
|
||||||
m_PrefabParentObject: {fileID: 0}
|
|
||||||
m_PrefabInternal: {fileID: 100100000}
|
|
||||||
m_GameObject: {fileID: 1240244544407914}
|
|
||||||
m_Enabled: 1
|
|
||||||
m_EditorHideFlags: 0
|
|
||||||
m_Script: {fileID: 11500000, guid: 2f74aedd71d9a4f55b3ce499326d45fb, type: 3}
|
|
||||||
m_Name:
|
|
||||||
m_EditorClassIdentifier:
|
|
||||||
syncInterval: 0.1
|
|
||||||
compressRotation: 1
|
|
||||||
--- !u!114 &114626868563338794
|
|
||||||
MonoBehaviour:
|
|
||||||
m_ObjectHideFlags: 1
|
|
||||||
m_PrefabParentObject: {fileID: 0}
|
|
||||||
m_PrefabInternal: {fileID: 100100000}
|
|
||||||
m_GameObject: {fileID: 1240244544407914}
|
|
||||||
m_Enabled: 1
|
|
||||||
m_EditorHideFlags: 0
|
|
||||||
m_Script: {fileID: 11500000, guid: 0748c7eda22b19845b9ce0e4d23d1021, type: 3}
|
|
||||||
m_Name:
|
|
||||||
m_EditorClassIdentifier:
|
|
||||||
syncInterval: 0.1
|
|
||||||
speed: 30
|
|
||||||
--- !u!212 &212641192162007874
|
--- !u!212 &212641192162007874
|
||||||
SpriteRenderer:
|
SpriteRenderer:
|
||||||
m_ObjectHideFlags: 1
|
m_ObjectHideFlags: 0
|
||||||
m_PrefabParentObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
m_PrefabInternal: {fileID: 100100000}
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 1240244544407914}
|
m_GameObject: {fileID: 1240244544407914}
|
||||||
m_Enabled: 1
|
m_Enabled: 1
|
||||||
m_CastShadows: 0
|
m_CastShadows: 0
|
||||||
@ -144,6 +50,8 @@ SpriteRenderer:
|
|||||||
m_MotionVectors: 1
|
m_MotionVectors: 1
|
||||||
m_LightProbeUsage: 1
|
m_LightProbeUsage: 1
|
||||||
m_ReflectionProbeUsage: 1
|
m_ReflectionProbeUsage: 1
|
||||||
|
m_RenderingLayerMask: 1
|
||||||
|
m_RendererPriority: 0
|
||||||
m_Materials:
|
m_Materials:
|
||||||
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
|
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
|
||||||
m_StaticBatchInfo:
|
m_StaticBatchInfo:
|
||||||
@ -175,3 +83,95 @@ SpriteRenderer:
|
|||||||
m_SpriteTileMode: 0
|
m_SpriteTileMode: 0
|
||||||
m_WasSpriteAssigned: 1
|
m_WasSpriteAssigned: 1
|
||||||
m_MaskInteraction: 0
|
m_MaskInteraction: 0
|
||||||
|
m_SpriteSortPoint: 0
|
||||||
|
--- !u!61 &61279767645666242
|
||||||
|
BoxCollider2D:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1240244544407914}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_Density: 1
|
||||||
|
m_Material: {fileID: 0}
|
||||||
|
m_IsTrigger: 0
|
||||||
|
m_UsedByEffector: 0
|
||||||
|
m_UsedByComposite: 0
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
m_SpriteTilingProperty:
|
||||||
|
border: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
pivot: {x: 0.5, y: 0.5}
|
||||||
|
oldSize: {x: 2, y: 4}
|
||||||
|
newSize: {x: 1, y: 1}
|
||||||
|
adaptiveTilingThreshold: 0.5
|
||||||
|
drawMode: 0
|
||||||
|
adaptiveTiling: 0
|
||||||
|
m_AutoTiling: 0
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Size: {x: 2, y: 4}
|
||||||
|
m_EdgeRadius: 0
|
||||||
|
--- !u!50 &50389918509199184
|
||||||
|
Rigidbody2D:
|
||||||
|
serializedVersion: 4
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1240244544407914}
|
||||||
|
m_BodyType: 0
|
||||||
|
m_Simulated: 1
|
||||||
|
m_UseFullKinematicContacts: 0
|
||||||
|
m_UseAutoMass: 0
|
||||||
|
m_Mass: 1
|
||||||
|
m_LinearDrag: 0
|
||||||
|
m_AngularDrag: 0.05
|
||||||
|
m_GravityScale: 0
|
||||||
|
m_Material: {fileID: 0}
|
||||||
|
m_Interpolate: 1
|
||||||
|
m_SleepingMode: 1
|
||||||
|
m_CollisionDetection: 1
|
||||||
|
m_Constraints: 4
|
||||||
|
--- !u!114 &114104497298166850
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1240244544407914}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 9b91ecbcc199f4492b9a91e820070131, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
m_ServerOnly: 0
|
||||||
|
m_LocalPlayerAuthority: 1
|
||||||
|
m_AssetId: b1651eaf8c7564a1c86031dfbb8a7b28
|
||||||
|
m_SceneId: 0
|
||||||
|
--- !u!114 &114626868563338794
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1240244544407914}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 0748c7eda22b19845b9ce0e4d23d1021, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
syncInterval: 0.1
|
||||||
|
speed: 1500
|
||||||
|
--- !u!114 &114398896143473162
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1240244544407914}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 2f74aedd71d9a4f55b3ce499326d45fb, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
syncInterval: 0.1
|
||||||
|
compressRotation: 1
|
||||||
|
@ -200,7 +200,6 @@ GameObject:
|
|||||||
serializedVersion: 6
|
serializedVersion: 6
|
||||||
m_Component:
|
m_Component:
|
||||||
- component: {fileID: 473997961}
|
- component: {fileID: 473997961}
|
||||||
- component: {fileID: 473997960}
|
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: RacketSpawnLeft
|
m_Name: RacketSpawnLeft
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
@ -208,18 +207,6 @@ GameObject:
|
|||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
m_StaticEditorFlags: 0
|
m_StaticEditorFlags: 0
|
||||||
m_IsActive: 1
|
m_IsActive: 1
|
||||||
--- !u!114 &473997960
|
|
||||||
MonoBehaviour:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 473997959}
|
|
||||||
m_Enabled: 1
|
|
||||||
m_EditorHideFlags: 0
|
|
||||||
m_Script: {fileID: 11500000, guid: 41f84591ce72545258ea98cb7518d8b9, type: 3}
|
|
||||||
m_Name:
|
|
||||||
m_EditorClassIdentifier:
|
|
||||||
--- !u!4 &473997961
|
--- !u!4 &473997961
|
||||||
Transform:
|
Transform:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -232,7 +219,7 @@ Transform:
|
|||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 4
|
m_RootOrder: 3
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!1 &753891880
|
--- !u!1 &753891880
|
||||||
GameObject:
|
GameObject:
|
||||||
@ -340,52 +327,6 @@ BoxCollider2D:
|
|||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_Size: {x: 50, y: 1}
|
m_Size: {x: 50, y: 1}
|
||||||
m_EdgeRadius: 0
|
m_EdgeRadius: 0
|
||||||
--- !u!1001 &1140775523
|
|
||||||
PrefabInstance:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
serializedVersion: 2
|
|
||||||
m_Modification:
|
|
||||||
m_TransformParent: {fileID: 0}
|
|
||||||
m_Modifications:
|
|
||||||
- target: {fileID: 4700925592147096, guid: 5f7a7f34494ed40268eff49dbf9168bf, type: 3}
|
|
||||||
propertyPath: m_LocalPosition.x
|
|
||||||
value: -3
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 4700925592147096, guid: 5f7a7f34494ed40268eff49dbf9168bf, type: 3}
|
|
||||||
propertyPath: m_LocalPosition.y
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 4700925592147096, guid: 5f7a7f34494ed40268eff49dbf9168bf, type: 3}
|
|
||||||
propertyPath: m_LocalPosition.z
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 4700925592147096, guid: 5f7a7f34494ed40268eff49dbf9168bf, type: 3}
|
|
||||||
propertyPath: m_LocalRotation.x
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 4700925592147096, guid: 5f7a7f34494ed40268eff49dbf9168bf, type: 3}
|
|
||||||
propertyPath: m_LocalRotation.y
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 4700925592147096, guid: 5f7a7f34494ed40268eff49dbf9168bf, type: 3}
|
|
||||||
propertyPath: m_LocalRotation.z
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 4700925592147096, guid: 5f7a7f34494ed40268eff49dbf9168bf, type: 3}
|
|
||||||
propertyPath: m_LocalRotation.w
|
|
||||||
value: 1
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 4700925592147096, guid: 5f7a7f34494ed40268eff49dbf9168bf, type: 3}
|
|
||||||
propertyPath: m_RootOrder
|
|
||||||
value: 3
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 50354248948880112, guid: 5f7a7f34494ed40268eff49dbf9168bf,
|
|
||||||
type: 3}
|
|
||||||
propertyPath: m_Simulated
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
m_RemovedComponents: []
|
|
||||||
m_SourcePrefab: {fileID: 100100000, guid: 5f7a7f34494ed40268eff49dbf9168bf, type: 3}
|
|
||||||
--- !u!1 &1346799726
|
--- !u!1 &1346799726
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -707,7 +648,6 @@ GameObject:
|
|||||||
serializedVersion: 6
|
serializedVersion: 6
|
||||||
m_Component:
|
m_Component:
|
||||||
- component: {fileID: 1397990096}
|
- component: {fileID: 1397990096}
|
||||||
- component: {fileID: 1397990095}
|
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: RacketSpawnRight
|
m_Name: RacketSpawnRight
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
@ -715,18 +655,6 @@ GameObject:
|
|||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
m_StaticEditorFlags: 0
|
m_StaticEditorFlags: 0
|
||||||
m_IsActive: 1
|
m_IsActive: 1
|
||||||
--- !u!114 &1397990095
|
|
||||||
MonoBehaviour:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 1397990094}
|
|
||||||
m_Enabled: 1
|
|
||||||
m_EditorHideFlags: 0
|
|
||||||
m_Script: {fileID: 11500000, guid: 41f84591ce72545258ea98cb7518d8b9, type: 3}
|
|
||||||
m_Name:
|
|
||||||
m_EditorClassIdentifier:
|
|
||||||
--- !u!4 &1397990096
|
--- !u!4 &1397990096
|
||||||
Transform:
|
Transform:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -739,7 +667,7 @@ Transform:
|
|||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 5
|
m_RootOrder: 4
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!1 &1575697329
|
--- !u!1 &1575697329
|
||||||
GameObject:
|
GameObject:
|
||||||
@ -939,7 +867,7 @@ MonoBehaviour:
|
|||||||
m_GameObject: {fileID: 1886246549}
|
m_GameObject: {fileID: 1886246549}
|
||||||
m_Enabled: 1
|
m_Enabled: 1
|
||||||
m_EditorHideFlags: 0
|
m_EditorHideFlags: 0
|
||||||
m_Script: {fileID: 11500000, guid: 8aab4c8111b7c411b9b92cf3dbc5bd4e, type: 3}
|
m_Script: {fileID: 11500000, guid: 0aa3018bb284840d6a6d0acee29ab098, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
dontDestroyOnLoad: 1
|
dontDestroyOnLoad: 1
|
||||||
@ -956,7 +884,12 @@ MonoBehaviour:
|
|||||||
type: 3}
|
type: 3}
|
||||||
autoCreatePlayer: 1
|
autoCreatePlayer: 1
|
||||||
playerSpawnMethod: 1
|
playerSpawnMethod: 1
|
||||||
spawnPrefabs: []
|
spawnPrefabs:
|
||||||
|
- {fileID: 1080679924113744, guid: 5f7a7f34494ed40268eff49dbf9168bf, type: 3}
|
||||||
|
leftRacketSpawn: {fileID: 473997961}
|
||||||
|
rightRacketSpawn: {fileID: 1397990096}
|
||||||
|
ballPrefab: {fileID: 1080679924113744, guid: 5f7a7f34494ed40268eff49dbf9168bf, type: 3}
|
||||||
|
ball: {fileID: 0}
|
||||||
--- !u!114 &1886246553
|
--- !u!114 &1886246553
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using Mirror;
|
|
||||||
|
|
||||||
namespace Mirror.Examples.Pong
|
namespace Mirror.Examples.Pong
|
||||||
{
|
{
|
||||||
@ -11,8 +10,6 @@ public override void OnStartServer()
|
|||||||
{
|
{
|
||||||
// only simulate ball physics on server
|
// only simulate ball physics on server
|
||||||
GetComponent<Rigidbody2D>().simulated = true;
|
GetComponent<Rigidbody2D>().simulated = true;
|
||||||
|
|
||||||
// Initial Velocity
|
|
||||||
GetComponent<Rigidbody2D>().velocity = Vector2.right * speed;
|
GetComponent<Rigidbody2D>().velocity = Vector2.right * speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,4 +52,4 @@ void OnCollisionEnter2D(Collision2D col)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
38
Assets/Mirror/Examples/Pong/Scripts/NetworkManagerPong.cs
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
// custom NetworkManager that simply assigns the correct racket positions when
|
||||||
|
// spawning players. the built in RoundRobin spawn method wouldn't work after
|
||||||
|
// someone reconnects (both players would be on the same side).
|
||||||
|
using UnityEngine;
|
||||||
|
using Mirror;
|
||||||
|
|
||||||
|
public class NetworkManagerPong : NetworkManager
|
||||||
|
{
|
||||||
|
public Transform leftRacketSpawn;
|
||||||
|
public Transform rightRacketSpawn;
|
||||||
|
public GameObject ballPrefab;
|
||||||
|
GameObject ball;
|
||||||
|
|
||||||
|
public override void OnServerAddPlayer(NetworkConnection conn, AddPlayerMessage extraMessage)
|
||||||
|
{
|
||||||
|
// add player at correct spawn position
|
||||||
|
Transform start = numPlayers == 0 ? leftRacketSpawn : rightRacketSpawn;
|
||||||
|
GameObject player = Instantiate(playerPrefab, start.position, start.rotation);
|
||||||
|
NetworkServer.AddPlayerForConnection(conn, player);
|
||||||
|
|
||||||
|
// spawn ball if two players
|
||||||
|
if (numPlayers == 2)
|
||||||
|
{
|
||||||
|
ball = Instantiate(ballPrefab);
|
||||||
|
NetworkServer.Spawn(ball);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnServerDisconnect(NetworkConnection conn)
|
||||||
|
{
|
||||||
|
// destroy ball
|
||||||
|
if (ball != null)
|
||||||
|
NetworkServer.Destroy(ball);
|
||||||
|
|
||||||
|
// call base functionality (actually destroys the player)
|
||||||
|
base.OnServerDisconnect(conn);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 0aa3018bb284840d6a6d0acee29ab098
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -1,5 +1,4 @@
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using Mirror;
|
|
||||||
|
|
||||||
namespace Mirror.Examples.Pong
|
namespace Mirror.Examples.Pong
|
||||||
{
|
{
|
||||||
@ -15,7 +14,7 @@ void FixedUpdate()
|
|||||||
if (!isLocalPlayer) return;
|
if (!isLocalPlayer) return;
|
||||||
|
|
||||||
float vertical = Input.GetAxisRaw("Vertical");
|
float vertical = Input.GetAxisRaw("Vertical");
|
||||||
GetComponent<Rigidbody2D>().velocity = new Vector2(0, vertical) * speed;
|
GetComponent<Rigidbody2D>().velocity = new Vector2(0, vertical) * speed * Time.fixedDeltaTime;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: d8b3e43538fc240feb28e07816c7e733
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
After Width: | Height: | Size: 918 KiB |
@ -1,12 +1,12 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 029d4d06af6a74673b65859a0a3af0f6
|
guid: ce00d67f9368944fa8ef4de6ccc77bfa
|
||||||
TextureImporter:
|
TextureImporter:
|
||||||
fileIDToRecycleName: {}
|
fileIDToRecycleName: {}
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
serializedVersion: 4
|
serializedVersion: 9
|
||||||
mipmaps:
|
mipmaps:
|
||||||
mipMapMode: 0
|
mipMapMode: 0
|
||||||
enableMipMap: 0
|
enableMipMap: 1
|
||||||
sRGBTexture: 1
|
sRGBTexture: 1
|
||||||
linearTexture: 0
|
linearTexture: 0
|
||||||
fadeOut: 0
|
fadeOut: 0
|
||||||
@ -21,6 +21,8 @@ TextureImporter:
|
|||||||
heightScale: 0.25
|
heightScale: 0.25
|
||||||
normalMapFilter: 0
|
normalMapFilter: 0
|
||||||
isReadable: 0
|
isReadable: 0
|
||||||
|
streamingMipmaps: 0
|
||||||
|
streamingMipmapsPriority: 0
|
||||||
grayScaleToAlpha: 0
|
grayScaleToAlpha: 0
|
||||||
generateCubemap: 6
|
generateCubemap: 6
|
||||||
cubemapConvolution: 0
|
cubemapConvolution: 0
|
||||||
@ -31,14 +33,14 @@ TextureImporter:
|
|||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
filterMode: -1
|
filterMode: -1
|
||||||
aniso: -1
|
aniso: -1
|
||||||
mipBias: -1
|
mipBias: -100
|
||||||
wrapU: 1
|
wrapU: -1
|
||||||
wrapV: 1
|
wrapV: -1
|
||||||
wrapW: 1
|
wrapW: -1
|
||||||
nPOTScale: 0
|
nPOTScale: 1
|
||||||
lightmap: 0
|
lightmap: 0
|
||||||
compressionQuality: 50
|
compressionQuality: 50
|
||||||
spriteMode: 1
|
spriteMode: 0
|
||||||
spriteExtrude: 1
|
spriteExtrude: 1
|
||||||
spriteMeshType: 1
|
spriteMeshType: 1
|
||||||
alignment: 0
|
alignment: 0
|
||||||
@ -47,15 +49,17 @@ TextureImporter:
|
|||||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||||
spriteGenerateFallbackPhysicsShape: 1
|
spriteGenerateFallbackPhysicsShape: 1
|
||||||
alphaUsage: 1
|
alphaUsage: 1
|
||||||
alphaIsTransparency: 1
|
alphaIsTransparency: 0
|
||||||
spriteTessellationDetail: -1
|
spriteTessellationDetail: -1
|
||||||
textureType: 8
|
textureType: 0
|
||||||
textureShape: 1
|
textureShape: 1
|
||||||
|
singleChannelComponent: 0
|
||||||
maxTextureSizeSet: 0
|
maxTextureSizeSet: 0
|
||||||
compressionQualitySet: 0
|
compressionQualitySet: 0
|
||||||
textureFormatSet: 0
|
textureFormatSet: 0
|
||||||
platformSettings:
|
platformSettings:
|
||||||
- buildTarget: DefaultTexturePlatform
|
- serializedVersion: 2
|
||||||
|
buildTarget: DefaultTexturePlatform
|
||||||
maxTextureSize: 2048
|
maxTextureSize: 2048
|
||||||
resizeAlgorithm: 0
|
resizeAlgorithm: 0
|
||||||
textureFormat: -1
|
textureFormat: -1
|
||||||
@ -70,7 +74,15 @@ TextureImporter:
|
|||||||
sprites: []
|
sprites: []
|
||||||
outline: []
|
outline: []
|
||||||
physicsShape: []
|
physicsShape: []
|
||||||
|
bones: []
|
||||||
|
spriteID:
|
||||||
|
vertices: []
|
||||||
|
indices:
|
||||||
|
edges: []
|
||||||
|
weights: []
|
||||||
spritePackingTag:
|
spritePackingTag:
|
||||||
|
pSDRemoveMatte: 0
|
||||||
|
pSDShowRemoveMatteOption: 0
|
||||||
userData:
|
userData:
|
||||||
assetBundleName:
|
assetBundleName:
|
||||||
assetBundleVariant:
|
assetBundleVariant:
|
@ -0,0 +1,272 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!91 &9100000
|
||||||
|
AnimatorController:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_Name: Controller
|
||||||
|
serializedVersion: 5
|
||||||
|
m_AnimatorParameters:
|
||||||
|
- m_Name: Moving
|
||||||
|
m_Type: 4
|
||||||
|
m_DefaultFloat: 0
|
||||||
|
m_DefaultInt: 0
|
||||||
|
m_DefaultBool: 0
|
||||||
|
m_Controller: {fileID: 0}
|
||||||
|
- m_Name: Shoot
|
||||||
|
m_Type: 9
|
||||||
|
m_DefaultFloat: 0
|
||||||
|
m_DefaultInt: 0
|
||||||
|
m_DefaultBool: 0
|
||||||
|
m_Controller: {fileID: 0}
|
||||||
|
m_AnimatorLayers:
|
||||||
|
- serializedVersion: 5
|
||||||
|
m_Name: Base Layer
|
||||||
|
m_StateMachine: {fileID: 1107772262116321704}
|
||||||
|
m_Mask: {fileID: 0}
|
||||||
|
m_Motions: []
|
||||||
|
m_Behaviours: []
|
||||||
|
m_BlendingMode: 0
|
||||||
|
m_SyncedLayerIndex: -1
|
||||||
|
m_DefaultWeight: 0
|
||||||
|
m_IKPass: 0
|
||||||
|
m_SyncedLayerAffectsTiming: 0
|
||||||
|
m_Controller: {fileID: 9100000}
|
||||||
|
--- !u!1101 &1101104249963802978
|
||||||
|
AnimatorStateTransition:
|
||||||
|
m_ObjectHideFlags: 1
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_Name:
|
||||||
|
m_Conditions:
|
||||||
|
- m_ConditionMode: 1
|
||||||
|
m_ConditionEvent: Moving
|
||||||
|
m_EventTreshold: 0
|
||||||
|
m_DstStateMachine: {fileID: 0}
|
||||||
|
m_DstState: {fileID: 1102824315819425342}
|
||||||
|
m_Solo: 0
|
||||||
|
m_Mute: 0
|
||||||
|
m_IsExit: 0
|
||||||
|
serializedVersion: 3
|
||||||
|
m_TransitionDuration: 0.25
|
||||||
|
m_TransitionOffset: 0
|
||||||
|
m_ExitTime: 0.6
|
||||||
|
m_HasExitTime: 0
|
||||||
|
m_HasFixedDuration: 1
|
||||||
|
m_InterruptionSource: 0
|
||||||
|
m_OrderedInterruption: 1
|
||||||
|
m_CanTransitionToSelf: 1
|
||||||
|
--- !u!1101 &1101366829127142966
|
||||||
|
AnimatorStateTransition:
|
||||||
|
m_ObjectHideFlags: 1
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_Name:
|
||||||
|
m_Conditions:
|
||||||
|
- m_ConditionMode: 1
|
||||||
|
m_ConditionEvent: Shoot
|
||||||
|
m_EventTreshold: 0
|
||||||
|
m_DstStateMachine: {fileID: 0}
|
||||||
|
m_DstState: {fileID: 1102254808008813326}
|
||||||
|
m_Solo: 0
|
||||||
|
m_Mute: 0
|
||||||
|
m_IsExit: 0
|
||||||
|
serializedVersion: 3
|
||||||
|
m_TransitionDuration: 0
|
||||||
|
m_TransitionOffset: 0
|
||||||
|
m_ExitTime: 1
|
||||||
|
m_HasExitTime: 0
|
||||||
|
m_HasFixedDuration: 1
|
||||||
|
m_InterruptionSource: 0
|
||||||
|
m_OrderedInterruption: 1
|
||||||
|
m_CanTransitionToSelf: 1
|
||||||
|
--- !u!1101 &1101806660142692138
|
||||||
|
AnimatorStateTransition:
|
||||||
|
m_ObjectHideFlags: 1
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_Name:
|
||||||
|
m_Conditions:
|
||||||
|
- m_ConditionMode: 2
|
||||||
|
m_ConditionEvent: Moving
|
||||||
|
m_EventTreshold: 0
|
||||||
|
m_DstStateMachine: {fileID: 0}
|
||||||
|
m_DstState: {fileID: 1102207974245764242}
|
||||||
|
m_Solo: 0
|
||||||
|
m_Mute: 0
|
||||||
|
m_IsExit: 0
|
||||||
|
serializedVersion: 3
|
||||||
|
m_TransitionDuration: 0.25
|
||||||
|
m_TransitionOffset: 0
|
||||||
|
m_ExitTime: 0.6
|
||||||
|
m_HasExitTime: 0
|
||||||
|
m_HasFixedDuration: 1
|
||||||
|
m_InterruptionSource: 0
|
||||||
|
m_OrderedInterruption: 1
|
||||||
|
m_CanTransitionToSelf: 1
|
||||||
|
--- !u!1101 &1101862483397811748
|
||||||
|
AnimatorStateTransition:
|
||||||
|
m_ObjectHideFlags: 1
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_Name:
|
||||||
|
m_Conditions:
|
||||||
|
- m_ConditionMode: 2
|
||||||
|
m_ConditionEvent: Moving
|
||||||
|
m_EventTreshold: 0
|
||||||
|
m_DstStateMachine: {fileID: 0}
|
||||||
|
m_DstState: {fileID: 1102207974245764242}
|
||||||
|
m_Solo: 0
|
||||||
|
m_Mute: 0
|
||||||
|
m_IsExit: 0
|
||||||
|
serializedVersion: 3
|
||||||
|
m_TransitionDuration: 0.25
|
||||||
|
m_TransitionOffset: 0
|
||||||
|
m_ExitTime: 0.75
|
||||||
|
m_HasExitTime: 0
|
||||||
|
m_HasFixedDuration: 1
|
||||||
|
m_InterruptionSource: 0
|
||||||
|
m_OrderedInterruption: 1
|
||||||
|
m_CanTransitionToSelf: 1
|
||||||
|
--- !u!1101 &1101947542735704306
|
||||||
|
AnimatorStateTransition:
|
||||||
|
m_ObjectHideFlags: 1
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_Name:
|
||||||
|
m_Conditions:
|
||||||
|
- m_ConditionMode: 1
|
||||||
|
m_ConditionEvent: Moving
|
||||||
|
m_EventTreshold: 0
|
||||||
|
m_DstStateMachine: {fileID: 0}
|
||||||
|
m_DstState: {fileID: 1102824315819425342}
|
||||||
|
m_Solo: 0
|
||||||
|
m_Mute: 0
|
||||||
|
m_IsExit: 0
|
||||||
|
serializedVersion: 3
|
||||||
|
m_TransitionDuration: 0.25
|
||||||
|
m_TransitionOffset: 0
|
||||||
|
m_ExitTime: 0.75
|
||||||
|
m_HasExitTime: 0
|
||||||
|
m_HasFixedDuration: 1
|
||||||
|
m_InterruptionSource: 0
|
||||||
|
m_OrderedInterruption: 1
|
||||||
|
m_CanTransitionToSelf: 1
|
||||||
|
--- !u!1102 &1102207974245764242
|
||||||
|
AnimatorState:
|
||||||
|
serializedVersion: 5
|
||||||
|
m_ObjectHideFlags: 1
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_Name: Idle
|
||||||
|
m_Speed: 1
|
||||||
|
m_CycleOffset: 0
|
||||||
|
m_Transitions:
|
||||||
|
- {fileID: 1101947542735704306}
|
||||||
|
m_StateMachineBehaviours: []
|
||||||
|
m_Position: {x: 50, y: 50, z: 0}
|
||||||
|
m_IKOnFeet: 0
|
||||||
|
m_WriteDefaultValues: 1
|
||||||
|
m_Mirror: 0
|
||||||
|
m_SpeedParameterActive: 0
|
||||||
|
m_MirrorParameterActive: 0
|
||||||
|
m_CycleOffsetParameterActive: 0
|
||||||
|
m_TimeParameterActive: 0
|
||||||
|
m_Motion: {fileID: 0}
|
||||||
|
m_Tag:
|
||||||
|
m_SpeedParameter:
|
||||||
|
m_MirrorParameter:
|
||||||
|
m_CycleOffsetParameter:
|
||||||
|
m_TimeParameter:
|
||||||
|
--- !u!1102 &1102254808008813326
|
||||||
|
AnimatorState:
|
||||||
|
serializedVersion: 5
|
||||||
|
m_ObjectHideFlags: 1
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_Name: Shoot
|
||||||
|
m_Speed: 1
|
||||||
|
m_CycleOffset: 0
|
||||||
|
m_Transitions:
|
||||||
|
- {fileID: 1101104249963802978}
|
||||||
|
- {fileID: 1101806660142692138}
|
||||||
|
m_StateMachineBehaviours: []
|
||||||
|
m_Position: {x: 50, y: 50, z: 0}
|
||||||
|
m_IKOnFeet: 0
|
||||||
|
m_WriteDefaultValues: 1
|
||||||
|
m_Mirror: 0
|
||||||
|
m_SpeedParameterActive: 0
|
||||||
|
m_MirrorParameterActive: 0
|
||||||
|
m_CycleOffsetParameterActive: 0
|
||||||
|
m_TimeParameterActive: 0
|
||||||
|
m_Motion: {fileID: 7400006, guid: 38b49695fc0a4418bbc350f2366660c5, type: 3}
|
||||||
|
m_Tag:
|
||||||
|
m_SpeedParameter:
|
||||||
|
m_MirrorParameter:
|
||||||
|
m_CycleOffsetParameter:
|
||||||
|
m_TimeParameter:
|
||||||
|
--- !u!1102 &1102824315819425342
|
||||||
|
AnimatorState:
|
||||||
|
serializedVersion: 5
|
||||||
|
m_ObjectHideFlags: 1
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_Name: Moving
|
||||||
|
m_Speed: 1
|
||||||
|
m_CycleOffset: 0
|
||||||
|
m_Transitions:
|
||||||
|
- {fileID: 1101862483397811748}
|
||||||
|
m_StateMachineBehaviours: []
|
||||||
|
m_Position: {x: 50, y: 50, z: 0}
|
||||||
|
m_IKOnFeet: 0
|
||||||
|
m_WriteDefaultValues: 1
|
||||||
|
m_Mirror: 0
|
||||||
|
m_SpeedParameterActive: 0
|
||||||
|
m_MirrorParameterActive: 0
|
||||||
|
m_CycleOffsetParameterActive: 0
|
||||||
|
m_TimeParameterActive: 0
|
||||||
|
m_Motion: {fileID: 7400004, guid: 38b49695fc0a4418bbc350f2366660c5, type: 3}
|
||||||
|
m_Tag:
|
||||||
|
m_SpeedParameter:
|
||||||
|
m_MirrorParameter:
|
||||||
|
m_CycleOffsetParameter:
|
||||||
|
m_TimeParameter:
|
||||||
|
--- !u!1107 &1107772262116321704
|
||||||
|
AnimatorStateMachine:
|
||||||
|
serializedVersion: 5
|
||||||
|
m_ObjectHideFlags: 1
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_Name: Base Layer
|
||||||
|
m_ChildStates:
|
||||||
|
- serializedVersion: 1
|
||||||
|
m_State: {fileID: 1102207974245764242}
|
||||||
|
m_Position: {x: 252, y: 48, z: 0}
|
||||||
|
- serializedVersion: 1
|
||||||
|
m_State: {fileID: 1102824315819425342}
|
||||||
|
m_Position: {x: 252, y: 204, z: 0}
|
||||||
|
- serializedVersion: 1
|
||||||
|
m_State: {fileID: 1102254808008813326}
|
||||||
|
m_Position: {x: 420, y: 120, z: 0}
|
||||||
|
m_ChildStateMachines: []
|
||||||
|
m_AnyStateTransitions:
|
||||||
|
- {fileID: 1101366829127142966}
|
||||||
|
m_EntryTransitions: []
|
||||||
|
m_StateMachineTransitions: {}
|
||||||
|
m_StateMachineBehaviours: []
|
||||||
|
m_AnyStatePosition: {x: 60, y: 132, z: 0}
|
||||||
|
m_EntryPosition: {x: 60, y: 168, z: 0}
|
||||||
|
m_ExitPosition: {x: 60, y: 96, z: 0}
|
||||||
|
m_ParentStateMachinePosition: {x: 800, y: 20, z: 0}
|
||||||
|
m_DefaultState: {fileID: 1102207974245764242}
|
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: a7211483bbd794b6d85ed88576e7d85c
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 9100000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
After Width: | Height: | Size: 78 KiB |
@ -1,12 +1,12 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: e79a606e2465b49168ad7785fd79e9d3
|
guid: 9b3e91ab0048a4aa3a17706a349c6bf5
|
||||||
TextureImporter:
|
TextureImporter:
|
||||||
fileIDToRecycleName: {}
|
fileIDToRecycleName: {}
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
serializedVersion: 4
|
serializedVersion: 9
|
||||||
mipmaps:
|
mipmaps:
|
||||||
mipMapMode: 0
|
mipMapMode: 0
|
||||||
enableMipMap: 0
|
enableMipMap: 1
|
||||||
sRGBTexture: 1
|
sRGBTexture: 1
|
||||||
linearTexture: 0
|
linearTexture: 0
|
||||||
fadeOut: 0
|
fadeOut: 0
|
||||||
@ -21,6 +21,8 @@ TextureImporter:
|
|||||||
heightScale: 0.25
|
heightScale: 0.25
|
||||||
normalMapFilter: 0
|
normalMapFilter: 0
|
||||||
isReadable: 0
|
isReadable: 0
|
||||||
|
streamingMipmaps: 0
|
||||||
|
streamingMipmapsPriority: 0
|
||||||
grayScaleToAlpha: 0
|
grayScaleToAlpha: 0
|
||||||
generateCubemap: 6
|
generateCubemap: 6
|
||||||
cubemapConvolution: 0
|
cubemapConvolution: 0
|
||||||
@ -31,14 +33,14 @@ TextureImporter:
|
|||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
filterMode: -1
|
filterMode: -1
|
||||||
aniso: -1
|
aniso: -1
|
||||||
mipBias: -1
|
mipBias: -100
|
||||||
wrapU: 1
|
wrapU: -1
|
||||||
wrapV: 1
|
wrapV: -1
|
||||||
wrapW: 1
|
wrapW: -1
|
||||||
nPOTScale: 0
|
nPOTScale: 1
|
||||||
lightmap: 0
|
lightmap: 0
|
||||||
compressionQuality: 50
|
compressionQuality: 50
|
||||||
spriteMode: 1
|
spriteMode: 0
|
||||||
spriteExtrude: 1
|
spriteExtrude: 1
|
||||||
spriteMeshType: 1
|
spriteMeshType: 1
|
||||||
alignment: 0
|
alignment: 0
|
||||||
@ -47,15 +49,17 @@ TextureImporter:
|
|||||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||||
spriteGenerateFallbackPhysicsShape: 1
|
spriteGenerateFallbackPhysicsShape: 1
|
||||||
alphaUsage: 1
|
alphaUsage: 1
|
||||||
alphaIsTransparency: 1
|
alphaIsTransparency: 0
|
||||||
spriteTessellationDetail: -1
|
spriteTessellationDetail: -1
|
||||||
textureType: 8
|
textureType: 0
|
||||||
textureShape: 1
|
textureShape: 1
|
||||||
|
singleChannelComponent: 0
|
||||||
maxTextureSizeSet: 0
|
maxTextureSizeSet: 0
|
||||||
compressionQualitySet: 0
|
compressionQualitySet: 0
|
||||||
textureFormatSet: 0
|
textureFormatSet: 0
|
||||||
platformSettings:
|
platformSettings:
|
||||||
- buildTarget: DefaultTexturePlatform
|
- serializedVersion: 2
|
||||||
|
buildTarget: DefaultTexturePlatform
|
||||||
maxTextureSize: 2048
|
maxTextureSize: 2048
|
||||||
resizeAlgorithm: 0
|
resizeAlgorithm: 0
|
||||||
textureFormat: -1
|
textureFormat: -1
|
||||||
@ -70,7 +74,15 @@ TextureImporter:
|
|||||||
sprites: []
|
sprites: []
|
||||||
outline: []
|
outline: []
|
||||||
physicsShape: []
|
physicsShape: []
|
||||||
|
bones: []
|
||||||
|
spriteID:
|
||||||
|
vertices: []
|
||||||
|
indices:
|
||||||
|
edges: []
|
||||||
|
weights: []
|
||||||
spritePackingTag:
|
spritePackingTag:
|
||||||
|
pSDRemoveMatte: 0
|
||||||
|
pSDShowRemoveMatteOption: 0
|
||||||
userData:
|
userData:
|
||||||
assetBundleName:
|
assetBundleName:
|
||||||
assetBundleVariant:
|
assetBundleVariant:
|
After Width: | Height: | Size: 61 KiB |
@ -1,12 +1,12 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 1df5a55dca9084efba7314d168c7106f
|
guid: a7467e18a834e4d1390091c8b1ea562c
|
||||||
TextureImporter:
|
TextureImporter:
|
||||||
fileIDToRecycleName: {}
|
fileIDToRecycleName: {}
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
serializedVersion: 4
|
serializedVersion: 9
|
||||||
mipmaps:
|
mipmaps:
|
||||||
mipMapMode: 0
|
mipMapMode: 0
|
||||||
enableMipMap: 0
|
enableMipMap: 1
|
||||||
sRGBTexture: 1
|
sRGBTexture: 1
|
||||||
linearTexture: 0
|
linearTexture: 0
|
||||||
fadeOut: 0
|
fadeOut: 0
|
||||||
@ -21,6 +21,8 @@ TextureImporter:
|
|||||||
heightScale: 0.25
|
heightScale: 0.25
|
||||||
normalMapFilter: 0
|
normalMapFilter: 0
|
||||||
isReadable: 0
|
isReadable: 0
|
||||||
|
streamingMipmaps: 0
|
||||||
|
streamingMipmapsPriority: 0
|
||||||
grayScaleToAlpha: 0
|
grayScaleToAlpha: 0
|
||||||
generateCubemap: 6
|
generateCubemap: 6
|
||||||
cubemapConvolution: 0
|
cubemapConvolution: 0
|
||||||
@ -31,14 +33,14 @@ TextureImporter:
|
|||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
filterMode: -1
|
filterMode: -1
|
||||||
aniso: -1
|
aniso: -1
|
||||||
mipBias: -1
|
mipBias: -100
|
||||||
wrapU: 1
|
wrapU: -1
|
||||||
wrapV: 1
|
wrapV: -1
|
||||||
wrapW: 1
|
wrapW: -1
|
||||||
nPOTScale: 0
|
nPOTScale: 1
|
||||||
lightmap: 0
|
lightmap: 0
|
||||||
compressionQuality: 50
|
compressionQuality: 50
|
||||||
spriteMode: 1
|
spriteMode: 0
|
||||||
spriteExtrude: 1
|
spriteExtrude: 1
|
||||||
spriteMeshType: 1
|
spriteMeshType: 1
|
||||||
alignment: 0
|
alignment: 0
|
||||||
@ -47,15 +49,17 @@ TextureImporter:
|
|||||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||||
spriteGenerateFallbackPhysicsShape: 1
|
spriteGenerateFallbackPhysicsShape: 1
|
||||||
alphaUsage: 1
|
alphaUsage: 1
|
||||||
alphaIsTransparency: 1
|
alphaIsTransparency: 0
|
||||||
spriteTessellationDetail: -1
|
spriteTessellationDetail: -1
|
||||||
textureType: 8
|
textureType: 0
|
||||||
textureShape: 1
|
textureShape: 1
|
||||||
|
singleChannelComponent: 0
|
||||||
maxTextureSizeSet: 0
|
maxTextureSizeSet: 0
|
||||||
compressionQualitySet: 0
|
compressionQualitySet: 0
|
||||||
textureFormatSet: 0
|
textureFormatSet: 0
|
||||||
platformSettings:
|
platformSettings:
|
||||||
- buildTarget: DefaultTexturePlatform
|
- serializedVersion: 2
|
||||||
|
buildTarget: DefaultTexturePlatform
|
||||||
maxTextureSize: 2048
|
maxTextureSize: 2048
|
||||||
resizeAlgorithm: 0
|
resizeAlgorithm: 0
|
||||||
textureFormat: -1
|
textureFormat: -1
|
||||||
@ -70,7 +74,15 @@ TextureImporter:
|
|||||||
sprites: []
|
sprites: []
|
||||||
outline: []
|
outline: []
|
||||||
physicsShape: []
|
physicsShape: []
|
||||||
|
bones: []
|
||||||
|
spriteID:
|
||||||
|
vertices: []
|
||||||
|
indices:
|
||||||
|
edges: []
|
||||||
|
weights: []
|
||||||
spritePackingTag:
|
spritePackingTag:
|
||||||
|
pSDRemoveMatte: 0
|
||||||
|
pSDShowRemoveMatteOption: 0
|
||||||
userData:
|
userData:
|
||||||
assetBundleName:
|
assetBundleName:
|
||||||
assetBundleVariant:
|
assetBundleVariant:
|
After Width: | Height: | Size: 651 KiB |
@ -1,9 +1,9 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: a623522aaab404bfb886bdd6fea0df80
|
guid: 2617bfecca4d44805a3a51a7aa215d7c
|
||||||
TextureImporter:
|
TextureImporter:
|
||||||
fileIDToRecycleName: {}
|
fileIDToRecycleName: {}
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
serializedVersion: 4
|
serializedVersion: 9
|
||||||
mipmaps:
|
mipmaps:
|
||||||
mipMapMode: 0
|
mipMapMode: 0
|
||||||
enableMipMap: 1
|
enableMipMap: 1
|
||||||
@ -21,6 +21,8 @@ TextureImporter:
|
|||||||
heightScale: 0.25
|
heightScale: 0.25
|
||||||
normalMapFilter: 0
|
normalMapFilter: 0
|
||||||
isReadable: 0
|
isReadable: 0
|
||||||
|
streamingMipmaps: 0
|
||||||
|
streamingMipmapsPriority: 0
|
||||||
grayScaleToAlpha: 0
|
grayScaleToAlpha: 0
|
||||||
generateCubemap: 6
|
generateCubemap: 6
|
||||||
cubemapConvolution: 0
|
cubemapConvolution: 0
|
||||||
@ -31,14 +33,14 @@ TextureImporter:
|
|||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
filterMode: -1
|
filterMode: -1
|
||||||
aniso: -1
|
aniso: -1
|
||||||
mipBias: -1
|
mipBias: -100
|
||||||
wrapU: 1
|
wrapU: -1
|
||||||
wrapV: 1
|
wrapV: -1
|
||||||
wrapW: 1
|
wrapW: -1
|
||||||
nPOTScale: 0
|
nPOTScale: 1
|
||||||
lightmap: 0
|
lightmap: 0
|
||||||
compressionQuality: 50
|
compressionQuality: 50
|
||||||
spriteMode: 1
|
spriteMode: 0
|
||||||
spriteExtrude: 1
|
spriteExtrude: 1
|
||||||
spriteMeshType: 1
|
spriteMeshType: 1
|
||||||
alignment: 0
|
alignment: 0
|
||||||
@ -51,11 +53,13 @@ TextureImporter:
|
|||||||
spriteTessellationDetail: -1
|
spriteTessellationDetail: -1
|
||||||
textureType: 1
|
textureType: 1
|
||||||
textureShape: 1
|
textureShape: 1
|
||||||
|
singleChannelComponent: 0
|
||||||
maxTextureSizeSet: 0
|
maxTextureSizeSet: 0
|
||||||
compressionQualitySet: 0
|
compressionQualitySet: 0
|
||||||
textureFormatSet: 0
|
textureFormatSet: 0
|
||||||
platformSettings:
|
platformSettings:
|
||||||
- buildTarget: DefaultTexturePlatform
|
- serializedVersion: 2
|
||||||
|
buildTarget: DefaultTexturePlatform
|
||||||
maxTextureSize: 2048
|
maxTextureSize: 2048
|
||||||
resizeAlgorithm: 0
|
resizeAlgorithm: 0
|
||||||
textureFormat: -1
|
textureFormat: -1
|
||||||
@ -70,7 +74,15 @@ TextureImporter:
|
|||||||
sprites: []
|
sprites: []
|
||||||
outline: []
|
outline: []
|
||||||
physicsShape: []
|
physicsShape: []
|
||||||
|
bones: []
|
||||||
|
spriteID:
|
||||||
|
vertices: []
|
||||||
|
indices:
|
||||||
|
edges: []
|
||||||
|
weights: []
|
||||||
spritePackingTag:
|
spritePackingTag:
|
||||||
|
pSDRemoveMatte: 0
|
||||||
|
pSDShowRemoveMatteOption: 0
|
||||||
userData:
|
userData:
|
||||||
assetBundleName:
|
assetBundleName:
|
||||||
assetBundleVariant:
|
assetBundleVariant:
|
@ -0,0 +1,7 @@
|
|||||||
|
Recon Tank (update), by Mophs
|
||||||
|
https://opengameart.org/users/mophs
|
||||||
|
|
||||||
|
Based on original work, Recon Tank, By MNDV.ecb, 2018 Eric Buisson
|
||||||
|
https://opengameart.org/content/recon-tank
|
||||||
|
|
||||||
|
CC-BY 4.0
|
@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: c7df69c69208a455abb56f1ec2ac9906
|
guid: 6e745106dbbc3412bbe43eaf25dabd4f
|
||||||
TextScriptImporter:
|
TextScriptImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
userData:
|
userData:
|
@ -0,0 +1,82 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!21 &2100000
|
||||||
|
Material:
|
||||||
|
serializedVersion: 6
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_Name: TankMaterial
|
||||||
|
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
|
||||||
|
m_ShaderKeywords: _EMISSION _METALLICGLOSSMAP _NORMALMAP _SPECGLOSSMAP
|
||||||
|
m_LightmapFlags: 0
|
||||||
|
m_EnableInstancingVariants: 0
|
||||||
|
m_DoubleSidedGI: 0
|
||||||
|
m_CustomRenderQueue: -1
|
||||||
|
stringTagMap: {}
|
||||||
|
disabledShaderPasses: []
|
||||||
|
m_SavedProperties:
|
||||||
|
serializedVersion: 3
|
||||||
|
m_TexEnvs:
|
||||||
|
- _BumpMap:
|
||||||
|
m_Texture: {fileID: 2800000, guid: 2617bfecca4d44805a3a51a7aa215d7c, type: 3}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _DetailAlbedoMap:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _DetailMask:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _DetailNormalMap:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _EmissionMap:
|
||||||
|
m_Texture: {fileID: 2800000, guid: 9b3e91ab0048a4aa3a17706a349c6bf5, type: 3}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _MainTex:
|
||||||
|
m_Texture: {fileID: 2800000, guid: ce00d67f9368944fa8ef4de6ccc77bfa, type: 3}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _MetallicGlossMap:
|
||||||
|
m_Texture: {fileID: 2800000, guid: a7467e18a834e4d1390091c8b1ea562c, type: 3}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _OcclusionMap:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _ParallaxMap:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _SpecGlossMap:
|
||||||
|
m_Texture: {fileID: 2800000, guid: a7467e18a834e4d1390091c8b1ea562c, type: 3}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
m_Floats:
|
||||||
|
- _BumpScale: 1.75
|
||||||
|
- _Cutoff: 0.5
|
||||||
|
- _DetailNormalMapScale: 1
|
||||||
|
- _DstBlend: 0
|
||||||
|
- _GlossMapScale: 0.09
|
||||||
|
- _Glossiness: 0.5
|
||||||
|
- _GlossyReflections: 1
|
||||||
|
- _Metallic: 0
|
||||||
|
- _Mode: 0
|
||||||
|
- _OcclusionStrength: 1
|
||||||
|
- _Parallax: 0.02
|
||||||
|
- _SmoothnessTextureChannel: 0
|
||||||
|
- _SpecularHighlights: 1
|
||||||
|
- _SrcBlend: 1
|
||||||
|
- _UVSec: 0
|
||||||
|
- _ZWrite: 1
|
||||||
|
m_Colors:
|
||||||
|
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||||
|
- _EmissionColor: {r: 1, g: 1, b: 1, a: 1}
|
||||||
|
- _SpecColor: {r: 0.2, g: 0.2, b: 0.2, a: 1}
|
@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 2ef04982cb77c4fa984062fdcfc61d20
|
guid: 2e67e42170aa64aa9a33424f8045ac89
|
||||||
NativeFormatImporter:
|
NativeFormatImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
mainObjectFileID: 2100000
|
mainObjectFileID: 2100000
|
@ -0,0 +1,239 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 38b49695fc0a4418bbc350f2366660c5
|
||||||
|
ModelImporter:
|
||||||
|
serializedVersion: 23
|
||||||
|
fileIDToRecycleName:
|
||||||
|
100000: Barrel
|
||||||
|
100002: Barrel_end
|
||||||
|
100004: Chasis
|
||||||
|
100006: Recon_Tank
|
||||||
|
100008: Recon_Tank_Rig
|
||||||
|
100010: //RootNode
|
||||||
|
100012: Root
|
||||||
|
100014: Turret
|
||||||
|
100016: Wheel_Front_L
|
||||||
|
100018: Wheel_Front_L_end
|
||||||
|
100020: Wheel_Middle_L
|
||||||
|
100022: Wheel_Middle_L_end
|
||||||
|
100024: Wheel_Rear_L
|
||||||
|
100026: Wheel_Rear_L_end
|
||||||
|
400000: Barrel
|
||||||
|
400002: Barrel_end
|
||||||
|
400004: Chasis
|
||||||
|
400006: Recon_Tank
|
||||||
|
400008: Recon_Tank_Rig
|
||||||
|
400010: //RootNode
|
||||||
|
400012: Root
|
||||||
|
400014: Turret
|
||||||
|
400016: Wheel_Front_L
|
||||||
|
400018: Wheel_Front_L_end
|
||||||
|
400020: Wheel_Middle_L
|
||||||
|
400022: Wheel_Middle_L_end
|
||||||
|
400024: Wheel_Rear_L
|
||||||
|
400026: Wheel_Rear_L_end
|
||||||
|
2100000: Recon_Tank
|
||||||
|
4300000: Recon_Tank
|
||||||
|
7400000: Recon_Tank_Rig|Drive
|
||||||
|
7400002: Recon_Tank_Rig|Forward
|
||||||
|
7400004: Recon_Tank_Rig|Idle
|
||||||
|
7400006: Recon_Tank_Rig|Shoot
|
||||||
|
9500000: //RootNode
|
||||||
|
13700000: Recon_Tank
|
||||||
|
externalObjects: {}
|
||||||
|
materials:
|
||||||
|
importMaterials: 1
|
||||||
|
materialName: 0
|
||||||
|
materialSearch: 1
|
||||||
|
materialLocation: 1
|
||||||
|
animations:
|
||||||
|
legacyGenerateAnimations: 4
|
||||||
|
bakeSimulation: 0
|
||||||
|
resampleCurves: 1
|
||||||
|
optimizeGameObjects: 0
|
||||||
|
motionNodeName:
|
||||||
|
rigImportErrors:
|
||||||
|
rigImportWarnings:
|
||||||
|
animationImportErrors:
|
||||||
|
animationImportWarnings:
|
||||||
|
animationRetargetingWarnings:
|
||||||
|
animationDoRetargetingWarnings: 0
|
||||||
|
importAnimatedCustomProperties: 0
|
||||||
|
importConstraints: 0
|
||||||
|
animationCompression: 1
|
||||||
|
animationRotationError: 0.5
|
||||||
|
animationPositionError: 0.5
|
||||||
|
animationScaleError: 0.5
|
||||||
|
animationWrapMode: 0
|
||||||
|
extraExposedTransformPaths: []
|
||||||
|
extraUserProperties: []
|
||||||
|
clipAnimations:
|
||||||
|
- serializedVersion: 16
|
||||||
|
name: Recon_Tank_Rig|Drive
|
||||||
|
takeName: Recon_Tank_Rig|Drive
|
||||||
|
firstFrame: 0
|
||||||
|
lastFrame: 1
|
||||||
|
wrapMode: 0
|
||||||
|
orientationOffsetY: 0
|
||||||
|
level: 0
|
||||||
|
cycleOffset: 0
|
||||||
|
loop: 0
|
||||||
|
hasAdditiveReferencePose: 0
|
||||||
|
loopTime: 0
|
||||||
|
loopBlend: 0
|
||||||
|
loopBlendOrientation: 0
|
||||||
|
loopBlendPositionY: 0
|
||||||
|
loopBlendPositionXZ: 0
|
||||||
|
keepOriginalOrientation: 0
|
||||||
|
keepOriginalPositionY: 1
|
||||||
|
keepOriginalPositionXZ: 0
|
||||||
|
heightFromFeet: 0
|
||||||
|
mirror: 0
|
||||||
|
bodyMask: 01000000010000000100000001000000010000000100000001000000010000000100000001000000010000000100000001000000
|
||||||
|
curves: []
|
||||||
|
events: []
|
||||||
|
transformMask: []
|
||||||
|
maskType: 3
|
||||||
|
maskSource: {instanceID: 0}
|
||||||
|
additiveReferencePoseFrame: 0
|
||||||
|
- serializedVersion: 16
|
||||||
|
name: Recon_Tank_Rig|Forward
|
||||||
|
takeName: Recon_Tank_Rig|Forward
|
||||||
|
firstFrame: 0
|
||||||
|
lastFrame: 25
|
||||||
|
wrapMode: 0
|
||||||
|
orientationOffsetY: 0
|
||||||
|
level: 0
|
||||||
|
cycleOffset: 0
|
||||||
|
loop: 0
|
||||||
|
hasAdditiveReferencePose: 0
|
||||||
|
loopTime: 0
|
||||||
|
loopBlend: 0
|
||||||
|
loopBlendOrientation: 0
|
||||||
|
loopBlendPositionY: 0
|
||||||
|
loopBlendPositionXZ: 0
|
||||||
|
keepOriginalOrientation: 0
|
||||||
|
keepOriginalPositionY: 1
|
||||||
|
keepOriginalPositionXZ: 0
|
||||||
|
heightFromFeet: 0
|
||||||
|
mirror: 0
|
||||||
|
bodyMask: 01000000010000000100000001000000010000000100000001000000010000000100000001000000010000000100000001000000
|
||||||
|
curves: []
|
||||||
|
events: []
|
||||||
|
transformMask: []
|
||||||
|
maskType: 3
|
||||||
|
maskSource: {instanceID: 0}
|
||||||
|
additiveReferencePoseFrame: 0
|
||||||
|
- serializedVersion: 16
|
||||||
|
name: Recon_Tank_Rig|Idle
|
||||||
|
takeName: Recon_Tank_Rig|Idle
|
||||||
|
firstFrame: 0
|
||||||
|
lastFrame: 11
|
||||||
|
wrapMode: 0
|
||||||
|
orientationOffsetY: 0
|
||||||
|
level: 0
|
||||||
|
cycleOffset: 0
|
||||||
|
loop: 0
|
||||||
|
hasAdditiveReferencePose: 0
|
||||||
|
loopTime: 1
|
||||||
|
loopBlend: 1
|
||||||
|
loopBlendOrientation: 0
|
||||||
|
loopBlendPositionY: 0
|
||||||
|
loopBlendPositionXZ: 0
|
||||||
|
keepOriginalOrientation: 0
|
||||||
|
keepOriginalPositionY: 1
|
||||||
|
keepOriginalPositionXZ: 0
|
||||||
|
heightFromFeet: 0
|
||||||
|
mirror: 0
|
||||||
|
bodyMask: 01000000010000000100000001000000010000000100000001000000010000000100000001000000010000000100000001000000
|
||||||
|
curves: []
|
||||||
|
events: []
|
||||||
|
transformMask: []
|
||||||
|
maskType: 3
|
||||||
|
maskSource: {instanceID: 0}
|
||||||
|
additiveReferencePoseFrame: 0
|
||||||
|
- serializedVersion: 16
|
||||||
|
name: Recon_Tank_Rig|Shoot
|
||||||
|
takeName: Recon_Tank_Rig|Shoot
|
||||||
|
firstFrame: 0
|
||||||
|
lastFrame: 15
|
||||||
|
wrapMode: 0
|
||||||
|
orientationOffsetY: 0
|
||||||
|
level: 0
|
||||||
|
cycleOffset: 0
|
||||||
|
loop: 0
|
||||||
|
hasAdditiveReferencePose: 0
|
||||||
|
loopTime: 0
|
||||||
|
loopBlend: 0
|
||||||
|
loopBlendOrientation: 0
|
||||||
|
loopBlendPositionY: 0
|
||||||
|
loopBlendPositionXZ: 0
|
||||||
|
keepOriginalOrientation: 0
|
||||||
|
keepOriginalPositionY: 1
|
||||||
|
keepOriginalPositionXZ: 0
|
||||||
|
heightFromFeet: 0
|
||||||
|
mirror: 0
|
||||||
|
bodyMask: 01000000010000000100000001000000010000000100000001000000010000000100000001000000010000000100000001000000
|
||||||
|
curves: []
|
||||||
|
events: []
|
||||||
|
transformMask: []
|
||||||
|
maskType: 3
|
||||||
|
maskSource: {instanceID: 0}
|
||||||
|
additiveReferencePoseFrame: 0
|
||||||
|
isReadable: 1
|
||||||
|
meshes:
|
||||||
|
lODScreenPercentages: []
|
||||||
|
globalScale: 0.15
|
||||||
|
meshCompression: 0
|
||||||
|
addColliders: 0
|
||||||
|
useSRGBMaterialColor: 1
|
||||||
|
importVisibility: 1
|
||||||
|
importBlendShapes: 1
|
||||||
|
importCameras: 1
|
||||||
|
importLights: 1
|
||||||
|
swapUVChannels: 0
|
||||||
|
generateSecondaryUV: 0
|
||||||
|
useFileUnits: 1
|
||||||
|
optimizeMeshForGPU: 1
|
||||||
|
keepQuads: 0
|
||||||
|
weldVertices: 1
|
||||||
|
preserveHierarchy: 0
|
||||||
|
indexFormat: 0
|
||||||
|
secondaryUVAngleDistortion: 8
|
||||||
|
secondaryUVAreaDistortion: 15.000001
|
||||||
|
secondaryUVHardAngle: 88
|
||||||
|
secondaryUVPackMargin: 4
|
||||||
|
useFileScale: 1
|
||||||
|
previousCalculatedGlobalScale: 0.0015
|
||||||
|
hasPreviousCalculatedGlobalScale: 1
|
||||||
|
tangentSpace:
|
||||||
|
normalSmoothAngle: 60
|
||||||
|
normalImportMode: 0
|
||||||
|
tangentImportMode: 3
|
||||||
|
normalCalculationMode: 4
|
||||||
|
legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0
|
||||||
|
blendShapeNormalImportMode: 1
|
||||||
|
normalSmoothingSource: 0
|
||||||
|
importAnimation: 1
|
||||||
|
copyAvatar: 0
|
||||||
|
humanDescription:
|
||||||
|
serializedVersion: 2
|
||||||
|
human: []
|
||||||
|
skeleton: []
|
||||||
|
armTwist: 0.5
|
||||||
|
foreArmTwist: 0.5
|
||||||
|
upperLegTwist: 0.5
|
||||||
|
legTwist: 0.5
|
||||||
|
armStretch: 0.05
|
||||||
|
legStretch: 0.05
|
||||||
|
feetSpacing: 0
|
||||||
|
rootMotionBoneName:
|
||||||
|
hasTranslationDoF: 0
|
||||||
|
hasExtraRoot: 0
|
||||||
|
skeletonHasParents: 1
|
||||||
|
lastHumanDescriptionAvatarSource: {instanceID: 0}
|
||||||
|
animationType: 2
|
||||||
|
humanoidOversampling: 1
|
||||||
|
additionalBone: 0
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
246
Assets/Mirror/Examples/Tanks/Prefabs/Projectile.prefab
Normal file
@ -0,0 +1,246 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!1 &63476987332307980
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 8035186136109819211}
|
||||||
|
- component: {fileID: 9118274893554935717}
|
||||||
|
- component: {fileID: 69063397099238371}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: 3D Model
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &8035186136109819211
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 63476987332307980}
|
||||||
|
m_LocalRotation: {x: 0.7071068, y: 0, z: 0, w: 0.7071068}
|
||||||
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
|
m_LocalScale: {x: 0.05, y: 0.1, z: 0.05}
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 24373266488650541}
|
||||||
|
m_RootOrder: 0
|
||||||
|
m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0}
|
||||||
|
--- !u!33 &9118274893554935717
|
||||||
|
MeshFilter:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 63476987332307980}
|
||||||
|
m_Mesh: {fileID: 10208, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
|
--- !u!23 &69063397099238371
|
||||||
|
MeshRenderer:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 63476987332307980}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_CastShadows: 1
|
||||||
|
m_ReceiveShadows: 1
|
||||||
|
m_DynamicOccludee: 1
|
||||||
|
m_MotionVectors: 1
|
||||||
|
m_LightProbeUsage: 1
|
||||||
|
m_ReflectionProbeUsage: 1
|
||||||
|
m_RenderingLayerMask: 1
|
||||||
|
m_RendererPriority: 0
|
||||||
|
m_Materials:
|
||||||
|
- {fileID: 2100000, guid: cba1b63a0bccc4b12ac25f05d0ae2dd1, type: 2}
|
||||||
|
m_StaticBatchInfo:
|
||||||
|
firstSubMesh: 0
|
||||||
|
subMeshCount: 0
|
||||||
|
m_StaticBatchRoot: {fileID: 0}
|
||||||
|
m_ProbeAnchor: {fileID: 0}
|
||||||
|
m_LightProbeVolumeOverride: {fileID: 0}
|
||||||
|
m_ScaleInLightmap: 1
|
||||||
|
m_PreserveUVs: 0
|
||||||
|
m_IgnoreNormalsForChartDetection: 0
|
||||||
|
m_ImportantGI: 0
|
||||||
|
m_StitchLightmapSeams: 0
|
||||||
|
m_SelectedEditorRenderState: 3
|
||||||
|
m_MinimumChartSize: 4
|
||||||
|
m_AutoUVMaxDistance: 0.5
|
||||||
|
m_AutoUVMaxAngle: 89
|
||||||
|
m_LightmapParameters: {fileID: 0}
|
||||||
|
m_SortingLayerID: 0
|
||||||
|
m_SortingLayer: 0
|
||||||
|
m_SortingOrder: 0
|
||||||
|
--- !u!1 &5890560936853567077
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 24373266488650541}
|
||||||
|
- component: {fileID: 1713098107664522388}
|
||||||
|
- component: {fileID: 2355290524794870353}
|
||||||
|
- component: {fileID: 4629190479245867726}
|
||||||
|
- component: {fileID: 7082621516996595528}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: Projectile
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &24373266488650541
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 5890560936853567077}
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_Children:
|
||||||
|
- {fileID: 8035186136109819211}
|
||||||
|
- {fileID: 7830988697844474908}
|
||||||
|
m_Father: {fileID: 0}
|
||||||
|
m_RootOrder: 0
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!114 &1713098107664522388
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 5890560936853567077}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 9b91ecbcc199f4492b9a91e820070131, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
m_ServerOnly: 0
|
||||||
|
m_LocalPlayerAuthority: 0
|
||||||
|
m_AssetId: b7dd46dbf38c643f09e206f9fa4be008
|
||||||
|
m_SceneId: 0
|
||||||
|
--- !u!136 &2355290524794870353
|
||||||
|
CapsuleCollider:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 5890560936853567077}
|
||||||
|
m_Material: {fileID: 0}
|
||||||
|
m_IsTrigger: 1
|
||||||
|
m_Enabled: 1
|
||||||
|
m_Radius: 0.05
|
||||||
|
m_Height: 0.2
|
||||||
|
m_Direction: 1
|
||||||
|
m_Center: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!54 &4629190479245867726
|
||||||
|
Rigidbody:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 5890560936853567077}
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Mass: 1
|
||||||
|
m_Drag: 0
|
||||||
|
m_AngularDrag: 0.05
|
||||||
|
m_UseGravity: 0
|
||||||
|
m_IsKinematic: 0
|
||||||
|
m_Interpolate: 1
|
||||||
|
m_Constraints: 0
|
||||||
|
m_CollisionDetection: 1
|
||||||
|
--- !u!114 &7082621516996595528
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 5890560936853567077}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 8f49b83f111a64bc7a5275af4f6f930b, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
syncInterval: 0.1
|
||||||
|
destroyAfter: 5
|
||||||
|
rigidBody: {fileID: 4629190479245867726}
|
||||||
|
force: 1000
|
||||||
|
--- !u!1 &9126921595194253319
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 7830988697844474908}
|
||||||
|
- component: {fileID: 4878977110396366525}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: Point Light
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &7830988697844474908
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 9126921595194253319}
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 24373266488650541}
|
||||||
|
m_RootOrder: 1
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!108 &4878977110396366525
|
||||||
|
Light:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 9126921595194253319}
|
||||||
|
m_Enabled: 1
|
||||||
|
serializedVersion: 8
|
||||||
|
m_Type: 2
|
||||||
|
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||||
|
m_Intensity: 5
|
||||||
|
m_Range: 2
|
||||||
|
m_SpotAngle: 30
|
||||||
|
m_CookieSize: 10
|
||||||
|
m_Shadows:
|
||||||
|
m_Type: 0
|
||||||
|
m_Resolution: -1
|
||||||
|
m_CustomResolution: -1
|
||||||
|
m_Strength: 1
|
||||||
|
m_Bias: 0.05
|
||||||
|
m_NormalBias: 0.4
|
||||||
|
m_NearPlane: 0.2
|
||||||
|
m_Cookie: {fileID: 0}
|
||||||
|
m_DrawHalo: 0
|
||||||
|
m_Flare: {fileID: 0}
|
||||||
|
m_RenderMode: 0
|
||||||
|
m_CullingMask:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 4294967295
|
||||||
|
m_Lightmapping: 4
|
||||||
|
m_LightShadowCasterMode: 0
|
||||||
|
m_AreaSize: {x: 1, y: 1}
|
||||||
|
m_BounceIntensity: 3
|
||||||
|
m_ColorTemperature: 6570
|
||||||
|
m_UseColorTemperature: 0
|
||||||
|
m_ShadowRadius: 0
|
||||||
|
m_ShadowAngle: 0
|
@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: b7dd46dbf38c643f09e206f9fa4be008
|
||||||
|
PrefabImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
312
Assets/Mirror/Examples/Tanks/Prefabs/Tank.prefab
Normal file
@ -0,0 +1,312 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!1 &1916082411674582
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 4492442352427800}
|
||||||
|
- component: {fileID: 114118589361100106}
|
||||||
|
- component: {fileID: 2240606817507776182}
|
||||||
|
- component: {fileID: 114250499875391520}
|
||||||
|
- component: {fileID: 6900008319038825817}
|
||||||
|
- component: {fileID: 5194388907919410155}
|
||||||
|
- component: {fileID: 114654712548978148}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: Tank
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &4492442352427800
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1916082411674582}
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_Children:
|
||||||
|
- {fileID: 7831918942946891954}
|
||||||
|
- {fileID: 6564220120147636086}
|
||||||
|
- {fileID: 5718089106632469514}
|
||||||
|
m_Father: {fileID: 0}
|
||||||
|
m_RootOrder: 0
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!114 &114118589361100106
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1916082411674582}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 9b91ecbcc199f4492b9a91e820070131, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
m_ServerOnly: 0
|
||||||
|
m_LocalPlayerAuthority: 1
|
||||||
|
m_AssetId: 6f43bf5488a7443d19ab2a83c6b91f35
|
||||||
|
m_SceneId: 0
|
||||||
|
--- !u!95 &2240606817507776182
|
||||||
|
Animator:
|
||||||
|
serializedVersion: 3
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1916082411674582}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_Avatar: {fileID: 9000000, guid: 38b49695fc0a4418bbc350f2366660c5, type: 3}
|
||||||
|
m_Controller: {fileID: 9100000, guid: a7211483bbd794b6d85ed88576e7d85c, type: 2}
|
||||||
|
m_CullingMode: 0
|
||||||
|
m_UpdateMode: 0
|
||||||
|
m_ApplyRootMotion: 0
|
||||||
|
m_LinearVelocityBlending: 0
|
||||||
|
m_WarningMessage:
|
||||||
|
m_HasTransformHierarchy: 1
|
||||||
|
m_AllowConstantClipSamplingOptimization: 1
|
||||||
|
m_KeepAnimatorControllerStateOnDisable: 0
|
||||||
|
--- !u!114 &114250499875391520
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1916082411674582}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 2f74aedd71d9a4f55b3ce499326d45fb, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
syncInterval: 0.1
|
||||||
|
compressRotation: 1
|
||||||
|
--- !u!195 &6900008319038825817
|
||||||
|
NavMeshAgent:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1916082411674582}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_AgentTypeID: 0
|
||||||
|
m_Radius: 0.5
|
||||||
|
m_Speed: 1
|
||||||
|
m_Acceleration: 1
|
||||||
|
avoidancePriority: 50
|
||||||
|
m_AngularSpeed: 120
|
||||||
|
m_StoppingDistance: 0
|
||||||
|
m_AutoTraverseOffMeshLink: 1
|
||||||
|
m_AutoBraking: 1
|
||||||
|
m_AutoRepath: 1
|
||||||
|
m_Height: 0.5
|
||||||
|
m_BaseOffset: 0
|
||||||
|
m_WalkableMask: 4294967295
|
||||||
|
m_ObstacleAvoidanceType: 0
|
||||||
|
--- !u!135 &5194388907919410155
|
||||||
|
SphereCollider:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1916082411674582}
|
||||||
|
m_Material: {fileID: 0}
|
||||||
|
m_IsTrigger: 1
|
||||||
|
m_Enabled: 1
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Radius: 0.5
|
||||||
|
m_Center: {x: 0, y: 0.25, z: 0}
|
||||||
|
--- !u!114 &114654712548978148
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1916082411674582}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 7deadf756194d461e9140e42d651693b, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
syncInterval: 0.1
|
||||||
|
agent: {fileID: 6900008319038825817}
|
||||||
|
animator: {fileID: 2240606817507776182}
|
||||||
|
rotationSpeed: 80
|
||||||
|
shootKey: 32
|
||||||
|
projectilePrefab: {fileID: 5890560936853567077, guid: b7dd46dbf38c643f09e206f9fa4be008,
|
||||||
|
type: 3}
|
||||||
|
projectileMount: {fileID: 5718089106632469514}
|
||||||
|
--- !u!1 &4426914200102054949
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 6564220120147636086}
|
||||||
|
- component: {fileID: 7604806193092689376}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: Spot Light
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &6564220120147636086
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 4426914200102054949}
|
||||||
|
m_LocalRotation: {x: 0.02281505, y: -0, z: -0, w: 0.9997397}
|
||||||
|
m_LocalPosition: {x: 0.07, y: 0.46, z: 0.126}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 4492442352427800}
|
||||||
|
m_RootOrder: 1
|
||||||
|
m_LocalEulerAnglesHint: {x: 2.615, y: 0, z: 0}
|
||||||
|
--- !u!108 &7604806193092689376
|
||||||
|
Light:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 4426914200102054949}
|
||||||
|
m_Enabled: 1
|
||||||
|
serializedVersion: 8
|
||||||
|
m_Type: 0
|
||||||
|
m_Color: {r: 1, g: 0.9205329, b: 0.7877358, a: 1}
|
||||||
|
m_Intensity: 3
|
||||||
|
m_Range: 15
|
||||||
|
m_SpotAngle: 80
|
||||||
|
m_CookieSize: 10
|
||||||
|
m_Shadows:
|
||||||
|
m_Type: 2
|
||||||
|
m_Resolution: -1
|
||||||
|
m_CustomResolution: -1
|
||||||
|
m_Strength: 1
|
||||||
|
m_Bias: 0.05
|
||||||
|
m_NormalBias: 0.4
|
||||||
|
m_NearPlane: 0.2
|
||||||
|
m_Cookie: {fileID: 0}
|
||||||
|
m_DrawHalo: 0
|
||||||
|
m_Flare: {fileID: 0}
|
||||||
|
m_RenderMode: 0
|
||||||
|
m_CullingMask:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 4294967295
|
||||||
|
m_Lightmapping: 4
|
||||||
|
m_LightShadowCasterMode: 0
|
||||||
|
m_AreaSize: {x: 1, y: 1}
|
||||||
|
m_BounceIntensity: 1
|
||||||
|
m_ColorTemperature: 6570
|
||||||
|
m_UseColorTemperature: 0
|
||||||
|
m_ShadowRadius: 0
|
||||||
|
m_ShadowAngle: 0
|
||||||
|
--- !u!1 &4730779867780281009
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 5718089106632469514}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: ProjectileMount
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: -964228994112308473, guid: 0000000000000000d000000000000000, type: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &5718089106632469514
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 4730779867780281009}
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0, y: 0.412, z: 0.936}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 4492442352427800}
|
||||||
|
m_RootOrder: 2
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!1001 &7831918942947279416
|
||||||
|
PrefabInstance:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Modification:
|
||||||
|
m_TransformParent: {fileID: 4492442352427800}
|
||||||
|
m_Modifications:
|
||||||
|
- target: {fileID: 100010, guid: 38b49695fc0a4418bbc350f2366660c5, type: 3}
|
||||||
|
propertyPath: m_Name
|
||||||
|
value: 3D Model
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 400010, guid: 38b49695fc0a4418bbc350f2366660c5, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 400010, guid: 38b49695fc0a4418bbc350f2366660c5, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 400010, guid: 38b49695fc0a4418bbc350f2366660c5, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 400010, guid: 38b49695fc0a4418bbc350f2366660c5, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 400010, guid: 38b49695fc0a4418bbc350f2366660c5, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 400010, guid: 38b49695fc0a4418bbc350f2366660c5, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 400010, guid: 38b49695fc0a4418bbc350f2366660c5, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.w
|
||||||
|
value: 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 400010, guid: 38b49695fc0a4418bbc350f2366660c5, type: 3}
|
||||||
|
propertyPath: m_RootOrder
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 400010, guid: 38b49695fc0a4418bbc350f2366660c5, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 400010, guid: 38b49695fc0a4418bbc350f2366660c5, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 400010, guid: 38b49695fc0a4418bbc350f2366660c5, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 13700000, guid: 38b49695fc0a4418bbc350f2366660c5, type: 3}
|
||||||
|
propertyPath: m_Materials.Array.data[0]
|
||||||
|
value:
|
||||||
|
objectReference: {fileID: 2100000, guid: 2e67e42170aa64aa9a33424f8045ac89, type: 2}
|
||||||
|
m_RemovedComponents:
|
||||||
|
- {fileID: 9500000, guid: 38b49695fc0a4418bbc350f2366660c5, type: 3}
|
||||||
|
m_SourcePrefab: {fileID: 100100000, guid: 38b49695fc0a4418bbc350f2366660c5, type: 3}
|
||||||
|
--- !u!4 &7831918942946891954 stripped
|
||||||
|
Transform:
|
||||||
|
m_CorrespondingSourceObject: {fileID: 400010, guid: 38b49695fc0a4418bbc350f2366660c5,
|
||||||
|
type: 3}
|
||||||
|
m_PrefabInstance: {fileID: 7831918942947279416}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|