Example #1
0
 public void Add(IByteUpdate sub, byte val)
 {
     if (isUpdating)
     {
         ByteAddCmd cmd;
         cmd.val    = val;
         cmd.target = sub;
         toAdd.Add(cmd);
     }
     else
     {
         AddDirect(sub, val);
     }
 }
Example #2
0
        void AddDirect(IByteUpdate sub, byte val)
        {
            if (count >= values.Length)
            {
                byte[]        newArray     = new byte[values.Length * 2];
                IByteUpdate[] newSubsArray = new IByteUpdate[subs.Length * 2];
                Array.Copy(values, 0, newArray, 0, values.Length);
                Array.Copy(subs, 0, newSubsArray, 0, values.Length);
                values = newArray;
                subs   = newSubsArray;
                //Debug.Log("alloc");
            }

            values[count] = val;
            subs[count]   = sub;
            sub.NotifyIndexChange(count);
            count++;
        }