コード例 #1
0
ファイル: Finder.cs プロジェクト: kaisadilla/D-Tector-v2
 private int result = 0; //0: nothing, 1: loading, 2: failure, 3: succeed.
 private void StartLoadingBar()
 {
     result           = 1;
     rbBlackScreen    = ScreenElement.BuildRectangle("BlackScreen0", Parent).SetSize(32, 32);
     sbLoading        = ScreenElement.BuildSprite("Loading", Parent).SetSprite(gm.spriteDB.loading).PlaceOutside(Direction.Up);
     loadingCoroutine = StartCoroutine(AnimateLoadingBar());
 }
コード例 #2
0
ファイル: SpeedRunner.cs プロジェクト: kaisadilla/D-Tector-v2
        public override void StartApp()
        {
            GenerateLevel();
            Sprite sRocket    = gm.spriteDB.speedRunner_rocket;
            Sprite sSpeedMark = gm.spriteDB.speedRunner_rocketSpeedMark;
            Sprite sAsteroid  = gm.spriteDB.speedRunner_rocketAsteroid;
            Sprite sExplosion = gm.spriteDB.speedRunner_rocketExplosion;
            Sprite sFinish    = gm.spriteDB.speedRunner_rocketFinish;

            ScreenElement.BuildRectangle("Line", Parent).SetSize(1, 32).SetPosition(6, 0);
            rocket = ScreenElement.BuildSprite("Rocket", Parent).SetSize(8, 8).SetPosition(15, 32).SetSprite(sRocket);
            StartCoroutine(IASpawnRocket());

            for (int i = 0; i < visualRows.Length; i++)
            {
                visualRows[i] = ScreenElement.BuildContainer($"Row{i}", Parent).SetSize(24, 6).SetPosition(7, -6);
                for (int j = 0; j < 3; j++)
                {
                    ScreenElement.BuildSprite($"Asteroid{j}", visualRows[i].transform).SetSize(7, 6).SetPosition(j * 8, 0).SetSprite(sAsteroid);
                }
            }
            finishRow = ScreenElement.BuildContainer($"FinishRow", Parent).SetSize(25, 32).SetPosition(7, -32);
            for (int i = 0; i < 2; i++)
            {
                ScreenElement.BuildSprite($"FinishLine{i}", finishRow.transform).SetSize(6, 32).SetPosition(1 + (i * 17), 0).SetSprite(sFinish);
            }
            for (int i = 0; i < speedMarks.Length; i++)
            {
                speedMarks[i] = ScreenElement.BuildSprite($"SpeedMark{i}", Parent).SetSize(3, 5).SetPosition(2, 26 - (i * 6)).SetSprite(sSpeedMark);
                speedMarks[i].SetActive(false);
            }
            InvokeRepeating("CustomUpdate", 0f, THIS_DELTA_TIME);
        }
コード例 #3
0
ファイル: Map.cs プロジェクト: kaisadilla/D-Tector-v2
        private void OpenViewDistance()
        {
            currentScreen = 2;
            //If the area chosen is the area the player is already in, the distance will not change. Otherwise, get the distance for the new area.

            int areaDist = (SelectedArea == originalArea) ? gm.WorldMgr.CurrentDistance : thisWorldData.areas[SelectedArea].distance;

            distanceScreen = ScreenElement.BuildSprite("DistanceScreen", screenDisplay.transform).SetSprite(gm.spriteDB.map_distanceScreen);
            ScreenElement.BuildTextBox("Distance", distanceScreen.transform, DFont.Regular)
            .SetText(areaDist.ToString()).SetSize(25, 5).SetPosition(6, 25).SetAlignment(TextAnchor.UpperRight);
        }
コード例 #4
0
ファイル: JackpotBox.cs プロジェクト: kaisadilla/D-Tector-v2
        private IEnumerator PADisplayPattern()
        {
            gm.LockInput();

            keypad  = ScreenElement.BuildSprite("Keypad", Parent).SetSize(24, 24).Center().SetSprite(gm.spriteDB.jackpot_pad);
            keys[0] = ScreenElement.BuildSprite("Key Left", Parent).SetSize(8, 12).SetPosition(4, 10)
                      .SetSprite(gm.spriteDB.jackpot_keys[0]).SetTransparent(true).SetActive(false);
            keys[1] = ScreenElement.BuildSprite("Key Right", Parent).SetSize(8, 12).SetPosition(20, 10)
                      .SetSprite(gm.spriteDB.jackpot_keys[1]).SetTransparent(true).SetActive(false);
            keys[2] = ScreenElement.BuildSprite("Key Up", Parent).SetSize(12, 8).SetPosition(10, 4)
                      .SetSprite(gm.spriteDB.jackpot_keys[2]).SetTransparent(true).SetActive(false);
            keys[3] = ScreenElement.BuildSprite("Key Down", Parent).SetSize(12, 8).SetPosition(10, 20)
                      .SetSprite(gm.spriteDB.jackpot_keys[3]).SetTransparent(true).SetActive(false);

            SpriteBuilder hourglass = ScreenElement.BuildSprite("Hourglass", Parent).SetSprite(gm.spriteDB.hourglass);

            yield return(new WaitForSeconds(0.75f));

            hourglass.Dispose();

            for (int i = 0; i < pattern.Length; i++)
            {
                audioMgr.PlaySound(audioMgr.beepLow);
                keys[pattern[i]].SetActive(true);
                yield return(new WaitForSeconds(delay));

                keys[pattern[i]].SetActive(false);
            }

            //Black screen:
            RectangleBuilder rbBlackScreen = ScreenElement.BuildRectangle("BlackScreen0", Parent).SetSize(32, 32);
            SpriteBuilder    sbLoading     = ScreenElement.BuildSprite("Loading", Parent).SetSprite(gm.spriteDB.loading).PlaceOutside(Direction.Up);

            for (int i = 0; i < 64; i++)
            {
                sbLoading.Move(Direction.Down);
                yield return(new WaitForSeconds((delay * 2f) / 64));
            }
            rbBlackScreen.Dispose();
            sbLoading.Dispose();

            //Ready the player:
            keypad.Move(Direction.Down, 4);
            keys.Move(Direction.Down, 4);
            tbTime = ScreenElement.BuildTextBox("Time", screenDisplay.transform, DFont.Small)
                     .SetText("TIME").SetSize(18, 5).SetPosition(1, 1);
            tbTimeCount = ScreenElement.BuildTextBox("TimeCount", screenDisplay.transform, DFont.Small)
                          .SetText(timeRemaining.ToString()).SetSize(10, 5).SetPosition(22, 1);
            StartCoroutine(TimeCount());

            gm.UnlockInput();
        }
コード例 #5
0
ファイル: Finder.cs プロジェクト: kaisadilla/D-Tector-v2
        private IEnumerator AnimateSuccessBar()
        {
            SpriteBuilder sbSuccessBar = ScreenElement.BuildSprite("LoadingSuccessful", Parent)
                                         .SetSize(32, 82)
                                         .SetSprite(gm.spriteDB.loadingComplete)
                                         .PlaceOutside(Direction.Up);

            for (int i = 0; i < 82 + 32; i++)
            {
                sbSuccessBar.Move(Direction.Down);
                yield return(new WaitForSeconds(1.75f / 64));
            }
            CloseApp();
            if (controller is LogicManager logicMgr)
            {
                logicMgr.CallRandomBattle(true);
            }
        }
コード例 #6
0
ファイル: DigiHunter.cs プロジェクト: kaisadilla/D-Tector-v2
        public override void StartApp()
        {
            gm.EnqueueAnimation(Animations.StartAppDigiHunter(mark => gameStarted = mark));

            ScreenElement.BuildTextBox("Time", screenDisplay.transform, DFont.Small).SetText("TIME").SetSize(18, 5).SetPosition(1, 0);
            tbTime = ScreenElement.BuildTextBox("TimeCount", screenDisplay.transform, DFont.Small).SetText(timeRemaining.ToString()).SetSize(10, 5).SetPosition(22, 0);

            sbArrows[0] = ScreenElement.BuildSprite("Y-Arrow", Parent).SetSize(3, 6).SetPosition(2, 9).SetSprite(gm.spriteDB.digiHunter_arrows[0]);
            sbArrows[1] = ScreenElement.BuildSprite("X-Arrow", Parent).SetSize(6, 3).SetPosition(6, 5).SetSprite(gm.spriteDB.digiHunter_arrows[1]);
            for (int y = 0; y < sbFaces.GetLength(0); y++)
            {
                for (int x = 0; x < sbFaces.GetLength(1); x++)
                {
                    sbFaces[y, x] = ScreenElement.BuildSprite("Face", Parent).SetSize(8, 8).SetPosition(5 + (x * 8), 8 + (y * 8)).SetSprite(gm.spriteDB.emptySprite);
                }
            }

            gm.StartCoroutine(CountDown());
            gm.StartCoroutine(GenerateFaces());
        }
コード例 #7
0
ファイル: Finder.cs プロジェクト: kaisadilla/D-Tector-v2
        private IEnumerator AnimateLoadingBar()
        {
            sbHourglass = ScreenElement.BuildSprite("Hourglass", Parent).SetSprite(gm.spriteDB.hourglass);
            yield return(new WaitForSeconds(0.5f));

            sbHourglass.Dispose();

            while (result == 1)
            {
                if (tries == 5)
                {
                    result = 2;
                    break;
                }
                int thisRoundRNG = Random.Range(0, 10);
                VisualDebug.WriteLine($"RNG: {thisRoundRNG}");
                if (thisRoundRNG == 0)
                {
                    result = 3;
                    break;
                }

                sbLoading.PlaceOutside(Direction.Up);
                for (int i = 0; i < 64; i++)
                {
                    sbLoading.Move(Direction.Down);
                    yield return(new WaitForSeconds(1.75f / 64));
                }
                tries++;
            }
            if (result == 2)
            {
                SetScreen(gm.spriteDB.error);
                rbBlackScreen.Dispose();
                sbLoading.Dispose();
            }
            else if (result == 3)
            {
                StartCoroutine(AnimateSuccessBar());
            }
        }
コード例 #8
0
ファイル: Camp.cs プロジェクト: kaisadilla/D-Tector-v2
 public override void StartApp()
 {
     gm.EnqueueAnimation(Animations.OpenCamp(PlayerSprites));
     sbCamp   = ScreenElement.BuildSprite("Camp", Parent).SetSize(24, 24).Center().SetSprite(gm.spriteDB.camp[0]);
     animCamp = StartCoroutine(PAnimateCamp());
 }
コード例 #9
0
ファイル: DatabaseApp.cs プロジェクト: kaisadilla/D-Tector-v2
        private void DrawScreen()
        {
            //Stop all coroutines, except if the digimon name sign has a value and we are still in the 'Pages' screen.
            if (!(digimonNameSign != null && currentScreen == ScreenDatabase.Pages))
            {
                if (screenAnimation != null)
                {
                    StopCoroutine(screenAnimation);
                }
            }
            //Destroy all children, except the ones called 'NameSign' if we are in the 'Pages' screen.
            foreach (Transform child in screenDisplay.transform)
            {
                if (!(currentScreen == ScreenDatabase.Pages && child.name == "NameSign"))
                {
                    Destroy(child.gameObject);
                }
            }

            if (currentScreen == ScreenDatabase.Menu)
            {
                screenDisplay.sprite = gm.spriteDB.database_sections[menuIndex];
            }
            else if (currentScreen == ScreenDatabase.Menu_Spirit)
            {
                if (SelectedElement < 10)
                {
                    screenDisplay.sprite = gm.spriteDB.elements[SelectedElement];
                }
                else
                {
                    screenDisplay.sprite = gm.spriteDB.database_spirit_fusion;
                }
            }
            else if (currentScreen == ScreenDatabase.Gallery)
            {
                string displayDigimon = galleryList[galleryIndex];
                digimonIsInDDock     = gm.IsInDock(displayDigimon);
                screenDisplay.sprite = (digimonIsInDDock) ? gm.spriteDB.invertedArrowsSmall : gm.spriteDB.arrowsSmall;

                Sprite spriteRegular = gm.spriteDB.GetDigimonSprite(displayDigimon, SpriteAction.Default);
                Sprite spriteAlt     = gm.spriteDB.GetDigimonSprite(displayDigimon, SpriteAction.Attack);

                if (digimonIsInDDock)
                {
                    spriteRegular = gm.spriteDB.GetInvertedSprite(spriteRegular);
                    spriteAlt     = gm.spriteDB.GetInvertedSprite(spriteAlt);
                }

                SpriteBuilder builder = ScreenElement.BuildSprite("DigimonDisplay", screenDisplay.transform).SetSize(24, 24).Center().SetSprite(spriteRegular);

                screenAnimation = StartCoroutine(AnimateSprite(builder, spriteRegular, spriteAlt));
            }
            else if (currentScreen == ScreenDatabase.Pages)
            {
                if (digimonNameSign == null)
                {
                    string         name        = string.Format("{0:000} {1}", pageDigimon.number, pageDigimon.name);
                    TextBoxBuilder nameBuilder = ScreenElement.BuildTextBox("NameSign", screenDisplay.transform, DFont.Big).SetText(name).SetSize(32, 7).SetPosition(32, 0);
                    nameBuilder.SetFitSizeToContent(true);
                    digimonNameSign = nameBuilder.gameObject;
                    screenAnimation = StartCoroutine(AnimateName(nameBuilder));
                }

                int playerLevel       = gm.logicMgr.GetPlayerLevel();
                int digimonExtraLevel = gm.logicMgr.GetDigimonExtraLevel(pageDigimon.name);
                int realLevel;

                MutableCombatStats stats;
                //If the Digimon is Spirit- or Armor-Stage.
                if (menuIndex == 5 || menuIndex == 6)
                {
                    realLevel = pageDigimon.GetBossLevel(playerLevel);
                    stats     = pageDigimon.GetBossStats(playerLevel);
                }
                else
                {
                    realLevel = pageDigimon.GetFriendlyLevel(digimonExtraLevel);
                    stats     = pageDigimon.GetFriendlyStats(digimonExtraLevel);
                }


                int element = (int)pageDigimon.element;

                if (pageIndex == 0)
                {
                    screenDisplay.sprite = gm.spriteDB.database_pages[0];
                    ScreenElement.BuildTextBox("Level", screenDisplay.transform, DFont.Regular)
                    .SetText(realLevel.ToString()).SetSize(15, 5).SetPosition(16, 9).SetAlignment(TextAnchor.UpperRight);
                    ScreenElement.BuildTextBox("HP", screenDisplay.transform, DFont.Regular)
                    .SetText(stats.HP.ToString()).SetSize(15, 5).SetPosition(16, 17).SetAlignment(TextAnchor.UpperRight);
                    ScreenElement.BuildSprite("Element", screenDisplay.transform).SetSize(30, 5).SetPosition(1, 25).SetSprite(gm.spriteDB.elementNames[element]);
                }
                else if (pageIndex == 1)
                {
                    screenDisplay.sprite = gm.spriteDB.database_pages[1];
                    ScreenElement.BuildTextBox("Energy", screenDisplay.transform, DFont.Regular)
                    .SetText(stats.EN.ToString()).SetSize(15, 5).SetPosition(16, 9).SetAlignment(TextAnchor.UpperRight);
                    ScreenElement.BuildTextBox("Crush", screenDisplay.transform, DFont.Regular)
                    .SetText(stats.CR.ToString()).SetSize(15, 5).SetPosition(16, 17).SetAlignment(TextAnchor.UpperRight);
                    ScreenElement.BuildTextBox("Ability", screenDisplay.transform, DFont.Regular)
                    .SetText(stats.AB.ToString()).SetSize(15, 5).SetPosition(16, 25).SetAlignment(TextAnchor.UpperRight);
                }
                else if (pageIndex == 2)
                {
                    screenDisplay.sprite = gm.spriteDB.database_pages[2];
                    ScreenElement.BuildTextBox("Code", screenDisplay.transform, DFont.Big)
                    .SetText(pageDigimon.code).SetSize(30, 8).SetPosition(2, 23).SetAlignment(TextAnchor.UpperRight);
                }
            }
            else if (currentScreen == ScreenDatabase.DDockList)
            {
                screenDisplay.sprite = gm.spriteDB.database_ddocks[ddockIndex];
            }
            else if (currentScreen == ScreenDatabase.DDockDisplay)
            {
                screenDisplay.sprite = gm.spriteDB.status_ddock[ddockIndex];
                gm.GetDDockScreenElement(ddockIndex, screenDisplay.transform);
            }
        }