/// <summary>
 /// Snapshot play sub options.
 /// </summary>
 /// <param name="subOption">The Network SubOption.</param>
 /// <returns>The play sub options.</returns>
 private static IEnumerable <List <int> > SnapshotSubOptions(Network.Options.Option.SubOption subOption)
 {
     if (!subOption.HasValidTarget())
     {
         if (subOption.PlayErrorInfo.IsValid())
         {
             if (subOption.ID == 0)
             {
                 yield break;
             }
             else
             {
                 yield return(new List <int> {
                     subOption.ID
                 });
             }
         }
     }
     else
     {
         foreach (var target in subOption.Targets)
         {
             if (target.PlayErrorInfo.IsValid())
             {
                 yield return(new List <int> {
                     subOption.ID, target.ID
                 });
             }
         }
     }
 }
Beispiel #2
0
 /* --- Instance Methods (Auxiliary) --- */
 private void SerializeSubOption(Network.Options.Option.SubOption so, BinaryWriter w)
 {
     w.Write(so.ID);
     if (so.Targets == null)
     {
         w.Write(0);
     }
     else
     {
         w.Write(so.Targets.Count);
         foreach (int targetID in so.Targets)
         {
             w.Write(targetID);
         }
     }
 }
Beispiel #3
0
        private Network.Options.Option.SubOption DeserializeSubOption(BinaryReader r)
        {
            var so = new Network.Options.Option.SubOption();

            so.ID = r.ReadInt32();
            int targetCount = r.ReadInt32();

            if (targetCount == 0)
            {
                return(so);
            }
            else
            {
                so.Targets = new List <int>();
                for (int i = 0; i < targetCount; ++i)
                {
                    int id = r.ReadInt32();
                    so.Targets.Add(id);
                }
            }

            return(so);
        }
Beispiel #4
0
 public void UpdateTargetHighlights(Network.Options.Option.SubOption subOption)
 {
     object[] objArray1 = new object[] { subOption };
     base.method_8("UpdateTargetHighlights", objArray1);
 }