Beispiel #1
0
        public override void SetSafetyNumberVariable(int index, int value)
        {
            switch (index)
            {
            case 1:
            {
                var bytes = value.ToBytes(Endian.Environment);
                inputFlag = new InputFlag(bytes[0]);
                return;
            }

            case 2:
                if (IsInputPosition)
                {
                    PositionX = value;
                }
                else if (IsInputWheel)
                {
                    MouseWheel = value;
                }
                return;

            case 3:
                if (IsInputPosition)
                {
                    PositionY = value;
                }
                return;

            default:
                throw new ArgumentOutOfRangeException(
                          ErrorMessage.OutOfRange(nameof(index), 1, 3, index));
            }
        }
Beispiel #2
0
        public void Serialize(StreamBuffer buffer)
        {
            buffer.Write(this.gcNID);
            int count = this._actions.Count;

            buffer.Write(( byte )count);
            for (int i = 0; i < count; i++)
            {
                Protos.GC2BS_FrameActionInfo info = this._actions[i];
                InputFlag inputFlag = ( InputFlag )info.InputFlag;
                buffer.Write(info.Frame);
                buffer.Write(( byte )inputFlag);
                if ((inputFlag & InputFlag.Move) > 0)
                {
                    buffer.Write(info.V0);
                    buffer.Write(info.V1);
                }

                if ((inputFlag & InputFlag.S1) > 0 ||
                    (inputFlag & InputFlag.S2) > 0)
                {
                    buffer.Write(info.V0);
                }
            }
        }
Beispiel #3
0
        public override void SetSafetyNumberVariable(int index, int value)
        {
            switch (index)
            {
            case 1:
            {
                var bytes = value.ToBytes(Endian.Environment);
                inputFlag = new InputFlag(bytes[0]);
                return;
            }

            default:
                throw new ArgumentOutOfRangeException(
                          ErrorMessage.OutOfRange(nameof(index), 1, 1, index));
            }
        }