コード例 #1
0
 public Contact(ContactState state, string name, DateTime requestSent, string message)
 {
     Name        = name;
     State       = state;
     RequestSent = requestSent;
     Message     = message;
 }
コード例 #2
0
		public PhysicalContactMatrixState(PhysicalContactMatrix matrix) {
			_defaultContact = new ContactState(matrix.defaultContact);

			if (matrix.contacts != null) {
				for (int i = 0; i < matrix.contacts.Length; ++i) {
					var contact = matrix.contacts[i];
					var state = new ContactState(contact);

					Dictionary<PhysicalMaterialClass, ContactState> map;
					if (!_contactMap.TryGetValue(contact.material1, out map)) {
						map = new Dictionary<PhysicalMaterialClass, ContactState>();
						_contactMap[contact.material1] = map;
					}

					map[contact.material2] = state;

					if (!_contactMap.TryGetValue(contact.material2, out map)) {
						map = new Dictionary<PhysicalMaterialClass, ContactState>();
						_contactMap[contact.material2] = map;
					}

					map[contact.material1] = state;
				}
			}
		}
コード例 #3
0
        public void Update(int x,int y,ContactState state)
        {
            Position = new Point(x, y);
            State = state;

            Orientation = 0;
        }
コード例 #4
0
ファイル: SequentialImpulses.cs プロジェクト: Anttifer/Jypeli
 public Arbiter(SequentialImpulsesSolver parent, Body body1, Body body2)
 {
     if (body1.ID < body2.ID)
     {
         this.body1 = body1;
         this.body2 = body2;
     }
     else
     {
         this.body1 = body2;
         this.body2 = body1;
     }
     this.tag1     = (SequentialImpulsesTag)this.body1.SolverTag;
     this.tag2     = (SequentialImpulsesTag)this.body2.SolverTag;
     this.circle1  = this.body1.Shape as CircleShape;
     this.circle2  = this.body2.Shape as CircleShape;
     this.friction = MathHelper.Sqrt(
         this.body1.Coefficients.DynamicFriction *
         this.body2.Coefficients.DynamicFriction);
     this.restitution = Math.Min(body1.Coefficients.Restitution, body2.Coefficients.Restitution);
     this.parent      = parent;
     this.contacts    = new LinkedList <ContactPoint>();
     this.lastUpdate  = -1;
     this.state       = ContactState.New;
     this.ignoresCollisionResponse = body1.IgnoresCollisionResponse || body2.IgnoresCollisionResponse;
 }
コード例 #5
0
        public override void Update(GameTime gameTime)
        {
            KeyboardState keyboardState = _parentEntity.Manager.Scene.KeyboardState;

            _previousContactState = _contactState;

            if (!(_previousKeyboardState.IsKeyDown(Keys.Up) || _previousKeyboardState.IsKeyDown(Keys.Space) ||
                  _previousKeyboardState.IsKeyDown(Keys.W)) && (
                    keyboardState.IsKeyDown(Keys.Up) || keyboardState.IsKeyDown(Keys.Space) || keyboardState.IsKeyDown(Keys.W)))
            {
                Jump();
            }

            _parentEntity.PreviousX = _parentEntity.X;
            _parentEntity.X        += _speed;
            _parentEntity.Y        += VelocityY;

            VelocityY += _gravity;

            if (VelocityY > _velocityYMax)
            {
                VelocityY = _velocityYMax;
            }

            _previousKeyboardState = keyboardState;
        }
コード例 #6
0
 public HandPointContact(HandPointContact hc, ContactState state)
     : base(hc.Id, state,hc.Position, 20, 20)
 {
     velocityx = 0;
     velocityy = 0;
       //  CenterPoint = new Point(hc.Position.X, hc.Position.Y);
 }
コード例 #7
0
 public HandPointContact(HandPointContact hc, ContactState state) :
     base(hc.Id, state, hc.Position, 20, 20)
 {
     velocityx = 0;
     velocityy = 0;
     //  CenterPoint = new Point(hc.Position.X, hc.Position.Y);
 }
コード例 #8
0
 internal void EnqueueContact(HandPointContact cursor, ContactState state)
 {
     lock (contactsQueue)
     {
         contactsQueue.Enqueue(new HandPointContact(cursor, state));
     }
 }
コード例 #9
0
 internal void EnqueueContact(TuioCursor cursor, ContactState state)
 {
     lock (contactsQueue)
     {
         contactsQueue.Enqueue(new TuioContact(cursor, state, monitorSize));
     }
 }
コード例 #10
0
        public void Update(int x, int y, ContactState state)
        {
            Position = new Point(x, y);
            State    = state;

            Orientation = 0;
        }
コード例 #11
0
 public HandPointContact(int id, int x, int y, ContactState state)
     : base(id, state,new Point(x,y), 20, 20)
 {
     //  CenterPoint = new Point(x,y);
         velocityy = 0;
         velocityx = 0;
         Orientation = 0;
 }
コード例 #12
0
ファイル: Contact.cs プロジェクト: xiajiaonly/MultiTouchVista
 /// <summary>
 /// Initializes a new instance of the <see cref="Contact"/> class.
 /// </summary>
 /// <param name="id">The id.</param>
 /// <param name="state">The state.</param>
 /// <param name="position">The position.</param>
 /// <param name="majorAxis">The major axis.</param>
 /// <param name="minorAxis">The minor axis.</param>
 public Contact(int id, ContactState state, Point position, double majorAxis, double minorAxis)
 {
     Id        = id;
     Position  = position;
     State     = state;
     MajorAxis = majorAxis;
     MinorAxis = minorAxis;
 }
コード例 #13
0
 internal void OnDeserializing(StreamingContext context)
 {
     if (History == null)
     {
         History = new ObservableCollection <Message>();
     }
     State = ContactState.Offline;
 }
コード例 #14
0
 public HandPointContact(int id, int x, int y, ContactState state)
     : base(id, state, new Point(x, y), 20, 20)
 {
     //  CenterPoint = new Point(x,y);
     velocityy   = 0;
     velocityx   = 0;
     Orientation = 0;
 }
コード例 #15
0
ファイル: Contact.cs プロジェクト: zhuangfangwang/ise
		/// <summary>
		/// Initializes a new instance of the <see cref="Contact"/> class.
		/// </summary>
		/// <param name="id">The id.</param>
		/// <param name="state">The state.</param>
		/// <param name="position">The position.</param>
		/// <param name="majorAxis">The major axis.</param>
		/// <param name="minorAxis">The minor axis.</param>
		public Contact(int id, ContactState state, Point position, double majorAxis, double minorAxis)
		{
			Id = id;
			Position = position;
			State = state;
			MajorAxis = majorAxis;
			MinorAxis = minorAxis;
		}
コード例 #16
0
        public TuioContact(TuioCursor cursor, ContactState state, System.Drawing.Size monitorSize)
            : base(cursor.getFingerID(), state, new Point(0, 0), 20, 20)
        {
            float x = cursor.getScreenX(monitorSize.Width);
            float y = cursor.getScreenY(monitorSize.Height);

            Position    = new Point(x, y);
            Orientation = 0;
        }
コード例 #17
0
ファイル: InputProvider.cs プロジェクト: zhuangfangwang/ise
		internal void EnqueueContact(TuioCursor cursor, ContactState state)
		{
			lock (contactsQueue)
			{
                Contact contact = new TuioContact(cursor, state, monitorSize);
                //Trace.WriteLine(contact.Position.ToString());
				contactsQueue.Enqueue(contact);
			}
		}
コード例 #18
0
		public TransformedContact(IContact copy)
		{
			Id = copy.Id;
			X = copy.X;
			Y = copy.Y;
			Width = copy.Width;
			Height = copy.Height;
			State = copy.State;
		}
コード例 #19
0
        public void FreeFall()
        {
            _contactState = ContactState.Airborne;

            if (_previousContactState == ContactState.Grounded)
            {
                _jumpState = JumpState.CantJump;
            }
        }
コード例 #20
0
        public TuioContact(TuioCursor cursor, ContactState state, System.Drawing.Size monitorSize)
            : base(cursor.getFingerID(), state, new Point(0, 0), 20, 20)
        {
            float x = cursor.getScreenX(monitorSize.Width);
            float y = cursor.getScreenY(monitorSize.Height);

            Position = new Point(x, y);
            Orientation = 0;
        }
コード例 #21
0
 public TransformedContact(IContact copy)
 {
     Id     = copy.Id;
     X      = copy.X;
     Y      = copy.Y;
     Width  = copy.Width;
     Height = copy.Height;
     State  = copy.State;
 }
コード例 #22
0
ファイル: Contact.cs プロジェクト: IgorProk24/Communicator
 public Contact()
 {
     this.NickName = string.Empty;
     this.Name = string.Empty;
     this.Surname = string.Empty;
     this.Email = string.Empty;
     this.Password = string.Empty;
     this.Id = Guid.NewGuid();
     this.State = ContactState.Online;
 }
コード例 #23
0
ファイル: Contact.cs プロジェクト: IgorProk24/Communicator
 public Contact(string nickName, string name, string surname, string email, string password)
 {
     this.Id       = Guid.NewGuid();
     this.NickName = nickName;
     this.Name     = name;
     this.Surname  = surname;
     this.Email    = email;
     this.Password = password;
     this.State    = ContactState.Online;
 }
コード例 #24
0
ファイル: Contact.cs プロジェクト: IgorProk24/Communicator
 public Contact()
 {
     this.NickName = string.Empty;
     this.Name     = string.Empty;
     this.Surname  = string.Empty;
     this.Email    = string.Empty;
     this.Password = string.Empty;
     this.Id       = Guid.NewGuid();
     this.State    = ContactState.Online;
 }
コード例 #25
0
ファイル: Contact.cs プロジェクト: IgorProk24/Communicator
 public Contact(string nickName, string name, string surname, string email, string password)
 {
     this.Id = Guid.NewGuid();
     this.NickName = nickName;
     this.Name = name;
     this.Surname = surname;
     this.Email = email;
     this.Password = password;
     this.State = ContactState.Online;
 }
コード例 #26
0
		internal static ContactData GetContactData(int id, ContactState state, Point point)
		{
			ContactData contactData = new ContactData();
			contactData.Position = point;
			contactData.Id = id;
			contactData.MajorAxis = 20;
			contactData.MinorAxis = 30;
			contactData.State = state;
			contactData.Orientation = 0;
			return contactData;
		}
コード例 #27
0
        internal static ContactData GetContactData(int id, ContactState state, Point point)
        {
            ContactData contactData = new ContactData();

            contactData.Position    = point;
            contactData.Id          = id;
            contactData.MajorAxis   = 20;
            contactData.MinorAxis   = 30;
            contactData.State       = state;
            contactData.Orientation = 0;
            return(contactData);
        }
コード例 #28
0
        public override void Update(GameTime gameTime)
        {
            _previousContactState   = _contactState;
            _parentEntity.PreviousX = _parentEntity.X;
            _parentEntity.X        += _speed;
            _parentEntity.Y        += VelocityY;

            VelocityY += _gravity;

            if (VelocityY > _velocityYMax)
            {
                VelocityY = _velocityYMax;
            }
        }
コード例 #29
0
    void DetermineContactState()
    {
        contactState = ContactState.FLATGROUND;
        sideAdjacent = MovementDirection.NEUTRAL;

        //If there is a collision below, the character is either FLATGROUND, a steep slope, or a slanted wall
        if (collisions.below)
        {
            if (collisions.groundSlopeAngle < steepSlopeAngle)
            {
                contactState = ContactState.FLATGROUND;
            }
            else
            {
                contactState = ContactState.STEEPSLOPE;
            }
        }
        //If there is a collision on the side but the slope is not vertical enough, the character is also on a steep slope.
        else if ((collisions.left && collisions.leftSurfaceAngle < minWallGrabAngle) || (collisions.right && collisions.rightSurfaceAngle < minWallGrabAngle))
        {
            contactState = ContactState.STEEPSLOPE;
        }
        //If the character was in contact with a steep surface beside it within a few milliseconds, it counts as
        //grabbing the wall
        else if (collisions.left)
        {
            contactState = ContactState.WALLADJACENT;
            sideAdjacent = MovementDirection.LEFT;
        }
        else if (collisions.right)
        {
            contactState = ContactState.WALLADJACENT;
            sideAdjacent = MovementDirection.RIGHT;
        }
        else
        {
            contactState = ContactState.AIRBORNE;
        }

        if (oldContactState != contactState)
        {
            contactStateChanged = true;
        }
        else
        {
            contactStateChanged = false;
        }
        oldContactState = contactState;
    }
コード例 #30
0
        public MainMenuInputComponent(BaseEntity parentEntity) : base(parentEntity)
        {
            _parentEntity         = parentEntity;
            Name                  = "Input";
            _speed                = 4;
            _gravity              = 1;
            _velocityYMax         = 8;
            _contactState         = ContactState.Airborne;
            _previousContactState = ContactState.Airborne;
            _jumpCounter          = 0;
            _maxJump              = 10;
            _minJump              = 7;

            Initialize();
        }
コード例 #31
0
ファイル: SequentialImpulses.cs プロジェクト: Anttifer/Jypeli
 public void OnRemoved()
 {
     if (everCollided)
     {
         body1.IsFrozen = false;
         body2.IsFrozen = false;
         // body1.idleCount -= 3;
         // body2.idleCount -= 3;
     }
     this.state = ContactState.Ended;
     if (Ended != null)
     {
         Ended(this, EventArgs.Empty);
     }
 }
コード例 #32
0
 static RoutedEvent GetPreviewEventFromRawMultitouchState(ContactState state)
 {
     if (state == ContactState.New)
     {
         return(MultitouchScreen.PreviewNewContactEvent);
     }
     if (state == ContactState.Moved)
     {
         return(MultitouchScreen.PreviewContactMovedEvent);
     }
     if (state == ContactState.Removed)
     {
         return(MultitouchScreen.PreviewContactRemovedEvent);
     }
     return(null);
 }
コード例 #33
0
        static void RaiseEnterLeave(Contact contact, UIElementsList list)
        {
            foreach (DependencyObject treeElement in list)
            {
                ContactState state = list.GetState(treeElement);
                switch (state)
                {
                case ContactState.New:
                    RaiseEnterLeaveEvents(contact, treeElement, MultitouchScreen.ContactEnterEvent);
                    break;

                case ContactState.Removed:
                    RaiseEnterLeaveEvents(contact, treeElement, MultitouchScreen.ContactLeaveEvent);
                    break;
                }
            }
        }
コード例 #34
0
ファイル: SequentialImpulses.cs プロジェクト: Anttifer/Jypeli
            public void Update(TimeStep step)
            {
                if (lastUpdate != -1)
                {
                    if (lastUpdate != step.UpdateCount - 1)
                    {
                        state = ContactState.New;
                    }
                    else
                    {
                        state = ContactState.Old;
                    }
                }


                if ((!body1.IsFrozen || !body2.IsFrozen))
                {
                    if (circle1 != null && circle2 != null &&
                        !body1.IsTransformed && !body2.IsTransformed)
                    {
                        CollideCircles();
                    }
                    else
                    {
                        Collide();
                    }
                    UpdateContacts();
                    if (Collided)
                    {
                        body1.IsFrozen = false;
                        body2.IsFrozen = false;
                        everCollided   = true;
                    }
                }
                if (Collided)
                {
                    lastUpdate = step.UpdateCount;
                }

                if (Updated != null &&
                    contactsArray.Length != 0)
                {
                    Updated(this, EventArgs.Empty);
                }
            }
コード例 #35
0
ファイル: TuioContact.cs プロジェクト: zhuangfangwang/ise
		public TuioContact(TuioCursor cursor, ContactState state, System.Drawing.Size monitorSize)
			: base(cursor.getFingerID(), state, new Point(0, 0), 20, 20)
		{

            float x, y;

            //Edit by Wander
            if (secondaryScreen == null)
            {
                x = cursor.getScreenX(monitorSize.Width);
                y = cursor.getScreenY(monitorSize.Height);
            }
            else
            {
                x = cursor.getX() * secondaryScreen.WorkingArea.Width + secondaryScreen.WorkingArea.Left;
                y = cursor.getY() * secondaryScreen.WorkingArea.Height + secondaryScreen.WorkingArea.Top;
            }

			Position = new Point(x, y);
			Orientation = 0;
		}
コード例 #36
0
        /// <summary>
        /// Get contact state string
        /// </summary>
        /// <returns></returns>
        private string GetContactStateString(string utid, int probe, decimal state, int language)
        {
            string       contactStateString = "";
            ContactState contactState       = null;

            try
            {
                contactState              = new ContactState();
                contactState.UTID         = utid;
                contactState.Probe        = probe;
                contactState.contactState = state;
                contactState.LanguageID   = language;
                contactState.Execute(contactState);

                contactStateString = contactState.contactStateString;
            }
            catch (Exception ex)
            {
                /*Debug Object values for reference*/
                LogBook.Debug(contactState, this);

                /*Write exception log*/
                LogBook.Write("Error has occurred while retrieving contactStateString", ex, "CooperAtkins.NotificationClient.NotificationComposer.Notification");
            }
            finally
            {
                contactState.Dispose();
            }
            //Set default string if contact string doesn't exist
            if (contactStateString == string.Empty && state == 0)
            {
                contactStateString = "Closed";
            }
            else if (contactStateString == string.Empty)
            {
                contactStateString = "Open";
            }

            return(contactStateString);
        }
コード例 #37
0
        protected override void ReadingChangedAsync(object sender, BandSensorReadingEventArgs <BandContactReading> args)
        {
            Task.Run(() =>
            {
                try
                {
                    ContactState state = args.SensorReading.State;

                    if (_previousState == null || state != _previousState.Value)
                    {
                        ContactStateChanged?.Invoke(this, state);
                        _previousState = state;
                    }
                }
                catch (Exception ex)
                {
                    SensusServiceHelper.Get().Logger.Log("Error processing Band contact change:  " + ex.Message, LoggingLevel.Normal, GetType());
                }

                base.ReadingChangedAsync(sender, args);
            });
        }
コード例 #38
0
 private void ContactStateChanged(object sender, ContactState contactState)
 {
     // contact probe might get a reading before this probe changes to the running state or after it changes
     // to the stopped state.
     if (Running)
     {
         // start readings if band is worn, regardless of whether we're stopping readings when it isn't worn.
         if (contactState == ContactState.Worn)
         {
             StartReadings();
             _stoppedBecauseNotWorn = false;
         }
         else if (contactState == ContactState.NotWorn && _stopWhenNotWorn && !_stoppedBecauseNotWorn)
         {
             // prevent race condition with client health test, which will be trying to start readings on this probe.
             lock (HEALTH_TEST_LOCKER)
             {
                 StopReadings();
                 _stoppedBecauseNotWorn = true;
             }
         }
     }
 }
コード例 #39
0
        public async Task RunContactAction(int currentUserId, int contactUserId, ContactState state)
        {
            using (var contactRepository = _unitOfWork.Repository <Contact>())
            {
                var contact = await contactRepository
                              .Query()
                              .Include(c => c.User)
                              .Include(c => c.ContactUser)
                              .SingleOrDefaultAsync(c => c.User.Id == currentUserId && c.ContactUser.Id == contactUserId);

                if (contact != null)
                {
                    var contactUserDto = new UserContactDto
                    {
                        Id        = currentUserId,
                        State     = state,
                        Avatar    = contact.User.Avatar,
                        Name      = contact.User.FirstName + " " + contact.User.LastName,
                        City      = contact.User.City,
                        UserState = contact.User.State,
                        IsOnline  = contact.User.IsOnline
                    };

                    using (var userRepository = _unitOfWork.Repository <User>())
                    {
                        var contactUser = await userRepository
                                          .Query()
                                          .SingleOrDefaultAsync(u => u.Id == contactUserId);

                        if (contactUser != null && !string.IsNullOrEmpty(contactUser.ConnectionId))
                        {
                            await _hubContext.Clients.Client(contactUser.ConnectionId).onContactAction(contactUserDto);
                        }
                    }
                }
            }
        }
コード例 #40
0
ファイル: HUDManager.cs プロジェクト: robertg/Soar
 public Contact(ContactState state, Vector2 position)
 {
     State = state;
     Position = position;
 }
コード例 #41
0
ファイル: Contact.cs プロジェクト: IgorProk24/Communicator
 public void ChangeState(ContactState newState) =>
     this.State = newState;
コード例 #42
0
 public void ChangedState(VsJid id, ContactState state)
 {
     GetInterlocutorOrSelf(id).State = state;
 }
コード例 #43
0
 private int StateMeasure(ContactState state)
 {
     switch (state)
     {
         case ContactState.Online:
             return 1;
         case ContactState.Offline:
             return 2;
         default:
             return 0;
     }
 }
コード例 #44
0
 public Arbiter(SequentialImpulsesSolver parent, Body body1, Body body2)
 {
     if (body1.ID < body2.ID)
     {
         this.body1 = body1;
         this.body2 = body2;
     }
     else
     {
         this.body1 = body2;
         this.body2 = body1;
     }
     this.tag1 = (SequentialImpulsesTag)this.body1.SolverTag;
     this.tag2 = (SequentialImpulsesTag)this.body2.SolverTag;
     this.circle1 = this.body1.Shape as CircleShape;
     this.circle2 = this.body2.Shape as CircleShape;
     this.friction = MathHelper.Sqrt(
             this.body1.Coefficients.DynamicFriction *
             this.body2.Coefficients.DynamicFriction);
     this.restitution = Math.Min(body1.Coefficients.Restitution, body2.Coefficients.Restitution);
     this.parent = parent;
     this.contacts = new LinkedList<ContactPoint>();
     this.lastUpdate = -1;
     this.state = ContactState.New;
     this.ignoresCollisionResponse = body1.IgnoresCollisionResponse || body2.IgnoresCollisionResponse;
 }
コード例 #45
0
            public void Update(TimeStep step)
            {
                if (lastUpdate != -1)
                {
                    if (lastUpdate != step.UpdateCount - 1)
                    {
                        state = ContactState.New;
                    }
                    else
                    {
                        state = ContactState.Old;
                    }
                }


                if ((!body1.IsFrozen || !body2.IsFrozen))
                {
                    if (circle1 != null && circle2 != null &&
                        !body1.IsTransformed && !body2.IsTransformed)
                    {
                        CollideCircles();
                    }
                    else
                    {
                        Collide();
                    }
                    UpdateContacts();
                    if (Collided)
                    {
                        body1.IsFrozen = false;
                        body2.IsFrozen = false;
                        everCollided = true;
                    }
                }
                if (Collided)
                {
                    lastUpdate = step.UpdateCount;
                }

                if (Updated != null &&
                    contactsArray.Length != 0)
                {
                    Updated(this, EventArgs.Empty);
                }
            }
コード例 #46
0
		internal static ContactData GetContactData(int id, ContactState state)
		{
			return GetContactData(id, state, new Point(100, 100));
		}
コード例 #47
0
 public MicrosoftBandContactDatum(DateTimeOffset timestamp, ContactState state)
     : base(timestamp)
 {
     _state = state;
 }
コード例 #48
0
ファイル: MultitouchLogic.cs プロジェクト: zhuangfangwang/ise
		static RoutedEvent GetPreviewEventFromRawMultitouchState(ContactState state)
		{
			if (state == ContactState.New)
				return MultitouchScreen.PreviewNewContactEvent;
			if (state == ContactState.Moved)
				return MultitouchScreen.PreviewContactMovedEvent;
			if (state == ContactState.Removed)
				return MultitouchScreen.PreviewContactRemovedEvent;
			return null;
		}
コード例 #49
0
 public void OnRemoved()
 {
     if (everCollided)
     {
         body1.IsFrozen = false;
         body2.IsFrozen = false;
        // body1.idleCount -= 3;
        // body2.idleCount -= 3;
     }
     this.state = ContactState.Ended;
     if (Ended != null) { Ended(this, EventArgs.Empty); }
 }
コード例 #50
0
 internal BandContactReading(ContactState state)
 {
     State = state;
 }
コード例 #51
0
 internal void EnqueueContact(TuioCursor cursor, ContactState state)
 {
     lock (contactsQueue)
     {
         contactsQueue.Enqueue(new TuioContact(cursor, state, monitorSize));
     }
 }
コード例 #52
0
 public CursorState(TuioCursor cursor, ContactState state)
 {
     Cursor = cursor;
     State = state;
 }
コード例 #53
0
 public Interlocutor()
 {
     History = new ObservableCollection <Message>();
     State   = ContactState.Offline;
 }