Out with MagicOnion, in with LiteNetLib
Removed MagicOnion Added LiteNetLib Created client and server abstractions Fixed serialization bugs
This commit is contained in:
parent
433a7b4ae4
commit
e96146b7bb
869 changed files with 59401 additions and 16812 deletions
28
Assets/Scripts/ServerShared/ActionCollection.cs
Normal file
28
Assets/Scripts/ServerShared/ActionCollection.cs
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public abstract class NotAnActionCollection{}
|
||||
|
||||
public class ActionCollection<T> : NotAnActionCollection where T : Message
|
||||
{
|
||||
private List<Action<T>> _actions = new List<Action<T>>();
|
||||
|
||||
public void Add(Action<T> action)
|
||||
{
|
||||
_actions.Add(action);
|
||||
}
|
||||
|
||||
public void Invoke(T message)
|
||||
{
|
||||
foreach (var action in _actions)
|
||||
{
|
||||
action(message);
|
||||
}
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
_actions.Clear();
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue