Commit Graph

1917 Commits

Author SHA1 Message Date
Paul Pacheco
2d554d446e Reduce cognitive complexity of RebuildObservers
Identified as a smell by sonar qube
No logic changes, just refactor the code into a separate functions
2020-03-24 14:52:19 -05:00
Chris Langsenkamp
f084706bdf Scene meta update 2020-03-24 15:28:34 -04:00
Paul Pacheco
c69ae75d6a simplify parameter change 2020-03-24 13:47:10 -05:00
Paul Pacheco
aba028e74b Reduce cognitive complexity of NetworkRoomPlayer.OnGUI
fixes code smell in SQ, no behavior change,  just split the method into
smaller methods
2020-03-24 12:52:02 -05:00
Paul Pacheco
102a8822b0 fix smell discard unused parameter 2020-03-24 12:52:02 -05:00
Paul Pacheco
e8c9d7951d test that we cannot unpack the wrong message 2020-03-24 10:37:54 -05:00
Paul Pacheco
a7ab26fa7d Simplify tests 2020-03-24 08:31:19 -05:00
Paul Pacheco
4a9dca3c1c Simplify tests 2020-03-24 08:16:19 -05:00
Paul Pacheco
1362b80eb4 A test should only test one thing 2020-03-24 08:11:42 -05:00
Paul Pacheco
f6bb3a9f06 use Assert.Throws 2020-03-24 08:09:41 -05:00
Paul Pacheco
2714be3869 Remove unused using 2020-03-24 08:04:42 -05:00
Paul Pacheco
3321dd8a95 Move NSubstitute to common folder, It will be used in play mode tests 2020-03-24 08:03:22 -05:00
Paul Pacheco
19a17c15b9 MemoryTransport is only for tests 2020-03-24 08:01:39 -05:00
vis2k
9e26b26689
NetworkIdentity.isServer simplified via one flag instead of helper variable + netId check. When isServer is set in OnStartServer, netId is set to != 0 in any case, so the previous check was unnecessary. (#1590)
* NetworkIdentity.isServer simplified via one flag instead of helper variable + netId check

* simplify teardowns

* NetworkIdentityTests can set isServer directly now

* networkbehaviourtests simplified

* NetworkServerTests can set isServer directly now

* remove comment
2020-03-24 11:25:04 +01:00
vis2k
9d088bc942
fix #1484: isServer state in NetworkIdentity is not dependent on NetworkServer.active anymore. Fixes a bug where isServer was already false in OnDestroy, but we sometimes still need it there to save a player etc. Also added a test to prevent it in the future. (#1585)
* fix #1484: revert isServer simplifiy. Fixes a bug where isServer was already false in OnDestroy, but we need sometimes still need it there to save skillbars etc.

* update comment
2020-03-24 11:07:40 +01:00
vis2k
2f87f3cca7 Runtime tests setup 2020-03-24 10:52:14 +01:00
Paul Pacheco
613356a6d0 fix smell, call parameter the same as base method 2020-03-23 10:29:45 -05:00
Paul Pacheco
0beba4dd2b fix smell, call parameter the same as base method 2020-03-23 10:28:49 -05:00
Paul Pacheco
f4a8692873 fix smell, keep parameter name in override 2020-03-23 10:27:51 -05:00
Paul Pacheco
bb655de71b fix smell keep overloaded methods together 2020-03-23 10:26:25 -05:00
Paul Pacheco
3a73a11a55 fix smell, use pascal case 2020-03-23 10:22:06 -05:00
Paul Pacheco
effb05e732 fix smells 2020-03-23 10:21:45 -05:00
James Frowen
cf55333a07
fix: overriden hooks are invoked (fixes #1581) (#1584)
* failing tests for virutal methods used by syncvar hook

* replacing Assert.fail to stop OnDeserialize failed error

* adding tests to make sure classes are set up correctly

* fix: call overriden hooks

Use a virtual call for hooks.  fixes #1581

Co-authored-by: Paul Pacheco <paulpach@gmail.com>
2020-03-23 14:06:24 +01:00
James Frowen
c7c3ee4ab9
Tests for SyncLists that use structs (#1583) 2020-03-22 17:05:50 -05:00
Paul Pacheco
addf847675
Move comments to previous line (#1579)
* Move comments to the previous Lines

We have a mix of comments at on the previous line and at the end of
the line. We need to "pick one way and stick with it".

Per the C# code guidelines, comments go on the previous line. See here:
https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/inside-a-program/coding-conventions

This also makes pull requests more readable since comments are less
likely to wrap

There are no code changes here, just a search and replace for all comments

This also makes cloc counts more accurate as it can better determine
how many lines of comments vs code we have

* Update Assets/Mirror/Components/NetworkTransformBase.cs

* Update Assets/Mirror/Examples/ListServer/ListServer.cs

* Update Assets/Mirror/Tests/Editor/WeaverTests~/TestingScriptableObjectArraySerialization.cs

* Update Assets/Mirror/Tests/Editor/WeaverTests~/TestingScriptableObjectArraySerialization.cs
2020-03-21 19:31:10 +01:00
MrGadget
b627779acd
fix: Make SendToReady non-ambiguous (#1578) 2020-03-21 11:33:35 -05:00
James Frowen
ad10ca115e
Weaver test for adding guard code (#1574)
* Adding check to make sure weaver adds code

* tests for network behaviour

* marking methods as static

* adding comment to method body

* making Weaver internal

* replacing string
2020-03-21 16:03:48 +01:00
James Frowen
0eb180555d
Fixing exceptions (#1569)
* removing another use of serializedObject

breaks when target is null

* adding check if target is NetworkBehaviour

* moving check from OnInspectorGUI
2020-03-21 14:46:02 +01:00
MrGadget
3156504270
fix: Added LogFilter.Debug check in a few places (#1575) 2020-03-21 14:42:33 +01:00
Chris Langsenkamp
4d827cd9f6 fix: comment punctuation 2020-03-20 20:30:35 -04:00
Chris Langsenkamp
cedbd8fb7a Make roomPlayerPrefab protected so it can be referenced in derived classes 2020-03-20 20:23:16 -04:00
Chris Langsenkamp
a8c4d6682e Fixed Template 2020-03-20 19:22:38 -04:00
James Frowen
d9cc73eabe
moving code to its own class (#1573)
* moving code to its own class

* using code suggestions
2020-03-20 22:21:01 +01:00
Paul Pacheco
59687675c9 Fix sonarqube null warning
Once upon a time, connections could be null here.  This is no longer
the case, connections always have something,

Even if they were null,  this method would not work at all because
the conn.Send call at the bottom would throw NRE.

Therefore the null checks here are unnecesary
2020-03-20 08:01:33 -05:00
FirstGearGames
57eff86e3f
Change LogError to Log. Added more details. (#1545)
Since messages behave similar to events and given the process is not technically breaking, using LogError seems incorrect. Using Log, maybe LogWarning would be more appropriate. Added additional text to clarify why the user may be seeing that log entry.
2020-03-20 10:56:02 +01:00
James Frowen
e040e6dc85
Removing use of serialized object (#1568)
using serializedObject causes AgumentException if target is null
2020-03-19 21:56:34 -05:00
James Frowen
c7c3ea8e0f
Moving draw synclist to class (#1566)
creating SyncListDrawer
2020-03-19 21:32:00 -05:00
James Frowen
a520c0e41d
Simplifying get type (#1567)
* adding IsParameterControlledByCurve check

* Simplifying GetType

Adding Warning because target is only null is something has gone wrong

* removing serializedObject.update

we dont use any values from serializedObject so we dont need to call update
2020-03-19 21:31:08 -05:00
James Frowen
421832f650
Cleaning up network behaviour inspector (#1565)
split large method into smaller ones
2020-03-19 20:46:53 -05:00
James Frowen
cc4032e236
Adding header before sync list (#1564)
matches untiy's Header style
2020-03-19 20:04:48 -05:00
James Frowen
55107115c6
feat: SyncSet and SyncDictionary now show in inspector (#1561)
SyncSet and SyncDictionary now show in inspector
2020-03-19 20:02:51 -05:00
Paul Pacheco
6b0fa18e0f Remove unused HideScriptField 2020-03-19 19:28:47 -05:00
Paul Pacheco
5571716749 Remove unused initialize field 2020-03-19 19:25:33 -05:00
James Frowen
b8c87d9053
fix: show private serializable fields in network behavior inspector (#1557)
* adding IsParameterControlledByCurve check

* Adding all visible syncvar fields to syncVarNames

old code only included public sync var fields
new code includes public and private fields with "SerializeField"

* adding comment

* adding method comment

Co-authored-by: Paul Pacheco <paulpach@gmail.com>
2020-03-19 18:52:31 -05:00
James Frowen
55767bb54d
Fixing syncs anything (#1560)
* adding IsParameterControlledByCurve check

* Fixing SyncsAnything

old code would not work with custom SyncObjects
2020-03-19 18:40:57 -05:00
James Frowen
98ecf7b647
Moving initialize code to onenable (#1558)
* adding IsParameterControlledByCurve check

* Moving Init code to OnEnable

the initialized bool is redundant

Co-authored-by: Paul Pacheco <paulpach@gmail.com>
2020-03-19 18:36:37 -05:00
James Frowen
b4ff4f2ce1
Using draw default inspector (#1559)
* adding IsParameterControlledByCurve check

* using DrawDefaultInspector

Now that SyncVar has a drawer this code is redundant
2020-03-19 18:29:55 -05:00
Chris Langsenkamp
e946c79194 fix: Fixed ClienRpc typos 2020-03-18 19:02:58 -04:00
James Frowen
cf8b979cce
adding IsParameterControlledByCurve check (#1547) 2020-03-18 17:30:16 +01:00
MrGadget
2d1b142276
fix: Prevent Double Call of NetworkServer.Destroy (#1554)
* fix: Prevent Double Call of NetworkServer.Destroy

* doc: Updated ChangeLog

* Extended comments and added LogWarning
2020-03-18 17:25:22 +01:00
James Frowen
35d7c9ddb4
adding PropertyDrawer for syncvar (#1552)
This fixing position of label with HeaderAttribute
This will also make sure that label is shown for all visable fields
2020-03-18 09:36:10 +01:00
Chris Langsenkamp
6f617f92e3 Added Tooltips and Headers to NetworkRoomManager and NetworkRoomPlayer 2020-03-17 23:47:57 -04:00
Chris Langsenkamp
a4ffcbe280 fix: Updated NetworkRoomPlayer inspector and doc and image 2020-03-17 19:22:53 -04:00
MrGadget
46c80bdc2e
Reverted 6431c28a (#1553) 2020-03-17 19:08:47 -04:00
vis2k
4faec29559
removed obsoletes (#1542)
* lobby

* networkroommanager

* networkanimatoreditor

* networkidentityeditor

* preprocessordefine

* clientscene

* customattributes

* localclient

* messages

* networkbehaviour

* networkclient

* networkconnection

* networkidentity

* networkmanager

* networkserver

* networkwriter

* syncdictionary

* synclist

* unetwork

* transport

* networkmessage

* remove leftover obsoletes

* NetworkServer

* NetworkManager

* NetworkRoomManager

* NetworkRoomManager

* AddPlayerMessage

* NetworkLobbyManager & NetworkLobbyPlayer

* PreprocessorDefine

* Removed usings

* Commented test class

* Restored NetworkMessage as empty file

* Removed SyncVarSTRUCT tests

* Removed SyncVarSTRUCT tests

Co-authored-by: Chris Langsenkamp <chris@clevertech.net>

leaving a few ones still in there:

addplayermessage
llapi because still useful
networkbehaviour.getrpchandler for networkprofiler

BREAKING CHANGE: removed obsoletes
2020-03-17 15:25:36 -05:00
Chris Langsenkamp
7bd137847d Added Deprecated Comment 2020-03-17 11:03:00 -04:00
Paul Pacheco
658847b096
fix: Command and Rpc debugging information (#1551)
When replacing command and rpc methods,  we now correctly move over
the debugging information.

Now you can put breakpoints in commands and Rpc

Should fix #1550
2020-03-16 18:50:14 -05:00
Paul Pacheco
0b84d4c5e1 fix: Report correct channel to profiler in SendToObservers 2020-03-15 11:54:39 -05:00
vis2k
20a2d09d07 fix: NetworkBehaviour.SyncVarNetworkIdentityEqual made protected again so that Weaver finds it again 2020-03-09 21:54:19 +01:00
vis2k
165a1dd94c fix: NetworkBehaviour.SyncVarGameObjectEqual made protected again so that Weaver finds it again 2020-03-09 21:51:17 +01:00
vis2k
76dd0c83bf syntax 2020-03-09 16:50:32 +01:00
vis2k
c928ef2353 syntax 2020-03-09 16:39:31 +01:00
vis2k
5801051a29 Weaver Helpers: remove unused AddSearchDirectoryHelper 2020-03-09 16:23:51 +01:00
vis2k
a26a0a39e2 syntax 2020-03-09 16:22:27 +01:00
vis2k
eb4ccd54b7 syntax 2020-03-09 16:21:36 +01:00
vis2k
83c8beac5e NetworkClientTests: Send 2020-03-09 11:23:28 +01:00
vis2k
df0ec137d0 NetworkClientTests: DisconnectInHostMode 2020-03-09 11:12:22 +01:00
vis2k
53165d2096 NetworkClientTests: ConnectUri 2020-03-09 11:05:59 +01:00
vis2k
572866410f Tests: MemoryTransport server connection id changed from 0 to 1 because 0 is reserved for localhost and will be rejected 2020-03-09 11:05:48 +01:00
vis2k
fe94b74009 Tests: MemoryTransport LateUpdate exposed so we can process messages 2020-03-09 11:05:19 +01:00
vis2k
f26ba488b8 NetworkClientTests: isConnected 2020-03-09 10:51:41 +01:00
vis2k
f9b8914e6d NetworkClientTests: serverIp 2020-03-09 10:47:44 +01:00
Chris Langsenkamp
4b27388771 Removed StartHost from ScriptTemplate 2020-03-08 11:19:13 -04:00
Paul Pacheco
f1860e3db9 test: test for obsolete should also be obsolete 2020-03-08 09:12:10 -05:00
vis2k
b74ef10780 NetworkBehaviourTests: OnStartLocalPlayer 2020-03-07 20:50:55 +01:00
vis2k
d48ab55ede NetworkBehaviourTests: OnStartClient 2020-03-07 20:50:01 +01:00
vis2k
ad0788fb95 NetworkBehaviourTests: OnNetworkDestroy 2020-03-07 20:48:42 +01:00
vis2k
35ab00f4eb NetworkBehaviourTests: SerializeAndDeserializeObjectsAll 2020-03-07 20:42:52 +01:00
vis2k
d703072768 NetworkBehaviour.DeSerializeObjectsDelta made internal so it can be tested 2020-03-07 20:42:42 +01:00
vis2k
d5b7802ae3 NetworkBehaviourTests: SerializeAndDeserializeObjectsAll 2020-03-07 20:38:58 +01:00
vis2k
2ff53580ba NetworkBehaviour: DeSerializeObjectsAll made internal so we can test it 2020-03-07 20:38:46 +01:00
vis2k
07530a301f NetworkBehaviourTests: DirtyObjectBits 2020-03-07 20:31:30 +01:00
vis2k
a4e0b32713 NetworkBehaviour.DirtyObjectBits made internal so it can be tested 2020-03-07 20:31:19 +01:00
vis2k
f12048a5c8 NetworkBehaviourTests: ClearAllDirtyBitsClearsSyncObjectsDirtyBits 2020-03-07 20:21:06 +01:00
vis2k
81c86d3d80 NetworkBehaviourTests: ClearAllDirtyBitsClearsSyncVarDirtyBits 2020-03-07 20:15:57 +01:00
vis2k
258d3bed02 NetworkBehaviourTests: GetSyncVarNetworkIdentityOnClientNull 2020-03-07 18:57:06 +01:00
vis2k
29035aaa7e NetworkBehaviourTests: GetSyncVarNetworkIdentityOnClient 2020-03-07 18:56:54 +01:00
vis2k
c84cbe38de NetworkBehaviourTests: GetSyncVarNetworkIdentityOnServerNull 2020-03-07 18:56:45 +01:00
vis2k
ed71ab0824 NetworkBehaviourTests: GetSyncVarNetworkIdentityOnServer 2020-03-07 18:56:34 +01:00
vis2k
b81a48ff36 NetworkBehaviourTests: SetSyncVarNetworkIdentityZeroNetId 2020-03-07 18:54:04 +01:00
vis2k
abcecf1eaf NetworkBehaviourTests: SetSyncVarNetworkIdentityNull 2020-03-07 18:53:56 +01:00
vis2k
356a054109 NetworkBehaviourTests: SetSyncVarNetworkIdentityWithValidObject 2020-03-07 18:53:47 +01:00
vis2k
006d3d5660 NetworkBehaviourTests: GetSyncVarGameObjectOnClientNull 2020-03-07 18:36:47 +01:00
vis2k
01a16581b3 NetworkIdentityTests: GetSyncVarGameObjectOnClient 2020-03-07 18:35:26 +01:00
vis2k
8acdd76699 NetworkBehaviourTests: GetSyncVarGameObjectOnServerNull 2020-03-07 18:31:28 +01:00
vis2k
c6c1a36559 NetworkBehaviourTests: GetSyncVarGameObjectOnServer 2020-03-07 18:29:54 +01:00
vis2k
f51e587c67 remove old empty Telepathy.dll + meta file. This causes a confusing 'failed to parse meta file' warning in Unity 2019.3, and we don't need it anymore anyway. UNET never had Telepathy. 2020-03-07 18:02:44 +01:00
vis2k
7006313aad NetworkBehaviourTests: SetSyncVarGameObjectZeroNetId 2020-03-07 18:00:12 +01:00
vis2k
9ff2a60e7a NetworkBehaviourTests: SetSyncVarGameObjectWithoutNetworkIdentity 2020-03-07 17:57:04 +01:00
vis2k
be422c9fda NetworkBehavourTests: SetSyncVarGameObjectNull 2020-03-07 17:40:45 +01:00