Ejemplo n.º 1
0
 void Awake()
 {
     MainPanel    = GameObject.Find("MainPanel");
     RankingPanel = GameObject.Find("RankingPanel");
     CreditsPanel = GameObject.Find("CreditsPanel");
     Panel        = GameObject.Find("Panel");
     CreditsPanel.SetActive(false);
     RankingPanel.SetActive(false);
 }
Ejemplo n.º 2
0
    public override void OnMessage(Message message)
    {
        string name = message.Name;

        object[] body = message.Params;
        switch (name)
        {
        case MessageConst.MODULE_TRAININGROOM_GOTO_PLAY_PANEL:
            _songChoosePanel = new SongChoosePanel();
            _songChoosePanel.Init(this);
            _songChoosePanel.Show(0.5f);
            break;

        case MessageConst.MODULE_TRAININGROOM_GOTO_RANKING_PANEL:
            _rankingPanel = new RankingPanel();
            _rankingPanel.Init(this);
            _rankingPanel.Show(0.5f);
            break;

        case MessageConst.MODULE_TRAININGROOM_GOTO_SHOP_PANEL:
            _exchangeShopPanel = new ExchangeShopPanel();
            _exchangeShopPanel.Init(this);
            _exchangeShopPanel.Show(0.5f);
            break;

        case MessageConst.MODULE_TRAININGROOM_GOTO_CHOOSECARD_PANEL:
            _chooseCardPanel = new ChooseCardPanel();
            _chooseCardPanel.Init(this);
            _chooseCardPanel.Show(0.5f);
            break;

        case MessageConst.MODULE_TRAININGROOM_SHOW_BACKBTN:
            _trainingRoomPanel.ShowBackBtn();
            break;

        case MessageConst.MODULE_TRAININGROOM_SHOW_SONGCHOOSEVIEW_BACKBTN:
            _songChoosePanel.ShowBackBtn();
            break;

        case MessageConst.MODULE_TRAININGROOM_GET_RES_FAILED:
            _trainingRoomPanel.OnBackClick();
            break;

        case MessageConst.MODULE_TRAININGROOM_CHOOSE_NUM_ENOUGH:
            _chooseCardPanel.Destroy();
            _songChoosePanel.ShowBackBtn();
            SendMessage(new Message(MessageConst.CMD_TRAININGROOM_CREATE_CHOOSE_CARD));
            break;
        }
    }
Ejemplo n.º 3
0
    private void CallbackWwwSuccess(string response)
    {
        List <RankingData> rankingList = RankingDataModel.DesirializeFromJson(response);
        int number = 1;

        foreach (RankingData ranking in rankingList)
        {
            GameObject panel = Instantiate(Panel, Panel.transform.position, Panel.transform.rotation);
            panel.transform.SetParent(parentTransform);
            RankingPanel rankingPanel = panel.GetComponent <RankingPanel>();
            rankingPanel.SetNumberText(number.ToString());
            number++;
            rankingPanel.SetScoreText(ranking.score.ToString());
            rankingPanel.SetDateText(ranking.Date.ToString());
        }
    }
Ejemplo n.º 4
0
    public void ShowBoatRankings(int boatId)
    {
        for (int i = 0; i < _rankingPanelParent.transform.childCount; i++)
        {
            Destroy(_rankingPanelParent.transform.GetChild(i).gameObject);
        }

        if (!_overallOrTournament)
        {
            List <BoatRanking> boatRankings = MainGameController.instance.databaseController.connection.Table <BoatRanking>().Where(x => x.BoatId == boatId).ToList();
            boatRankings = boatRankings.OrderBy(x => x.Points).ThenBy(x => x.RacesWon).ToList();
            foreach (BoatRanking br in boatRankings)
            {
                GameObject rankingPanel = GameObject.Instantiate(_rankingPanel);
                rankingPanel.transform.SetParent(_rankingPanelParent.transform);
                rankingPanel.transform.localScale = Vector3.one;
                RankingPanel rp = rankingPanel.GetComponent <RankingPanel>();
                if (br.PersonId != MainGameController.instance.player.id)
                {
                    List <Person> temppersons = MainGameController.instance.databaseController.connection.Table <Person>().Where(x => x.id == br.PersonId).ToList();
                    Person        p           = temppersons.First();
                    rp.SetData(br, p);
                }
                else
                {
                    rp.SetData(br, MainGameController.instance.player);
                }
            }
        }
        else
        {
            List <Person> persons = MainGameController.instance.databaseController.connection.Table <Person>().ToList();
            persons = persons.OrderBy(x => x.LifetimePoints).ThenBy(x => x.RacesWon).Where(x => x.LifetimePoints > 0).ToList();
            foreach (Person p in persons)
            {
                GameObject rankingPanel = GameObject.Instantiate(_rankingPanel);
                rankingPanel.transform.SetParent(_rankingPanelParent.transform);
                rankingPanel.transform.localScale = Vector3.one;
                RankingPanel rp = rankingPanel.GetComponent <RankingPanel>();
                rp.SetData(p);
            }
        }
    }
Ejemplo n.º 5
0
 public void CloseRanking()
 {
     RankingPanel.SetActive(false);
     MainPanel.SetActive(true);
 }
Ejemplo n.º 6
0
 public void OpenRanking()
 {
     MainPanel.SetActive(false);
     RankingPanel.SetActive(true);
 }