private readonly IEventRunner _eventRunner;           //#A

        public DomainEventsDbContext(                         //#B
            DbContextOptions <DomainEventsDbContext> options, //#B
            IEventRunner eventRunner = null)                  //#B
            : base(options)
        {
            _eventRunner = eventRunner;                       //#B
        }
Exemplo n.º 2
0
 public ComponentTest(IComponentOwner owner, IEventRunner eventRunner, Input input, IEventSwitchUpdater eventSwitchUpdater) : base(owner)
 {
     this.eventRunner        = eventRunner;
     this.input              = input;
     this.eventSwitchUpdater = eventSwitchUpdater;
     input.NewInput         += InputOnNewInput;
     lastUpdate              = false;
 }
Exemplo n.º 3
0
        public InputStateManager(IEventRunner eventRunner)
        {
            clipBoard = new HashSet <BoardObject>();

            state        = new SelectionToolState();
            SelectedTool = Tools.SelectionTool;

            this.eventRunner = eventRunner;
        }
Exemplo n.º 4
0
        public Main(ILobby lobby, IEventRunner eventRunner, IDiscordHandler discord, ISpreadsheet sheet, ScriptInput input) : base(eventRunner)
        {
            _lobby       = lobby;
            _discord     = discord;
            _eventRunner = eventRunner;
            _sheet       = sheet;
            _input       = input;

            _sorter = new LobbySort(eventRunner, lobby, input.CaptainA, input.CaptainB);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Registers the <see cref="EventObject"/>
        /// </summary>
        /// <param name="eventRunner"></param>
        public void Register(IEventRunner eventRunner)
        {
            while (eventRunner.Contains(Id))
            {
                Id = Guid.NewGuid();
            }

#pragma warning disable CS0618 // Type or member is obsolete
            eventRunner.Register(this);
#pragma warning restore CS0618 // Type or member is obsolete
        }
Exemplo n.º 6
0
        /// <summary>
        /// Event object, used to access all events
        /// </summary>
        public EventObject(IEventRunner evRunner, bool register = true)
        {
            Id        = Guid.NewGuid();
            _evRunner = evRunner;

            if (register)
#pragma warning disable CS0618 // Type or member is obsolete
            {
                _evRunner.Register(this);
            }
#pragma warning restore CS0618 // Type or member is obsolete
        }
Exemplo n.º 7
0
        public virtual void OnDeconstruct()
        {
            this.eventRunner = default;

            this.prewarmed                = false;
            this.beginAddEventsCount      = 0;
            this.beginAddEvents           = false;
            this.statEventsAdded          = 0;
            this.statPlayedEvents         = 0;
            this.oldestTick               = Tick.Invalid;
            this.lastSavedStateTick       = Tick.Invalid;
            this.pauseStoreStateSinceTick = Tick.Invalid;

            this.statesHistory.DiscardAll();
            this.statesHistory = null;

            this.world.SetStatesHistoryModule(null);

            foreach (var item in this.events)
            {
                var values = item.Value.Values;
                for (int i = 0, cnt = values.Count; i < cnt; ++i)
                {
                    var val = values[i];
                    if (val.parameters != null)
                    {
                        PoolArray <object> .Recycle(ref val.parameters);
                    }
                }
                item.Value.Clear();
                PoolSortedList <long, HistoryEvent> .Recycle(item.Value);
            }
            PoolDictionary <Tick, ME.ECS.Collections.SortedList <long, HistoryEvent> > .Recycle(ref this.events);

            foreach (var kv in this.syncHashTable)
            {
                PoolDictionary <int, int> .Recycle(kv.Value);
            }
            PoolDictionary <Tick, Dictionary <int, int> > .Recycle(ref this.syncHashTable);
        }
Exemplo n.º 8
0
 void IStatesHistoryModule <TState> .SetEventRunner(IEventRunner eventRunner)
 {
     this.eventRunner = eventRunner;
 }
 public EventRouter(IEventRunner eventRunner)
 {
     this.eventRunner = eventRunner;
 }
Exemplo n.º 10
0
 public void Deregister(IEventRunner eventRunner)
 {
     _evRunner.Delete(this);
 }
 public EventTriggerEyeContact(IComponentOwner owner, IEventRunner eventRunner, IList <IEvent> events, IWorldData worldData) : base(owner, eventRunner, events)
 {
     this.worldData = worldData;
 }
Exemplo n.º 12
0
 protected EventTrigger(IComponentOwner owner, IEventRunner eventRunner, IList <IEvent> events) : base(owner)
 {
     this.eventRunner = eventRunner;
     this.events      = events;
 }
        public IList <WorldObject> LoadEntities(string mapName, IWorldData worldData, IEventRunner eventRunner, EventSwitchHandler eventSwitchHandler)
        {
            var entityList = new List <WorldObject>();
            var entity     = new WorldObject("player", eventSwitchHandler);

            entity.AddComponent(new Sprite(entity, new SpriteData
            {
                Color         = Color.White,
                Height        = 19,
                Width         = 15,
                TextureName   = "NPC/main_character",
                XTilePosition = 2,
                YTilePosition = 2
            }, new Rectangle(0, 0, 16, 19)));
            entity.AddComponent(new MovementPlayer(entity, 1, new InputKeyboard()));
            entity.AddComponent(new Animation(entity));
            entity.AddComponent(new Collision(entity, worldData));
            entity.AddComponent(new ComponentTest(entity, eventRunner, new InputKeyboard(), eventSwitchHandler));
            //NPC
            var entityNpc = new WorldObject("npc", eventSwitchHandler);

            entityNpc.AddComponent(new Sprite(entityNpc, new SpriteData
            {
                Color         = Color.White,
                Height        = 19,
                Width         = 15,
                TextureName   = "NPC/rock_trainer",
                XTilePosition = 4,
                YTilePosition = 4
            }, new Rectangle(0, 0, 16, 19)));
            entityNpc.AddComponent(new Animation(entityNpc, new AnimationSpinning(16, 20, 400)), 1);
            entityNpc.AddComponent(new Collision(entityNpc, worldData));
            //entityNpc.AddComponent(new EventTriggerEyeContact(entityNpc, eventRunner, new List<IEvent> { new EventEmotion("npc", new EmotionTrainer(eventSwitchHandler)), new EventMovement("npc", new Vector2(8, 8))}, worldData));
            entityNpc.AddComponent(new Movement(entityNpc, 1));
            entityList.Add(entityNpc);
            entityList.Add(entity);
            return(entityList);
        }
Exemplo n.º 14
0
 public LobbySort(IEventRunner ev, ILobby lobby, string captainA, string captainB) : base(ev, false)
 {
     _ev     = ev;
     _sorter = new SlotSorter(lobby, new string[] { captainA, captainB });
 }
Exemplo n.º 15
0
 public void OnLoad(ILobby lobby, IEventRunner eventRunner, IDiscordHandler discord, ISpreadsheet sheet, string scriptInputJson)
 {
     _scriptInput = Newtonsoft.Json.JsonConvert.DeserializeObject <ScriptInput>(scriptInputJson);
     _main        = new Main(lobby, eventRunner, discord, sheet, _scriptInput);
 }