Ejemplo n.º 1
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;
        }
    }
Ejemplo n.º 2
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);
    }