scripts
This commit is contained in:
@@ -0,0 +1,82 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace RecRoom
|
||||
{
|
||||
// Token: 0x0200113C RID: 4412
|
||||
public sealed class ActionEvent<T, U> : ListEvent<Action<T, U>>
|
||||
{
|
||||
// Token: 0x06025BC7 RID: 154567 RVA: 0x00A788C0 File Offset: 0x00A76AC0
|
||||
public ActionEvent(int capacity = 32, bool useTryCatch = false)
|
||||
: base(capacity, useTryCatch)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x06025BC8 RID: 154568 RVA: 0x00A788CC File Offset: 0x00A76ACC
|
||||
public void Invoke(T t, U u)
|
||||
{
|
||||
object actionList = this.actionList;
|
||||
lock (actionList)
|
||||
{
|
||||
try
|
||||
{
|
||||
this.isIterating = true;
|
||||
if (this.useTryCatch)
|
||||
{
|
||||
for (int i = 0; i < this.actionList.Count; i++)
|
||||
{
|
||||
try
|
||||
{
|
||||
this.actionList[i](t, u);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.LogException(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int j = 0; j < this.actionList.Count; j++)
|
||||
{
|
||||
this.actionList[j](t, u);
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
base.ProcessQueuedModifications();
|
||||
this.isIterating = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06025BC9 RID: 154569 RVA: 0x00A789B4 File Offset: 0x00A76BB4
|
||||
public override void DynamicInvoke(object[] args)
|
||||
{
|
||||
if (args == null)
|
||||
{
|
||||
throw new ArgumentException("Null arguments passed to ActionEvent.Invoke()");
|
||||
}
|
||||
if (args.Length != 2)
|
||||
{
|
||||
throw new ArgumentException("Invalid number of arguments passed to ActionEvent.Invoke()");
|
||||
}
|
||||
this.Invoke((T)((object)args[0]), (U)((object)args[1]));
|
||||
}
|
||||
|
||||
// Token: 0x06025BCA RID: 154570 RVA: 0x00A789F4 File Offset: 0x00A76BF4
|
||||
public static ActionEvent<T, U>operator +(ActionEvent<T, U> actionEvent, Action<T, U> action)
|
||||
{
|
||||
actionEvent.Add(action);
|
||||
return actionEvent;
|
||||
}
|
||||
|
||||
// Token: 0x06025BCB RID: 154571 RVA: 0x00A78A00 File Offset: 0x00A76C00
|
||||
public static ActionEvent<T, U>operator -(ActionEvent<T, U> actionEvent, Action<T, U> action)
|
||||
{
|
||||
actionEvent.Remove(action);
|
||||
return actionEvent;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user