Exemplo n.º 1
0
    public void Update()
    {
        if (--applauseTimer == 0)
        {
            PD.sounds.SetSoundAndPlay(SoundPaths.S_Applause + Random.Range(1, 7).ToString());
        }
        if (isOnline)
        {
            UpdateOnline();
            return;
        }
        if (PD.controller.G_Launch() || PD.controller.Pause() || clicker.isDown())
        {
            PD.sounds.SetSoundVolume(PD.GetSaveData().savedOptions["vol_s"] / 150.0f);
            if (PD.gameType == PersistData.GT.Versus)
            {
                PD.ChangeScreen(PersistData.GS.CharSel);
            }
            else
            {
                PD.ChangeScreen(PersistData.GS.HighScore);
            }
        }
        int pCount = particles.GetParticles(pars);

        for (int i = 0; i < pCount; i++)
        {
            if (Mathf.Abs(pars[i].startLifetime - pars[i].lifetime) < 0.05f)
            {
                pars[i].color = new Color(Random.Range(0.0f, 1.0f), Random.Range(0.0f, 1.0f), Random.Range(0.0f, 1.0f), 1.0f);
                pars[i].size *= Random.Range(0.8f, 1.2f);
            }
        }
        particles.SetParticles(pars, pCount);
    }
Exemplo n.º 2
0
    private void ResetOptions(bool andGraphics = true)
    {
        resolutions       = new Vector2[] { new Vector2(1280, 720), new Vector2(1600, 900), new Vector2(1920, 1080) };
        currentResolution = new Vector2(Screen.width, Screen.height);
        resIdx            = -1;
        for (int i = 0; i < resolutions.Length; i++)
        {
            if (resolutions[i].x == currentResolution.x && resolutions[i].y == currentResolution.y)
            {
                resIdx = i; break;
            }
        }
        if (resIdx < 0)
        {
            resIdx = 0; currentResolution = resolutions[0];
        }
        isFullScreen = Screen.fullScreen;
        SaveData sd = PD.GetSaveData();

        volume_music = sd.savedOptions["vol_m"];
        PD.sounds.SetMusicVolume(volume_music / 100.0f);
        volume_sound = sd.savedOptions["vol_s"];
        PD.sounds.SetSoundVolume(volume_sound / 100.0f);
        volume_voice = sd.savedOptions["vol_v"];
        PD.sounds.SetVoiceVolume(volume_voice / 100.0f);

        if (andGraphics)
        {
            optionsScreen.SetResText(resolutions[resIdx]);
            optionsScreen.SetVMuText(volume_music);
            optionsScreen.SetVSoText(volume_sound);
            optionsScreen.SetVVoText(volume_voice);
            optionsScreen.SetFlsText(isFullScreen);
        }
    }
Exemplo n.º 3
0
    public void Start()
    {
        StateControllerInit();
        PD.sounds.SetVoiceAndPlay(SoundPaths.NarratorPath + "022", 0);
        p1_delay = 0; p2_delay = 0; p1eggState = 0;
        conf1    = false; conf1options = false; conf2 = true;
        int    completionPercent = PD.GetSaveData().CalculateGameCompletionPercent();
        string spPath = SpritePaths.CharSelSheet, crPath = SpritePaths.CharSelCursors;
        int    crNum = 10; dX = 0.71f; initX = -3.2f;

        if (completionPercent == 100)
        {
            spPath = SpritePaths.CharSelSheetAll;
            crPath = SpritePaths.CharSelCursorsAll;
            crNum  = 12;
            initX  = -3.25f;
            dX     = 0.591f;
        }
        else if (completionPercent >= 50)
        {
            spPath = SpritePaths.CharSelSheetWhite;
            crPath = SpritePaths.CharSelCursorsWhite;
            crNum  = 11;
            initX  = -3.21f;
            dX     = 0.6455f;
        }
        charactersel = GetGameObject(new Vector3(0.0f, -0.99f), "Character Select", Resources.Load <Sprite>(spPath), true, "HUD");
        cursor       = GetMenuCursor(crNum, 1, crPath, initX, -0.99f, dX, 0.0f, 0, 0, 1, 0, 0.2f);

        beginSheet = Resources.LoadAll <Sprite>(SpritePaths.ShortButtons);
        begin      = GetGameObject(new Vector3(0.0f, 0.3f), "Begin", beginSheet[0], true, "HUD");
        FontData f   = PD.mostCommonFont.Clone(); f.scale = 0.045f;
        XmlNode  top = GetXMLHead();

        beginText = GetMeshText(new Vector3(0.0f, 0.45f), GetXmlValue(top, "begin"), f).gameObject;

        f.color    = Color.white; f.scale = 0.035f;
        chooseText = GetMeshText(new Vector3(0.0f, 1.11f), GetXmlValue(top, "chooseyourcharacter"), f).gameObject;

        int yMax = InitOptionsTextAndReturnValueCount();

        cursorOp        = GetOptionsCursor(1, yMax + 1, null, -0.2f, 0.45f, 0.0f, 0.25f, 0, yMax, 1);
        cursorOpDisplay = gameObject.AddComponent <OptionsSelector>();
        cursorOpDisplay.Setup(0.2f, 0.45f, 0.25f);
        cursorOpDisplay.SetVisibility(false);
        cursorOpDisplay.SetWidth(PD.gameType == PersistData.GT.Training?0.85f:0.6f);
        InitPlayer1Select();
        SetupBackgrounds();
        ToggleDisplayOptions(false);
        if (PD.gameType == PersistData.GT.Arcade)
        {
            AddVictoryIcons();
        }
        else if (PD.gameType == PersistData.GT.Versus)
        {
            SetupP2StartText(top, f);
            conf2 = false;
        }
    }
Exemplo n.º 4
0
    public void Start()
    {
        StateControllerInit(false);
        usingTouchControls = PD.GetSaveData().savedOptions["touchcontrols"] == 1;
        firstLaunch        = true;
        player1Human       = !PD.isDemo; player2Human = (PD.gameType == PersistData.GT.Versus);
        bh           = new BlockHandler(PD, PD.GetPuzzleLevel());
        zaps         = new List <ZappyGun>();
        zapsToDelete = new List <ZappyGun>();
        SetupCountdown();
        SetupActors();
        SetupRoundDisplay();
        SetupEasterEgg();
        specialMode = PD.useSpecial;
        height      = PD.isTutorial?6:PD.rowCount; width = 8;
        float p1Xoffset = (player2Human || (PD.isDemo && PD.demoPlayers == 2)) ? -10.1f : (PD.IsLeftAlignedHUD()?-1.5f:-5.5f), p2Xoffset = 3.0f;

        CreateBoards(p1Xoffset, p2Xoffset);
        SetUpHUDAndScores();
        if (PD.gameType == PersistData.GT.Challenge)
        {
            (board1 as BoardWarPuzzlePlayer).unlockedRow = (hud as PuzzleHUD).GetUnlockedRow();
        }
        cursor1 = CreatePlayerCursor(player1Human, p1Xoffset, 1, board1, board2);
        cursor2 = CreatePlayerCursor(player2Human || PD.override2P, p2Xoffset, 2, board2, board1, PD.override2P);
        board1.Setup(cursor1, th, bh, (player2Human || (PD.isDemo && PD.demoPlayers == 2)) ? new Vector2(-0.2f, -0.6f) : new Vector2(PD.IsLeftAlignedHUD()?-0.725f:0.75f, -0.6f), player2Human || (PD.isDemo && PD.demoPlayers == 2), true, player1Human && usingTouchControls);
        board2.Setup(cursor2, th, bh, new Vector2(0.2f, -0.6f), true, player2Human || (PD.isDemo && PD.demoPlayers == 2));
        board1.RefreshGraphics();
        board2.RefreshGraphics();
        CreateMirrors(p1Xoffset, p2Xoffset);
        mirror1.RefreshGraphics();
        mirror2.RefreshGraphics();
        SetupMouseControls(p1Xoffset);

        if (!PD.isDemo)
        {
            if (PD.gameType == PersistData.GT.Campaign)
            {
                campaign = new CampaignHandler(PD, board1 as BoardWarSpecial, board2 as BoardWarCampaign,
                                               mirror2 as BoardMirrorSpecial, cursor1 as BoardCursorWar, cursor2 as BoardCursorBot, hud as CampaignHUD, GetXMLHead());
            }
            pauseButtonSheet = Resources.LoadAll <Sprite>(SpritePaths.ShortButtons);
            pauseButton      = GetGameObject(player2Human ? (new Vector3(0.0f, -0.1f)):(new Vector3(2.5f, 0.7f)), "Pause Button", pauseButtonSheet[0], true, "HUD");
            pauseButton.SetActive(PD.usingMouse);
            pauseButton.transform.localScale = new Vector3(0.75f, 0.75f);
            FontData f = PD.mostCommonFont.Clone(); f.scale = 0.035f;
            pauseText = GetMeshText(player2Human ? (new Vector3(0.0f, 0.0f)):(new Vector3(2.5f, 0.8f)), GetXmlValue(GetXMLHead(), "pause"), f).gameObject;
            pauseText.SetActive(PD.usingMouse);
            pauseTimer = 0;
            mouseObjects.Add(pauseButton);
            mouseObjects.Add(pauseText);
        }
        else
        {
            demoCountdown = 1800;
        }
    }
Exemplo n.º 5
0
    public string GetPuzzleData(int l, int type)
    {
        SaveData saveInfo = PD.GetSaveData();

        if (!saveInfo.puzzleScores.ContainsKey(l))
        {
            return("");
        }
        return("\n\n{0}: " + saveInfo.puzzleScores[l] + ((type == 0)?"":("\n{1}: " + saveInfo.puzzleTimes[l])));
    }
Exemplo n.º 6
0
    public List <int> GetCompletedPuzzles()
    {
        SaveData   saveInfo = PD.GetSaveData();
        List <int> keys     = new List <int>();

        foreach (int k in saveInfo.puzzleScores.Keys)
        {
            keys.Add(k);
        }
        return(keys);
    }
Exemplo n.º 7
0
    private void SetupAFuckingBalloon()
    {
        if (PD.GetSaveData().savedOptions["beatafuckingballoon"] != 1)
        {
            return;
        }
        Sprite     psprite = Resources.LoadAll <Sprite>(SpritePaths.CharFullShots)[32];
        GameObject pleaseDadCanIHgaaveOne = GetGameObject(new Vector3(-1.8f, 1.2f), "Puhloonverlay", psprite, false, "HUDText");

        pleaseDadCanIHgaaveOne.GetComponent <SpriteRenderer>().color = new Color(1.0f, 1.0f, 1.0f, 0.5f);
        pleaseDadCanIHgaaveOne.renderer.transform.localScale         = new Vector2(0.5f, 0.45f);
    }
Exemplo n.º 8
0
    private int GetFirstIncompletePuzzle()
    {
        SaveData saveInfo = PD.GetSaveData();

        for (int i = 1; i < PuzzleSelectController.totalPuzzleCount; i++)
        {
            if (!saveInfo.puzzleScores.ContainsKey(i))
            {
                return(i);
            }
        }
        return(0);
    }
Exemplo n.º 9
0
 public void Setup(bool won)
 {
     GetPersistData();
     didP1Win    = won;
     playeractor = CreateActor(PD.GetPlayerSpritePath(PD.p1Char), new Vector3(-2.1f, 0.2f), false, true, true);
     playeractor.SetScale(0.4f);
     opponentactor = CreateActor(PD.GetPlayerSpritePath(PD.p2Char), new Vector3(2.1f, 0.2f), true, true, true);
     opponentactor.SetScale(0.4f);
     tbox = (DialogContainer)gameObject.AddComponent("DialogContainer");
     tbox.Setup(new Vector3(0.0f, -1.4f), true);
     isFirstLoad = true;
     PD.sounds.SetSoundVolume(PD.GetSaveData().savedOptions["vol_s"] / 350.0f);
     setText();
 }
Exemplo n.º 10
0
    public void Start()
    {
        StateControllerInit(false);

        playeractor = CreateActor(PD.GetPlayerSpritePath(PD.p1Char), new Vector3(-5.15f, 1.0f));
        PD.GetNextOpponent();
        opponentactor = CreateActor(PD.GetPlayerSpritePath(PD.p2Char), new Vector3(5.15f, 1.0f), true);
        skipMenuIsUp  = false;

        XmlNodeList dialogs = GetXMLHead("/" + playeractor.GetPath(PD.p1Char == PersistData.C.FuckingBalloon), "dialogs").SelectNodes("dialog");
        XmlNode     dialog  = dialogs[PD.GetPuzzleLevel()];

        dialogArr = dialog.SelectNodes("line");

        rawInput = GetInputHandler();

        dialogueBox = gameObject.AddComponent <DialogContainer>();
        dialogueBox.Setup(new Vector3(0.0f, -3.5f));

        bool isBossChar = PD.p1Char == PersistData.C.White || PD.p1Char == PersistData.C.September;

        curFrame = (!isBossChar && (PD.level == 6 || PD.level == 8))?0:2;
        StartFrame(curFrame);

        skipButtonSheet = Resources.LoadAll <Sprite>(SpritePaths.ShortButtons);
        skipButton      = GetGameObject(new Vector3(8.3f, -4.75f), "Skip", skipButtonSheet[0], true, "Pause HUD Buttons");
        FontData font = PD.mostCommonFont.Clone(); font.scale = 0.045f;
        XmlNode  top  = GetXMLHead();

        skipText = GetMeshText(new Vector3(8.3f, -4.61f), GetXmlValue(top, "skip"), font).gameObject;
        skipText.renderer.sortingLayerName = "Pause HUD Text";

        mouseObjects.Add(skipButton);
        mouseObjects.Add(skipText);

        skipMenu = GetGameObject(new Vector3(0.0f, 0.0f), "Skip Menu", Resources.Load <Sprite>(SpritePaths.CutsceneSkipBox), false, "HUDText");

        string f = string.Format(GetXmlValue(top, "skipmessage"), "\r\n", PD.controller.GetFriendlyActionName(InputMethod.Action.launch), PD.controller.GetFriendlyActionName(InputMethod.Action.pause));

        font.scale        = 0.08f; font.layerName = "Reference";
        skipMenuText      = GetMeshText(new Vector3(0.0f, 0.5f), f, font);
        skipMenuText.text = new WritingWriter().GetWrappedString(skipMenuText, f, skipMenu.renderer.bounds.size);
        skipMenuText.gameObject.SetActive(false);
        skipMenu.SetActive(false);

        PD.sounds.SetSoundVolume(PD.GetSaveData().savedOptions["vol_s"] / 350.0f);
    }
Exemplo n.º 11
0
    private void SetupCharacter()
    {
        SaveData sd = PD.GetSaveData();

        PD.p2Char = (PersistData.C)sd.GetTitleScreenCharacter();
        int winOffset = PD.GetPlayerSpriteStartIdx(PD.p2Char) * 3 + sd.getPlayerWinType(PD.GetPlayerSpritePath(PD.p2Char));

        if (PD.p2Char == PersistData.C.White)
        {
            winOffset = 30;
        }
        else if (PD.p2Char == PersistData.C.September)
        {
            winOffset = 31;
        }
        Sprite[] sheet   = Resources.LoadAll <Sprite>(SpritePaths.CharFullShots);
        bool     onRight = System.Array.IndexOf(new int[] { 0, 3, 4, 7, 11, 13, 15, 16, 17, 19, 20, 22, 23, 24, 27, 29, 31 }, winOffset) >= 0;
        float    xOffset = onRight?2.5f:-2.5f;

        if (PD.p2Char != PersistData.C.Null)
        {
            PD.sounds.SetVoiceAndPlay(SoundPaths.VoicePath + PD.GetPlayerSpritePath(PD.p2Char) + "/" + "083", 0);
            character  = GetGameObject(new Vector3(xOffset, -0.5f), "A Player Is You", sheet[winOffset], true, "Zapper");
            charTalker = new CutsceneChar(PD.GetPlayerSpritePath(PD.p2Char), character, null, 0, PD);
            if (PD.p2Char != PersistData.C.September && PD.p2Char != PersistData.C.White)
            {
                PD.sounds.SetMusicAndPlay(SoundPaths.M_Title_DerivPath + PD.GetPlayerSpritePath(PD.p2Char));
            }
            else
            {
                PD.sounds.SetMusicAndPlay(SoundPaths.M_Title_DerivPath + "White");
                if (PD.p2Char == PersistData.C.September)
                {
                    PD.sounds.SetVoiceAndPlay(SoundPaths.VoicePath + "September/042", 0);
                }
                else
                {
                    PD.sounds.SetVoiceAndPlay(SoundPaths.VoicePath + "White/032", 0);
                }
            }
        }
        else
        {
            PD.sounds.SetVoiceAndPlay(SoundPaths.NarratorPath + "001", 0);
            PD.sounds.SetMusicAndPlay(SoundPaths.M_Title_Default);
        }
    }
Exemplo n.º 12
0
    private void UpdateCursorPosition(int pos)
    {
        if (pos == prevPos)
        {
            return;
        }
        prevPos = pos;
        goBack.SetActive(false);
        funFactText.text = "";
        switch (pos)
        {
        case 3:
            optionsScreen.CleanUp();
            controlsScreen.CleanUp();
            accessibilityScreen.CleanUp();
            optionsScreen.Setup(resolutions[resIdx], isFullScreen, volume_music, volume_sound, volume_voice, resIdx, resolutions.Length - 1);
            break;

        case 2:
            optionsScreen.CleanUp();
            controlsScreen.CleanUp();
            accessibilityScreen.CleanUp();
            controlsScreen.Setup();
            break;

        case 1:
            optionsScreen.CleanUp();
            controlsScreen.CleanUp();
            accessibilityScreen.CleanUp();
            accessibilityScreen.Setup();
            accessibilityScreen.Reset(PD.GetSaveData());
            break;

        case 0:
            optionsScreen.CleanUp();
            controlsScreen.CleanUp();
            accessibilityScreen.CleanUp();
            headerText.text  = GetXmlValue(top, "returntomenu");
            funFactText.text = GetFunFactText();
            goBack.SetActive(true);
            break;
        }
    }
Exemplo n.º 13
0
    public void CreateAI(BoardWar myBoard, BoardWar theirBoard, int type, int difficulty = 0)
    {
        switch (type)
        {
        case (int)PersistData.GT.Training: AI = new TrainingAI(myBoard, theirBoard, this); break;

        case (int)PersistData.GT.Challenge: AI = new TrainingAI(myBoard, theirBoard, this); break;

        default: AI = new AIversion2(myBoard, theirBoard, this, difficulty); break;
        }
        if (type == (int)PersistData.GT.Training && difficulty == 2)
        {
            AI.forceState(3);
        }
        if (PD.GetSaveData().savedOptions["easymode"] == 1)
        {
            AI.EasyModo(); AI.boostDifficulty(difficulty);
        }
    }
Exemplo n.º 14
0
    private List <XmlNode> GetFilteredBiosList()
    {
        XmlNodeList    allBios       = GetXMLHead("/characterBios", "bios").SelectNodes("character");
        List <XmlNode> availableBios = new List <XmlNode>();
        SaveData       sd            = PD.GetSaveData();

        for (int i = 0; i < allBios.Count - 1; i++)
        {
            if (sd.HasBeatenGameWithCharacter(allBios[i].Attributes["name"].InnerText))
            {
                availableBios.Add(allBios[i]);
            }
        }
        if (availableBios.Count < 12)
        {
            availableBios.Add(allBios[12]);
        }
        return(availableBios);
    }
    private void FullInitP2Select()
    {
        int    completionPercent = PD.GetSaveData().CalculateGameCompletionPercent();
        string crPath            = SpritePaths.CharSelCursors;
        int    crNum             = 10;

        if (completionPercent == 100)
        {
            crPath = SpritePaths.CharSelCursorsAll;
            crNum  = 12;
        }
        else if (completionPercent >= 50)
        {
            crPath = SpritePaths.CharSelCursorsWhite;
            crNum  = 11;
        }
        cursor2 = GetMenuCursor(crNum, 1, crPath, initX, -0.99f, dX, 0.0f, 1, 0, 2, 1, 0.2f);
        InitPlayer2Select();
        UpdateBackground(false);
    }
Exemplo n.º 16
0
    protected override bool HandleMouse()
    {
        if (!PD.usingMouse)
        {
            return(false);
        }
        HandleCharacterClick();
        Vector3 inTitle = clicker.getPositionInGameObject(title);

        if (inTitle.z == 1 && Mathf.Abs(inTitle.x) > 1.5f && Mathf.Abs(inTitle.y) < 0.3f && clicker.isDown())
        {
            if (PD.GetSaveData().savedOptions["beatafuckingballoon"] == 1)
            {
                PD.p1Char = (PersistData.C)Random.Range(0, 10);
                PD.MoveToBalloonBattle();
            }
        }
        int initv = GetClickSelection();

        if (initv < 0)
        {
            return(false);
        }
        int v = 9 - initv;
        int x = v % 2, y = (v - x) / 2;

        if (x == 0)
        {
            x = 1;
        }
        else
        {
            x = 0;
        }
        cursor.setX(x); cursor.setY(y);
        if (clicker.isDown())
        {
            ConfirmSelectionAndAdvance(initv);
        }
        return(false);
    }
Exemplo n.º 17
0
    private void AdvanceToGameOrCredits()
    {
        PD.sounds.SetSoundVolume(PD.GetSaveData().savedOptions["vol_s"] / 100.0f);
        bool isBossChar = PD.p1Char == PersistData.C.White || PD.p1Char == PersistData.C.September;

        if (!isBossChar && (PD.level == 6 || PD.level == 8))
        {
            if (PD.level == 6)
            {
                PD.winType = 1;
            }
            else
            {
                PD.winType = 2;
            }
            PD.ChangeScreen(PersistData.GS.Credits);
        }
        else
        {
            PD.ChangeScreen(PersistData.GS.Game);
        }
    }
Exemplo n.º 18
0
    protected override void DoTheActualSetup()
    {
        StateControllerInit(false);
        onlineState        = 0;
        usingTouchControls = PD.GetSaveData().savedOptions["touchcontrols"] == 1;
        firstLaunch        = true;
        player1Human       = true;
        player2Human       = false;
        opponent           = (CSteamID)PD.onlineOpponentId;
        zaps         = new List <ZappyGun>();
        zapsToDelete = new List <ZappyGun>();
        SetupActors();
        SetupRoundDisplay();
        SetupEasterEgg();
        specialMode = false;
        height      = 6; width = 8;
        SetUpHUDAndScores();
        pauseButtonSheet = Resources.LoadAll <Sprite>(SpritePaths.ShortButtons);
        pauseButton      = GetGameObject(player2Human ? (new Vector3(0.0f, -0.1f)):(new Vector3(2.5f, 0.7f)), "Pause Button", pauseButtonSheet[0], true, "HUD");
        pauseButton.SetActive(PD.usingMouse);
        pauseButton.transform.localScale = new Vector3(0.75f, 0.75f);
        FontData f = PD.mostCommonFont.Clone(); f.scale = 0.035f;

        pauseText = GetMeshText(new Vector3(2.5f, 0.8f), GetXmlValue(GetXMLHead(), "pause"), f).gameObject;
        pauseText.SetActive(PD.usingMouse);
        pauseTimer = 0;
        mouseObjects.Add(pauseButton);
        mouseObjects.Add(pauseText);
        timeUntilProgression = 5.0f;
        if (PD.isOnlineHost)
        {
            Debug.Log("P1 SENDING SEED");
            onlineState = 1;
            int seed = Random.seed;
            FinishSetup(seed);
            SendMessage(seed.ToString());
        }
    }
Exemplo n.º 19
0
 public void ToggleVisibility(bool show)
 {
     soundTestBG.SetActive(show);
     playlist.gameObject.SetActive(show);
     titleText.gameObject.SetActive(show);
     trackinfo.gameObject.SetActive(show);
     playPauseButton.SetActive(show);
     playerDataBG.SetActive(!show);
     for (int y = 0; y < playlistShown; y++)
     {
         playlistColliders[y].SetActive(show);
     }
     if (show)
     {
         PD.sounds.SetMusicVolume(1.0f);
         PD.sounds.StopMusic();
     }
     else if (isActive)
     {
         PD.sounds.SetMusicVolume(PD.GetSaveData().savedOptions["vol_m"] / 100.0f);
         PD.sounds.SetMusicAndPlay(SoundPaths.M_Menu);
     }
     isActive = show;
 }
    private void AddVictoryIcons()
    {
        Sprite[] trophies = Resources.LoadAll <Sprite>(SpritePaths.CharSelVictoryIcons);
        List <KeyValuePair <string, int> > vals = PD.GetSaveData().characterWinsArcade;

        for (int i = 0; i < vals.Count; i++)
        {
            KeyValuePair <string, int> v = vals[i];
            switch (v.Key)
            {
            case "George": AddVictoryIcon(0, v.Value, trophies); break;

            case "Milo": AddVictoryIcon(1, v.Value, trophies); break;

            case "Devin": AddVictoryIcon(2, v.Value, trophies); break;

            case "MJ": AddVictoryIcon(3, v.Value, trophies); break;

            case "Andrew": AddVictoryIcon(4, v.Value, trophies); break;

            case "Joan": AddVictoryIcon(5, v.Value, trophies); break;

            case "Depeche": AddVictoryIcon(6, v.Value, trophies); break;

            case "Lars": AddVictoryIcon(7, v.Value, trophies); break;

            case "Laila": AddVictoryIcon(8, v.Value, trophies); break;

            case "AliceAna": AddVictoryIcon(9, v.Value, trophies); break;

            case "White": AddVictoryIcon(10, v.Value, trophies); break;

            case "September": AddVictoryIcon(11, v.Value, trophies); break;
            }
        }
    }
Exemplo n.º 21
0
    public void Start()
    {
        StateControllerInit(false);
        SaveData sd = PD.GetSaveData();

        currentName = "---";
        characters  = new char[] { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0' };
        string savedName = sd.highScoreName;

        inputName = new int[] { System.Array.IndexOf(characters, savedName[0]), System.Array.IndexOf(characters, savedName[1]), System.Array.IndexOf(characters, savedName[2]) };
        GetGameObject(Vector3.zero, "BG", Resources.Load <Sprite>(SpritePaths.DefaultBG), false, "BG0");

        keyPress = new Regex("[A-Za-z0-9]");

        PD.sounds.SetMusicAndPlay(SoundPaths.M_Menu);

        writer = new ScoreTextFormatter(PD);
        List <KeyValuePair <string, int> > scores = sd.getHighScores(PD.gameType);
        int userScorePos = sd.getHighscorePos(scores, PD.runningScore, true);

        if (userScorePos < 0)
        {
            userScorePos = 100;
        }
        scorePosText = (userScorePos + 1).ToString() + ". "; if (userScorePos < 9)
        {
            scorePosText = " " + scorePosText;
        }
        scoreTxt = PD.runningScore.ToString();
        float scoreX = -2.0f;

        List <KeyValuePair <string, int> > times = sd.getBestTimes(PD.gameType);
        int userTimePos = -1;

        if (PD.gameType == PersistData.GT.Campaign)
        {
            userTimePos = sd.getHighscorePos(times, PD.runningTime, true);
        }
        else
        {
            userTimePos = PD.won?sd.getHighscorePos(times, PD.runningTime, false):-1;
        }
        if (userTimePos < 0)
        {
            userTimePos = 100;
        }
        timePosText = (userTimePos + 1).ToString() + ". "; if (userTimePos < 9)
        {
            timePosText = " " + timePosText;
        }
        timeTxt = writer.ConvertSecondsToMinuteSecondFormat(PD.runningTime);
        float timeX = 2.0f;

        writer.SetScoreRowAndTimeRowWidths(scores, times);

        System.Xml.XmlNode top = GetXMLHead();
        GetMeshText(new Vector3(scoreX, 1.4f), GetXmlValue(top, "highscores"), PD.mostCommonFont, "Prefabs/Text/FixedWidth");
        GetMeshText(new Vector3(timeX, 1.4f), GetXmlValue(top, "besttimes"), PD.mostCommonFont, "Prefabs/Text/FixedWidth");

        Sprite slab = Resources.Load <Sprite>(SpritePaths.HighScoreSlab);

        GetGameObject(new Vector3(scoreX, 0.15f), "Score Slab", slab);
        GetGameObject(new Vector3(timeX, 0.15f), "Time Slab", slab);

        for (int pos = 0; pos < 10; pos++)
        {
            if (pos < userScorePos)
            {
                GetTextRow(scores[pos], pos, scoreX);
            }
            else if (pos == userScorePos)
            {
                currentScore = GetTextRow(new KeyValuePair <string, int>(currentName, PD.runningScore), userScorePos, scoreX);
            }
            else if (pos > userScorePos)
            {
                GetTextRow(scores[pos - 1], pos, scoreX);
            }

            if (pos < userTimePos)
            {
                GetTextRow(times[pos], pos, timeX, true);
            }
            else if (pos == userTimePos)
            {
                currentTime = GetTextRow(new KeyValuePair <string, int>(currentName, PD.runningTime), pos, timeX, true);
            }
            else if (pos > userTimePos)
            {
                GetTextRow(times[pos - 1], pos, timeX, true);
            }
        }
        if (currentScore != null)
        {
            currentScore.color = Color.red;
        }
        if (currentTime != null)
        {
            currentTime.color = Color.red;
        }

        saved      = (userScorePos > 10) && (userTimePos > 10);
        nameCursor = GetOptionsCursor(3, 1, SpritePaths.VerticalArrows, -0.17f, -0.8f, 0.17f, 0, 0, 0, 1);
        if (!saved)
        {
            FontData f = new FontData(TextAnchor.MiddleCenter, TextAlignment.Center);
            GetGameObject(new Vector3(0.0f, -0.65f), "Minislab", Resources.Load <Sprite>(SpritePaths.HighScoreInput));
            GetMeshText(new Vector3(0.0f, -0.5f), GetXmlValue(top, "entername"), f);
            nameEntry            = GetMeshText(new Vector3(0.0f, -0.8f), savedName, f, "Prefabs/Text/FixedWidth");
            inputCollider        = GetGameObject(new Vector3(0.0f, -0.8f), "Input Collider", Resources.Load <Sprite>(SpritePaths.ScoreCollider), true);
            confirmButtonSprites = Resources.LoadAll <Sprite>(SpritePaths.ConfirmButtons);
            confirmButton        = GetGameObject(new Vector3(0.0f, -1.2f), "Confirm", confirmButtonSprites[0], true);
            confirmButton.SetActive(PD.usingMouse);
            mouseObjects.Add(confirmButton);
            PD.sounds.SetVoiceAndPlay(SoundPaths.NarratorPath + "036", 0);
        }
        else
        {
            nameCursor.cursor.SetActive(false);
            PD.sounds.SetVoiceAndPlay(SoundPaths.NarratorPath + "041", 0);
        }
    }
Exemplo n.º 22
0
    public void Start()
    {
        StateControllerInit(false);
        GameObject g = GameObject.Find("Confetti") as GameObject;

        particles = g.GetComponent <ParticleSystem>();
        pars      = new ParticleSystem.Particle[particles.maxParticles];

        int p1Wins = 0, p2Wins = 0;

        for (int i = 0; i < PD.playerOneWonRound.Count; i++)
        {
            if (PD.playerOneWonRound[i])
            {
                p1Wins++;
            }
            else
            {
                p2Wins++;
            }
        }
        PersistData.C winChar  = p1Wins > p2Wins?PD.p1Char:PD.p2Char;
        PersistData.C loseChar = p1Wins < p2Wins?PD.p1Char:PD.p2Char;
        GetGameObject(Vector3.zero, "BG", Resources.Load <Sprite>(SpritePaths.BGPath + PD.GetPlayerSpritePath(p1Wins > p2Wins?PD.p1Char:PD.p2Char, true)), false, "BG0");

        PD.sounds.SetMusicAndPlay(SoundPaths.M_Title_DerivPath + PD.GetPlayerSpritePath(winChar));

        winner = CreateActor(PD.GetPlayerSpritePath(winChar), new Vector3(-2.06f, -0.5f));
        winner.SetScale(0.4f).SetSprite(2, false).SetSortingLayer("BG1");

        PD.sounds.SetVoiceAndPlay(SoundPaths.NarratorPath + (Random.value > 0.5f ? "039" : "040"), 0);
        int narratorIndex = 24 + (int)winChar;

        PD.sounds.QueueVoice(SoundPaths.NarratorPath + narratorIndex.ToString("d3"));
        int val = Random.Range(70, 76);

        PD.sounds.QueueVoice(SoundPaths.VoicePath + PD.GetPlayerSpritePath(winChar) + "/" + val.ToString("d3"));
        PD.sounds.SetSoundVolume(PD.GetSaveData().savedOptions["vol_s"] / 115.0f);

        loser = CreateActor(PD.GetPlayerSpritePath(loseChar), new Vector3(2.81f, -1.25f), true);
        loser.SetSprite(loser.loseFrame, false).SetScale(0.2f).SetSortingLayer("BG1").SetTint(new Color(0.5f, 0.5f, 0.5f));
        GetGameObject(new Vector3(1.3f, 0.7f), "infoBox", Resources.Load <Sprite>(SpritePaths.DetailsBox));
        System.Xml.XmlNode top = GetXMLHead();
        FontData           f   = PD.mostCommonFont.Clone();

        f.scale = 0.07f;
        float x = 1.3f;

        GetMeshText(new Vector3(x, 1.5f), string.Format(GetXmlValue(top, "winstatement"), p1Wins > p2Wins?1:2), f);
        x = 1.2f; f.align = TextAlignment.Right; f.anchor = TextAnchor.MiddleRight; f.scale = 0.035f;
        GetMeshText(new Vector3(x, 0.9f), GetXmlValue(top, "wins") + ":", f);
        GetMeshText(new Vector3(x, 0.65f), GetXmlValue(top, "losses") + ":", f);
        GetMeshText(new Vector3(x, 0.4f), GetXmlValue(top, "totaltime") + ":", f);
        GetMeshText(new Vector3(x, 0.15f), GetXmlValue(top, "p1score") + ":", f);
        GetMeshText(new Vector3(x, -0.1f), GetXmlValue(top, "p2score") + ":", f);
        x = 1.7f; f.align = TextAlignment.Left; f.anchor = TextAnchor.MiddleLeft;
        GetMeshText(new Vector3(x, 0.9f), Mathf.Max(p1Wins, p2Wins).ToString(), f);
        GetMeshText(new Vector3(x, 0.65f), Mathf.Min(p1Wins, p2Wins).ToString(), f);
        GetMeshText(new Vector3(x, 0.4f), new ScoreTextFormatter().ConvertSecondsToMinuteSecondFormat(PD.totalRoundTime), f);
        GetMeshText(new Vector3(x, 0.15f), PD.totalP1RoundScore.ToString(), f);
        GetMeshText(new Vector3(x, -0.1f), PD.totalP2RoundScore.ToString(), f);
        applauseTimer = Random.Range(200, 220);
    }
Exemplo n.º 23
0
 protected override bool HandleMouse()
 {
     if (!PD.usingMouse)
     {
         return(false);
     }
     if (menuPosition == 3)
     {
         Vector2 res = optionsScreen.GetColliderPosition(clicker);
         if (res.y < 0)
         {
             return(false);
         }
         int i = (int)res.y;
         cursor2.setY(8 - i);
         int dx = 0;
         if (clicker.getPositionInGameObject(cursor2Display.leftArrow).z == 1.0f)
         {
             cursor2Display.HighlightArrow(false);
             dx--;
         }
         else if (clicker.getPositionInGameObject(cursor2Display.rightArrow).z == 1.0f)
         {
             cursor2Display.HighlightArrow(true);
             dx++;
         }
         else
         {
             cursor2Display.ClearArrows();
         }
         if (!clicker.isDown())
         {
             return(false);
         }
         if (i < 6)
         {
             UpdateOption(8 - i, dx);
         }
         else if (i == 6)
         {
             WipeSelected_Options();
         }
         else if (i == 7)
         {
             ApplySelected_Options();
         }
         else
         {
             menuPosition = 0;
             SignalFailure();
             ResetOptions();
             cursor.setY(3);
         }
     }
     else if (menuPosition == 2)
     {
         if (clicker.getPositionInGameObject(side_back[0]).z > 0 ||
             clicker.getPositionInGameObject(side_accessibility[0]).z > 0 ||
             clicker.getPositionInGameObject(side_controls[0]).z > 0 ||
             clicker.getPositionInGameObject(side_options[0]).z > 0)
         {
             if (clicker.isDown())
             {
                 LeaveControls();
                 return(false);
             }
         }
         if (controlsPos == 0)
         {
             Vector2 res = controlsScreen.GetTopColliderPositionX(clicker);
             if (res.y < 0)
             {
                 return(false);
             }
             cursor3.setX(res.x < 0 ? 0 : 1);
             if (clicker.isDown())
             {
                 TransitionIntoControlsInner();
             }
         }
         else if (controlsPos == 1)
         {
             Vector2 res = controlsScreen.GetTopColliderPositionY(clicker);
             if (res.x < 0)
             {
                 return(false);
             }
             int newval = 11;
             if (res.y < -1.05f)
             {
                 newval = 0;
             }
             else if (res.y < -0.87f)
             {
                 newval = 1;
             }
             else if (res.y < -0.65f)
             {
                 newval = 2;
             }
             else if (res.y < -0.48f)
             {
                 newval = 3;
             }
             else if (res.y < -0.28f)
             {
                 newval = 4;
             }
             else if (res.y < -0.08f)
             {
                 newval = 5;
             }
             else if (res.y < 0.12f)
             {
                 newval = 6;
             }
             else if (res.y < 0.32f)
             {
                 newval = 7;
             }
             else if (res.y < 0.52f)
             {
                 newval = 8;
             }
             else if (res.y < 0.72f)
             {
                 newval = 9;
             }
             else if (res.y < 0.92f)
             {
                 newval = 10;
             }
             cursor2.setY(newval);
             if (clicker.isDown())
             {
                 SelectControlChange();
             }
         }
         else if (controlsPos == 2)
         {
             if (controlsScreen.ClickingCancelButton(clicker))
             {
                 SignalFailure();
                 controlsPos = 1;
                 controlsScreen.UndoQuestion(cursor2.getY(), cursor3.getX() == 0);
             }
         }
     }
     else if (menuPosition == 1)
     {
         Vector2 res = accessibilityScreen.GetColliderPosition(clicker);
         if (res.y < 0)
         {
             return(false);
         }
         int i  = (int)res.y;
         int cy = 8 - i;
         cursor2.setY(cy);
         int dx = 0;
         if (clicker.getPositionInGameObject(cursor2Display.leftArrow).z == 1.0f)
         {
             cursor2Display.HighlightArrow(false);
             dx--;
         }
         else if (clicker.getPositionInGameObject(cursor2Display.rightArrow).z == 1.0f)
         {
             cursor2Display.HighlightArrow(true);
             dx++;
         }
         else
         {
             cursor2Display.ClearArrows();
         }
         if (!clicker.isDown())
         {
             return(false);
         }
         if (cy == 1)
         {
             ApplySelected_Accessibility();
         }
         else if (cy == 0)
         {
             menuPosition = 0;
             SignalFailure();
             accessibilityScreen.Reset(PD.GetSaveData());
             cursor.setY(1);
         }
         else
         {
             UpdateAccessibilityOption(cy, dx);
         }
     }
     else
     {
         if (clicker.getPositionInGameObject(side_back[0]).z > 0)
         {
             cursor.setY(0);
             if (clicker.isDown())
             {
                 SignalSuccess(); PD.GoToMainMenu();
             }
         }
         else if (clicker.getPositionInGameObject(side_accessibility[0]).z > 0)
         {
             cursor.setY(1);
             if (clicker.isDown())
             {
                 SignalSuccess();
                 cursor2.setY(8);
                 menuPosition = 1;
                 cursor2Display.SetWidth(GetXmlFloat(top, "accessibilityscalewidth"));
             }
         }
         else if (clicker.getPositionInGameObject(side_controls[0]).z > 0)
         {
             cursor.setY(2);
             if (clicker.isDown())
             {
                 SignalSuccess();
                 menuPosition = 2;
             }
         }
         else if (clicker.getPositionInGameObject(side_options[0]).z > 0)
         {
             cursor.setY(3);
             if (clicker.isDown())
             {
                 cursor2.setY(8);
                 menuPosition = 3;
                 cursor2Display.SetWidth(GetXmlFloat(top, "optionscalewidth"));
                 SignalSuccess();
             }
         }
         return(false);
     }
     return(false);
 }
Exemplo n.º 24
0
    public void Start()
    {
        StateControllerInit(false);
        GameObject g = GameObject.Find("Confetti") as GameObject;

        particles = g.GetComponent <ParticleSystem>();
        pars      = new ParticleSystem.Particle[particles.maxParticles];

        int p1Wins = 0, p2Wins = 0;

        for (int i = 0; i < PD.playerOneWonRound.Count; i++)
        {
            if (PD.playerOneWonRound[i])
            {
                p1Wins++;
            }
            else
            {
                p2Wins++;
            }
        }
        PersistData.C winChar  = p1Wins > p2Wins?PD.p1Char:PD.p2Char;
        PersistData.C loseChar = p1Wins < p2Wins?PD.p1Char:PD.p2Char;
        GetGameObject(Vector3.zero, "BG", Resources.Load <Sprite>(SpritePaths.BGPath + PD.GetPlayerSpritePath(p1Wins > p2Wins?PD.p1Char:PD.p2Char, true)), false, "BG0");

        PD.sounds.SetMusicAndPlay(SoundPaths.M_Title_DerivPath + PD.GetPlayerSpritePath(winChar));

        winner = CreateActor(PD.GetPlayerSpritePath(winChar), new Vector3(-2.06f, -0.5f));
        winner.SetScale(0.4f).SetSprite(2, false).SetSortingLayer("BG1");

        PD.sounds.SetVoiceAndPlay(SoundPaths.NarratorPath + (Random.value > 0.5f ? "039" : "040"), 0);
        int narratorIndex = 24 + (int)winChar;

        PD.sounds.QueueVoice(SoundPaths.NarratorPath + narratorIndex.ToString("d3"));
        int val = Random.Range(70, 76);

        PD.sounds.QueueVoice(SoundPaths.VoicePath + PD.GetPlayerSpritePath(winChar) + "/" + val.ToString("d3"));
        PD.sounds.SetSoundVolume(PD.GetSaveData().savedOptions["vol_s"] / 115.0f);

        loser = CreateActor(PD.GetPlayerSpritePath(loseChar), new Vector3(2.81f, -1.25f), true);
        loser.SetSprite(loser.loseFrame, false).SetScale(0.2f).SetSortingLayer("BG1").SetTint(new Color(0.5f, 0.5f, 0.5f));
        GetGameObject(new Vector3(1.3f, 0.7f), "infoBox", Resources.Load <Sprite>(SpritePaths.DetailsBox));
        System.Xml.XmlNode top = GetXMLHead();
        FontData           f   = PD.mostCommonFont.Clone();

        f.scale = 0.07f;
        float x = 1.3f;

        GetMeshText(new Vector3(x, 1.5f), string.Format(GetXmlValue(top, "winstatement"), p1Wins > p2Wins?1:2), f);
        x = 1.2f; f.align = TextAlignment.Right; f.anchor = TextAnchor.MiddleRight; f.scale = 0.035f;
        GetMeshText(new Vector3(x, 0.9f), GetXmlValue(top, "wins") + ":", f);
        GetMeshText(new Vector3(x, 0.65f), GetXmlValue(top, "losses") + ":", f);
        GetMeshText(new Vector3(x, 0.4f), GetXmlValue(top, "totaltime") + ":", f);
        GetMeshText(new Vector3(x, 0.15f), GetXmlValue(top, "p1score") + ":", f);
        GetMeshText(new Vector3(x, -0.1f), GetXmlValue(top, "p2score") + ":", f);
        x = 1.7f; f.align = TextAlignment.Left; f.anchor = TextAnchor.MiddleLeft;
        GetMeshText(new Vector3(x, 0.9f), Mathf.Max(p1Wins, p2Wins).ToString(), f);
        GetMeshText(new Vector3(x, 0.65f), Mathf.Min(p1Wins, p2Wins).ToString(), f);
        GetMeshText(new Vector3(x, 0.4f), new ScoreTextFormatter().ConvertSecondsToMinuteSecondFormat(PD.totalRoundTime), f);
        GetMeshText(new Vector3(x, 0.15f), PD.totalP1RoundScore.ToString(), f);
        GetMeshText(new Vector3(x, -0.1f), PD.totalP2RoundScore.ToString(), f);
        applauseTimer = Random.Range(200, 220);
        if (PD.gameType == PersistData.GT.Online)
        {
            FontData f2         = PD.mostCommonFont.Clone(); f.scale = 0.03f;
            Sprite[] beginSheet = Resources.LoadAll <Sprite>(SpritePaths.LongButtons);
            begin     = GetGameObject(new Vector3(0.0f, -1.31f), "Again", beginSheet[0], true, "HUD");
            beginText = GetMeshText(new Vector3(0.0f, -1.215f), string.Format(GetXmlValue(top, "again"), PD.GetP1InputName(InputMethod.KeyBinding.launch)), f2).gameObject;

            cancel     = GetGameObject(new Vector3(0.0f, -1.7f), "Leave", beginSheet[0], true, "HUD");
            cancelText = GetMeshText(new Vector3(0.0f, -1.61f), string.Format(GetXmlValue(top, "leave"), PD.GetP1InputName(InputMethod.KeyBinding.back)), f2).gameObject;

            roundsSheet = Resources.LoadAll <Sprite>(SpritePaths.RoundStateIcons);

            p1Ok        = GetGameObject(new Vector3(-0.25f, -1f), "P1 Ready", roundsSheet[2], true, "HUD");
            p2Ok        = GetGameObject(new Vector3(0.25f, -1f), "P2 Ready", roundsSheet[2], true, "HUD");
            isOnline    = true;
            onlineState = 0;
            theyreReady = false;

            Callback_statsReceived = Callback <UserStatsReceived_t> .Create(OnGetUserStats);

            SteamUserStats.RequestCurrentStats();
            SteamUserStats.RequestUserStats((CSteamID)PD.onlineOpponentId);
            didP1win   = p1Wins > p2Wins;
            readyToEnd = false;
            wantToEnd  = false;
        }
        else
        {
            isOnline = false;
        }
    }
Exemplo n.º 25
0
    private void UpdateAccessibility()
    {
        cursor2Display.SetVisibility(true);
        cursor.SetVisibility(false);
        cursor3.SetVisibility(false);
        cursor2.DoUpdate();
        int cy = cursor2.getY();

        cursor2Display.UpdatePosition(cy);
        if (cursor2.launchOrPause())
        {
            if (cy == 0)
            {
                menuPosition = 0;
                accessibilityScreen.Reset(PD.GetSaveData());
                cursor.setY(1);
                SignalFailure();
            }
            else if (cy == 1)
            {
                ApplySelected_Accessibility();
            }
            else
            {
                cursor2.setY(1);
            }
        }
        else if (cursor2.back())
        {
            menuPosition = 0;
            cursor.setY(1);
            SignalFailure();
        }
        else
        {
            if (--leftRight_delay <= 0)
            {
                int dx = 0;
                if (cursor.shiftRight() || cursor.shiftAllRight() || PD.controller.Nav_Right())
                {
                    cursor2Display.HighlightArrow(true);
                    dx++;
                }
                else if (cursor.shiftLeft() || cursor.shiftAllLeft() || PD.controller.Nav_Left())
                {
                    cursor2Display.HighlightArrow(false);
                    dx--;
                }
                else
                {
                    if (!PD.usingMouse)
                    {
                        cursor2Display.ClearArrows();
                    }
                }
                if (dx != 0)
                {
                    UpdateAccessibilityOption(cy, dx);
                    leftRight_delay = 15;
                }
            }
        }
        accessibilityScreen.UpdateCursorGraphic(cursor2Display, cy);
    }