public static void Init() { _GameMode = new CGameModeNormal(); _GameMode.Init(); _Player = new SPlayer[CSettings.MaxNumPlayer]; ResetPlayer(); }
public TankManager[] SpawnTankManagers(IGameMode gameMode) { int totalPlayers = m_NumHumans + m_NumAI; int totalTanks = (totalPlayers > MAX_TANKS) ? MAX_TANKS : totalPlayers; TankManager[] tanks = new TankManager[totalTanks]; for (int i = 0; i < tanks.Length; ++i) { float rotation = i * Mathf.PI * 2 / totalTanks; Vector2 direction = new Vector2(Mathf.Cos(rotation), Mathf.Sin(rotation)) * m_SpawnRadius; Vector3 spawnPosition = new Vector3(direction.y, 0f, direction.x); Quaternion spawnRotation = new Quaternion { eulerAngles = new Vector3(0f, Mathf.Rad2Deg * rotation, 0f) }; tanks[i] = new TankManager() { m_SpawnPosition = spawnPosition, m_SpawnRotation = spawnRotation, m_PlayerColor = COLORS[i], m_Instance = Instantiate(m_TankPrefab, spawnPosition, spawnRotation) as GameObject, m_PlayerNumber = i + 1, m_InputType = GetTankInputType(m_NumHumans--) }; tanks[i].Setup(); } return(tanks); }
/// <summary> /// A simple constructor that initializes the object with its dependencies. /// </summary> /// <param name="p_gmdGameMode">The current game mode.</param> /// <param name="p_eifEnvironmentInfo">The application's envrionment info.</param> /// <param name="p_booIsAutoCheck">Whether the check is automatic or user requested.</param> public UpdateTask(UpdateManager p_umUpdateManager, IGameMode p_gmdGameMode, IEnvironmentInfo p_eifEnvironmentInfo, bool p_booIsAutoCheck) { m_booIsAutoCheck = p_booIsAutoCheck; GameMode = p_gmdGameMode; EnvironmentInfo = p_eifEnvironmentInfo; UpdateManager = p_umUpdateManager; }
/// <summary> /// Initializes the singleton intances of the mod manager. /// </summary> /// <param name="p_gmdGameMode">The current game mode.</param> /// <param name="p_eifEnvironmentInfo">The application's envrionment info.</param> /// <param name="p_mrpModRepository">The mod repository from which to get mods and mod metadata.</param> /// <param name="p_dmrMonitor">The download monitor to use to track task progress.</param> /// <param name="p_frgFormatRegistry">The <see cref="IModFormatRegistry"/> that contains the list /// of supported <see cref="IModFormat"/>s.</param> /// <param name="p_mrgModRegistry">The <see cref="ModRegistry"/> that contains the list /// of managed <see cref="IMod"/>s.</param> /// <param name="p_futFileUtility">The file utility class.</param> /// <param name="p_scxUIContext">The <see cref="SynchronizationContext"/> to use to marshall UI interactions to the UI thread.</param> /// <param name="p_ilgInstallLog">The install log tracking mod activations for the current game mode.</param> /// <param name="p_pmgPluginManager">The plugin manager to use to work with plugins.</param> /// <returns>The initialized mod manager.</returns> /// <exception cref="InvalidOperationException">Thrown if the mod manager has already /// been initialized.</exception> public static ModManager Initialize(IGameMode p_gmdGameMode, IEnvironmentInfo p_eifEnvironmentInfo, IModRepository p_mrpModRepository, DownloadMonitor p_dmrMonitor, ActivateModsMonitor p_ammMonitor, IModFormatRegistry p_frgFormatRegistry, ModRegistry p_mrgModRegistry, FileUtil p_futFileUtility, SynchronizationContext p_scxUIContext, IInstallLog p_ilgInstallLog, IPluginManager p_pmgPluginManager) { if (m_mmgCurrent != null) throw new InvalidOperationException("The Mod Manager has already been initialized."); m_mmgCurrent = new ModManager(p_gmdGameMode, p_eifEnvironmentInfo, p_mrpModRepository, p_dmrMonitor, p_ammMonitor, p_frgFormatRegistry, p_mrgModRegistry, p_futFileUtility, p_scxUIContext, p_ilgInstallLog, p_pmgPluginManager); return m_mmgCurrent; }
/// <summary> /// A simple constructor that initializes the object with the given values. /// </summary> /// <param name="p_modMod">The mod being installed.</param> /// <param name="p_gmdGameMode">The game mode currently bieng managed.</param> /// <param name="p_pmgPluginManager">The plugin manager.</param> /// <param name="p_eifEnvironmentInfo">The application's envrionment info.</param> public ConditionStateManager(IMod p_modMod, IGameMode p_gmdGameMode, IPluginManager p_pmgPluginManager, IEnvironmentInfo p_eifEnvironmentInfo) { Mod = p_modMod; GameMode = p_gmdGameMode; PluginManager = p_pmgPluginManager; EnvironmentInfo = p_eifEnvironmentInfo; }
/// <summary> /// A simple constructor that initializes the object with the given dependencies. /// </summary> /// <param name="p_eifEnvironmentInfo">The application's envrionment info.</param> public SupportedToolsSettingsGroup(IEnvironmentInfo p_eifEnvironmentInfo, IGameMode p_gmGameMode) : base(p_eifEnvironmentInfo) { EnvironmentInfo = p_eifEnvironmentInfo; GameModeDescriptor = p_gmGameMode; Errors = new ErrorContainer(); }
public void Init(int map_id, long match_id, int player_count) { // 이전에 등록했던 시작 이벤트 초기화 OnStart = null; // 게임 시작 이벤트 등록 foreach (var gameObject in World.Instance(WorldId).GetGameObjects()) { if (gameObject.GetClassId() == (byte)GameObjectClassId.Trap) { RegisterStartEvent(((Trap)gameObject).OnStart); } else if (gameObject.GetClassId() == (byte)GameObjectClassId.TreasureBox) { RegisterStartEvent(((TreasureBox)gameObject).OnStart); } else if (gameObject.GetClassId() == (byte)GameObjectClassId.Train) { RegisterStartEvent(((Train)gameObject).OnStart); } } mMapData = ACDC.MapData[map_id]; mGameModeData = ACDC.GameModeData[mMapData.GameMode]; game_mode = CreateGameMode((GameModeType)mGameModeData.ID); mMatchId = match_id; StartTime = Timing.sInstance.GetFrameStartTime(); state = GameModeState.Init; InitTime = Timing.sInstance.GetFrameStartTime(); ReservedPlayerCount = player_count; }
/// <summary> /// A simple constructor that initializes the object with the given dependencies. /// </summary> /// <param name="p_eifEnvironmentInfo">The application's envrionment info.</param> /// <param name="p_gmrInstalledGames">The registry of insalled games.</param> /// <param name="p_gmdGameMode">The game mode currently being managed.</param> /// <param name="p_mrpModRepository">The repository we are logging in to.</param> /// <param name="p_dmtMonitor">The download monitor to use to track task progress.</param> /// <param name="p_umgUpdateManager">The update manager to use to perform updates.</param> /// <param name="p_mmgModManager">The <see cref="ModManager"/> to use to manage mods.</param> /// <param name="p_pmgPluginManager">The <see cref="PluginManager"/> to use to manage plugins.</param> public MainFormVM(IEnvironmentInfo p_eifEnvironmentInfo, GameModeRegistry p_gmrInstalledGames, IGameMode p_gmdGameMode, IModRepository p_mrpModRepository, DownloadMonitor p_dmtMonitor, ActivateModsMonitor p_ammMonitor, UpdateManager p_umgUpdateManager, ModManager p_mmgModManager, IPluginManager p_pmgPluginManager) { EnvironmentInfo = p_eifEnvironmentInfo; GameMode = p_gmdGameMode; GameMode.GameLauncher.GameLaunching += new CancelEventHandler(GameLauncher_GameLaunching); ModManager = p_mmgModManager; ModRepository = p_mrpModRepository; UpdateManager = p_umgUpdateManager; ModManagerVM = new ModManagerVM(p_mmgModManager, p_eifEnvironmentInfo.Settings, p_gmdGameMode.ModeTheme); if (GameMode.UsesPlugins) { PluginManagerVM = new PluginManagerVM(p_pmgPluginManager, p_eifEnvironmentInfo.Settings, p_gmdGameMode); } DownloadMonitorVM = new DownloadMonitorVM(p_dmtMonitor, p_eifEnvironmentInfo.Settings, p_mmgModManager, p_mrpModRepository); ActivateModsMonitorVM = new ActivateModsMonitorVM(p_ammMonitor, p_eifEnvironmentInfo.Settings, p_mmgModManager); HelpInfo = new HelpInformation(p_eifEnvironmentInfo); GeneralSettingsGroup gsgGeneralSettings = new GeneralSettingsGroup(p_eifEnvironmentInfo); foreach (IModFormat mftFormat in p_mmgModManager.ModFormats) { gsgGeneralSettings.AddFileAssociation(mftFormat.Extension, mftFormat.Name); } ModOptionsSettingsGroup mosModOptions = new ModOptionsSettingsGroup(p_eifEnvironmentInfo); List <ISettingsGroupView> lstSettingGroups = new List <ISettingsGroupView>(); lstSettingGroups.Add(new GeneralSettingsPage(gsgGeneralSettings)); lstSettingGroups.Add(new ModOptionsPage(mosModOptions)); DownloadSettingsGroup dsgDownloadSettings = new DownloadSettingsGroup(p_eifEnvironmentInfo, ModRepository); lstSettingGroups.Add(new DownloadSettingsPage(dsgDownloadSettings)); if (p_gmdGameMode.SettingsGroupViews != null) { lstSettingGroups.AddRange(p_gmdGameMode.SettingsGroupViews); } SettingsFormVM = new SettingsFormVM(p_gmdGameMode, p_eifEnvironmentInfo, lstSettingGroups); UpdateCommand = new Command("Update", String.Format("Update {0}", EnvironmentInfo.Settings.ModManagerName), UpdateProgramme); LogoutCommand = new Command("Logout", "Logout", Logout); List <Command> lstChangeGameModeCommands = new List <Command>(); List <IGameModeDescriptor> lstSortedModes = new List <IGameModeDescriptor>(p_gmrInstalledGames.RegisteredGameModes); lstSortedModes.Sort((x, y) => x.Name.CompareTo(y.Name)); foreach (IGameModeDescriptor gmdInstalledGame in lstSortedModes) { string strId = gmdInstalledGame.ModeId; string strName = gmdInstalledGame.Name; string strDescription = String.Format("Change game to {0}", gmdInstalledGame.Name); Image imgCommandIcon = new Icon(gmdInstalledGame.ModeTheme.Icon, 32, 32).ToBitmap(); lstChangeGameModeCommands.Add(new Command(strId, strName, strDescription, imgCommandIcon, () => ChangeGameMode(strId), true)); } lstChangeGameModeCommands.Add(new Command("Change Default Game...", "Change Default Game", () => ChangeGameMode(CHANGE_DEFAULT_GAME_MODE))); lstChangeGameModeCommands.Add(new Command("Rescan Installed Games...", "Rescan Installed Games", () => ChangeGameMode(RESCAN_INSTALLED_GAMES))); ChangeGameModeCommands = lstChangeGameModeCommands; }
/// <summary> /// Initializes the singleton intances of the mod manager. /// </summary> /// <param name="p_gmdGameMode">The current game mode.</param> /// <param name="p_mprManagedPluginRegistry">The <see cref="PluginRegistry"/> that contains the list /// of managed <see cref="Plugin"/>s.</param> /// <param name="p_aplPluginLog">The <see cref="ActivePluginLog"/> tracking plugin activations for the /// current game mode.</param> /// <param name="p_polOrderLog">The <see cref="IPluginOrderLog"/> tracking plugin order for the /// current game mode.</param> /// <param name="p_povOrderValidator">The object that validates plugin order.</param> /// <exception cref="InvalidOperationException">Thrown if the plugin manager has already /// been initialized.</exception> public static IPluginManager Initialize(IGameMode p_gmdGameMode, PluginRegistry p_mprManagedPluginRegistry, ActivePluginLog p_aplPluginLog, IPluginOrderLog p_polOrderLog, IPluginOrderValidator p_povOrderValidator) { if (m_pmgCurrent != null) throw new InvalidOperationException("The Plugin Manager has already been initialized."); m_pmgCurrent = new PluginManager(p_gmdGameMode, p_mprManagedPluginRegistry, p_aplPluginLog, p_polOrderLog, p_povOrderValidator); return m_pmgCurrent; }
void Awake() { instance = this; // only have one gamemode for now _currentGameMode = GetComponent <GameModeLastMan>(); }
private void Awake() { playerManager = pch.PlayerManager; boardManager = pch.BoardManager; gameMode = pch.GameMode; ai = pch.ai; }
/// <summary> /// A simple constructor that initializes the object with the given values. /// </summary> /// <param name="p_gmdGameMode">The game mode currently being managed.</param> /// <param name="p_eifEnvironmentInfo">The application's envrionment info.</param> /// <param name="p_csfFunctions">The proxy providing the implementations of the functions available to the C# script.</param> /// <param name="p_tpeBaseScriptType">The type of the base script from which all C# scripts should derive.</param> public CSharpScriptExecutor(IGameMode p_gmdGameMode, IEnvironmentInfo p_eifEnvironmentInfo, CSharpScriptFunctionProxy p_csfFunctions, Type p_tpeBaseScriptType) { m_gmdGameMode = p_gmdGameMode; m_eifEnvironmentInfo = p_eifEnvironmentInfo; m_csfFunctions = p_csfFunctions; BaseScriptType = p_tpeBaseScriptType; }
public void Push(IGameMode gameMode) { if (!_isChanging) { StartCoroutine(ChangeGameMode(gameMode)); } }
private void PrintLoadedMainMenu(IEnumerable <Type> gameModes) { Console.Clear(); Console.WriteLine("Select Game Mode:"); Console.WriteLine("------------------"); Type[] gameModeArray = gameModes.ToArray(); for (int i = 0; i < gameModeArray.Length; i++) { Type t = gameModeArray[i]; Console.WriteLine($"{i}) {t.Name} - {GetDescriptionAttributeText(t)}"); } // use the array indexes for input selection, saves us a switch char key = Console.ReadKey().KeyChar; if (int.TryParse(key.ToString(), out int selection)) { if (selection >= gameModeArray.Length) { return; } // Clear console when game mode is selected Console.Clear(); // Create instance of the game mode and run it IGameMode gameMode = Activator.CreateInstance(gameModeArray[selection]) as IGameMode; gameMode.Run(); Console.ReadKey(); } }
private async void OnSceneLoaded(EventArgs arg) { FSceneLoadedEventArg eventArg = (FSceneLoadedEventArg)arg; CLevelConfiguration metadata = FindObjectOfType <CLevelConfiguration>(); if (metadata == null) { FLog.Warning(CLASS_TYPE.Name, $"Cannot find scene metadata `S{eventArg.Scene.name}`"); } else if (metadata.GameMode == null) { FLog.Warning(CLASS_TYPE.Name, $"GameMode is not sat for this level."); } else { _currentGameMode = Activator.CreateInstance(metadata.GameMode.Type) as IGameMode; await _currentGameMode?.PreInitializeAsync(); await _currentGameMode?.InitializeAsync(); await _currentGameMode?.BeginPlayAsync(); FEventManager.Publish(FEventManager.ON_GAME_MODE_LOADED); } }
private IEnumerator ChangeGameMode(IGameMode mode) { _isChanging = true; if (_modes.Count > 0) { yield return(ScreenFade.FadeIn()); _dataSystem.SaveAllDataInternal(); _currentGameMode.OnExit(); yield return(_sceneSystem.UnloadAllScenes()); } if (mode != null) { _modes.Push(mode); } else { _modes.Pop(); } yield return(_sceneSystem.LoadScene(_currentGameMode.SceneName)); _dataSystem.LoadAllDataInternal(); _currentGameMode.OnEnter(); yield return(ScreenFade.FadeOut()); _isChanging = false; }
protected virtual void CreateInLevelManagers() { Singleton <RuntimeIDManager> .Create(); Singleton <StageManager> .Create(); Singleton <AvatarManager> .Create(); Singleton <CameraManager> .Create(); Singleton <MonsterManager> .Create(); Singleton <PropObjectManager> .Create(); Singleton <DynamicObjectManager> .Create(); Singleton <EventManager> .Create(); Singleton <LevelDesignManager> .Create(); Singleton <AuxObjectManager> .Create(); Singleton <DetourManager> .Create(); Singleton <ShaderDataManager> .Create(); Singleton <CinemaDataManager> .Create(); this.gameMode = new OriginalSPGameMode(); }
/// <summary> /// A simple constructor that initializes the object with the given values. /// </summary> /// <param name="p_gmdGameMode">The game mode currently being managed.</param> /// <param name="p_eifEnvironmentInfo">The application's envrionment info.</param> /// <param name="p_msfFunctions">The proxy providing the implementations of the functions available to the mod script script.</param> public ModScriptExecutor(IGameMode p_gmdGameMode, IEnvironmentInfo p_eifEnvironmentInfo, ModScriptFunctionProxy p_msfFunctions, string p_strVirtualActivatorPath) { m_gmdGameMode = p_gmdGameMode; m_eifEnvironmentInfo = p_eifEnvironmentInfo; m_msfFunctions = p_msfFunctions; m_strVirtualActivatorPath = p_strVirtualActivatorPath; }
private void Awake() { cameraTransition = new CameraTransitionBehaviour(GameManager.Instance.MainCamera, GameManager.Instance.Table, Vector3.zero, Quaternion.identity); gameMode = GameManager.Instance.gameMode; this.enabled = false; }
/// <summary> /// A simple constructor that initializes the object with the required dependencies. /// </summary> /// <param name="p_modMod">The mod for which the script is running.</param> /// <param name="p_gmdGameMode">The game mode currently being managed.</param> /// <param name="p_igpInstallers">The utility class to use to install the mod items.</param> public XmlScriptInstaller(IMod p_modMod, IGameMode p_gmdGameMode, InstallerGroup p_igpInstallers, IVirtualModActivator p_ivaVirtualModActivator) { Mod = p_modMod; GameMode = p_gmdGameMode; Installers = p_igpInstallers; m_ivaVirtualModActivator = p_ivaVirtualModActivator; m_mliModLinkInstaller = m_ivaVirtualModActivator.GetModLinkInstaller(); }
/// <summary> /// A simple constructor that initializes the object with the given values. /// </summary> /// <param name="p_gmdGameMode">The game mode currently being managed.</param> /// <param name="p_eifEnvironmentInfo">The application's envrionment info.</param> /// <param name="p_csfFunctions">The proxy providing the implementations of the functions available to the C# script.</param> /// <param name="p_tpeBaseScriptType">The type of the base script from which all C# scripts should derive.</param> /// <param name="p_strVirtualActivatorFolder">The virtual mod activator's folder.</param> public CSharpScriptExecutor(IGameMode p_gmdGameMode, IEnvironmentInfo p_eifEnvironmentInfo, CSharpScriptFunctionProxy p_csfFunctions, Type p_tpeBaseScriptType, string p_strVirtualActivatorFolder) { m_gmdGameMode = p_gmdGameMode; m_eifEnvironmentInfo = p_eifEnvironmentInfo; m_csfFunctions = p_csfFunctions; BaseScriptType = p_tpeBaseScriptType; m_strVirtualActivatorPath = p_strVirtualActivatorFolder; }
public void Setup(PlayerController controller, IGameMode gameMode) { this.controller = controller; this.gameMode = gameMode; setup = true; trail.material = ColorManager.Instance.GetPlayerMaterial(controller.PlayerNumber, ColorManager.PlayerColorVarient.UI_PRIMARY_ACTIVE); }
public void Dispose() { _onFinish = null; _mode = null; _map.Dispose(); CommandHandler.Dispose(); _cycleManager.Dispose(); }
/// <summary> /// A simple constructor that initializes the object with the given values. /// </summary> /// <param name="p_modMod">The mod for which the script is running.</param> /// <param name="p_gmdGameMode">The game mode currently being managed.</param> /// <param name="p_eifEnvironmentInfo">The application's envrionment info.</param> /// <param name="p_igpInstallers">The utility class to use to install the mod items.</param> /// <param name="p_uipUIProxy">The UI manager to use to interact with UI elements.</param> public ScriptFunctionProxy(IMod p_modMod, IGameMode p_gmdGameMode, IEnvironmentInfo p_eifEnvironmentInfo, InstallerGroup p_igpInstallers, UIUtil p_uipUIProxy) { Mod = p_modMod; GameMode = p_gmdGameMode; EnvironmentInfo = p_eifEnvironmentInfo; Installers = p_igpInstallers; UIManager = p_uipUIProxy; }
/// <summary> /// Creates a mod from the specified file. /// </summary> /// <remarks> /// The specified file must be in the current format. /// </remarks> /// <param name="p_strPath">The path of the file from which to create an <see cref="IMod"/>.</param> /// <param name="p_gmdGameMode">The game mode creating the mod.</param> /// <returns>A mod from the specified file.</returns> public IMod CreateMod(string p_strPath, IGameMode p_gmdGameMode) { if (CheckFormatCompliance(p_strPath) <= FormatConfidence.Convertible) { throw new ModFormatException(this); } return(new OMod(p_strPath, this, ModCacheManager, IScriptTypeRegistry)); }
public MatchManager(IGameMode gameMode) { ColorTurn = PlayerColor.White; Board = new Board(); GameMode = gameMode; Init(); }
public TypeObservable <int> GetModeEndObservable(IGameMode gameMode) { if (!this.modeEndObservableDictionary.ContainsKey(gameMode)) { this.modeEndObservableDictionary.Add(gameMode, new TypeObservable <int>()); } return(this.modeEndObservableDictionary[gameMode]); }
private void ChangeModeWithHistory(IGameMode gameMode) { if (this.currentGameMode != null) { this.gameModeHistory.Push(this.currentGameMode); } ChangeMode(gameMode); }
/// <summary> /// A simple constructor that initializes the object with the required dependencies. /// </summary> /// <param name="p_modMod">The mod for which the script is running.</param> /// <param name="p_gmdGameMode">The game mode currently being managed.</param> /// <param name="p_eifEnvironmentInfo">The application's envrionment info.</param> /// <param name="p_igpInstallers">The utility class to use to install the mod items.</param> /// <param name="p_scxUIContext">The <see cref="SynchronizationContext"/> to use to marshall UI interactions to the UI thread.</param> public XmlScriptExecutor(IMod p_modMod, IGameMode p_gmdGameMode, IEnvironmentInfo p_eifEnvironmentInfo, InstallerGroup p_igpInstallers, SynchronizationContext p_scxUIContext) { m_scxSyncContext = p_scxUIContext; Mod = p_modMod; GameMode = p_gmdGameMode; EnvironmentInfo = p_eifEnvironmentInfo; Installers = p_igpInstallers; }
public static void StartGame(IGameMode g) { staticTimer.SetActive(true); staticScore.SetActive(true); game = g; //game = gameObject.AddComponent<game.GetType>(); g.StartPlaying(); }
/// <summary> /// A simple constructor that initializes the object with the given values. /// </summary> /// <param name="p_modMod">The mod being installed.</param> /// <param name="p_igpInstallers">The utility class to use to install the mod items.</param> /// <param name="p_ilgModInstallLog">The install log that tracks mod install info /// for the current game mode</param> /// <param name="p_gmdGameMode">The the current game mode.</param> /// <param name="p_rolActiveMods">The list of active mods.</param> public BasicUninstallTask(IMod p_modMod, InstallerGroup p_igpInstallers, IInstallLog p_ilgModInstallLog, IGameMode p_gmdGameMode, ReadOnlyObservableList <IMod> p_rolActiveMods) { Mod = p_modMod; Installers = p_igpInstallers; ModInstallLog = p_ilgModInstallLog; GameMode = p_gmdGameMode; ActiveMods = p_rolActiveMods; }
/// <summary> /// A simple constructor that initializes the object with the given values. /// </summary> /// <param name="p_modMod">The mod being installed.</param> /// <param name="p_igpInstallers">The utility class to use to install the mod items.</param> /// <param name="p_ilgModInstallLog">The install log that tracks mod install info /// for the current game mode</param> /// <param name="p_gmdGameMode">The the current game mode.</param> /// <param name="p_rolActiveMods">The list of active mods.</param> public BasicUninstallTask(IMod p_modMod, InstallerGroup p_igpInstallers, IInstallLog p_ilgModInstallLog, IGameMode p_gmdGameMode, ReadOnlyObservableList<IMod> p_rolActiveMods) { Mod = p_modMod; Installers = p_igpInstallers; ModInstallLog = p_ilgModInstallLog; GameMode = p_gmdGameMode; ActiveMods = p_rolActiveMods; }
protected void _StartMode(OpData opData) { IGameMode nextMode = _factory.Create(opData.NextModeId); _modeDataStack.Push(new ModeData(opData.NextModeId, nextMode)); nextMode.Setup(this, _gameInst); nextMode.Start(opData.NextParam); }
/// <summary> /// A simple constructor that initializes the object with the given values. /// </summary> /// <param name="p_modMod">The mod being installed.</param> /// <param name="p_gmdGameMode">The the current game mode.</param> /// <param name="p_mfiFileInstaller">The file installer to use.</param> /// <param name="p_pmgPluginManager">The plugin manager.</param> /// <param name="p_booSkipReadme">Whether to skip the installation of readme files.</param> /// <param name="p_rolActiveMods">The list of active mods.</param> public BasicInstallTask(IMod p_modMod, IGameMode p_gmdGameMode, IModFileInstaller p_mfiFileInstaller, IPluginManager p_pmgPluginManager, bool p_booSkipReadme, ReadOnlyObservableList<IMod> p_rolActiveMods) { Mod = p_modMod; GameMode = p_gmdGameMode; FileInstaller = p_mfiFileInstaller; PluginManager = p_pmgPluginManager; SkipReadme = p_booSkipReadme; ActiveMods = p_rolActiveMods; }
public Match Create(IEnumerable<User> players, IGameMode mode) { long matchID = Interlocked.Increment(ref _matchIDs); Match match = new Match(players, mode, matchID); _matches.TryAdd(matchID, match); return match; }
/// <summary> /// A simple constructor that initializes the factory with the required dependencies. /// </summary> /// <param name="p_gmdGameMode">The game mode for which the created installer will be installing mods.</param> /// <param name="p_eifEnvironmentInfo">The application's envrionment info.</param> /// <param name="p_futFileUtility">The file utility class.</param> /// <param name="p_scxUIContext">The <see cref="SynchronizationContext"/> to use to marshall UI interactions to the UI thread.</param> /// <param name="p_ilgInstallLog">The install log that tracks mod install info /// for the current game mode.</param> /// <param name="p_pmgPluginManager">The plugin manager to use to work with plugins.</param> public ModInstallerFactory(IGameMode p_gmdGameMode, IEnvironmentInfo p_eifEnvironmentInfo, FileUtil p_futFileUtility, SynchronizationContext p_scxUIContext, IInstallLog p_ilgInstallLog, IPluginManager p_pmgPluginManager, ModManager p_mmModManager) { m_gmdGameMode = p_gmdGameMode; m_eifEnvironmentInfo = p_eifEnvironmentInfo; m_futFileUtility = p_futFileUtility; m_scxUIContext = p_scxUIContext; m_ilgInstallLog = p_ilgInstallLog; m_pmgPluginManager = p_pmgPluginManager; m_mmModManager = p_mmModManager; }
/// <summary> /// Creates a new console menu handler /// </summary> /// <param name="inputProvider">Input provider</param> /// <param name="renderer">Renderer</param> /// <param name="menuItems">Menu items</param> /// <param name="menuTop">Menu rendering top row</param> /// <param name="menuLeft">Menu rendering left col</param> public ConsoleMenuHandler(IConsoleInputProvider inputProvider, IConsoleRenderer renderer, IEnumerable<IGameMode> menuItems, int menuTop, int menuLeft) { this.inputProvider = inputProvider; this.renderer = renderer; this.currentSelection = new BeginnerMode(); this.menuItems = menuItems; this.menuBodyTop = menuTop + RenderersConstants.MenuTitleRowsCount; this.menuBodyLeft = menuLeft; this.selectionCharTop = menuTop + RenderersConstants.MenuTitleRowsCount; this.selectionCharLeft = this.menuBodyLeft; }
public SplashMode( string imageFilename, double secondsDisplayed, IGameMode nextMode) { // Save the properties this.imageFilename = imageFilename; this.secondsDisplayed = secondsDisplayed; this.secondsRemaining = secondsDisplayed; this.nextMode = nextMode; }
/// <summary> /// Creates a mod of the appropriate type from the specified file. /// Code copy&pasted from class ModRegistry /// </summary> /// <param name="p_strModPath">The path to the mod file.</param> /// <returns>A mod of the appropriate type from the specified file, if the type of hte mod /// can be determined; <c>null</c> otherwise.</returns> private static IMod CreateMod(string modPath, IModFormatRegistry formatRegistry, IGameMode gameMode) { List<KeyValuePair<FormatConfidence, IModFormat>> lstFormats = new List<KeyValuePair<FormatConfidence, IModFormat>>(); foreach (IModFormat mftFormat in formatRegistry.Formats) lstFormats.Add(new KeyValuePair<FormatConfidence, IModFormat>(mftFormat.CheckFormatCompliance(modPath), mftFormat)); lstFormats.Sort((x, y) => -x.Key.CompareTo(y.Key)); if (lstFormats[0].Key <= FormatConfidence.Convertible) { Console.WriteLine("failed to determine format for " + modPath); return null; } return lstFormats[0].Value.CreateMod(modPath, gameMode); }
public Match(IEnumerable<User> players, IGameMode mode, long id) { _players = new List<User>(players); _mode = mode; ID = id; State = MatchState.Ready; foreach (User player in _players) { player.CurrentMatch = this; } _broadcastHandler = new BroadcastHandler(id, players); _loadingHandler = new MatchLoadingHandler(players, initializeGame); }
/// <summary> /// Constructs a text display mode with a given embedded /// resource. /// </summary> public TextScrollGameMode(string path, IGameMode nextMode) { // Save the next mode this.next = nextMode; // Process the assembly manifest and convert it into the // scrolling structure with the various line encoding. Assembly assembly = GetType().Assembly; using (Stream s = assembly.GetManifestResourceStream(path)) { // Wrap in a stream reader StreamReader sr = new StreamReader(s); // Go through the lines string line = null; while ((line = sr.ReadLine()) != null) { // Create the line TextScrollLine tsl = new TextScrollLine(); // Check for header flags if (line.StartsWith("=1 ")) { tsl.LineType = LineType.Heading1; tsl.Line = line.Substring(3); } else if (line.StartsWith("=2 ")) { tsl.LineType = LineType.Heading1; tsl.Line = line.Substring(3); } else if (line.StartsWith("=3 ")) { tsl.LineType = LineType.Heading3; tsl.Line = line.Substring(3); } else { tsl.Line = line; } // Add the line lines.Add(tsl); } } }
public DummyPluginManager(string pluginsFile, IGameMode gameMode, IMod mod) { StreamReader reader = new StreamReader(pluginsFile); string installationPath = Path.Combine(gameMode.GameModeEnvironmentInfo.InstallationPath, gameMode.GetModFormatAdjustedPath(mod.Format, null, false)); string line; while ((line = reader.ReadLine()) != null) { if (line[0] != '#') { m_Plugins.Add(new Plugin(Path.Combine(installationPath, line.ToLower()), line, null)); } } ((INotifyCollectionChanged)m_Plugins).CollectionChanged += new NotifyCollectionChangedEventHandler(ActivePlugins_CollectionChanged); m_ROOLPlugins = new ReadOnlyObservableList<Plugin>(m_Plugins); }
public void Dispose() { _players.Clear(); _players = null; _mode = null; Game.Dispose(); Game = null; _broadcastHandler.Dispose(); _loadingHandler.Dispose(); foreach (User player in _players) { player.CurrentMatch = this; } }
public Game(IEnumerable<User> players, IGameMode mode, BroadcastHandler broadcastHandler, Action onFinish) { _mode = mode; _gameConfiguration = _mode.GetConfiguration(); _broadcastHandler = broadcastHandler; _map = new Map(_gameConfiguration.MapConfig); var cycleDictionary = createCycles(players); _onFinish = onFinish; _cycleManager = new CycleManager(cycleDictionary); _map.RegisterCycles(cycleDictionary); _broadcastHandler.RegisterCycles(cycleDictionary); CommandHandler = new CommandHandler(cycleDictionary); }
/// <summary> /// Searches for script type assemblies in the specified path, and loads /// any script types that are found into a registry. /// </summary> /// <remarks> /// A script type is loaded if the class implements <see cref="IScriptType"/> and is /// not abstract. Once loaded, the type is added to the registry. /// </remarks> /// <param name="p_strSearchPath">The path in which to search for script type assemblies.</param> /// <param name="p_gmdGameMode">The current game mode.</param> /// <returns>A registry containing all of the discovered script types.</returns> public static IScriptTypeRegistry DiscoverScriptTypes(string p_strSearchPath, IGameMode p_gmdGameMode) { Trace.TraceInformation("Discovering Script Types..."); Trace.Indent(); Trace.TraceInformation("Discovering Generic Script Types..."); Trace.Indent(); Trace.TraceInformation("Looking in: {0}", p_strSearchPath); IScriptTypeRegistry stgRegistry = new ScriptTypeRegistry(); if (!Directory.Exists(p_strSearchPath)) { Trace.TraceError("Script Type search path does not exist."); Trace.Unindent(); Trace.Unindent(); return stgRegistry; } string[] strAssemblies = Directory.GetFiles(p_strSearchPath, "*.dll"); RegisterScriptTypes(stgRegistry, strAssemblies); Trace.Unindent(); Trace.TraceInformation("Discovering Game Mode Specific Script Types..."); Trace.Indent(); string strGameModeSearchPath = Path.GetDirectoryName(Assembly.GetAssembly(p_gmdGameMode.GetType()).Location); Trace.TraceInformation("Looking in: {0}", strGameModeSearchPath); if (!Directory.Exists(strGameModeSearchPath)) { Trace.TraceError("Game Mode Specific Script Type search path does not exist."); Trace.Unindent(); Trace.Unindent(); return stgRegistry; } List<string> lstAssemblies = new List<string>(); foreach (IScriptType stpType in stgRegistry.Types) lstAssemblies.AddRange(Directory.GetFiles(strGameModeSearchPath, String.Format("{0}.{1}.dll", p_gmdGameMode.ModeId, stpType.TypeId))); RegisterScriptTypes(stgRegistry, lstAssemblies); Trace.Unindent(); Trace.Unindent(); return stgRegistry; }
/// <summary> /// Creates a <see cref="ConditionStateManager"/> to use when running an XML script. /// </summary> /// <param name="p_modMod">The mod being installed.</param> /// <param name="p_gmdGameMode">The game mode currently bieng managed.</param> /// <param name="p_pmgPluginManager">The plugin manager.</param> /// <param name="p_eifEnvironmentInfo">The application's envrionment info.</param> /// <returns>A <see cref="ConditionStateManager"/> to use when running an XML script.</returns> public override ConditionStateManager CreateConditionStateManager(IMod p_modMod, IGameMode p_gmdGameMode, IPluginManager p_pmgPluginManager, IEnvironmentInfo p_eifEnvironmentInfo) { return new SkyrimConditionStateManager(p_modMod, p_gmdGameMode, p_pmgPluginManager, p_eifEnvironmentInfo); }
/// <summary> /// Returns a proxy that implements the functions available to C# scripts. /// </summary> /// <param name="p_modMod">The mod being installed.</param> /// <param name="p_gmdGameMode">The game mode currently bieng managed.</param> /// <param name="p_eifEnvironmentInfo">The application's envrionment info.</param> /// <param name="p_igpInstallers">The utility class to use to install the mod items.</param> /// <param name="p_scxUIContext">The <see cref="SynchronizationContext"/> to use to marshall UI interactions to the UI thread.</param> /// <returns>A proxy that implements the functions available to C# scripts.</returns> protected override CSharpScriptFunctionProxy GetScriptFunctionProxy(IMod p_modMod, IGameMode p_gmdGameMode, IEnvironmentInfo p_eifEnvironmentInfo, InstallerGroup p_igpInstallers, SynchronizationContext p_scxUIContext) { BsaManager bmgBsaManager = new BsaManager((SkyrimGameMode)p_gmdGameMode); UIUtil uitUiUtilities = new UIUtil(p_gmdGameMode, p_eifEnvironmentInfo, p_scxUIContext); return new SkyrimCSharpScriptFunctionProxy(p_modMod, p_gmdGameMode, p_eifEnvironmentInfo, p_igpInstallers, bmgBsaManager, uitUiUtilities); }
/// <summary> /// A simple constructor that initializes the object with the given dependencies. /// </summary> /// <param name="p_gmdGameMode">>The game mode currently being managed.</param> /// <param name="p_eifEnvironmentInfo">The application's envrionment info.</param> public DragonAgeToolLauncher(IGameMode p_gmdGameMode, IEnvironmentInfo p_eifEnvironmentInfo) { GameMode = p_gmdGameMode; EnvironmentInfo = p_eifEnvironmentInfo; SetupTools(); }
/// <summary> /// A simple constructor that initializes the object with the given dependencies. /// </summary> /// <param name="p_gmdGameMode">>The game mode currently being managed.</param> /// <param name="p_eifEnvironmentInfo">The application's envrionment info.</param> public DarkSoulsLauncher(IGameMode p_gmdGameMode, IEnvironmentInfo p_eifEnvironmentInfo) : base(p_gmdGameMode, p_eifEnvironmentInfo) { }
/// <summary> /// Returns a proxy that implements the functions available to Mod Script scripts. /// </summary> /// <param name="p_modMod">The mod being installed.</param> /// <param name="p_gmdGameMode">The game mode currently bieng managed.</param> /// <param name="p_eifEnvironmentInfo">The application's envrionment info.</param> /// <param name="p_igpInstallers">The utility class to use to install the mod items.</param> /// <param name="p_scxUIContext">The <see cref="SynchronizationContext"/> to use to marshall UI interactions to the UI thread.</param> /// <returns>A proxy that implements the functions available to Mod Script scripts.</returns> protected override ModScriptFunctionProxy GetScriptFunctionProxy(IMod p_modMod, IGameMode p_gmdGameMode, IEnvironmentInfo p_eifEnvironmentInfo, InstallerGroup p_igpInstallers, SynchronizationContext p_scxUIContext) { return new WoTModScriptFunctionProxy(p_modMod, p_gmdGameMode, p_eifEnvironmentInfo, p_igpInstallers, new ModScriptUIUtil(p_gmdGameMode, p_eifEnvironmentInfo, p_scxUIContext)); }
/// <summary> /// A simple constructor that initializes the object with the required dependencies. /// </summary> /// <param name="p_modMod">The mod for which the script is running.</param> /// <param name="p_gmdGameMode">The game mode currently being managed.</param> /// <param name="p_igpInstallers">The utility class to use to install the mod items.</param> public XmlScriptInstaller(IMod p_modMod, IGameMode p_gmdGameMode, InstallerGroup p_igpInstallers) { Mod = p_modMod; GameMode = p_gmdGameMode; Installers = p_igpInstallers; }
/// <summary> /// A simple constructor that initializes the object with the required dependencies. /// </summary> /// <param name="p_gmdGameMode">The game mode to which this info belongs.</param> /// <param name="p_eifEnvironmentInfo">The application's environement info.</param> public GameModeInfo(IGameMode p_gmdGameMode, IEnvironmentInfo p_eifEnvironmentInfo) { GameMode = p_gmdGameMode; EnvironmentInfo = p_eifEnvironmentInfo; }
/// <summary> /// A simple constructor that initializes the object with the given dependencies. /// </summary> /// <param name="p_gmdGameMode">>The game mode currently being managed.</param> /// <param name="p_eifEnvironmentInfo">The application's envrionment info.</param> public Fallout3ToolLauncher(IGameMode p_gmdGameMode, IEnvironmentInfo p_eifEnvironmentInfo) { GameMode = p_gmdGameMode; EnvironmentInfo = p_eifEnvironmentInfo; SetupTools(); }
/// <summary> /// A simple constructor that initializes the object with the given dependencies. /// </summary> /// <param name="p_eifEnvironmentInfo">The application's envrionment info.</param> /// <param name="p_gmdGameMode">The game mode currently being managed.</param> public GeneralSettingsGroup(IEnvironmentInfo p_eifEnvironmentInfo, IGameMode p_gmdGameMode) : base(p_eifEnvironmentInfo) { GameMode = p_gmdGameMode; RequiredDirectoriesVM = new RequiredDirectoriesControlVM(p_eifEnvironmentInfo, p_gmdGameMode); }
/// <summary> /// A simple constructor that initializes the object with the given dependencies. /// </summary> /// <param name="p_eifEnvironmentInfo">The application's envrionment info.</param> /// <param name="p_gmrInstalledGames">The registry of insalled games.</param> /// <param name="p_gmdGameMode">The game mode currently being managed.</param> /// <param name="p_mrpModRepository">The repository we are logging in to.</param> /// <param name="p_dmtMonitor">The download monitor to use to track task progress.</param> /// <param name="p_umgUpdateManager">The update manager to use to perform updates.</param> /// <param name="p_mmgModManager">The <see cref="ModManager"/> to use to manage mods.</param> /// <param name="p_pmgPluginManager">The <see cref="PluginManager"/> to use to manage plugins.</param> public MainFormVM(IEnvironmentInfo p_eifEnvironmentInfo, GameModeRegistry p_gmrInstalledGames, IGameMode p_gmdGameMode, IModRepository p_mrpModRepository, DownloadMonitor p_dmtMonitor, ActivateModsMonitor p_ammMonitor, UpdateManager p_umgUpdateManager, ModManager p_mmgModManager, IPluginManager p_pmgPluginManager) { EnvironmentInfo = p_eifEnvironmentInfo; GameMode = p_gmdGameMode; GameMode.GameLauncher.GameLaunching += new CancelEventHandler(GameLauncher_GameLaunching); ModManager = p_mmgModManager; ModRepository = p_mrpModRepository; UpdateManager = p_umgUpdateManager; ModManagerVM = new ModManagerVM(p_mmgModManager, p_eifEnvironmentInfo.Settings, p_gmdGameMode.ModeTheme); DownloadMonitorVM = new DownloadMonitorVM(p_dmtMonitor, p_eifEnvironmentInfo.Settings, p_mmgModManager, p_mrpModRepository); ModActivationMonitor = p_ammMonitor; ActivateModsMonitorVM = new ActivateModsMonitorVM(p_ammMonitor, p_eifEnvironmentInfo.Settings, p_mmgModManager); if (GameMode.UsesPlugins) PluginManagerVM = new PluginManagerVM(p_pmgPluginManager, p_eifEnvironmentInfo.Settings, p_gmdGameMode, p_ammMonitor); HelpInfo = new HelpInformation(p_eifEnvironmentInfo); GeneralSettingsGroup gsgGeneralSettings = new GeneralSettingsGroup(p_eifEnvironmentInfo); foreach (IModFormat mftFormat in p_mmgModManager.ModFormats) gsgGeneralSettings.AddFileAssociation(mftFormat.Extension, mftFormat.Name); ModOptionsSettingsGroup mosModOptions = new ModOptionsSettingsGroup(p_eifEnvironmentInfo); List<ISettingsGroupView> lstSettingGroups = new List<ISettingsGroupView>(); lstSettingGroups.Add(new GeneralSettingsPage(gsgGeneralSettings)); lstSettingGroups.Add(new ModOptionsPage(mosModOptions)); DownloadSettingsGroup dsgDownloadSettings = new DownloadSettingsGroup(p_eifEnvironmentInfo, ModRepository); lstSettingGroups.Add(new DownloadSettingsPage(dsgDownloadSettings)); if (p_gmdGameMode.SettingsGroupViews != null) lstSettingGroups.AddRange(p_gmdGameMode.SettingsGroupViews); SettingsFormVM = new SettingsFormVM(p_gmdGameMode, p_eifEnvironmentInfo, lstSettingGroups); UpdateCommand = new Command("Update", String.Format("Update {0}", EnvironmentInfo.Settings.ModManagerName), UpdateProgramme); LogoutCommand = new Command("Logout", "Logout", Logout); List<Command> lstChangeGameModeCommands = new List<Command>(); List<IGameModeDescriptor> lstSortedModes = new List<IGameModeDescriptor>(p_gmrInstalledGames.RegisteredGameModes); lstSortedModes.Sort((x, y) => x.Name.CompareTo(y.Name)); foreach (IGameModeDescriptor gmdInstalledGame in lstSortedModes) { string strId = gmdInstalledGame.ModeId; string strName = gmdInstalledGame.Name; string strDescription = String.Format("Change game to {0}", gmdInstalledGame.Name); Image imgCommandIcon = new Icon(gmdInstalledGame.ModeTheme.Icon, 32, 32).ToBitmap(); lstChangeGameModeCommands.Add(new Command(strId, strName, strDescription, imgCommandIcon, () => ChangeGameMode(strId), true)); } lstChangeGameModeCommands.Add(new Command("Change Default Game...", "Change Default Game", () => ChangeGameMode(CHANGE_DEFAULT_GAME_MODE))); lstChangeGameModeCommands.Add(new Command("Rescan Installed Games...", "Rescan Installed Games", () => ChangeGameMode(RESCAN_INSTALLED_GAMES))); ChangeGameModeCommands = lstChangeGameModeCommands; }
/// <summary> /// A simple constructor that initializes the object with the given values. /// </summary> /// <param name="p_modMod">The mod for which the script is running.</param> /// <param name="p_gmdGameMode">The game mode currently being managed.</param> /// <param name="p_eifEnvironmentInfo">The application's envrionment info.</param> /// <param name="p_igpInstallers">The utility class to use to install the mod items.</param> /// <param name="p_uipUIProxy">The UI manager to use to interact with UI elements.</param> public WoTModScriptFunctionProxy(IMod p_modMod, IGameMode p_gmdGameMode, IEnvironmentInfo p_eifEnvironmentInfo, InstallerGroup p_igpInstallers, ModScriptUIUtil p_uipUIProxy) : base(p_modMod, p_gmdGameMode, p_eifEnvironmentInfo, p_igpInstallers, p_uipUIProxy) { }