public Checkpoint(string checkpointNumber, DateTime checkpointTime,
                          string[] checkpointProcessIndicator,
                          string[] checkpointUpdateIndicator, string checkpointCheckMethodIndicator,
                          SimulatorBase checkpointTransferObject, CheckpointArgs checkpointTransferArgs,
                          string checkpointTypeIndicator, bool checkpointConstancy, bool checkpointCanBeSaved)
        {
            CheckpointNumber = checkpointNumber;
            CheckpointTime   = checkpointTime;

            CheckpointProcessIndicators = checkpointProcessIndicator;

            CheckpointUpdateIndicators     = checkpointUpdateIndicator;
            CheckpointCheckMethodIndicator = checkpointCheckMethodIndicator;
            CheckpointTransferObject       = checkpointTransferObject;

            CheckpointTransferArgs  = checkpointTransferArgs;
            CheckpointTypeIndicator = checkpointTypeIndicator;

            CheckpointIsConstant = checkpointConstancy;
            CheckpointCanBeSaved = checkpointCanBeSaved;

            _checkFinishMethod = (sender, args) => false;


            GenerateCheckpoint();
        }
        /// <summary>
        /// 从XElement中读取Checkpoint
        /// </summary>
        /// <param name="xe"></param>
        /// <param name="player"></param>
        /// <returns></returns>
        public static Checkpoint ReadCheckpointXml(XElement xe, Player.Player player)
        {
            var checkpointProcessIndicators =
                (from element in xe.Element("CheckpointProcessIndicators")
                 ?.Elements("CheckpointProcessIndicator")
                 select element.Attribute("target")?.Value).ToArray();

            var checkpointUpdateIndicators =
                (from element in xe.Element("CheckpointUpdateIndicators")
                 ?.Elements("CheckpointUpdateIndicator")
                 select element.Attribute("target")?.Value).ToArray();

            // var args =
            //     new
            //         CheckpointArgs(int.Parse(xe.Element("CheckpointTransferArgs")?.Element("CheckParm")?.FirstAttribute.Value
            //                               ?? throw new InvalidOperationException()),
            //                        int.Parse(xe.Element("CheckpointTransferArgs")?.Element("CheckParm")?.FirstAttribute.Value
            //                               ?? throw new InvalidOperationException()),
            //                        int.Parse(xe.Element("CheckpointTransferArgs")?.Element("UpdateSpeed")?.FirstAttribute.Value
            //                               ?? throw new InvalidOperationException())
            //                       );

            CheckpointArgs args = null;

            using (StringReader sr = new StringReader(xe.Element("CheckpointTransferArgs")?.Element("CheckpointArgs")?.ToString() ?? throw new InvalidOperationException()))
            {
                XmlSerializer serializer = new XmlSerializer(typeof(CheckpointArgs));
                args = serializer.Deserialize(sr) as CheckpointArgs;
            }


            SimulatorBase obj = null;

            switch (xe.Attribute("CheckpointTypeIndicator")?.Value)
            {
            case "Game":
                //TODO 这里Game的加载也不太行
                obj =
                    player.PlayerStudio.FindGame(xe.Attribute("CheckpointTransferObject")?.Value);
                if (((Game.Game)obj).GameIsDeveloping)
                {
                    ((Game.Game)obj).GameArt   = args.ArtParm;
                    ((Game.Game)obj).GameMusic = args.MusicParm;
                    ((Game.Game)obj).GameFun   = args.FunParm;
                }
                break;

            case "Staff":
                obj =
                    PageBase.FindStaff(xe.Attribute("CheckpointTransferObject")?.Value);
                break;

            case "Studio":
                // TODO 这里的Studio读取方式不行,要优化
                obj =
                    PageBase.FindStudio(xe.Attribute("CheckpointTransferObject")?.Value);
                break;
            }

            return(new
                   Checkpoint(xe.Attribute("CheckpointNumber")?.Value ?? throw new InvalidOperationException(),
                              DateTime.Parse(xe.Attribute("CheckpointTime")?.Value),
                              checkpointProcessIndicators,
                              checkpointUpdateIndicators,
                              xe.Attribute("CheckpointCheckMethodIndicator")?.Value,
                              obj,
                              args,
                              xe.Attribute("CheckpointTypeIndicator")?.Value,
                              bool.Parse(xe.Attribute("CheckpointConstancy")?.Value ?? throw new InvalidOperationException()),
                              true
                              ));
        }
 public bool CheckTimeAndProcess(object sender, CheckpointArgs args) =>
 args.UpdateParm >= 100 || SimulatorTimer.GameTimeNow >= CheckpointTime;