using System; using System.Collections.Generic; using UnityEngine; namespace RecRoom.Challenges { // Token: 0x02000B15 RID: 2837 public abstract class DynamicArithmeticChallenge : ChallengeBase where T : struct, IConvertible, IComparable { // Token: 0x06015B01 RID: 88833 RVA: 0x006059A4 File Offset: 0x00603BA4 public DynamicArithmeticChallenge() { } // Token: 0x06015B02 RID: 88834 RVA: 0x006059B4 File Offset: 0x00603BB4 public DynamicArithmeticChallenge(NumOperation numOp, INumResolver numResolverA, INumResolver numResolverB) { this.NumOp = numOp; this.numResolverA = numResolverA; this.numResolverB = numResolverB; } // Token: 0x06015B03 RID: 88835 RVA: 0x006059D8 File Offset: 0x00603BD8 protected override bool EvaluateInternal(ChallengeEvents.IChallengeEventData challengeEventData) { if (this.numResolverA == null || this.numResolverB == null) { Debug.LogWarning("NumResolver was null"); return false; } T? value = this.numResolverA.GetValue(challengeEventData); T? value2 = this.numResolverB.GetValue(challengeEventData); if (value == null || value2 == null) { return false; } T value3 = value.Value; T value4 = value2.Value; switch (this.NumOp) { case NumOperation.GT: return value3.CompareTo(value4) > 0; case NumOperation.LT: return value3.CompareTo(value4) < 0; case NumOperation.EQ: return this.Equals(value3, value4); case NumOperation.GTE: return value3.CompareTo(value4) > 0 || this.Equals(value3, value4); case NumOperation.LTE: return value3.CompareTo(value4) < 0 || this.Equals(value3, value4); default: throw new NotImplementedException(); } } // Token: 0x06015B04 RID: 88836 protected abstract bool Equals(T valueA, T valueB); // Token: 0x06015B05 RID: 88837 RVA: 0x00605AE8 File Offset: 0x00603CE8 public sealed override Dictionary Serialize() { Dictionary dictionary = base.Serialize(); dictionary["op"] = (int)this.NumOp; if (this.numResolverA != null) { dictionary["rA"] = this.numResolverA.Serialize(); } if (this.numResolverB != null) { dictionary["rB"] = this.numResolverB.Serialize(); } return dictionary; } // Token: 0x06015B06 RID: 88838 RVA: 0x00605B58 File Offset: 0x00603D58 protected sealed override void DeserializeInternal(Dictionary jsonDict) { this.NumOp = (NumOperation)ChallengeParser.GetOptionalKey("op", jsonDict, 2); this.numResolverA = NumResolver.FromJsonDict(ChallengeParser.GetOptionalKey>("rA", jsonDict, null)); this.numResolverB = NumResolver.FromJsonDict(ChallengeParser.GetOptionalKey>("rB", jsonDict, null)); } // Token: 0x04003C5A RID: 15450 public INumResolver numResolverA; // Token: 0x04003C5B RID: 15451 public NumOperation NumOp = NumOperation.EQ; // Token: 0x04003C5C RID: 15452 public INumResolver numResolverB; } }