Exemplo n.º 1
0
        static InputManager()
        {
            _input = new InputListenerManager();
            _events = new EventsContainer(_input);

            _handledKeys = new Dictionary<Keys, bool>();
            _handledMouseButtons = new Dictionary<MouseButton, bool>();
        }
Exemplo n.º 2
0
        static InputManager()
        {
            _input  = new InputListenerManager();
            _events = new EventsContainer(_input);

            _handledKeys         = new Dictionary <Keys, bool>();
            _handledMouseButtons = new Dictionary <MouseButton, bool>();
        }
Exemplo n.º 3
0
 public BeatmapActionParams(BeatmapActionContainer container)
 {
     notes      = container.notes;
     obstacles  = container.obstacles;
     events     = container.events;
     bpm        = container.bpm;
     selection  = container.selection;
     nodeEditor = container.nodeEditor;
 }
Exemplo n.º 4
0
        public CreateEventsPresenter(ICreateEvents view)
        {
            if (view == null)
            {
                throw new ArgumentNullException("view cannot be null");
            }

            eventsContainer = new EventsContainer();
            View            = view;
        }
Exemplo n.º 5
0
        public MockOfEventsModel()
        {
            contextEvents = Substitute.For <EventsContainer>(MockOfCompetitionEventsContainer.contextCompetitionEvents, MockOfAgeGroupTypesContainer.contextAgeGroupTypes);

            //Events
            var events = new List <Events>
            {
                new Events {
                    Id = 0, Title = "Begimas 1500m", Type = 1
                }
            };

            var mockEvents = Substitute.For <DbSet <Events>, IQueryable <Events> >();

            ((IQueryable <Events>)mockEvents).Provider.Returns(events.AsQueryable().Provider);
            ((IQueryable <Events>)mockEvents).Expression.Returns(events.AsQueryable().Expression);
            ((IQueryable <Events>)mockEvents).ElementType.Returns(events.AsQueryable().ElementType);
            ((IQueryable <Events>)mockEvents).GetEnumerator().Returns(events.AsQueryable().GetEnumerator());

            mockEvents.When(q => q.Add(Arg.Any <Events>()))
            .Do(q => events.Add(q.Arg <Events>()));

            mockEvents.When(q => q.Remove(Arg.Any <Events>()))
            .Do(q => events.Remove(q.Arg <Events>()));

            contextEvents.Events = mockEvents;

            //Age group events

            var ageGroupEvents = new List <AgeGroupEvents>
            {
                new AgeGroupEvents {
                    Id = 0, AgeGroupType = 1, EventId = 0
                }
            };

            var mockAgeGroupEvents = Substitute.For <DbSet <AgeGroupEvents>, IQueryable <AgeGroupEvents> >();

            ((IQueryable <AgeGroupEvents>)mockAgeGroupEvents).Provider.Returns(ageGroupEvents.AsQueryable().Provider);
            ((IQueryable <AgeGroupEvents>)mockAgeGroupEvents).Expression.Returns(ageGroupEvents.AsQueryable().Expression);
            ((IQueryable <AgeGroupEvents>)mockAgeGroupEvents).ElementType.Returns(ageGroupEvents.AsQueryable().ElementType);
            ((IQueryable <AgeGroupEvents>)mockAgeGroupEvents).GetEnumerator().Returns(ageGroupEvents.AsQueryable().GetEnumerator());

            mockAgeGroupEvents.When(q => q.Add(Arg.Any <AgeGroupEvents>()))
            .Do(q => ageGroupEvents.Add(q.Arg <AgeGroupEvents>()));

            mockAgeGroupEvents.When(q => q.Remove(Arg.Any <AgeGroupEvents>()))
            .Do(q => ageGroupEvents.Remove(q.Arg <AgeGroupEvents>()));

            contextEvents.AgeGroupEvents = mockAgeGroupEvents;
        }
Exemplo n.º 6
0
    // プリロードコンポネント
    static PreloadComponent()
    {
        // ゲームオブジェクトをプリロードシーンの中に探す
        GameObject g = SafeFind("_App");

        // ゲームオブジェクトのコンポネントの初期化
        events   = (EventsContainer)SafeComponent(g, "EventsContainer");
        gameOver = (GameOver)SafeComponent(g, "GameOver");
        resetPD  = (ResetPickablesData)SafeComponent(g, "ResetPickablesData");

        //  サウンドマネージャーを初期化する
        GameObject sound = SafeFind("SoundManager");

        // サウンドマネージャのコンポネントの初期化
        soundManager = (SoundManager)SafeComponent(sound, "SoundManager");
    }
Exemplo n.º 7
0
    /// <summary>
    /// Pastes any copied objects into the map, selecting them immediately.
    /// </summary>
    public void Paste(bool triggersAction = true)
    {
        DeselectAll();
        CopiedObjects = CopiedObjects.OrderBy((x) => x._time).ToList();
        List <BeatmapObjectContainer> pasted = new List <BeatmapObjectContainer>();

        foreach (BeatmapObject data in CopiedObjects)
        {
            if (data == null)
            {
                continue;
            }
            float newTime = data._time + atsc.CurrentBeat;
            BeatmapObjectContainer pastedContainer = null;
            if (data is BeatmapNote)
            {
                BeatmapObject newData = new BeatmapNote(data.ConvertToJSON());
                newData._time = newTime;
                NotesContainer notes = collections.Where(x => x is NotesContainer).FirstOrDefault() as NotesContainer;
                pastedContainer = notes?.SpawnObject(newData);
            }
            if (data is BeatmapObstacle)
            {
                BeatmapObject newData = new BeatmapObstacle(data.ConvertToJSON());
                newData._time = newTime;
                ObstaclesContainer obstacles = collections.Where(x => x is ObstaclesContainer).FirstOrDefault() as ObstaclesContainer;
                pastedContainer = obstacles?.SpawnObject(newData);
            }
            if (data is MapEvent)
            {
                BeatmapObject newData = new MapEvent(data.ConvertToJSON());
                newData._time = newTime;
                EventsContainer events = collections.Where(x => x is EventsContainer).FirstOrDefault() as EventsContainer;
                pastedContainer = events?.SpawnObject(newData);
            }
            pasted.Add(pastedContainer);
        }
        if (triggersAction)
        {
            BeatmapActionContainer.AddAction(new SelectionPastedAction(pasted, CopiedObjects, atsc.CurrentBeat));
        }
        SelectedObjects.AddRange(pasted);
        RefreshSelectionMaterial(false);
        RefreshMap();
        Debug.Log("Pasted!");
    }
        public StartCompetitionPresenter(IStartCompetition view)
        {
            AgeGroupTypesContainer = new AgeGroupTypesContainer();
            AgeGroupContainer      = new AgeGroupContainer();
            CompetitorsContainer   = new CompetitorsContainer();
            CompetitionContainer   = new CompetitionContainer();
            SubGroupsContainer     = new SubGroupsContainer();
            EventsContainer        = new EventsContainer();
            EventTypes             = new EventTypesContainer();
            ResultsContainer       = new ResultsContainer();
            CompetitionEvents      = new CompetitionEventsContainer();

            if (view == null)
            {
                throw new ArgumentNullException("View cannot be null");
            }

            View = view;
        }
Exemplo n.º 9
0
        void ReleaseDesignerOutlets()
        {
            if (EventsContainer != null)
            {
                EventsContainer.Dispose();
                EventsContainer = null;
            }

            if (PlayersContainer != null)
            {
                PlayersContainer.Dispose();
                PlayersContainer = null;
            }

            if (DetailsContainer != null)
            {
                DetailsContainer.Dispose();
                DetailsContainer = null;
            }
        }
Exemplo n.º 10
0
        public CreateEventsPresenter(CreateEventsViewMock view, EventsContainer context)
        {
            View = view;

            eventsContainer = context;
        }
Exemplo n.º 11
0
    public IEnumerator LoadObjects <T>(IEnumerable <T> objects) where T : BeatmapObject
    {
        if (!objects.Any())
        {
            yield break;
        }
        BeatmapObjectContainerCollection collection = BeatmapObjectContainerCollection.GetCollectionForType(objects.First().beatmapType);

        if (collection == null)
        {
            yield break;
        }
        foreach (BeatmapObject obj in collection.LoadedObjects.ToArray())
        {
            collection.DeleteObject(obj, false, false);
        }
        PersistentUI.Instance.LevelLoadSlider.gameObject.SetActive(true);
        collection.LoadedObjects   = new SortedSet <BeatmapObject>(objects, new BeatmapObjectComparer());
        collection.UnsortedObjects = collection.LoadedObjects.ToList();
        UpdateSlider <T>();
        if (typeof(T) == typeof(BeatmapNote) || typeof(T) == typeof(BeatmapObstacle))
        {
            for (int i = 0; i < objects.Count(); i++)
            {
                BeatmapObject data = objects.ElementAt(i);
                if (data is BeatmapNote noteData)
                {
                    if (noteData._lineIndex >= 1000 || noteData._lineIndex <= -1000 || noteData._lineLayer >= 1000 || noteData._lineLayer <= -1000)
                    {
                        continue;
                    }
                    if (2 - noteData._lineIndex > noteLaneSize)
                    {
                        noteLaneSize = 2 - noteData._lineIndex;
                    }
                    if (noteData._lineIndex - 1 > noteLaneSize)
                    {
                        noteLaneSize = noteData._lineIndex - 1;
                    }
                    if (noteData._lineLayer + 1 > noteLayerSize)
                    {
                        noteLayerSize = noteData._lineLayer + 1;
                    }
                }
                else if (data is BeatmapObstacle obstacleData)
                {
                    if (obstacleData._lineIndex >= 1000 || obstacleData._lineIndex <= -1000)
                    {
                        continue;
                    }
                    if (2 - obstacleData._lineIndex > noteLaneSize)
                    {
                        noteLaneSize = 2 - obstacleData._lineIndex;
                    }
                    if (obstacleData._lineIndex - 1 > noteLaneSize)
                    {
                        noteLaneSize = obstacleData._lineIndex - 1;
                    }
                }
            }
            if (Settings.NonPersistentSettings.ContainsKey("NoteLanes"))
            {
                Settings.NonPersistentSettings["NoteLanes"] = (noteLaneSize * 2).ToString();
            }
            else
            {
                Settings.NonPersistentSettings.Add("NoteLanes", (noteLaneSize * 2).ToString());
            }
            noteLanesController.UpdateNoteLanes((noteLaneSize * 2).ToString());
        }
        if (typeof(T) == typeof(MapEvent))
        {
            manager.RefreshTracks();
            EventsContainer events = collection as EventsContainer;
            events.AllRotationEvents = objects.Cast <MapEvent>().Where(x => x.IsRotationEvent).ToList();
            events.AllBoostEvents    = objects.Cast <MapEvent>().Where(x => x._type == MapEvent.EVENT_TYPE_BOOST_LIGHTS).ToList();
        }
        collection.RefreshPool(true);
    }
Exemplo n.º 12
0
 /// <summary>
 /// Converts the event.
 /// </summary>
 /// <param name="container">The container.</param>
 /// <param name="limit">The limit.</param>
 /// <returns></returns>
 public static FacebookEvent[] ConvertEvent(this EventsContainer container, int limit = 1)
 {
     return(container == null ? null : container.events.data.ConvertEvent().Take(limit).ToArray());
 }
Exemplo n.º 13
0
        private static async Task SendEventsFromCSVFile(string deviceId, string targetSite, string fileDataPath, string fieldDefinitionsPath)
        {
            try
            {
                EventsContainer events = null;

                if (fieldDefinitionsPath.Length > 0)
                {
                    events = new EventsContainer(fieldDefinitionsPath);
                }
                else
                {
                    events = new EventsContainer(fileDataPath);
                }

                if (events.EventsFlag)
                {
                    NameValueCollection keyFields = new NameValueCollection();

                    if (deviceId.Length != 0)
                    {
                        keyFields.Add(Names.EventKeyFieldDeviceId, deviceId);
                        keyFields.Add(Names.EventKeyFieldTargetSite, targetSite);
                    }

                    bool continueProcess = events.ReplayFlag;

                    if (continueProcess)
                    {
                        Console.WriteLine("Press Any Key to Halt Replay Process");
                    }

                    int iterationsCount = 0;
                    do
                    {
                        List <Task> tasks = new List <Task>(devices.Count());
                        foreach (string[] messageValues in events.GetValuesList())
                        {
                            List <object> dataEvents = new List <object>();

                            dataEvents.Add(events.GetEventMessageForValues(messageValues));

                            if (deviceId.Length == 0)
                            {
                                keyFields = events.GetKeyFields(messageValues);
                            }

                            int waitPeriod = 0;
                            if (int.TryParse(messageValues[0], out waitPeriod))
                            {
                                Thread.Sleep(waitPeriod);
                            }

                            tasks.Add(IoTHubClient.SendMessageToIoTHubAsync(connectionString, devices, keyFields, dataEvents));
                        }

                        await Task.WhenAll(tasks);

                        await Task.Delay(TimeSpan.FromSeconds(1));

                        if (events.ReplayFlag)
                        {
                            Console.WriteLine("  Finished Iteration {0}", ++iterationsCount);
                        }

                        if (Console.KeyAvailable)
                        {
                            continueProcess = false;
                        }
                    } while (continueProcess);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Send failed. {0}", ex.Message);
            }
        }
Exemplo n.º 14
0
 /// <summary>
 /// Set the reference for the Input container
 /// </summary>
 /// <param name="_eventsContainer"></param>
 public void SetEventsContainer(EventsContainer _eventsContainer)
 {
     I.eventsContainer = _eventsContainer;
 }