コード例 #1
0
        public static List <GameObject> Collect <T>(this IEntities entities)
        {
            var targets = new List <GameObject>();

            entities.With <T>((o, x) => targets.Add(o));
            return(targets);
        }
コード例 #2
0
        public static List <GameObject> Collect <T1, T2>(this IEntities entities)
        {
            var collection1 = entities.Collect <T1>();
            var collection2 = entities.Collect <T2>();

            return(collection1.Intersect(collection2).ToList());
        }
コード例 #3
0
 public void Draw(IEntities entities, SpriteBatch sprites)
 {
     entities.With <BorderTexture>((o, b) => {
         Resources.Put(b.Value.GetHashCode().ToString(), b.Value);
         sprites.Draw(b.Value, null, o.Transform.ToRectangle(), null, null, o.Transform.Rotation.Value * .017453292519f, new Vector2(1, 1));
     });
 }
コード例 #4
0
        public static void Where <T>(this IEntities entities, Predicate <T> condition, Action <T> action)
        {
            var targets = new List <GameObject>();

            entities.With <T>((o, x) => x.If(condition(x), () => targets.Add(o)));
            targets.ForEach(o => o.With(action));
        }
コード例 #5
0
 public void Draw(IEntities entities, SpriteBatch sprites)
 {
     entities.Collect <Sprite>()
     .ForEach(t => t.With <Sprite>(s =>
                                   sprites.Draw(Resources.Load <Texture2D>(s.Name), null, t.Transform.ToRectangle(), null, null,
                                                GetRotation(t), new Vector2(1, 1), null, SpriteEffects.None, GetDepth(t))));
 }
コード例 #6
0
 public void Draw(IEntities entities)
 {
     entities.ForEach(
         e => e.With <TextDisplay>(
             text => e.With <Spatial2>(
                 spatial => UI.DrawTextCentered(text.Text(), spatial.Transform.ToRectangle(), text.Color, text.Font))));
 }
コード例 #7
0
 public NewDLLFunctions(EntityDictionary entityDictionary, Wrapper wrapper, IServerInterface serverInterface, IEntities serverEntities)
 {
     EntityDictionary = entityDictionary ?? throw new ArgumentNullException(nameof(entityDictionary));
     Wrapper          = wrapper ?? throw new ArgumentNullException(nameof(wrapper));
     ServerInterface  = serverInterface ?? throw new ArgumentNullException(nameof(serverInterface));
     ServerEntities   = serverEntities ?? throw new ArgumentNullException(nameof(serverEntities));
 }
コード例 #8
0
        private List <GameObject> GetColliderObjects(IEntities entities)
        {
            var colliderObjs = new List <GameObject>();

            entities.With <BoxCollider>((o, x) => colliderObjs.Add(o));
            return(colliderObjs);
        }
コード例 #9
0
 public void Update(IEntities entities, TimeSpan delta)
 {
     if (Keyboard.GetState().GetPressedKeys().Contains(Keys.Escape))
     {
         GameInstance.TheGame.Exit();
     }
 }
コード例 #10
0
 public void Update(IEntities entities, TimeSpan delta)
 {
     _unprocessedControls.ForEach(
         ctrl => entities.With <Controls>(
             (o, ctrls) => ctrls.OnControl(ctrl)));
     _unprocessedControls.Clear();
 }
コード例 #11
0
        private static string GetServiceRoot(IEntities entities)
        {
            var origin      = entities.Request.Context.Client;
            var hostAndPath = $"{origin.Host}{Settings.Instance.Uri}-odata";

            return(origin.HTTPS ? $"https://{hostAndPath}" : $"http://{hostAndPath}");
        }
コード例 #12
0
 public void Update(IEntities entities, TimeSpan delta)
 {
     entities.With <StepTrigger>((o, trigger) =>
                                 o.With <OnCollision>(onCollision =>
                                                      onCollision.GameObject.Get <Collision>().CollidingWith
                                                      .ForEach(x => onCollision.Action(x))));
 }
コード例 #13
0
        public void Update(IEntities entities, TimeSpan delta)
        {
            _mouse = _mouse.Current();

            if (!_mouse.IsOnGameScreen)
            {
                return;
            }

            entities.WithTopMost <MouseStateActions>(_mouse.WorldPosition,
                                                     (o, m) =>
            {
                if (!o.World.Intersects(_mouse.WorldPosition))
                {
                    m.Exit();
                }
                else if (!o.World.Intersects(_mouse.LastWorldPosition))
                {
                    m.Hover();
                }
                else if (_mouse.JustPressed(m.Button))
                {
                    m.Click();
                }
                else if (_mouse.JustReleased(m.Button))
                {
                    m.Release();
                }
            },
                                                     (o, m) => m.Exit());
        }
コード例 #14
0
 public static void WithTopMost <T>(this IEntities entities, Point point, Action <GameObject, T> action)
 {
     Collect <T>(entities)
     .Where(o => o.Transform.Intersects(point))
     .OrderByDescending(o => o.Transform.ZIndex)
     .FirstAsOptional()
     .IfPresent(o => o.With <T>(x => action(o, x)));
 }
コード例 #15
0
 public void BuyGame(IEntities game, IEntities user)
 {
     foreach (var sale in _saleServices)
     {
         sale.Discount(game);
     }
     Console.WriteLine("Tebrikler! " + user.Name + " Oyunu başarıyla aldınız : " + game.Name);
 }
コード例 #16
0
 public void Update(IEntities entities, TimeSpan delta)
 {
     entities.With <MotionAnimationStates>(
         (obj, motionStates) => obj.With <MotionState>(
             motionState => obj.With <Motion2>(
                 motion => obj.With <Animation>(
                     animation => EnsureCorrectAnimation(motionStates, motion, motionState, animation)))));
 }
コード例 #17
0
 // ReSharper disable once TooManyDependencies
 public ReferenceReader(IReader reader, IReferenceMaps maps, IEntities entities, TypeInfo definition,
                        IClassification classification) : base(reader)
 {
     _maps           = maps;
     _entities       = entities;
     _definition     = definition;
     _classification = classification;
 }
コード例 #18
0
 public void Update(IEntities game)
 {
     foreach (var logger in _loggerGameServices)
     {
         logger.Update(game);
     }
     Console.WriteLine(game.Name + " : Oyun Güncellendi");
 }
コード例 #19
0
        public void Update(IEntities entities, TimeSpan delta)
        {
            var min = new MinHeight();

            entities.Collect <ZGravity>()
            .OrderBy(x => x.Transform.ZIndex)
            .ForEach(x => Update(min, x));
        }
コード例 #20
0
 public void Update(IEntities user)
 {
     foreach (var logger in _loggerUserServices)
     {
         logger.Update(user);
     }
     Console.WriteLine(user.Name + " : Oyuncu Güncellendi");
 }
コード例 #21
0
        public void Update(IEntities entities, TimeSpan delta)
        {
            Update(delta);
            var inputs = _newInputs.Copy();

            _newInputs.Clear();
            entities.With <TypingInput>((o, t) => t.If(t.IsActive, () => ProcessAllInputs(inputs, t)));
        }
コード例 #22
0
 public void Delete(IEntities user)
 {
     foreach (var logger in _loggerUserServices)
     {
         logger.Delete(user);
     }
     Console.WriteLine(user.Name + " : Oyuncu Silindi");
 }
コード例 #23
0
 public Repository(IEntities context)
 {
     if (context == null)
     {
         throw new ArgumentNullException("context");
     }
     this.context = context;
 }
コード例 #24
0
 public virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         context.Dispose();
         context = null;
     }
 }
コード例 #25
0
 public void Delete(IEntities game)
 {
     foreach (var logger in _loggerGameServices)
     {
         logger.Delete(game);
     }
     Console.WriteLine(game.Name + " : Oyun Silindi");
 }
コード例 #26
0
 private static void RepositionCards(IEntities entities, Hand hand, List <Vector2> positions)
 {
     hand.Cards().ForEachIndex((cardId, i) => entities.With <Transform2>(cardId, (obj, CardTransform) =>
     {
         CardTransform.Center = positions[i];
         CardTransform.ZIndex = i;
     }));
 }
コード例 #27
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="context"></param>
        protected Manager(IEntities context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            DataContext = context;
        }
コード例 #28
0
 public void Draw(IEntities entities, SpriteBatch sprites, IViewport viewport)
 {
     entities.With <BorderTexture>((o, b) =>
     {
         var screenPosition = viewport.GetScreenPosition(o.World.Expanded(new Size2(b.Width, b.Width)));
         sprites.Draw(b.Value, screenPosition.ToRectangle(), null, Color.White,
                      screenPosition.Rotation.Radians, Vector2.Zero, SpriteEffects.None, (screenPosition.ZIndex - 1).AsDepth());
     });
 }
コード例 #29
0
ファイル: Manager.cs プロジェクト: HedinRakot/CoreProjects
        /// <summary>
        /// 
        /// </summary>
        /// <param name="context"></param>
		protected Manager(IEntities context)
        {
			if (context == null)
			{
				throw new ArgumentNullException("context");
			}

			DataContext = context;
		} 
コード例 #30
0
 public void Update(IEntities entities, TimeSpan delta)
 {
     entities.With <Motion2>((o, motion) => o.With <Collision>(collision =>
     {
         if (o.Get <Collision>().IsBlocking&& collision.CollidingWith.Any(x => x.Get <Collision>().IsBlocking))
         {
             motion.Velocity.Speed = 0;
         }
     }));
 }
コード例 #31
0
 public void Update(IEntities entities, TimeSpan delta)
 {
     entities.With <Mortal>(
         (o, mortal) => o.With <Health>(
             (health) => { if (health.HP < 1)
                           {
                               mortal.OnDeath();
                           }
             }));
 }
コード例 #32
0
 public EntityLinkMaterialiser(IEntityLinks entityLinks, IEntities entities)
 {
     _entityLinks = entityLinks;
     _entities = entities;
 }
コード例 #33
0
		public EntityLinkValidator(IEntityLinks entityLinks, IEntities entities)
		{
			_entityLinks = entityLinks;
			_entities = entities;
		}