public StatisticsBallEntity(IMatch match, int index, BallMoveReport ballMoveReport)
        {
            Round = ballMoveReport.AsRound;
            var state = ballMoveReport.ClassId;

            if (ballMoveReport.ClassId == 2)
            {
                BallState = "长传";
            }
            else if (ballMoveReport.ClassId == 3)
            {
                BallState = "射进";
            }
            else
            {
                BallState = GetStateStr(ballMoveReport.StateData.State);
            }
            if (ballMoveReport.ClassId > 1)
            {
                for (int i = index; i < match.Report.BallResults.Count; i++)
                {
                    if (match.Report.BallResults[i].ClassId == state)
                    {
                        EndRound = match.Report.BallResults[i].AsRound;
                    }
                    else
                    {
                        return;
                    }
                }
            }
        }
        public BallMoveReport SaveRpt(IMatch match)
        {
            var state = CreateStateRpt(match);

            FillStateRpt(match, state);
            var rpt = new BallMoveReport();

            rpt.AsRound   = match.Status.Round;
            rpt.StateData = state;
            return(rpt);
        }
Beispiel #3
0
        /// <summary>
        /// Play a <see cref="FootballProcess"/>.
        /// 播放一个足球回合
        /// </summary>
        /// <param name="process"><see cref="IProcess"/></param>
        private void PlayFootballProcess(BallMoveReport process)
        {
            if (null == process)
            {
                return;
            }
            this.lblInterruption.Content = string.Empty;
            this.lblRound.Content        = _round.ToString() + '/' + _match.BallResults[_match.CntBallResults - 1].AsRound;

            #region 比分效果
            if (process.ClassId == ReportAsset.MatchStateAsset.CLASSIdGoal)
            {
                var goalState = process.StateData as GoalStateReport;
                if (null != goalState)
                {
                    this.lblSoccer.Content = goalState.HomeScore + ":" + goalState.AwayScore;
                }
            }
            #endregion

            #region 经理技能
            lblManagerName.Content = String.Empty;

            if (process.StateData.State == (int)Base.Enum.EnumMatchBreakState.SectionOpen)
            {
                lblInterruption.Content = "过场动画";
            }

            if (process.StateData.FoulState > 0)
            {
                lblInterruption.Content += "犯规";
            }
            #endregion

            #region 播放足球移动
            var    coordinate = process.StateData.Current;
            double x          = coordinate.X * RECTANGLE_SIZE - (double)RECTANGLE_SIZE / 2;
            double y          = coordinate.Y * RECTANGLE_SIZE - (double)RECTANGLE_SIZE / 2;

            _ball.ToolTip = string.Format("{0},{1}", coordinate.X, coordinate.Y);

            var doubleAnimationX = new DoubleAnimation();
            doubleAnimationX.From     = Convert.ToDouble(_ball.GetValue(Canvas.LeftProperty));
            doubleAnimationX.To       = x;
            doubleAnimationX.Duration = new Duration(TimeSpan.FromMilliseconds(Defines.Match.ROUND_TIME * 1000));

            Storyboard.SetTarget(doubleAnimationX, _ball);
            Storyboard.SetTargetProperty(doubleAnimationX, new PropertyPath("(Canvas.Left)"));

            var doubleAnimationY = new DoubleAnimation();
            doubleAnimationY.From     = Convert.ToDouble(_ball.GetValue(Canvas.TopProperty));
            doubleAnimationY.To       = y;
            doubleAnimationY.Duration = new Duration(TimeSpan.FromMilliseconds(Defines.Match.ROUND_TIME * 1000));

            Storyboard.SetTarget(doubleAnimationY, _ball);
            Storyboard.SetTargetProperty(doubleAnimationY, new PropertyPath("(Canvas.Top)"));

            var storyboard = new Storyboard();
            storyboard.Children.Add(doubleAnimationX);
            storyboard.Children.Add(doubleAnimationY);

            storyboard.Begin();
            #endregion
        }