Exemple #1
0
        public void RoundInit()
        {
            _status.MatchState = _football.IsInAir ? AirBallState.Instance : DefaultBallState.Instance;
            _status.GoalState  = false;
            _status.FoulState  = EnumMatchFoulState.None;
            _status.FoulPlayer = null;
            _status.Break(EnumMatchBreakState.None);
            _football.TurnFlag = false;
            short round      = _status.Round;
            int   minute     = MatchRule.ConvertRound2Minute(round, _status.TotalRound);
            int   sectionNo  = -1;
            bool  minuteFlag = false;

            if (round == 0)
            {
                sectionNo  = 0;
                minuteFlag = true;
            }
            else if (_status.Minute != minute)
            {
                minuteFlag = true;
                if (minute == 46)
                {
                    sectionNo = 1;
                }
            }
            if (sectionNo >= 0)
            {
                _status.SectionNo = sectionNo;
                HomeManager.SectionInit(sectionNo);
                AwayManager.SectionInit(sectionNo);
                SkillFacade.TriggerManagerSkills(HomeManager, 0);
                SkillFacade.TriggerManagerSkills(AwayManager, 0);
                foreach (var player in HomeManager.Players)
                {
                    SkillFacade.TriggerPlayerSkills(player, 0);
                }
                foreach (var player in AwayManager.Players)
                {
                    SkillFacade.TriggerPlayerSkills(player, 0);
                }
            }
            if (minuteFlag)
            {
                _status.Minute = (short)minute;
                HomeManager.MinuteInit();
                AwayManager.MinuteInit();
            }
            if (sectionNo >= 0)
            {
                _openSide = _openSide == Side.Home ? Side.Away : Side.Home;
                _status.Break(EnumMatchBreakState.SectionOpen);
                Openball(_openSide == Side.Home ? _homeManager : _awayManager);
            }
            if (null != _status.BallHandler && _status.BallHandler.Disable)
            {
                _status.IsNoBallHandler = true;
            }
            if (_status.IsNoBallHandler)
            {
                RefreshBallHandler();
            }
            if (HomeManager.IsAttackSide)
            {
                AwayManager.RoundInit();
                HomeManager.RoundInit();
            }
            else
            {
                HomeManager.RoundInit();
                AwayManager.RoundInit();
            }
        }