79 lines
1.7 KiB
C#
79 lines
1.7 KiB
C#
using System;
|
|
using UnityEngine;
|
|
|
|
namespace RecRoom
|
|
{
|
|
// Token: 0x0200113A RID: 4410
|
|
public sealed class ActionEvent : ListEvent<Action>
|
|
{
|
|
// Token: 0x06025BBD RID: 154557 RVA: 0x00A78650 File Offset: 0x00A76850
|
|
public ActionEvent(int capacity = 32, bool useTryCatch = false)
|
|
: base(capacity, useTryCatch)
|
|
{
|
|
}
|
|
|
|
// Token: 0x06025BBE RID: 154558 RVA: 0x00A7865C File Offset: 0x00A7685C
|
|
public void Invoke()
|
|
{
|
|
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]();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Debug.LogException(ex);
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
for (int j = 0; j < this.actionList.Count; j++)
|
|
{
|
|
this.actionList[j]();
|
|
}
|
|
}
|
|
}
|
|
finally
|
|
{
|
|
base.ProcessQueuedModifications();
|
|
this.isIterating = false;
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x06025BBF RID: 154559 RVA: 0x00A78740 File Offset: 0x00A76940
|
|
public override void DynamicInvoke(object[] args)
|
|
{
|
|
if (args != null && args.Length != 0)
|
|
{
|
|
throw new ArgumentException("Invalid number of arguments passed to ActionEvent.Invoke()");
|
|
}
|
|
this.Invoke();
|
|
}
|
|
|
|
// Token: 0x06025BC0 RID: 154560 RVA: 0x00A78764 File Offset: 0x00A76964
|
|
public static ActionEvent operator +(ActionEvent actionEvent, Action action)
|
|
{
|
|
actionEvent.Add(action);
|
|
return actionEvent;
|
|
}
|
|
|
|
// Token: 0x06025BC1 RID: 154561 RVA: 0x00A78770 File Offset: 0x00A76970
|
|
public static ActionEvent operator -(ActionEvent actionEvent, Action action)
|
|
{
|
|
actionEvent.Remove(action);
|
|
return actionEvent;
|
|
}
|
|
}
|
|
}
|