Exemplo n.º 1
0
        public void Init(GameplayLevelScheduler level)
        {
            game_ = GameScheduler.instance;
            anim_ = AnimationManager.instance;

            scoreText.text         = "0";
            scoreAdditionText.text = "";
            comboText.text         = "";
            comboGroup.alpha       = 0;
            judgmentText.text      = "";
            accuracyText.text      = "";

            //flashControllers = new FlashController[laneCount];
            //for (int i = 0; i < laneCount; i++) {
            //	var flashController = Instantiate(flashPrefab, flashPageRect).GetComponent<FlashController>();
            //	flashController.rect.anchoredPosition = new Vector2(laneXDict[i], judgeHeight);
            //	flashController.rect.sizeDelta = new Vector2(blockWidth, 0);
            //	flashControllers[i] = flashController;
            //}

            shouldUploadTrial = 1 <= level.playbackSpeed && level.playbackSpeed <= 2;
#if UNITY_EDITOR
            shouldUploadTrial = true;
#endif
        }
Exemplo n.º 2
0
        public virtual void Init(GameplayLevelScheduler level)
        {
            this.level = level;

            if (loadCustomSkin)
            {
                string skinPath      = System.IO.Path.Combine(Application.persistentDataPath, CUSTOM_SKIN_ROOT_PATH, customSkinPath);
                float  pixelsPerUnit = LoadCustomSkin(skinPath, BLOCK_SHORT_FILENAME, BLOCK_SHORT);
                LoadCustomSkin(skinPath, BLOCK_SHORT_CONNECT_FILENAME, BLOCK_SHORT_CONNECT, pixelsPerUnit, true);
                LoadCustomSkin(skinPath, BLOCK_INSTANT_FILENAME, BLOCK_INSTANT, pixelsPerUnit);
                LoadCustomSkin(skinPath, BLOCK_INSTANT_INNER_FILENAME, BLOCK_INSTANT_INNER, pixelsPerUnit);
                LoadCustomSkin(skinPath, BLOCK_INSTANT_CONNECT_FILENAME, BLOCK_INSTANT_CONNECT, pixelsPerUnit, true);
                LoadCustomSkin(skinPath, BLOCK_LONG_START_FILENAME, BLOCK_LONG_START, pixelsPerUnit);
                LoadCustomSkin(skinPath, BLOCK_LONG_FILL_FILENAME, BLOCK_LONG_FILL, pixelsPerUnit, true);
                LoadCustomSkin(skinPath, BLOCK_LONG_END_FILENAME, BLOCK_LONG_END, pixelsPerUnit);
            }
            else
            {
                string[] skinNames = new string[] {
                    BLOCK_SHORT,
                    BLOCK_SHORT_CONNECT,
                    BLOCK_INSTANT,
                    BLOCK_INSTANT_INNER,
                    BLOCK_INSTANT_CONNECT,
                    BLOCK_LONG_START,
                    BLOCK_LONG_FILL,
                    BLOCK_LONG_END,
                };
                foreach (var name in skinNames)
                {
                    var prefab = Resources.Load <GameObject>(BUILTIN_SKIN_ROOT_PATH + "/" + skinPrefabPath + "/" + name);
                    LoadSkin(name, prefab ?? emptyBlock);
                }
            }

            var canvasSize = level.sizeWatcher.canvasSize;

            judgeRect.anchoredPosition = new Vector2(0, judgeHeight);
            judgeRect.sizeDelta        = new Vector2(0, judgeThickness);
            cacheHeight = canvasSize.y - judgeHeight;

            blockScaling = blockWidth / 100;
            float canvasWidth = canvasSize.x;

            float[] laneX       = new float[laneCount];
            float   laneStart   = blockWidth * .5f;
            float   laneSpacing = (canvasWidth - blockWidth) / (laneCount - 1);

            for (int i = 0; i < laneX.Length; i++)
            {
                laneX[i] = laneStart + i * laneSpacing;
            }
            generator.laneCount = laneCount;
            generator.laneX     = laneX;

            if (level.keyboardMode)
            {
                GenerateKeyboardHints();
            }

            cacheTicks = cacheBeats * level.midiFile.ticksPerBeat;
            graceTicks = graceBeats * level.midiFile.ticksPerBeat;

            blockJudgingHalfWidth = blockJudgingWidth * .5f;

            level.midiSequencer.ticks = -cacheTicks;

            blockInfos = generator.GenerateBlocks(level.gameSequences);
            level.backgroundSequences.Add(new NoteSequenceCollection.Sequence {
                notes = generator.backgroundNotes
            });
            blockInfoIndex = 0;
        }