Skip to content

Commit 9d19f7e

Browse files
Dev: Network Movement Player
More description in pullrequest #1
1 parent 51169f0 commit 9d19f7e

File tree

1,392 files changed

+143746
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,392 files changed

+143746
-0
lines changed

Assets/FishNet.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/FishNet/CodeGenerating.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/FishNet/CodeGenerating/Extension.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using FishNet.CodeGenerating.Helping.Extension;
2+
using MonoFN.Cecil.Cil;
3+
4+
namespace FishNet.CodeGenerating.Extension
5+
{
6+
7+
8+
internal static class ILProcessorExtensions
9+
{
10+
/// <summary>
11+
/// Creates a variable type within the body and returns it's VariableDef.
12+
/// </summary>
13+
internal static VariableDefinition CreateVariable(this ILProcessor processor, System.Type variableType)
14+
{
15+
return processor.Body.Method.CreateVariable(variableType);
16+
}
17+
}
18+
19+
20+
}

Assets/FishNet/CodeGenerating/Extension/ILProcessorExtensions.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+

2+
using FishNet.CodeGenerating.Helping;
3+
using FishNet.CodeGenerating.Helping.Extension;
4+
using MonoFN.Cecil;
5+
using UnityEngine;
6+
7+
namespace FishNet.CodeGenerating.Extension
8+
{
9+
10+
11+
internal static class TypeDefinitionExtensions
12+
{
13+
/// <summary>
14+
/// Returns a method in the next base class.
15+
/// </summary>
16+
public static MethodReference GetMethodReferenceInBase(this TypeDefinition td, string methodName)
17+
{
18+
if (td == null)
19+
{
20+
CodegenSession.LogError($"TypeDefinition is null.");
21+
return null;
22+
}
23+
if (td.BaseType == null)
24+
{
25+
CodegenSession.LogError($"BaseType for {td.FullName} is null.");
26+
return null;
27+
}
28+
29+
TypeDefinition baseTd = td.BaseType.CachedResolve();
30+
MethodDefinition baseMd = baseTd.GetMethod(methodName);
31+
//Not found.
32+
if (baseMd == null)
33+
return null;
34+
35+
//Is generic.
36+
if (baseTd.HasGenericParameters)
37+
{
38+
TypeReference baseTr = td.BaseType;
39+
GenericInstanceType baseGit = (GenericInstanceType)baseTr;
40+
41+
CodegenSession.ImportReference(baseMd.ReturnType);
42+
MethodReference mr = new MethodReference(methodName, baseMd.ReturnType)
43+
{
44+
DeclaringType = baseGit,
45+
CallingConvention = baseMd.CallingConvention,
46+
HasThis = baseMd.HasThis,
47+
ExplicitThis = baseMd.ExplicitThis,
48+
};
49+
return mr;
50+
}
51+
//Not generic.
52+
else
53+
{
54+
return CodegenSession.ImportReference(baseMd);
55+
}
56+
}
57+
58+
/// <summary>
59+
/// Returns a method in any inherited classes. The first found method is returned.
60+
/// </summary>
61+
public static MethodDefinition GetMethodDefinitionInAnyBase(this TypeDefinition td, string methodName)
62+
{
63+
while (td != null)
64+
{
65+
foreach (MethodDefinition md in td.Methods)
66+
{
67+
if (md.Name == methodName)
68+
return md;
69+
}
70+
71+
try
72+
{
73+
td = td.GetNextBaseTypeDefinition();
74+
}
75+
catch
76+
{
77+
return null;
78+
}
79+
}
80+
81+
return null;
82+
}
83+
84+
/// <summary>
85+
/// Returns the next base type.
86+
/// </summary>
87+
internal static TypeDefinition GetNextBaseTypeDefinition(this TypeDefinition typeDef)
88+
{
89+
return (typeDef.BaseType == null) ? null : typeDef.BaseType.CachedResolve();
90+
}
91+
92+
93+
}
94+
95+
96+
}

Assets/FishNet/CodeGenerating/Extension/TypeDefinitionExtensions.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+

2+
using FishNet.CodeGenerating.Helping;
3+
using FishNet.CodeGenerating.Helping.Extension;
4+
using MonoFN.Cecil;
5+
using UnityEngine;
6+
7+
namespace FishNet.CodeGenerating.Extension
8+
{
9+
10+
11+
internal static class TypeReferenceExtensions
12+
{
13+
14+
/// <summary>
15+
/// Returns a method in the next base class.
16+
/// </summary>
17+
public static MethodReference GetMethodInBase(this TypeReference tr, string methodName)
18+
{
19+
return GetMethodInBase(tr.CachedResolve(), methodName);
20+
}
21+
}
22+
23+
24+
}

Assets/FishNet/CodeGenerating/Extension/TypeReferenceExtensions.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
After updating a custom Cecil to fix conflict with Unity.Burst in 2021 perform the following:
2+
3+
- Open cecil in it's own project; eg: do not place directly in FN.
4+
- Rename namespace.Mono to namespace.MonoFN.
5+
- Current project rename strings, "Mono to "MonoFN
6+
- Replace current project #if INSIDE_ROCKS to #if UNITY_EDITOR
7+
- Comment out `[assembly: AssemblyTitle ("MonoFN.Cecil.Rocks")]` within rocks\Mono.Cecil.Rocks\AssemblyInfo.cs.
8+
- Delete obj/bin/tests folders.
9+
- Copy into FN project.

0 commit comments

Comments
 (0)