コード例 #1
0
        public void CreateObjects(IChartParser parser)
        {
            List <ScenecontrolObject> objsList = new List <ScenecontrolObject>();

            foreach (var spr in parser.SpriteScenecontrolData)
            {
                var newGameObject      = Instantiate(spriteObjectPrefab);
                var scenecontrolObject = newGameObject.GetComponent <SpriteScenecontrolObject>();

                scenecontrolObject.data       = spr.Item1;
                scenecontrolObject.spriteData = spr.Item2;

                objsList.Add(scenecontrolObject);
            }

            foreach (var txt in parser.TextScenecontrolData)
            {
                var newGameObject      = Instantiate(textObjectPrefab);
                var scenecontrolObject = newGameObject.GetComponent <TextScenecontrolObject>();

                scenecontrolObject.data     = txt.Item1;
                scenecontrolObject.textData = txt.Item2;

                objsList.Add(scenecontrolObject);
            }

            objs = objsList.ToArray();
        }
コード例 #2
0
        public void CreateEntitiesAndGetData(
            IChartParser parser,
            out List <RenderMesh> initial,
            out List <RenderMesh> highlight,
            out List <RenderMesh> grayout,
            out List <RenderMesh> head,
            out List <RenderMesh> height,
            out RenderMesh shadow,
            out RenderMesh shadowGrayout,
            out int arcGroupCount)
        {
            //SETUP MATERIALS
            initial   = new List <RenderMesh>();
            highlight = new List <RenderMesh>();
            grayout   = new List <RenderMesh>();
            head      = new List <RenderMesh>();
            height    = new List <RenderMesh>();

            for (int i = 0; i <= parser.MaxArcColor; i++)
            {
                Material arcColorMaterialInstance             = Object.Instantiate(arcMaterial);
                Material heightIndicatorColorMaterialInstance = Object.Instantiate(heightMaterial);

                arcColorMaterialInstance.SetColor(colorShaderId, Settings.GetArcColor(i));
                heightIndicatorColorMaterialInstance.SetColor(colorShaderId, Settings.GetArcColor(i));

                Material highlightMat = Object.Instantiate(arcColorMaterialInstance);
                Material grayoutMat   = Object.Instantiate(arcColorMaterialInstance);

                highlightMat.SetFloat(highlightShaderId, 1);
                grayoutMat.SetFloat(highlightShaderId, -1);

                initial.Add(new RenderMesh {
                    mesh = arcMesh, material = arcColorMaterialInstance
                });
                highlight.Add(new RenderMesh {
                    mesh = arcMesh, material = highlightMat
                });
                grayout.Add(new RenderMesh {
                    mesh = arcMesh, material = grayoutMat
                });
                head.Add(new RenderMesh {
                    mesh = headMesh, material = arcColorMaterialInstance
                });
                height.Add(new RenderMesh {
                    mesh = heightMesh, material = heightIndicatorColorMaterialInstance
                });
            }

            shadow        = shadowRenderMesh;
            shadowGrayout = shadowGrayoutRenderMesh;

            arcGroupCount = CreateArclike(parser.Arcs);
        }
コード例 #3
0
ファイル: Extractor.cs プロジェクト: lepeap/TxTraktor
 public Extractor(ITokenizer tokenizer,
                  IMorphAnalizer morphAnalizer,
                  IChartParser parser,
                  ExtractorSettings settings,
                  ILogger <IExtractor> logger)
 {
     _tokenizer     = tokenizer;
     _morphAnalizer = morphAnalizer;
     _parser        = parser;
     _settings      = settings;
     _logger        = logger;
 }
コード例 #4
0
        public void CreateEntities(IChartParser parser)
        {
            var holds = parser.Holds;

            holds.Sort((item1, item2) => { return(item1.timing.CompareTo(item2.timing)); });

            foreach (HoldRaw hold in holds)
            {
                //Main entity
                Entity holdEntity = em.Instantiate(holdNoteEntityPrefab);

                float       x = Conversion.TrackToX(hold.track);
                const float y = 0;
                const float z = 0;

                const float scalex = 1;
                const float scaley = 1;

                float endFloorPosition   = PlayManager.Conductor.GetFloorPositionFromTiming(hold.endTiming, hold.timingGroup);
                float startFloorPosition = PlayManager.Conductor.GetFloorPositionFromTiming(hold.timing, hold.timingGroup);
                float scalez             = -endFloorPosition + startFloorPosition;

                int t1         = PlayManager.Conductor.GetFirstTimingFromFloorPosition(startFloorPosition + Constants.RenderFloorPositionRange, 0);
                int t2         = PlayManager.Conductor.GetFirstTimingFromFloorPosition(endFloorPosition - Constants.RenderFloorPositionRange, 0);
                int appearTime = (t1 < t2) ? t1 : t2;

                em.SetComponentData(holdEntity, new Translation()
                {
                    Value = new float3(x, y, z)
                });
                em.AddComponentData(holdEntity, new NonUniformScale()
                {
                    Value = new float3(scalex, scaley, scalez)
                });
                em.SetComponentData(holdEntity, new BaseLength(scalez));
                em.SetComponentData(holdEntity, new FloorPosition(startFloorPosition));
                em.SetComponentData(holdEntity, new TimingGroup(hold.timingGroup));
                em.SetComponentData(holdEntity, new ChartTime {
                    value = hold.timing
                });
                em.SetComponentData(holdEntity, new ChartLane(hold.track));
                em.SetComponentData(holdEntity, new AppearTime(appearTime));
                em.SetComponentData(holdEntity, new DestroyOnTiming(hold.endTiming + Constants.FarWindow));

                float startBpm = PlayManager.Conductor.GetTimingEventFromTiming(hold.timing, hold.timingGroup).bpm;
                em.SetComponentData(holdEntity, ChartIncrTime.FromBpm(hold.timing, hold.endTiming, startBpm, out int comboCount));

                PlayManager.ScoreHandler.tracker.noteCount += comboCount;
            }
        }
コード例 #5
0
        public void CreateEntities(IChartParser parser)
        {
            var taps    = parser.Taps;
            var arctaps = parser.Arctaps;

            taps.Sort((item1, item2) => { return(item1.timing.CompareTo(item2.timing)); });
            arctaps.Sort((item1, item2) => { return(item1.timing.CompareTo(item2.timing)); });

            int tapCount    = taps.Count;
            int arcTapCount = arctaps.Count;
            int tapIndex    = 0;
            int arcTapIndex = 0;

            while (tapIndex < tapCount && arcTapIndex < arcTapCount)
            {
                TapRaw    tap    = taps[tapIndex];
                ArctapRaw arctap = arctaps[arcTapIndex];

                if (tap.timing == arctap.timing)
                {
                    Entity tapEntity    = CreateTapEntity(tap);
                    Entity arctapEntity = CreateArcTapEntity(arctap);
                    CreateConnection(tap, arctap, tapEntity, arctapEntity);

                    tapIndex++;
                    arcTapIndex++;
                }
                else if (tap.timing < arctap.timing)
                {
                    CreateTapEntity(tap);
                    tapIndex++;
                }
                else
                {
                    CreateArcTapEntity(arctap);
                    arcTapIndex++;
                }
            }

            while (tapIndex < tapCount)
            {
                CreateTapEntity(taps[tapIndex++]);
            }

            while (arcTapIndex < arcTapCount)
            {
                CreateArcTapEntity(arctaps[arcTapIndex++]);
            }
        }
コード例 #6
0
ファイル: Conductor.cs プロジェクト: 0thElement/ArcCore
        /// <summary>
        /// Create timing event groups to track timing events given raw aff timing components.
        /// </summary>
        /// <param name="timingGroups">The raw aff timing components.</param>
        public void SetupTimingGroups(IChartParser parser)
        {
            var timingGroups = parser.Timings;

            timingEventGroups    = new TimingEvent[timingGroups.Count][];
            currentFloorPosition = new NativeArray <float>(new float[timingGroups.Count], Allocator.Persistent);

            for (int i = 0; i < timingGroups.Count; i++)
            {
                SetupTimingGroup(timingGroups, i);
            }

            groupIndexCache = new int[timingEventGroups.Length];
            CalculateScrollSpeed();
        }
コード例 #7
0
 public void CreateEntities(IChartParser parser)
 {
     CreateArclike(parser.Traces);
 }
コード例 #8
0
        public async System.Threading.Tasks.Task <AbstractChartDto> BuildChart(string p_chartUrl, List <KeyValuePair <string, string> > p_chartHeaders, IChartParser p_chartParser)
        {
            AbstractChartDto retChart = new ChartDto();


            if (p_chartUrl == null || p_chartUrl == "")
            {
                throw (new ArgumentException("Missing chart url"));
            }

            if (p_chartHeaders == null)
            {
                throw (new ArgumentException("Missing chart request headers"));
            }

            if (p_chartParser == null)
            {
                throw (new ArgumentException("Missing chart parser"));
            }



            using (var client = new HttpClient())
            {
                try
                {
                    foreach (var item in p_chartHeaders)
                    {
                        client.DefaultRequestHeaders.Add(item.Key, item.Value);
                    }


                    var response = await client.GetAsync(p_chartUrl);

                    response.EnsureSuccessStatusCode();


                    var stringResponse = await response.Content.ReadAsStringAsync();


                    if (p_chartParser.AnalyzeRawChartData(stringResponse))
                    {
                        retChart = p_chartParser.ParseChart(stringResponse);
                    }



                    //link chart with youtube ids
                    foreach (var item in retChart.SongsList)
                    {
                        //loop and assign youtube ids
                        item.YouTubeId = await _youtubeSearch.SearchFirstByKeyword(item.Artist + "-" + item.Name);

                        Task.Delay(100);
                    }



                    if (retChart.SongNum > 0)
                    {
                        //save chart to data storage
                        _dbChartManager.Add(retChart);
                    }
                }
                catch (HttpRequestException ex)
                {
                    // record error to log
                }
            }

            return(retChart);
        }
コード例 #9
0
        public async System.Threading.Tasks.Task <AbstractChartDto> BuildChart(string p_chartUrl, string p_post_data, List <KeyValuePair <string, string> > p_chartHeaders, IChartParser p_chartParser)
        {
            AbstractChartDto retChart = new ChartDto();

            if (p_chartUrl == null || p_chartUrl == "")
            {
                throw (new ArgumentException("Missing chart url"));
            }

            if (p_chartHeaders == null)
            {
                throw (new ArgumentException("Missing chart request headers"));
            }

            if (p_chartParser == null)
            {
                throw (new ArgumentException("Missing chart parser"));
            }



            using (var client = new HttpClient())
            {
                try
                {
                    foreach (var item in p_chartHeaders)
                    {
                        client.DefaultRequestHeaders.Add(item.Key, item.Value);
                    }
                    client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));


                    var stringContent = new StringContent(p_post_data);

                    var response = await client.PostAsync(p_chartUrl, stringContent);

                    response.EnsureSuccessStatusCode();


                    var stringResponse = await response.Content.ReadAsStringAsync();


                    if (p_chartParser.AnalyzeRawChartData(stringResponse))
                    {
                        retChart = p_chartParser.ParseChart(stringResponse);
                    }


                    if (retChart.SongNum > 0)
                    {
                        // save chart to data storage
                        _dbChartManager.Add(retChart);
                    }
                }
                catch (HttpRequestException ex)
                {
                    // record error to log
                }
            }

            return(retChart);
        }
コード例 #10
0
 public void CreateEntitiesAndGetMeshes(IChartParser parser, out RenderMesh highlight, out RenderMesh grayout, out RenderMesh initial)
 {
     GetRenderMeshes(out highlight, out grayout, out initial);
     CreateEntities(parser);
 }
コード例 #11
0
        public void CreateEntities(IChartParser parser)
        {
            var timings = parser.Timings[0];

            timings.Sort((item1, item2) => { return(item1.timing.CompareTo(item2.timing)); });

            //Extending the first event to before the song's starting point
            {
                TimingRaw firstTiming = timings[0];
                float     start       = -3000 - PlayManager.Conductor.FullOffset;

                float distanceBetweenTwoLine = firstTiming.bpm == 0 ? float.MaxValue :
                                               60000f / math.abs(firstTiming.bpm) * firstTiming.divisor;

                if (distanceBetweenTwoLine != 0)
                {
                    for (float timing = start; timing < 0; timing += distanceBetweenTwoLine)
                    {
                        CreateLineAt(firstTiming, timing);
                    }
                }
            }

            for (int i = 0; i < timings.Count - 1; i++)
            {
                TimingRaw currentTiming = timings[i];
                int       limit         = timings[i + 1].timing;

                float distanceBetweenTwoLine = currentTiming.bpm == 0 ? float.MaxValue :
                                               60000f / math.abs(currentTiming.bpm) * currentTiming.divisor;

                if (distanceBetweenTwoLine == 0)
                {
                    continue;
                }

                for (float timing = currentTiming.timing; timing < limit; timing += distanceBetweenTwoLine)
                {
                    CreateLineAt(currentTiming, timing);
                }
            }

            //Last timing event
            {
                TimingRaw lastTiming = timings[timings.Count - 1];
                uint      limit      = PlayManager.Conductor.songLength;

                float distanceBetweenTwoLine = lastTiming.bpm == 0 ? float.MaxValue :
                                               60000f / math.abs(lastTiming.bpm) * lastTiming.divisor;

                if (distanceBetweenTwoLine == 0)
                {
                    return;
                }

                for (float timing = lastTiming.timing; timing < limit; timing += distanceBetweenTwoLine)
                {
                    CreateLineAt(lastTiming, timing);
                }
            }
        }