예제 #1
0
    void SetSemiFinals()
    {
        for (int i = 0; i < TournamentUtil.Instance.R16Ids.Length; i++)
        {
            byte id;
            if (i == 0)
            {
                id = (byte)NationalSuits.getNationId(Game.Instance.Nation01);
            }
            else
            {
                id = TournamentUtil.Instance.R16Ids [i];
            }
            R16Flags [i].sprite2D = NationalSuits.getNationFlag(NationalSuits.getNationById(id));
        }

        for (int i = 0; i < TournamentUtil.Instance.QuarterIds.Length; i++)
        {
            byte id;
            if (i == 0)
            {
                id = (byte)NationalSuits.getNationId(Game.Instance.Nation01);
            }
            else
            {
                id = TournamentUtil.Instance.QuarterIds [i];
            }
            QuartiFlags [i].sprite2D  = NationalSuits.getNationFlag(NationalSuits.getNationById(id));
            R16Goals [i * 2].text     = "" + TournamentUtil.Instance.R16Goals [i * 2];
            R16Goals [i * 2 + 1].text = "" + TournamentUtil.Instance.R16Goals [i * 2 + 1];
            if (TournamentUtil.Instance.R16Goals [i * 2] > TournamentUtil.Instance.R16Goals [i * 2 + 1])
            {
                R16Bg [i * 2].sprite2D = bgRosso;
            }
            else
            {
                R16Bg [i * 2 + 1].sprite2D = bgRosso;
            }
        }

        TournamentUtil.Instance.IsInSemiFinals = true;
        for (int i = 0; i < TournamentUtil.Instance.SemiFinalsIds.Length; i++)
        {
            Partita partita = CosaGoal(i, TournamentUtil.Instance.QuarterIds, TournamentUtil.Instance.QuarterGoals);
            SemifinaleFlags [i].sprite2D = NationalSuits.getNationFlag(NationalSuits.getNationById(partita.Id));
            QuartiGoals [i * 2].text     = "" + partita.Goal01;
            QuartiGoals [i * 2 + 1].text = "" + partita.Goal02;
            if (partita.Goal01 > partita.Goal02)
            {
                QuartiBg [i * 2].sprite2D = bgRosso;
            }
            else
            {
                QuartiBg [i * 2 + 1].sprite2D = bgRosso;
            }
            TournamentUtil.Instance.SemiFinalsIds [i]        = partita.Id;
            TournamentUtil.Instance.QuarterGoals [i * 2]     = partita.Goal01;
            TournamentUtil.Instance.QuarterGoals [i * 2 + 1] = partita.Goal02;
        }
    }
예제 #2
0
 void SetR16()
 {
     TournamentUtil.Instance.IsInR16 = true;
     for (int i = 0; i < TournamentUtil.Instance.R16Ids.Length; i++)
     {
         byte id;
         if (i == 0)
         {
             id = (byte)NationalSuits.getNationId(Game.Instance.Nation01);
         }
         else
         {
             id = getId(TournamentUtil.Instance.R16Ids);
         }
         TournamentUtil.Instance.R16Ids [i] = id;
         R16Flags [i].sprite2D = NationalSuits.getNationFlag(NationalSuits.getNationById(id));
     }
 }
예제 #3
0
    Partita CosaGoal(int i, byte[] ids, byte[] goals)
    {
        Partita partita = new Partita();

        if (i == 0)
        {
            partita.Id     = (byte)NationalSuits.getNationId(Game.Instance.Nation01);
            partita.Goal01 = Game.Instance.PlayerScore01;
            partita.Goal02 = Game.Instance.PlayerScore02;
        }
        else
        {
            partita.Goal01 = (byte)Random.Range(0, 5);
            partita.Goal02 = (byte)getGoal02(partita.Goal01);
            partita.Id     = partita.Goal01 > partita.Goal02 ? ids [i * 2] : ids [i * 2 + 1];
        }
        return(partita);
    }
예제 #4
0
    public void ConfigureOnlineFinished()
    {
        UniversalOnline.Instance.Progress = 90;
        byte[]     dataSmall = new byte[20];
        PlayerEnum player    = PlayerEnumUtils.GetCurrentPlayer();

        dataSmall [0] = Constants.CODE_CONFIGURE_MATCH;

        if (player == PlayerEnum.RIGHT)
        {
            int nationId02 = NationalSuits.getNationId(Game.Instance.Nation02);
            Game.Instance.LandscapeId = (byte)Random.Range(0, (int)Constants.BACKGROUNDS);
            dataSmall [1]             = Game.Instance.LandscapeId;
            dataSmall [2]             = Constants.CODE_NOTHING;
            dataSmall [3]             = (byte)nationId02;
            Game.Instance.Nation02    = NationalSuits.getNationById((byte)nationId02);
        }
        else
        {
            int nationId01 = NationalSuits.getNationId(Game.Instance.Nation01);
            dataSmall [1] = Constants.CODE_NOTHING;
            dataSmall [2] = (byte)nationId01;
            dataSmall [3] = Constants.CODE_NOTHING;

            Game.Instance.Nation01 = NationalSuits.getNationById((byte)nationId01);
        }
        if (Game.Instance.OnlinePlay)
        {
            PlayGamesPlatform.Instance.RealTime.SendMessageToAll(true, dataSmall);
        }
        else if (Game.Instance.BluetoothPlay)
        {
                                                #if UNITY_ANDROID
            SendInfoToServerMainMenu(dataSmall);
                                                #endif
        }
        UniversalOnline.Instance.State = UniversalOnline.States.Playing;

        if (UniversalOnline.Instance.TheOpponentIsReady)
        {
            Invoke("StartOnlineMatch", 2.5f);
        }
    }
예제 #5
0
    void SetWinner()
    {
        for (int i = 0; i < TournamentUtil.Instance.R16Ids.Length; i++)
        {
            byte id;
            if (i == 0)
            {
                id = (byte)NationalSuits.getNationId(Game.Instance.Nation01);
            }
            else
            {
                id = TournamentUtil.Instance.R16Ids [i];
            }
            R16Flags [i].sprite2D = NationalSuits.getNationFlag(NationalSuits.getNationById(id));
        }

        for (int i = 0; i < TournamentUtil.Instance.QuarterIds.Length; i++)
        {
            byte id;
            if (i == 0)
            {
                id = (byte)NationalSuits.getNationId(Game.Instance.Nation01);
            }
            else
            {
                id = TournamentUtil.Instance.QuarterIds [i];
            }
            QuartiFlags [i].sprite2D  = NationalSuits.getNationFlag(NationalSuits.getNationById(id));
            R16Goals [i * 2].text     = "" + TournamentUtil.Instance.R16Goals [i * 2];
            R16Goals [i * 2 + 1].text = "" + TournamentUtil.Instance.R16Goals [i * 2 + 1];
            if (TournamentUtil.Instance.R16Goals [i * 2] > TournamentUtil.Instance.R16Goals [i * 2 + 1])
            {
                R16Bg [i * 2].sprite2D = bgRosso;
            }
            else
            {
                R16Bg [i * 2 + 1].sprite2D = bgRosso;
            }
        }

        for (int i = 0; i < TournamentUtil.Instance.SemiFinalsIds.Length; i++)
        {
            byte id;
            if (i == 0)
            {
                id = (byte)NationalSuits.getNationId(Game.Instance.Nation01);
            }
            else
            {
                id = TournamentUtil.Instance.SemiFinalsIds [i];
            }
            SemifinaleFlags [i].sprite2D = NationalSuits.getNationFlag(NationalSuits.getNationById(id));
            QuartiGoals [i * 2].text     = "" + TournamentUtil.Instance.QuarterGoals [i * 2];
            QuartiGoals [i * 2 + 1].text = "" + TournamentUtil.Instance.QuarterGoals [i * 2 + 1];
            if (TournamentUtil.Instance.QuarterGoals [i * 2] > TournamentUtil.Instance.QuarterGoals [i * 2 + 1])
            {
                QuartiBg [i * 2].sprite2D = bgRosso;
            }
            else
            {
                QuartiBg [i * 2 + 1].sprite2D = bgRosso;
            }
        }

        for (int i = 0; i < TournamentUtil.Instance.FinalsIds.Length; i++)
        {
            byte id;
            if (i == 0)
            {
                id = (byte)NationalSuits.getNationId(Game.Instance.Nation01);
            }
            else
            {
                id = TournamentUtil.Instance.FinalsIds [i];
            }
            FInaleFlags [i].sprite2D         = NationalSuits.getNationFlag(NationalSuits.getNationById(id));
            SemifinaleGoals [i * 2].text     = "" + TournamentUtil.Instance.SemiFinalsGoals [i * 2];
            SemifinaleGoals [i * 2 + 1].text = "" + TournamentUtil.Instance.SemiFinalsGoals [i * 2 + 1];
            if (TournamentUtil.Instance.SemiFinalsGoals [i * 2] > TournamentUtil.Instance.SemiFinalsGoals [i * 2 + 1])
            {
                SemifinaleBg [i * 2].sprite2D = bgRosso;
            }
            else
            {
                SemifinaleBg [i * 2 + 1].sprite2D = bgRosso;
            }
        }

        Partita partita = CosaGoal(0, TournamentUtil.Instance.FinalsIds, TournamentUtil.Instance.FinalsIds);

        FInaleGoals [0].text = "" + partita.Goal01;
        FInaleGoals [1].text = "" + partita.Goal02;
        if (partita.Goal01 > partita.Goal02)
        {
            FInaleBg [0].sprite2D = bgRosso;
        }
        else
        {
            FInaleBg [1].sprite2D = bgRosso;
        }
    }