예제 #1
0
    public LevelScore GetScoreByBoardId(string boardId)
    {
        LevelScore score = LevelScores.Find(p => { return(p.LeardBoardID == boardId); });

        if (score == null)
        {
            score = new LevelScore(GameGlobalValue.GetLevelIdByBoardId(boardId));
            score.LeardBoardID = boardId;
            LevelScores.Add(score);
        }
        return(score);
    }
예제 #2
0
    /// <summary>
    /// 获得游戏场景的纪录
    /// </summary>
    /// <param name="level"></param>
    /// <returns></returns>
    public LevelScore GetScoreByLevel(int level)
    {
        LevelScore score = LevelScores.Find(p => { return(p.LevelID == level); });

        if (score == null)
        {
            score = new LevelScore(level);
            score.LeardBoardID = GameGlobalValue.GetBoardIdByLevel(level);
            LevelScores.Add(score);
        }
        return(score);
    }
예제 #3
0
 void OnGameNext(LTEvent evt)
 {
     if (GameGlobalValue.IsLastLevel(GameGlobalValue.s_CurrentLevel))
     {
         OnGameMainMenu(evt);
     }
     else
     {
         GameGlobalValue.s_CurrentLevel += 1;
         Application.LoadLevel(Application.loadedLevel);
     }
 }
예제 #4
0
    public void OnClickStart()
    {
        if (m_IsGameStart == false)
        {
            return;
        }
        GameGlobalValue.Init();

        m_MainMenu.gameObject.SetActive(false);
        m_WarMenu.gameObject.SetActive(true);
        //m_title.Close();
        //mainGame.OpenStartLabel("Start");
    }
예제 #5
0
    /// <summary>
    /// 敌人死亡
    /// </summary>
    /// <param name="headshoot">是否爆头死亡</param>
    public void EmenyDead(int score, bool headshoot = false)
    {
        records.EnemyKills += 1;
        UIManager.Instance.UpdateMissionRemain(records.EnemyKills);

        if (headshoot)
        {
            records.HeadShotCount += 1;
        }
        isCombo = true;
        curRemainComboInterval = comboInterval;
        currentCombo          += 1;
        SoundManager.Instance.PlayComboSound(currentCombo, headshoot);
        if (currentCombo > 0)
        {
            UIManager.Instance.ShowCombo(currentCombo, headshoot);
        }
        //更新最大连击数
        records.MaxCombos = currentCombo;
        int addScore = GameGlobalValue.GetHitScore(currentCombo, ref score, headshoot);

        if (headshoot)
        {
            records.HeadshotAddScore += addScore;
        }
        else
        {
            records.HitAddAcores += addScore;
        }

        //计算武器加成
        if (currentWeapon != null)
        {
            records.WeaponScoreBonus += (int)(currentWeapon.scoreBonus * score);
            score += (int)(currentWeapon.scoreBonus * score);
        }
        records.Scores += score;
        UIManager.Instance.UpdateScoreText(records.Scores);
        //显示分数
        UIManager.Instance.ShowPoint(score, headshoot);
        //SoundManager.Instance.PlaySound(SoundManager.SoundType.OneKill);
    }
예제 #6
0
    /// <summary>
    /// 显示结束UI
    /// </summary>
    /// <param name="success"></param>
    /// <param name="record"></param>
    void ShowFinishUI(bool success, GameRecords record)
    {
        if (uiFinish)
        {
            uiFinish.SetActive(true);
            RectTransform bgRect = uiFinish.GetComponent <RectTransform>().FindChild("Background").GetComponent <RectTransform>();
            if (bgRect)
            {
                Vector3 bgScale = bgRect.localScale;
                bgRect.localScale = Vector3.zero;
                LeanTween.scale(bgRect, bgScale, 0.2f);

                if (GameType != 2)
                {
                    //显示title
                    GameObject tltSucc = bgRect.FindChild("TitleSuccess").gameObject;
                    GameObject tltFail = bgRect.FindChild("TitleFailed").gameObject;
                    if (tltSucc)
                    {
                        tltSucc.SetActive(success);
                    }
                    if (tltFail)
                    {
                        tltFail.SetActive(!success);
                    }
                }
                //更新数据显示

                //杀敌数
                CommonUtils.SetChildText(bgRect, "Infos/Kills/TextCount", record.EnemyKills.ToString());
                //最大连击数
                CommonUtils.SetChildText(bgRect, "Infos/MaxHits/TextCount", record.MaxCombos.ToString());


                //爆头数
                CommonUtils.SetChildText(bgRect, "Infos/HeadShot/TextCount", record.HeadShotCount.ToString());

                //分数
                //CommonUtils.SetChildText(bgRect, "Infos/ScoreText", record.Scores.ToString());

                Text txtScore = bgRect.FindChild("Infos/ScoreText").GetComponent <Text>();
                if (txtScore)
                {
                    //txtScore.text = record.Scores.ToString();
                    StartCoroutine(DigitalDisplay(txtScore, record.Scores, 0, 1000));
                }

                Text txtMoneyEarn = bgRect.FindChild("Infos/MoenyEarn/TextCount").GetComponent <Text>();
                if (txtMoneyEarn)
                {
                    int moneyEarned = GameGlobalValue.GetMoneyFromRecord(record, success);
                    Player.CurrentPlayer.EarnMoney(moneyEarned);
                    StartCoroutine(DigitalDisplay(txtMoneyEarn, moneyEarned));
                }

                //重新开始按钮
                Button btnRestart = bgRect.FindChild("BtnRestart").GetComponent <Button>();
                if (btnRestart)
                {
                    btnRestart.onClick.AddListener(OnRestartClicked);
                }



                //回主页按钮
                Button btnMainMenu = bgRect.FindChild("BtnMainMenu").GetComponent <Button>();
                if (btnMainMenu)
                {
                    btnMainMenu.onClick.AddListener(OnMenuClicked);
                }

                Button btnNext = bgRect.FindChild("BtnNext").GetComponent <Button>();
                if (btnNext)
                {
                    btnNext.onClick.AddListener(OnBtnNextClicked);
                }

                if (record.gameType == global::GameType.Story)
                {
                    if (success)
                    {
                        CommonUtils.SetChildText(bgRect, "Title", "Level Success");
                        btnRestart.gameObject.SetActive(false);
                        btnNext.gameObject.SetActive(true);
                    }
                    else
                    {
                        CommonUtils.SetChildText(bgRect, "Title", "Level Failed");
                        btnRestart.gameObject.SetActive(true);
                        btnNext.gameObject.SetActive(false);
                    }
                }
                else
                {
                    btnRestart.gameObject.SetActive(true);
                    btnNext.gameObject.SetActive(false);
                }
            }
        }
    }