示例#1
0
        private void HandleFrameItem(FrameItem item)
        {
            switch (item)
            {
            case PlaceObject po:
                //place a new display item
                if (po.Flags.HasFlag(PlaceObjectFlags.HasCharacter) &&
                    !po.Flags.HasFlag(PlaceObjectFlags.Move))
                {
                    PlaceItem(po);
                }
                //modify an existing display item
                else if (!po.Flags.HasFlag(PlaceObjectFlags.HasCharacter) &&
                         po.Flags.HasFlag(PlaceObjectFlags.Move))
                {
                    MoveItem(po);
                }
                //this will erase an existing item and place a new item right away
                else if (po.Flags.HasFlag(PlaceObjectFlags.HasCharacter) &&
                         po.Flags.HasFlag(PlaceObjectFlags.Move))
                {
                    PlaceItem(po);
                }
                break;

            case RemoveObject ro:
                _content.Items.Remove(ro.Depth);
                break;

            case Action action:
                _actionList.Add(action);
                break;
            }
        }
示例#2
0
        public static Frame Parse(BinaryReader reader)
        {
            var frame = new Frame();

            frame.FrameItems = reader.ReadListAtOffset <FrameItem>(() => FrameItem.Create(reader), true);

            return(frame);
        }
示例#3
0
        // static constructor
        static PG2VNCViewer()
        {
            int n = 0;

            FrameItem.FiFillInPropertyDescriptions(allprops, ref n, true, true, true, true, false);
            foreach (PropertyDesc propertyDesc in myprops)
            {
                allprops[n++] = propertyDesc;
            }
        }
        // static constructor
        static MyfirstElement()
        {
            int n = 0;

            FrameItem.FiFillInPropertyDescriptions(allprops, ref n, true, true, true, true, false);
            foreach (PropertyDesc propertyDesc in myprops)
            {
                allprops[n++] = propertyDesc;
            }
        }
    public void addFrameItemToLatestFrame(Vector3 position, Quaternion rotation,
                                          bool deactivateAfterThisFrame, TimeManageable item)
    {
        TransformData tfd          = new TransformData(); tfd.position = position; tfd.rotation = rotation;
        FrameItem     newFrameItem = new FrameItem(); newFrameItem.transformData = tfd;

        newFrameItem.deactivateAfterThisFrame = deactivateAfterThisFrame;
        newFrameItem.item = item;
        recordedFrames[recordedFrames.Count - 1].AddFrameItem(newFrameItem);
    }
示例#6
0
        static PG2SqlQueryBox()
        {
            var n = 0;

            FrameItem.FiFillInPropertyDescriptions(Allprops, ref n, true, true, true, true, false);
            foreach (PropertyDesc propertyDesc in Properties)
            {
                Allprops[n++] = propertyDesc;
            }
        }
示例#7
0
        private void HandleFrameItem(FrameItem item)
        {
            switch (item)
            {
            case PlaceObject po:
                //place a new display item
                if (po.Flags.HasFlag(PlaceObjectFlags.HasCharacter) &&
                    !po.Flags.HasFlag(PlaceObjectFlags.Move))
                {
                    PlaceItem(po);
                }
                //modify an existing display item
                else if (!po.Flags.HasFlag(PlaceObjectFlags.HasCharacter) &&
                         po.Flags.HasFlag(PlaceObjectFlags.Move))
                {
                    MoveItem(po);
                }
                //this will erase an existing item and place a new item right away
                else if (po.Flags.HasFlag(PlaceObjectFlags.HasCharacter) &&
                         po.Flags.HasFlag(PlaceObjectFlags.Move))
                {
                    PlaceItem(po);
                }
                break;

            case RemoveObject ro:
                Content.RemoveItem(ro.Depth);
                break;

            case Action action:
                _actionList.Add(action);
                break;

            case BackgroundColor bg:
                if (SetBackgroundColor != null)
                {
                    SetBackgroundColor(bg.Color.ToColorRgbaF());
                }
                else
                {
                    //throw new InvalidOperationException("BackgroundColor can only be set from root!");
                }
                break;

            default:
                throw new NotImplementedException("Unimplemented frameitem");
            }
        }
示例#8
0
    private IMessage FrameDataNotify(ByteString message)
    {
        GSFrameDataNotify request = new GSFrameDataNotify();

        ByteUtils.ByteStringToObject(request, message);
        GSFrameBroadcastAck reply = new GSFrameBroadcastAck()
        {
            Status = (UInt32)ErrorCode.Ok
        };

        Dictionary <UInt32, FrameData> roomFrame;

        if (!roomFrames.TryGetValue(request.RoomID, out roomFrame))
        {
            roomFrame = new Dictionary <UInt32, FrameData>();
            roomFrames[request.RoomID] = roomFrame;
        }

        FrameData frame;

        if (!roomFrame.TryGetValue(request.FrameIdx, out frame))
        {
            frame = new FrameData()
            {
                GameID     = request.GameID,
                RoomID     = request.RoomID,
                FrameIndex = request.FrameIdx,
                FrameItems = new List <FrameItem>(),
            };
            roomFrame[request.FrameIdx] = frame;
        }

        FrameItem item = new FrameItem()
        {
            SrcUserID = request.SrcUid,
            CpProto   = request.CpProto,
            Timestamp = request.TimeStamp,
        };

        frame.FrameItems.Add(item);

        return(reply);
    }
示例#9
0
 public void AddFrameItem(FrameItem fItem)
 {
     frameItems.Add(fItem);
 }
示例#10
0
 public void AddFrameItem(FrameItem fItem)
 {
     frameItems.Add(fItem);
 }
 public void AddFrameItem(FrameItem fi)
 {
     frameEntities.Add(fi);
 }
示例#12
0
    public void ConstructBike(BikeConstructionData data)
    {
        GameObject frame;

        if (data.frame != null)
        {
            frame  = Instantiate(data.frame.gameObject, transform.position, transform.rotation);
            _frame = frame.GetComponent <FrameItem>();

            _frameRB         = frame.GetComponent <Rigidbody2D>();
            _backWheelJoint  = _frame.backWheelJoint;
            _frontWheelJoint = _frame.frontWheelJoint;

            _backWheelMotor  = _backWheelJoint.motor;
            _frontWheelMotor = _frontWheelJoint.motor;
        }
        else
        {
            _isDead = true;
            raceOverlay.Wasted();
            return;
        }

        if (data.backWheel != null)
        {
            //Create back wheel
            Vector3    backWheelWorldPos = frame.transform.TransformPoint(_backWheelJoint.anchor);
            GameObject backWheel         = Instantiate(data.backWheel.gameObject, backWheelWorldPos, frame.transform.rotation);
            _backWheelJoint.connectedBody = backWheel.GetComponent <Rigidbody2D>();
        }
        else
        {
            _backWheelJoint.enabled = false;
        }

        if (data.frontWheel != null)
        {
            // Create front wheel
            Vector3    frontWheelWorldPos = frame.transform.TransformPoint(_frontWheelJoint.anchor);
            GameObject frontWheel         = Instantiate(data.frontWheel.gameObject, frontWheelWorldPos, frame.transform.rotation);

            _frontWheelJoint.connectedBody = frontWheel.GetComponent <Rigidbody2D>();
        }
        else
        {
            _backWheelJoint.enabled = false;
        }

        if (data.handlebars != null)
        {
            GameObject handlebars    = Instantiate(data.handlebars.gameObject, _frame.handlebarTransform);
            var        handlebarItem = handlebars.GetComponent <HandlebarItem>();

            Vector3 localHandlebarPosition = _frameRB.transform.InverseTransformPoint(handlebarItem.handPosition.position);
            _ragdollController.SetHandJointAnchor(_frameRB, localHandlebarPosition);
        }
        else
        {
            _ragdollController.DisableHandJoint();
        }

        if (data.seatItem != null)
        {
            GameObject seat     = Instantiate(data.seatItem.gameObject, _frame.seatTransform);
            var        seatItem = seat.GetComponent <SeatItem>();

            Vector3 localSeatPosition = _frameRB.transform.InverseTransformPoint(seatItem.assPosition.position);
            _ragdollController.SetSeatJointAnchor(_frameRB, localSeatPosition);
        }
        else
        {
            _ragdollController.DisableSeatJoint();
        }


        SetConfiguredValues();
        CameraDirector.Instance.SetTarget(_ragdollController.torso.transform);
        _ragdollController.headCollisionEventSystem.onValidCollision += DestroyBike;
    }