Paul Pacheco
59bc83f997
Fix more comments
2020-09-28 22:42:34 -05:00
Paul Pacheco
fe1064ce0b
Remove redundant InitLocals
2020-09-28 22:37:25 -05:00
Paul Pacheco
53452cc003
Fix comments
2020-09-28 22:37:25 -05:00
Paul Pacheco
5c4d8a27cc
Refactor writer for loops ( #2294 )
...
* Refactor writer for loops
* Remove unused variable
2020-09-28 22:37:25 -05:00
Paul Pacheco
fe2adc8d59
Deduplicate null check ( #2295 )
2020-09-28 22:37:25 -05:00
Paul Pacheco
0aea48cf06
Linting
2020-09-28 22:14:54 -05:00
Paul Pacheco
b9550cf6d3
Linting
2020-09-28 22:14:09 -05:00
Paul Pacheco
4ec84df494
Reuse checking for null ( #2293 )
2020-09-28 21:32:43 -05:00
Paul Pacheco
66be588512
reuse ReadLength ( #2292 )
2020-09-28 21:32:16 -05:00
Paul Pacheco
7c2a6595eb
refactor reader for loops ( #2291 )
...
* Fix comments
* refactor for loops
* Cleanup a bit
2020-09-28 21:29:52 -05:00
Paul Pacheco
69161144a0
Fix comments
2020-09-28 21:02:53 -05:00
Paul Pacheco
4a710b2eea
Add some comments
2020-09-28 20:44:18 -05:00
Paul Pacheco
86df5954ac
Add some comments
2020-09-28 20:32:38 -05:00
Paul Pacheco
3ccb7d9da4
feat: Support recursive data types ( #2288 )
...
Remove all the recursionCount nonsense.
This was added to prevent infinite recursion with types that reference themselves.
No need to check anymore, the weaver can generate readers and writers for types that reference themselves such as:
```cs
class Tree {
Tree child1;
Tree child2;
}
```
This works by the weaver doing it the way the compiler does: Create a function first, memoize it, then write the body. If the body needs the function, it will get itself and issue a call to itself.
2020-09-28 20:18:56 -05:00
Paul Pacheco
513a0f9945
feat: support null when serializing classes ( #2290 )
2020-09-28 19:55:29 -05:00
Paul Pacheco
fe641adae8
Refactor writer function generation ( #2289 )
2020-09-28 17:07:16 -05:00
Paul Pacheco
6fc5a4effc
remove TODO comment
2020-09-28 16:43:48 -05:00
Paul Pacheco
7aa47f14be
Simplify reader registration
2020-09-28 15:52:36 -05:00
Paul Pacheco
2dc280d292
Refactor reader function generation
2020-09-28 15:50:40 -05:00
Paul Pacheco
fe061ac792
Simplify generated writer name
2020-09-28 15:32:06 -05:00
Paul Pacheco
5e78e27c8f
Simplify generated reader name
2020-09-28 15:09:19 -05:00
Paul Pacheco
664d5f7f99
Generate reader and writer functions for enums ( #2283 )
...
Currently, whenever we want to serialize an enum,
we simply serialize the underlying type (byte, short, int)
This works fine, but in order to get the reader and writer
at runtime I need a function for each type.
With this PR, we generate a reader and writer function for enums too,
the function body simply calls the underlying reader and writer.
2020-09-28 14:51:13 -05:00
James Frowen
fa059b59bf
Squashed ( #2187 )
...
* throwing Exception instead of returning null
* re-adding null check until later PR
* removing error from test
* removing extra error
* adding comment
* replacing error with throw for abstact
2020-09-28 21:29:10 +02:00
James Frowen
796aa3baf8
moving WeaverLists functions to WeaverLists ( #2285 )
...
The plan is to remove WeaverLists at some point so moving the functions
out of weaver to here for now and then move them closer to where they
are actaully used when we start to remove WeaverLists.
2020-09-28 21:21:30 +02:00
Paul Pacheco
694de7255b
Cannot use generics as declared reader and writers
2020-09-28 09:17:33 -05:00
Paul Pacheco
f9ecc64468
Simplify type check
2020-09-28 09:13:25 -05:00
Paul Pacheco
b0d1d9aac0
Rename method for clarity
2020-09-28 08:52:15 -05:00
Paul Pacheco
59566588b1
Simplify type check
2020-09-28 07:39:03 -05:00
Paul Pacheco
54f96309da
Simplify type check
2020-09-28 07:38:24 -05:00
vis2k
9077cc7fd7
Add comments
2020-09-27 18:51:23 +02:00
James Frowen
8b3e509c3b
Update Transport.cs
2020-09-23 16:52:11 +01:00
James Frowen
bdd81e33ba
fix: fixing new import
...
see https://github.com/vis2k/Mirror/pull/2259
2020-09-23 16:30:32 +01:00
Paul Pacheco
a0aecf11fb
Linting
2020-09-22 13:07:03 -05:00
Paul Pacheco
25b2fa9af8
KISS
2020-09-22 13:03:33 -05:00
Paul Pacheco
c868561822
Remove passthrough method
2020-09-22 12:49:38 -05:00
Paul Pacheco
3fec9ec880
Remove static weaver state
2020-09-22 12:33:48 -05:00
Paul Pacheco
116336fbf1
Remmove passthrough method
2020-09-22 12:33:18 -05:00
Paul Pacheco
3d331b4c61
Simplify set initialization
2020-09-22 12:21:58 -05:00
Paul Pacheco
34fa002099
Remove comment that does not apply
2020-09-22 12:20:37 -05:00
Paul Pacheco
a126bfd4dd
Simplify method signature
2020-09-22 11:56:54 -05:00
Paul Pacheco
fdc21582db
simplify module weaving
2020-09-22 11:45:31 -05:00
Paul Pacheco
e79ffeaa8e
Use string interpolation
2020-09-22 11:40:13 -05:00
Paul Pacheco
b113fd4ecf
KISS
2020-09-22 11:23:24 -05:00
Paul Pacheco
6c7e578d5a
Remove redundant validations
2020-09-22 11:22:36 -05:00
Paul Pacheco
3e8870f791
we only weave one assembly at a time, no need for array
2020-09-22 10:11:07 -05:00
Paul Pacheco
eaf6ac66f0
output directory is always null, no need to pass it around
2020-09-22 10:06:13 -05:00
Paul Pacheco
eadb029393
Rename methods for clarity
2020-09-22 09:53:23 -05:00
Paul Pacheco
9d7c9069d7
Simplify namespace
2020-09-22 08:17:06 -05:00
Paul Pacheco
0fbcefe8df
Follow naming convention
2020-09-22 08:16:04 -05:00
Paul Pacheco
85d26ebce6
type safe type comparison
2020-09-21 23:00:30 -05:00
Paul Pacheco
541b516d60
Remove unused parameter
2020-09-21 17:09:13 -05:00
Paul Pacheco
030dc86ea9
Namespace simplifications
2020-09-21 17:08:46 -05:00
Paul Pacheco
12debf1c8c
Simplify namespace
2020-09-21 17:05:20 -05:00
Paul Pacheco
f77186e1d1
Simplify namespace
2020-09-21 17:00:57 -05:00
Paul Pacheco
d123e03915
Simplify namespace
2020-09-21 17:00:10 -05:00
Paul Pacheco
8fcbba50c4
Remove unused parameter
2020-09-21 16:59:05 -05:00
Paul Pacheco
7347e5700d
Remove unused parameter
2020-09-21 16:58:33 -05:00
Paul Pacheco
76ce3796eb
Simplify attribute namespace
2020-09-21 16:58:08 -05:00
Paul Pacheco
ca418457e8
Simplify guard check
2020-09-21 16:57:22 -05:00
Paul Pacheco
65f6e42b53
Simplify namespaces
2020-09-21 16:53:01 -05:00
James Frowen
94419ba003
Update ApiConnector.cs
...
adding null check for when listserver fails to be created
2020-09-20 00:44:13 +01:00
James Frowen
44401ab3bf
Update NetworkHeadlessLogger.cs
2020-09-19 11:30:41 +01:00
vis2k
d559bcfea7
Icon updated to half M
2020-09-19 10:01:10 +02:00
Paul Pacheco
07d290fd8c
Enhance code readability by using extension method ( #2260 )
...
# Before
This is hard to read:
```
if (ca.AttributeType.FullName == typeof(Mirror.CommandAttribute).FullName) {
...
}
```
# After
```
if (ca.AttributeType.Is<Mirror.CommandAttribute>()) {
...
}
```
2020-09-18 14:54:51 -05:00
James Frowen
7919942110
Splitting up test function
...
* Update NetworkServerTest.cs
splitting up test
* Update NetworkServer.cs
using string interpolation
2020-09-18 20:47:54 +01:00
Paul Pacheco
e50ea6318f
perf(weaver): No need to manually load mirror and unity assemblies ( #2261 )
2020-09-18 14:32:14 -05:00
James Frowen
a573bccc79
Update ApiUpdater.cs
2020-09-18 20:14:10 +01:00
Paul Pacheco
0b5989f87d
Move overloads together
2020-09-18 13:06:34 -05:00
Paul Pacheco
6cfdd6469a
Simplify type lookup in weaver ( #2258 )
...
# Before
WeaverTypes declared a static variable like this:
```cs
public static TypeReference int32Type;
```
Weavertypes then loaded the variable in SetupTargetTypes like this:
```cs
int32Type = ImportSystemModuleType(currentAssembly, systemModule, "System.Int32");
```
Note we lookup the type with a string, any typo there won't be detected until the code is executed. It will also not be found by the IDE when you click "find references", or when you refactor.
Then we use it like this:
```cs
var intType = WeaverTypes.int32Type;
```
This is a DRY violation: I have to modify 3 different code sections just to say that I want the int32 type.
# After
Get rid of all the duplication, and use the type instead of a string:
```cs
var intType = WeaverTypes.Import<int>();
```
No need for static variable, or to add it in SetupTargetTypes.
2020-09-18 13:05:16 -05:00
James Frowen
8dac53ce3c
making InvokeUserCode use correct type in argument ( #2259 )
2020-09-17 22:41:37 +01:00
James Frowen
c69d8cca0b
flip equals to return early ( #2245 )
...
* flip equals to return early
* flip equals to return early
* removing un-needed comment
2020-09-16 12:05:43 +01:00
James Frowen
23bd9559d3
pref: increasing performance when Send is called on no observers ( #2244 )
...
* pref increasing performance when sending to no observers
* pref increasing performance when sending to no observers
2020-09-16 10:32:16 +02:00
James Frowen
5eb5ff6601
fix: fixing NullReferenceException when loading scene ( #2240 )
...
* fixing null ref error when local player is destroyed
* removing null objects
* fixing InvalidOperationException
* moving code to its own function
* Update Assets/Mirror/Runtime/ClientScene.cs
2020-09-16 10:30:10 +02:00
James Frowen
7580e9a6f5
Update ClientScene.cs ( #2250 )
...
* Update ClientScene.cs
Improving logging
- making sure sceneId is always hex
- only logging "Client spawn for ..." if it was successful
* Update ClientSceneTests_OnSpawn.cs
2020-09-14 22:35:41 +01:00
James Frowen
833c329ab2
Update ApiUpdater.cs
...
- Adding handlers in Awake instead of Start to make sure they are added before start on headless
- using GetComponent for NetworkManagerListServer
- Adding asserts to make sure values are set
2020-09-14 21:58:33 +01:00
James Frowen
b4fea1bfa3
Update NetworkServer.cs ( #2247 )
2020-09-13 19:07:59 +01:00
James Frowen
aec9b8a2ec
Update NetworkIdentity.cs
...
fixing block not being in remarks
2020-09-13 15:44:25 +01:00
James Frowen
d5c2387d1d
Update SyncObject.cs
2020-09-13 14:33:32 +01:00
James Frowen
ae9d2e35a9
docs: adding debug notes on list server ( #2246 )
2020-09-13 02:47:57 +01:00
James Frowen
844904dae5
adding doc comment ( #2243 )
2020-09-13 01:54:23 +01:00
James Frowen
94da8aec34
fix: Fixing IndexChanged hook not being called for NetworkRoomPlayer ( #2242 )
...
* adding Server to make sure index is only changed on the server
* removing calls to RecalculateRoomPlayerIndices on client
2020-09-13 01:52:32 +01:00
James Frowen
0c78fa0d7a
making sure CallOnClientExitRoom is called when object is disabled/destroyed ( #2241 )
2020-09-12 23:36:46 +01:00
Paul Pacheco
992129e5b6
Simplify string interpolation
2020-09-12 09:04:52 -05:00
James Frowen
5edba81dee
fix: ClientScene.localplayer is now set to null when it is destroyed ( #2227 )
...
* moving FakeNetworkConnection to common test folder
* adding test for local player destroy
* adding method to clear local player
* temp move test functions
* adding test for destroying non player
* moving asset to setup
* adding tests for destroy message and host mode
* adding ClearLocalPlayer to reset
2020-09-08 09:45:24 +02:00
James Frowen
2033f7d009
breaking: Removing manual invoke for Cmd and RPC ( #2223 )
...
* Removing manual invoke for Cmd and RPC
There should be no reason to manaully invoke remote code
they are marked with EditorBrowsableState.Never which implies they should not be called by the user
* removing tests
2020-09-06 16:14:05 +02:00
vis2k
a30e8fcd85
adding empty SyncEventProcessor file for deleted file
2020-09-06 16:07:52 +02:00
James Frowen
a232c539a7
adding empty program file for deleted file
2020-09-06 16:05:50 +02:00
James Frowen
bfa482fde7
Adding Network Lerp Rigidbody docs and change log ( #2226 )
...
* adding NetworkLerpRigidbody to change log
* adding docs for Network Lerp Rigidbody
2020-09-05 13:09:06 +01:00
James Frowen
f326999d50
removing methods that only set enum ( #2221 )
2020-09-04 22:41:38 +01:00
James Frowen
622b52124b
Refactoring handle remote call ( #2222 )
...
* using string interpolation for logs
* return early instead of if/else
2020-09-04 22:40:56 +01:00
James Frowen
eac69ab5f6
docs: sync event obsolete ( #2216 )
...
* adding note to guides about removed SyncEvent
* updating Obsolete
making Obsolete error whe used
updating text to say it has been removed
linking to issue
* adding Obsolete note to other references to SyncEvent
2020-09-04 16:29:46 +01:00
vis2k
e67cef6666
Remove ScriptTemplates to clean up folder ( #2213 )
...
* Remove ScriptTemplates to clean up folder
* Update main.yml
Removing script templates from CI
Co-authored-by: James Frowen <jamesfrowendev@gmail.com>
2020-09-04 07:55:11 +02:00
James Frowen
24e3ea099c
adding version define from v18 breaking change ( #2214 )
2020-09-03 15:46:15 +01:00
James Frowen
e79e340e0d
fixing typo in NetworkIdentity.cs
2020-09-03 11:51:05 +01:00
vis2k
cd3d9c2144
Delete old file
2020-09-03 09:05:47 +02:00
vis2k
fc1096d66c
breaking: Removed [SyncEvent] because ClientRpc/TargetRpc does the same thing, and it's an enormous effort to support the Weaver code. ( #2178 )
2020-09-03 09:04:29 +02:00
James Frowen
ad8af783dc
Replacing prefabAssetPath with assetPath for PrefabStage to stop warning ( #2210 )
2020-09-03 08:48:06 +02:00
James Frowen
1ade82d435
feat: making NetworkBehaviour.IsDirty public ( #2208 )
2020-08-31 12:26:50 +01:00
James Frowen
5701369e84
feat: adding script to help debug list server ( #2202 )
...
Script uses OnGui so can be used to check if server has been added to list server
2020-08-27 23:15:43 +01:00
James Frowen
fc530782cc
fix: fixing width and layout group on cloud example ( #2201 )
2020-08-27 23:10:11 +01:00
vis2k
f6dbf8c19e
Fix broken Weaver test
2020-08-27 00:18:01 +02:00
vis2k
594aec45bf
Weaver RpcProcessor validation moved to NetworkBeahviourProcessor.ProcessClientRpc
2020-08-26 13:15:23 +02:00
vis2k
25ef6ac36a
Weaver TargetRpcProcessor validation moved to NetworkBehaviourProcessor.ProcessTargetRpc
2020-08-26 13:13:56 +02:00
vis2k
820d0daa29
Weaver CommandProcessor validation moved to NetworkBehaviourProcessor.ProcessCommand
2020-08-26 13:12:56 +02:00
vis2k
5e7257d7bc
Weaver ValidateRemoteCallAndParameters IsStatic check added so we don't need to check in Command/Rpc/TargetRpcProcessors
2020-08-26 13:11:56 +02:00
vis2k
2e178b7eaf
Weaver NetworkBehaviourProcessor: ValidateRemoteCallAndParameters function added to be used from Command/Rpc/TargetRpcProcessors
2020-08-26 13:08:46 +02:00
vis2k
fbad5d2401
Add comment
2020-08-26 13:04:39 +02:00
vis2k
68ebaf1756
Weaver TargetRpcProcessor: ValidateTargetRpc simplified
2020-08-26 13:03:44 +02:00
vis2k
e6ffe6d6bf
Weaver: Simplify ValidateParameters
2020-08-26 13:02:25 +02:00
vis2k
ce3dd51d81
Weaver NetworkBehaviourProcessor: ProcessMethodsValidateParameters renamed to ValidateParameters
2020-08-26 13:01:43 +02:00
vis2k
ee8ad1d750
Weaver TargetRpcProcessor: ProcessMethodsValidateTargetRpc renamed to ValidateTargetRpc
2020-08-26 13:01:43 +02:00
vis2k
1b49a21d49
Weaver RpcProcessor: ProcessMethodsValidateRpc renamed to ValidateRpc
2020-08-26 13:01:43 +02:00
vis2k
9131586f5c
Weaver NetworkBehaviourProcessor: ProcessMethodsValidateFunction renamed to ValidateFunction
2020-08-26 13:01:43 +02:00
vis2k
3dab0ec7c5
Weaver CommandProcessor: ProcessMethodsValidateCommand renamed to ValidateCommand
2020-08-26 13:01:43 +02:00
James Frowen
a9d21ea9ab
fix: adding error for generated read writer for abstract class ( #2191 )
...
* fix adding error for gernated read writer for abstract class
weaver can not initialize class abstract class so cant not create a reader
this gives a helpful error telling the server to make a custom reader
* adding tests for error message
* fixing typo
* renaming
* fixing expected error messages
2020-08-25 17:14:39 +01:00
James Frowen
c9a9f92c7c
commenting out reader error checks ( #2196 )
...
Reader code doesn't run on Rpc now if a valid writer can not be found
In future PR write and read functions should be generated together as they share most of the same checks
2020-08-25 01:39:03 +01:00
James Frowen
d73de03eca
renaming variables in Readers to match writers ( #2195 )
2020-08-24 14:48:15 +01:00
James Frowen
11a8d41464
fixng ArgumentNullException ( #2193 )
2020-08-24 14:43:51 +01:00
James Frowen
771f1fea13
fixing typo ( #2192 )
...
variable should start with lower case
2020-08-23 19:30:20 +01:00
James Frowen
1045b1f2ed
tests using HasError ( #2188 )
...
* replacing assert with haserror
* adding IsSuccess and HasWarning functions
* using IsSuccess
* checking weaverWarnings empty in success
* using HasWarning
* replacing asserts missed by regex
* fixing typo
* adding HasNoErrors function to be used when tests only have warnings
* fixing typo
* making fields public to stop warnings
* simplifying more test files
2020-08-22 20:20:16 +01:00
James Frowen
bd7c93674e
Error with message overloads ( #2168 )
...
* weaver error with message overloads
* finding method with 1 arg
2020-08-22 21:07:33 +02:00
James Frowen
d5d434cf13
weaver: renaming variables and changing order things happen ( #2172 )
...
* renaming variables
* adding todo
* moving order that things happen
2020-08-22 21:05:01 +02:00
James Frowen
ea0b9e1215
returning lists instead of passing them in as args ( #2183 )
2020-08-22 20:51:47 +02:00
James Frowen
f051c4b911
Simplify weaver tests ( #2186 )
...
* Simplifying weaver test files
* updating error messages
2020-08-22 19:00:11 +01:00
James Frowen
c312874bcb
renaming test folder in order to use WeaverTestsBuildFromTestName ( #2189 )
2020-08-22 18:59:06 +01:00
James Frowen
f1d7f207c3
adding HasError method ( #2185 )
...
Makes it easier to write error message within weaver tests because there is mess syntax to worry about
2020-08-22 16:23:56 +01:00
vis2k
9ec5eadd51
Weaver: PropertySiteProcessor.ProcessSitesModule renamed to Process for consistency
2020-08-22 13:59:17 +02:00
vis2k
ed60e592dc
Syntax
2020-08-22 13:57:52 +02:00
vis2k
16f8f05abe
Weaver: ReaderWriterProcessor.ProcessReadersAndWriters renamed to Process for consistency
2020-08-22 13:56:52 +02:00
vis2k
84602aace6
ServerClientAttributeProcessor: ProcessSiteClass renamed to Process for consistency
2020-08-22 13:55:22 +02:00
vis2k
342ed13f55
Weaver: update ServerClientAttributeProcessor explanation
2020-08-22 13:40:41 +02:00
vis2k
427adf6c8e
Weaver: ProcessNetworkBehaviourType code moved into NetworkBehaviourProcessor.Process
2020-08-22 13:40:41 +02:00
James Frowen
4774f83032
moving FindSyncObjectsFields to its own function ( #2182 )
2020-08-22 12:10:01 +02:00
vis2k
df38c4fb2c
Syntax
2020-08-21 20:00:42 +02:00
vis2k
5cc908a18d
Weaver PropertySiteProcessor: remove redundant AssemblyDefinition parameter. Weaver passes assembly.MainModule anyway.
2020-08-21 18:25:01 +02:00
vis2k
4258220b26
Weaver PropertySiteProcessor: pass CurrentAssembly to Process function to reduce coupling
2020-08-21 18:22:12 +02:00
vis2k
7b9066832b
Syntax
2020-08-21 18:04:32 +02:00
vis2k
fe32557a38
Weaver ProcessSyncVars: remove redundant numSyncVars field, use syncVars.Count instead
2020-08-21 17:33:11 +02:00
vis2k
54c32227bd
[Obsolete] SyncEvent ( #2180 )
2020-08-21 17:03:06 +02:00
James Frowen
eec49fafce
feat: Use Server Client attribute outside of NetworkBehaviour ( #2150 )
...
* adding generated test for other baseclasses
* removing errors when attribute is not in networkbehaviour
* temp weaver tests
* updating weaver tests for monobehaviour
* adding weaver tests for non-networkbehaviour
* moving where serverclient attributes are processed
* removing un-used code
* regenerate tests
2020-08-21 16:02:37 +01:00
James Frowen
c6fa49c72a
fix: adding version define from v17 breaking change
2020-08-21 13:49:54 +01:00
vis2k
35d8e0ed60
Syntax
2020-08-21 12:12:40 +02:00
vis2k
07f5912215
Weaver GenericArgumentResolver: reuse StripGenericParametersFromClassName
2020-08-21 12:07:18 +02:00
vis2k
0e124ff8b2
Weaver Resolvers: remove unused code
2020-08-21 12:02:01 +02:00
vis2k
bfb97e7202
Syntax
2020-08-21 11:54:49 +02:00
vis2k
2ea787f4fc
Weaver Extensions: HasCustomAttribute uses Linq to simplify code
2020-08-21 11:38:36 +02:00
vis2k
467d9e834f
Weaver Extensions: GetMethod uses Linq to simplify code
2020-08-21 11:38:36 +02:00
vis2k
045b50a929
Weaver Extensions: GetMethods uses Linq to simplify code
2020-08-21 11:31:25 +02:00
vis2k
687c9002dd
typo
2020-08-21 11:28:51 +02:00
vis2k
0043288900
typo
2020-08-21 11:28:38 +02:00