Esempio n. 1
0
 // Token: 0x0600189E RID: 6302 RVA: 0x00069FA2 File Offset: 0x000681A2
 public void Copy([NotNull] RuleBook src)
 {
     if (src == null)
     {
         throw new ArgumentException("Argument cannot be null.", "src");
     }
     Array.Copy(src.ruleValues, this.ruleValues, this.ruleValues.Length);
 }
Esempio n. 2
0
        // Token: 0x06001034 RID: 4148 RVA: 0x00047468 File Offset: 0x00045668
        private void TestRuleValues()
        {
            RuleBook ruleBook = new RuleBook();

            ruleBook.Copy(this.networkRuleBookComponent.ruleBook);
            RuleDef       ruleDef   = RuleCatalog.GetRuleDef(UnityEngine.Random.Range(0, RuleCatalog.ruleCount));
            RuleChoiceDef choiceDef = ruleDef.choices[UnityEngine.Random.Range(0, ruleDef.choices.Count)];

            ruleBook.ApplyChoice(choiceDef);
            this.networkRuleBookComponent.SetRuleBook(ruleBook);
            base.Invoke("TestRuleValues", 0.5f);
        }
 public void SetRuleBook([NotNull] RuleBook newRuleBook)
 {
     if (!NetworkServer.active)
     {
         Debug.LogWarning("[Server] function 'System.Void RoR2.NetworkRuleBook::SetRuleBook(RoR2.RuleBook)' called on client");
         return;
     }
     if (this.ruleBook.Equals(newRuleBook))
     {
         return;
     }
     base.SetDirtyBit(1u);
     this.ruleBook.Copy(newRuleBook);
 }
Esempio n. 4
0
        // Token: 0x0600189C RID: 6300 RVA: 0x00069F34 File Offset: 0x00068134
        public override bool Equals(object obj)
        {
            RuleBook ruleBook = obj as RuleBook;

            if (ruleBook != null)
            {
                for (int i = 0; i < this.ruleValues.Length; i++)
                {
                    if (this.ruleValues[i] != ruleBook.ruleValues[i])
                    {
                        return(false);
                    }
                }
            }
            return(true);
        }
Esempio n. 5
0
 // Token: 0x060018A4 RID: 6308 RVA: 0x0006A1B0 File Offset: 0x000683B0
 public static bool FromXml(XElement element, ref RuleBook dest)
 {
     dest.SetToDefaults();
     string[] array = element.Value.Split(new char[]
     {
         ' '
     });
     for (int i = 0; i < array.Length; i++)
     {
         RuleChoiceDef ruleChoiceDef = RuleCatalog.FindChoiceDef(array[i]);
         if (ruleChoiceDef != null)
         {
             dest.ApplyChoice(ruleChoiceDef);
         }
     }
     return(true);
 }
Esempio n. 6
0
 // Token: 0x060018A3 RID: 6307 RVA: 0x0006A124 File Offset: 0x00068324
 public static void ToXml(XElement element, RuleBook src)
 {
     byte[] array = src.ruleValues;
     RuleBook.< > c__DisplayClass28_0 CS$ < > 8__locals1;
     CS$ < > 8__locals1.choiceNamesBuffer = new string[array.Length];
     CS$ < > 8__locals1.choiceNamesCount  = 0;
     for (int i = 0; i < array.Length; i++)
     {
         RuleDef ruleDef = RuleCatalog.GetRuleDef(i);
         byte    b       = array[i];
         if ((ulong)b < (ulong)((long)ruleDef.choices.Count))
         {
             RuleBook.< ToXml > g__AddChoice | 28_0 (ruleDef.choices[(int)b].globalName, ref CS$ < > 8__locals1);
         }
     }
     element.Value = string.Join(" ", CS$ < > 8__locals1.choiceNamesBuffer, 0, CS$ < > 8__locals1.choiceNamesCount);
 }
Esempio n. 7
0
 public Run BeginRun(Run runPrefabComponent, RuleBook ruleBook, ulong seed)
 {
     if (!NetworkServer.active)
     {
         Debug.LogWarning("[Server] function 'RoR2.Run RoR2.NetworkSession::BeginRun(RoR2.Run,RoR2.RuleBook,System.UInt64)' called on client");
         return(null);
     }
     if (!Run.instance)
     {
         GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(runPrefabComponent.gameObject);
         Run        component  = gameObject.GetComponent <Run>();
         component.SetRuleBook(ruleBook);
         component.seed = seed;
         NetworkServer.Spawn(gameObject);
         return(component);
     }
     return(null);
 }
Esempio n. 8
0
 // Token: 0x060009B6 RID: 2486 RVA: 0x00030CC9 File Offset: 0x0002EEC9
 public static void ReadRuleBook(this NetworkReader reader, RuleBook dest)
 {
     dest.Deserialize(reader);
 }
Esempio n. 9
0
 // Token: 0x060009B5 RID: 2485 RVA: 0x00030CC0 File Offset: 0x0002EEC0
 public static void Write(this NetworkWriter writer, RuleBook src)
 {
     src.Serialize(writer);
 }
Esempio n. 10
0
 // Token: 0x0600197C RID: 6524 RVA: 0x00079C1A File Offset: 0x00077E1A
 public void Copy([NotNull] RuleBook src)
 {
     Array.Copy(src.ruleValues, this.ruleValues, this.ruleValues.Length);
 }
 // Token: 0x06000EE8 RID: 3816 RVA: 0x0004225B File Offset: 0x0004045B
 private void Awake()
 {
     this.ruleBook = new RuleBook();
 }