예제 #1
0
        /// <summary>
        /// 判断与比较值不相同的情况下,将当前值写入Wirter
        /// </summary>
        /// <param name="comparedInfo"></param>
        /// <param name="writer"></param>
        public void Write(WeaponBagContainer comparedInfo, MyBinaryWriter writer)
        {
            writer.Write(HeldSlotPointer);
            writer.Write(LastSlotPointer);
            BitArrayWrapper bitArray = BitArrayWrapper.Allocate(GameGlobalConst.WeaponSlotMaxLength, false);

            //  return new BitArray(5, true);
            if (comparedInfo == null)
            {
                bitArray.SetAll(true);
            }
            else
            {
                for (int i = 0; i < GameGlobalConst.WeaponSlotMaxLength; i++)
                {
                    bitArray[i] = slotWeapons[i] != comparedInfo.slotWeapons[i];
                }
            }

            writer.Write(bitArray);
            for (int i = 0; i < GameGlobalConst.WeaponSlotMaxLength; i++)
            {
                if (bitArray[i])
                {
                    writer.Write(slotWeapons[i].WeaponKey.EntityId);
                    writer.Write(slotWeapons[i].WeaponKey.EntityType);
                }
            }


            bitArray.ReleaseReference();
        }
예제 #2
0
        public void Write(NetworkAnimatorLayer right, MyBinaryWriter writer)
        {
            BitArrayWrapper bitArray = BitArrayWrapper.Allocate(7, false);

            if (right == null)
            {
                bitArray.SetAll(true);
            }
            else
            {
                bitArray[0] = !CompareUtility.IsApproximatelyEqual(LayerIndex, right.LayerIndex);
                bitArray[1] = Weight != right.Weight;
                bitArray[2] = !CompareUtility.IsApproximatelyEqual(CurrentStateHash, right.CurrentStateHash);
                bitArray[3] = NormalizedTime != right.NormalizedTime;
                bitArray[4] = StateDuration != right.StateDuration;
                bitArray[5] = TransitionNormalizedTime != right.TransitionNormalizedTime;
                bitArray[6] = TransitionDuration != right.TransitionDuration;
            }

            writer.Write(bitArray);
            if (bitArray[0])
            {
                writer.Write(LayerIndex);
            }
            if (bitArray[1])
            {
                writer.Write(Weight);
            }
            if (bitArray[2])
            {
                writer.Write(CurrentStateHash);
            }
            if (bitArray[3])
            {
                writer.Write(NormalizedTime);
            }
            if (bitArray[4])
            {
                writer.Write(StateDuration);
            }
            if (bitArray[5])
            {
                writer.Write(TransitionNormalizedTime);
            }
            if (bitArray[6])
            {
                writer.Write(TransitionDuration);
            }


            bitArray.ReleaseReference();
        }
예제 #3
0
        public void Write(NetworkAnimatorParameter right, MyBinaryWriter writer)
        {
            BitArrayWrapper bitArray = BitArrayWrapper.Allocate(5, false);

            //  return new BitArray(5, true);
            if (right == null)
            {
                bitArray.SetAll(true);
            }
            else
            {
                bitArray[0] = ParamType != right.ParamType;
                bitArray[1] = !CompareUtility.IsApproximatelyEqual(NameHash, right.NameHash);
                bitArray[2] = !CompareUtility.IsApproximatelyEqual(BoolValue, right.BoolValue);
                bitArray[3] = !CompareUtility.IsApproximatelyEqual(FloatValue, right.FloatValue, 0.0001f);
                bitArray[4] = !CompareUtility.IsApproximatelyEqual(IntValue, right.IntValue);
            }

            writer.Write(bitArray);
            if (bitArray[0])
            {
                writer.Write((byte)ParamType);
            }
            if (bitArray[1])
            {
                writer.Write(NameHash);
            }
            if (bitArray[2])
            {
                writer.Write(BoolValue);
            }
            if (bitArray[3])
            {
                writer.Write(FloatValue);
            }
            if (bitArray[4])
            {
                writer.Write(IntValue);
            }


            bitArray.ReleaseReference();
        }