@@ -42,60 +42,54 @@ private void Awake() {
42
42
43
43
private void FixedUpdate ( ) {
44
44
// KCP 开了线程所以只能把 RespondAction放进主线程
45
- if ( this . GetSystem < INetworkSystem > ( ) . PlayerCreateMsgs . Count > 0 ) {
46
- lock ( this . GetSystem < INetworkSystem > ( ) . MsgLock ) {
45
+ lock ( this . GetSystem < INetworkSystem > ( ) . MsgLock ) {
46
+ if ( this . GetSystem < INetworkSystem > ( ) . PlayerCreateMsgs . Count > 0 ) {
47
47
this . SendCommand ( new MakeNewPlayerCommand ( this . GetSystem < INetworkSystem > ( ) . PlayerCreateMsgs . Peek ( ) ) ) ;
48
48
this . GetSystem < INetworkSystem > ( ) . PlayerCreateMsgs . Dequeue ( ) ;
49
49
}
50
- }
51
50
52
- if ( this . GetSystem < INetworkSystem > ( ) . PlayerStateMsgs . Count > 0 ) {
53
- lock ( this . GetSystem < INetworkSystem > ( ) . MsgLock ) {
51
+ if ( this . GetSystem < INetworkSystem > ( ) . PlayerStateMsgs . Count > 0 ) {
54
52
this . GetSystem < IPlayerManagerSystem > ( ) . RespondStateAction (
55
53
this . GetSystem < INetworkSystem > ( ) . PlayerStateMsgs . Peek ( ) ) ;
56
54
this . GetSystem < INetworkSystem > ( ) . PlayerStateMsgs . Dequeue ( ) ;
57
55
}
58
- }
59
56
60
- if ( this . GetSystem < INetworkSystem > ( ) . PlayerOperatMsgs . Count > 0 ) {
61
- lock ( this . GetSystem < INetworkSystem > ( ) . MsgLock ) {
57
+ if ( this . GetSystem < INetworkSystem > ( ) . PlayerOperatMsgs . Count > 0 ) {
62
58
this . GetSystem < IPlayerManagerSystem > ( ) . RespondOperatAction (
63
59
this . GetSystem < INetworkSystem > ( ) . PlayerOperatMsgs . Peek ( ) ) ;
64
60
this . GetSystem < INetworkSystem > ( ) . PlayerOperatMsgs . Dequeue ( ) ;
65
61
}
66
- }
67
62
68
- if ( this . GetSystem < INetworkSystem > ( ) . PlayerCompleteMsgs . Count > 0 ) {
69
- lock ( this . GetSystem < INetworkSystem > ( ) . MsgLock ) {
63
+ if ( this . GetSystem < INetworkSystem > ( ) . PlayerCompleteMsgs . Count > 0 ) {
70
64
this . SendCommand ( new UpdateMatchResultUICommand ( this . GetSystem < INetworkSystem > ( ) . PlayerCompleteMsgs . Peek ( ) ) ) ;
71
65
this . GetSystem < INetworkSystem > ( ) . PlayerCompleteMsgs . Dequeue ( ) ;
72
66
}
73
- }
74
-
75
- if ( this . GetSystem < INetworkSystem > ( ) . OnMatchRoomCreateMsg != null ) {
76
- this . GetSystem < IMatchRoomSystem > ( ) . OnCreateMsg ( this . GetSystem < INetworkSystem > ( ) . OnMatchRoomCreateMsg ) ;
77
- this . GetSystem < INetworkSystem > ( ) . OnMatchRoomCreateMsg = null ;
78
- }
79
-
80
- if ( this . GetSystem < INetworkSystem > ( ) . OnMatchRoomJoinMsg != null ) {
81
- this . GetSystem < IMatchRoomSystem > ( ) . OnJoinMsg ( this . GetSystem < INetworkSystem > ( ) . OnMatchRoomJoinMsg ) ;
82
- this . GetSystem < INetworkSystem > ( ) . OnMatchRoomJoinMsg = null ;
83
- }
84
-
85
- if ( this . GetSystem < INetworkSystem > ( ) . OnMatchRoomExitMsg != null ) {
86
- this . GetSystem < IMatchRoomSystem > ( ) . OnExitMsg ( this . GetSystem < INetworkSystem > ( ) . OnMatchRoomExitMsg ) ;
87
- this . GetSystem < INetworkSystem > ( ) . OnMatchRoomExitMsg = null ;
88
- }
89
-
90
- if ( this . GetSystem < INetworkSystem > ( ) . OnMatchRoomStartMsg != null ) {
91
- this . GetSystem < IMatchRoomSystem > ( ) . OnStartMsg ( this . GetSystem < INetworkSystem > ( ) . OnMatchRoomStartMsg ) ;
92
- this . GetSystem < INetworkSystem > ( ) . OnMatchRoomStartMsg = null ;
93
- }
94
-
95
- if ( this . GetSystem < INetworkSystem > ( ) . OnMatchRoomStatusMsg != null ) {
96
- this . GetSystem < IMatchRoomSystem > ( ) . OnStatusMsg ( this . GetSystem < INetworkSystem > ( ) . OnMatchRoomStatusMsg ) ;
97
- this . GetSystem < INetworkSystem > ( ) . OnMatchRoomStatusMsg = null ;
98
- }
67
+
68
+ if ( this . GetSystem < INetworkSystem > ( ) . OnMatchRoomCreateMsg != null ) {
69
+ this . GetSystem < IMatchRoomSystem > ( ) . OnCreateMsg ( this . GetSystem < INetworkSystem > ( ) . OnMatchRoomCreateMsg ) ;
70
+ this . GetSystem < INetworkSystem > ( ) . OnMatchRoomCreateMsg = null ;
71
+ }
72
+
73
+ if ( this . GetSystem < INetworkSystem > ( ) . OnMatchRoomJoinMsg != null ) {
74
+ this . GetSystem < IMatchRoomSystem > ( ) . OnJoinMsg ( this . GetSystem < INetworkSystem > ( ) . OnMatchRoomJoinMsg ) ;
75
+ this . GetSystem < INetworkSystem > ( ) . OnMatchRoomJoinMsg = null ;
76
+ }
77
+
78
+ if ( this . GetSystem < INetworkSystem > ( ) . OnMatchRoomExitMsg != null ) {
79
+ this . GetSystem < IMatchRoomSystem > ( ) . OnExitMsg ( this . GetSystem < INetworkSystem > ( ) . OnMatchRoomExitMsg ) ;
80
+ this . GetSystem < INetworkSystem > ( ) . OnMatchRoomExitMsg = null ;
81
+ }
82
+
83
+ if ( this . GetSystem < INetworkSystem > ( ) . OnMatchRoomStartMsg != null ) {
84
+ this . GetSystem < IMatchRoomSystem > ( ) . OnStartMsg ( this . GetSystem < INetworkSystem > ( ) . OnMatchRoomStartMsg ) ;
85
+ this . GetSystem < INetworkSystem > ( ) . OnMatchRoomStartMsg = null ;
86
+ }
87
+
88
+ if ( this . GetSystem < INetworkSystem > ( ) . OnMatchRoomStatusMsg != null ) {
89
+ this . GetSystem < IMatchRoomSystem > ( ) . OnStatusMsg ( this . GetSystem < INetworkSystem > ( ) . OnMatchRoomStatusMsg ) ;
90
+ this . GetSystem < INetworkSystem > ( ) . OnMatchRoomStatusMsg = null ;
91
+ }
92
+ }
99
93
}
100
94
101
95
public IArchitecture GetArchitecture ( ) {
0 commit comments