Beispiel #1
0
 /// <summary>
 /// Returns loader that can load the level into playing mode.
 /// </summary>
 /// <param name="levelRep">Presentation of the level for the user.</param>
 /// <param name="storedLevel">Stored serialized state of the level.</param>
 /// <param name="players">Data to initialize the players.</param>
 /// <param name="customSettings">Data to initialize the level logic instance plugin.</param>
 /// <param name="parentProgress">Progress watcher for the parent process.</param>
 /// <param name="loadingSubsectionSize">Size of this loading process as a part of the parent process.</param>
 /// <returns>Loader that can load the level into playing mode.</returns>
 public static ILevelLoader GetLoaderForPlaying(LevelRep levelRep,
                                                StLevel storedLevel,
                                                PlayerSpecification players,
                                                LevelLogicCustomSettings customSettings,
                                                IProgressEventWatcher parentProgress = null,
                                                double loadingSubsectionSize         = 100)
 {
     return(new SavedLevelPlayingLoader(levelRep, storedLevel, players, customSettings, parentProgress, loadingSubsectionSize));
 }
Beispiel #2
0
            /// <summary>
            /// Creates a loader that loads saved level into a playing mode.
            /// </summary>
            /// <param name="levelRep">Presentation part of the level.</param>
            /// <param name="storedLevel">Saved level.</param>
            /// <param name="players">Data for player initialization.</param>
            /// <param name="customSettings">Data for level logic initialization.</param>
            /// <param name="parentProgress">Progress watcher for the parent process.</param>
            /// <param name="loadingSubsectionSize">Size of this loading process as a part of the parent process.</param>
            public SavedLevelPlayingLoader(LevelRep levelRep,
                                           StLevel storedLevel,
                                           PlayerSpecification players,
                                           LevelLogicCustomSettings customSettings,
                                           IProgressEventWatcher parentProgress = null,
                                           double loadingSubsectionSize         = 100)
                : base(levelRep, storedLevel, false, parentProgress, loadingSubsectionSize)
            {
                this.players        = players;
                this.customSettings = customSettings;

                if ((players == PlayerSpecification.LoadFromSavedGame) !=
                    (customSettings == LevelLogicCustomSettings.LoadFromSavedGame))
                {
                    throw new
                          ArgumentException("Argument mismatch, one argument is loaded from save and the other is not");
                }
            }