private IEnumerator deleteStarPerform(int starNum, int totalScore, int preScore, int curScore, StarSettlementView settlementView)
    {
        for (int i = starNum - 1; i >= 0; i--)
        {
            GameObject starObject = gameObject.transform.GetChild(i).gameObject;
            starObject.SetActive(false);
            totalScore = totalScore - preScore;
            totalScore = totalScore >= 0 ? totalScore : 0;
            //播放消失动画

            settlementView.UpdateScore(totalScore);
            if (totalScore > 0)
            {
                yield return(new WaitForSeconds(0.5f));
            }
        }
        UIManager.Instance.CloseView(settlementView.GetViewID());

        //更新当前分数
        EventManager.Instance.EventDispatcher.dispatchEvent <int, float, float>(EventEnum.FightUI_Update_LevelInfo, -1, -1, curScore);
        ChangeLevelView changeLevelView = UIManager.Instance.ShowView <ChangeLevelView>(UIType.Fight_ChangeLevelView);

        if (changeLevelView)
        {
            LevelInfoComponent levelInfo  = _context.levelInfo;
            IGameConfig        gameConfig = _context.gameConfig.config;
            if (levelInfo != null && gameConfig != null)
            {
                changeLevelView.Show(levelInfo.curScore >= levelInfo.targetScore, levelInfo.curLevelId >= gameConfig.GetLevelTotalNum());
            }
        }
    }
Esempio n. 2
0
    protected override void Execute(List <GameEntity> entities)
    {
        foreach (var e in entities)
        {
            int starNum = e.gainScore.starNum;
            int score   = 0;

            int step      = 3;
            int offScore  = 50;
            int baseScore = 100;

            while (starNum > 0)
            {
                int num = starNum > step ? step : starNum;
                starNum   = starNum - step;
                score     = score + num * baseScore;
                baseScore = baseScore + offScore;
            }

            LevelInfoComponent levelInfo = _contexts.game.levelInfo;
            _contexts.game.ReplaceLevelInfo(levelInfo.curLevelId, levelInfo.boardRow, levelInfo.boardCol, levelInfo.curScore + score, levelInfo.endTotalScore, levelInfo.endPreScore, levelInfo.targetScore);
            //更新UI
            EventManager.Instance.EventDispatcher.dispatchEvent <int, float, float>(EventEnum.FightUI_Update_LevelInfo, _contexts.game.levelInfo.curLevelId, _contexts.game.levelInfo.targetScore, _contexts.game.levelInfo.curScore);
        }
    }
Esempio n. 3
0
    private void Settlement()
    {
        LevelInfoComponent levelInfo = _contexts.game.levelInfo;
        int totalScore = levelInfo.endTotalScore;
        int preScore   = levelInfo.endPreScore;
        int starNum    = _contexts.game.getStarNum();
        int addScore   = totalScore - (starNum * preScore) > 0 ? totalScore - (starNum * preScore) : 0;

        _contexts.game.ReplaceLevelInfo(levelInfo.curLevelId, levelInfo.boardRow, levelInfo.boardCol, levelInfo.curScore + addScore, levelInfo.endTotalScore, levelInfo.endPreScore, levelInfo.targetScore);

        //通知UI表现
        //EventManager.Instance.EventDispatcher.dispatchEvent<int, float, float>(EventEnum.FightUI_Update_LevelInfo, _contexts.game.levelInfo.curLevelId, _contexts.game.levelInfo.targetScore, _contexts.game.levelInfo.curScore);
        EventManager.Instance.EventDispatcher.dispatchEvent <int, int, int, int>(EventEnum.FightUI_Settlement, starNum, totalScore, preScore, levelInfo.curScore);
    }