File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed
Assets/BossRoom/Scripts/Shared/Infrastructure Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -33,9 +33,15 @@ public void Dispose()
33
33
34
34
public void Publish ( T message )
35
35
{
36
- while ( m_PendingHandlers . Count > 0 ) m_PendingHandlers . Dequeue ( ) ? . Invoke ( ) ;
36
+ while ( m_PendingHandlers . Count > 0 )
37
+ {
38
+ m_PendingHandlers . Dequeue ( ) ? . Invoke ( ) ;
39
+ }
37
40
38
- foreach ( var messageHandler in m_MessageHandlers ) messageHandler ? . Invoke ( message ) ;
41
+ foreach ( var messageHandler in m_MessageHandlers )
42
+ {
43
+ messageHandler ? . Invoke ( message ) ;
44
+ }
39
45
}
40
46
41
47
public IDisposable Subscribe ( Action < T > handler )
@@ -48,7 +54,9 @@ public IDisposable Subscribe(Action<T> handler)
48
54
void DoSubscribe ( Action < T > _h )
49
55
{
50
56
if ( _h != null && ! m_MessageHandlers . Contains ( _h ) )
57
+ {
51
58
m_MessageHandlers . Add ( _h ) ;
59
+ }
52
60
}
53
61
}
54
62
@@ -80,7 +88,10 @@ public void Dispose()
80
88
{
81
89
m_isDisposed = true ;
82
90
83
- if ( ! m_MessageChannel . m_IsDisposed ) m_MessageChannel . Unsubscribe ( m_Handler ) ;
91
+ if ( ! m_MessageChannel . m_IsDisposed )
92
+ {
93
+ m_MessageChannel . Unsubscribe ( m_Handler ) ;
94
+ }
84
95
85
96
m_Handler = null ;
86
97
m_MessageChannel = null ;
You can’t perform that action at this time.
0 commit comments