public bool EndOfGameCheck(int fieldSize, IGameInstance battleField) { //int count = 0; bool endOfGame = true; for (int rowCheck = 0; rowCheck < fieldSize; rowCheck++) { for (int colCheck = 0; colCheck < fieldSize; colCheck++) { // if it is not 0 it is a mine if (battleField.Field[rowCheck, colCheck].Select() != 0) { // it is not the end of the game return false; } } } //for (int rowCheck = 0; rowCheck < fieldSize; rowCheck++) //{ // for (int colCheck = 0; colCheck < fieldSize; colCheck++) // { // if (battleField.Field[rowCheck, colCheck] == "-" || battleField.Field[rowCheck, colCheck] == "X") // { // count++; // } // if (count == fieldSize * fieldSize) // { // endOfGame = true; // } // } //} return endOfGame; }
public void FieldUpdate(int row, int col, IGameInstance battleField) { // TODO: FLYWEIGHT PATTERN NEEDED var explodedFieldCell = battleField.CellStorage.GetCell("x"); switch (battleField.Field[row, col].Select()) { case 1: ExplodeLevelOne(row, col, battleField.Size, battleField, explodedFieldCell); break; case 2: ExplodeLevelTwo(row, col, battleField.Size, battleField, explodedFieldCell); break; case 3: ExplodeLevelThree(row, col, battleField.Size, battleField, explodedFieldCell); break; case 4: ExplodeLevelFour(row, col, battleField.Size, battleField, explodedFieldCell); break; case 5: ExplodeLevelFive(row, col, battleField.Size, battleField, explodedFieldCell); break; default: break; } // return battleField; }
public void PrintField(IGameInstance battleField) { // Printing the first row of table Write(" "); for (int i = 0; i < battleField.Size; i++) { Write("{0} ", i); } WriteLine(); // Print separator row Write(" -"); for (int i = 1; i < battleField.Size; i++) { Write("---"); } WriteLine(); // Print all rows for (int i = 0; i < battleField.Size; i++) { Write("{0}|", i); for (int j = 0; j < battleField.Size; j++) { Write(" {0} ", battleField.Field[i, j].DrawingSign); } WriteLine(); } }
public Core(ILogicController controller, IReader reader, IWriter writer, IGameInstance game) { this.controller = controller; this.reader = reader; this.writer = writer; this.game = game; }
public static Dictionary <char, char> GetDecodeCharMap(IGameInstance instance, Language language) { string filename = null; string packfile = null; if (instance.Game == GameSteamID.SaintsRow2) { filename = String.Format("charlist_{0}.txt", GetLanguageCode(language).ToLowerInvariant()); packfile = "patch.vpp_pc"; } else { filename = String.Format("charlist_{0}.dat", GetLanguageCode(language).ToLowerInvariant()); packfile = "misc.vpp_pc"; } using (Stream stream = instance.OpenLooseFile(filename)) { if (stream != null) { return(GetDecodeCharMapFromStream(stream)); } } using (Stream stream = instance.OpenPackfileFile(filename, packfile)) { if (stream != null) { return(GetDecodeCharMapFromStream(stream)); } } return(new Dictionary <char, char>()); }
public bool EndOfGameCheck(int fieldSize, IGameInstance battleField) { //int count = 0; bool endOfGame = true; for (int rowCheck = 0; rowCheck < fieldSize; rowCheck++) { for (int colCheck = 0; colCheck < fieldSize; colCheck++) { // if it is not 0 it is a mine if (battleField.Field[rowCheck, colCheck].Select() != 0) { // it is not the end of the game return(false); } } } //for (int rowCheck = 0; rowCheck < fieldSize; rowCheck++) //{ // for (int colCheck = 0; colCheck < fieldSize; colCheck++) // { // if (battleField.Field[rowCheck, colCheck] == "-" || battleField.Field[rowCheck, colCheck] == "X") // { // count++; // } // if (count == fieldSize * fieldSize) // { // endOfGame = true; // } // } //} return(endOfGame); }
public App(IGameInstance game, ILogger <GameInstance> logger, IServiceProvider provider) { _game = game; _logger = logger ?? throw new ArgumentNullException("logger"); _timer = new Timer(Start, null, Timeout.Infinite, 0); _provider = provider ?? throw new ArgumentNullException("provider"); }
static IContainer FindContainer(IGameInstance sriv, string containerName) { string[] asmNames = new string[] { "customize_item.asm_pc", "dlc1_customize_item.asm_pc", "dlc2_customize_item.asm_pc", "dlc3_customize_item.asm_pc", "dlc4_customize_item.asm_pc", "dlc5_customize_item.asm_pc", "dlc6_customize_item.asm_pc" }; string name = Path.GetFileNameWithoutExtension(containerName); foreach (string asmName in asmNames) { using (Stream s = sriv.OpenPackfileFile(asmName)) { IAssetAssemblerFile asm = AssetAssemblerFile.FromStream(s); foreach (var container in asm.Containers) { if (container.Name == name) { return(container); } } } } return(null); }
public World( IGameInstance gameInstance, Streaming sharedStreaming, WorldChunkComponent chunkComponent, Transform sceneGroup, GameObject defaultActorPrefab, GetObjectPoolRootDelegate getStaticPoolRoot, GetObjectPoolRootDelegate getTransientPoolRoot, SerializableObjectFactory objectFactory, INetDriver netDriver, NetMsgFactory netMsgFactory ) { this.gameInstance = gameInstance; _sceneGroup = sceneGroup; _netDriver = netDriver; _rpcReferenceCollector = new RPCObjectReferenceCollector(this); _objectFactory = objectFactory; _netMsgFactory = netMsgFactory; _getStaticPoolRoot = getStaticPoolRoot; _getTransientPoolRoot = getTransientPoolRoot; _defaultActorPrefab = defaultActorPrefab; CacheNetworkDispatchMethods(); _netArchiveBytes = new byte[MAX_RELIABLE_MESSAGE_SIZE]; _netArchive = new NetMsgArchive(_netArchiveBytes); _nextNetID = 0; _worldStreaming = sharedStreaming ?? new Streaming(chunkComponent, CreateGenVoxelsJob, MMapChunkData, WriteChunkData); _sharedWorldStreaming = sharedStreaming != null; }
static bool CheckOutputs(ISignalArray output, IGameInstance gameInstance) { /* * outputs: * move < -.5 = left > .5 = right * rotate >= .5 * drop > .5 */ if (output[0] <= -0.5) { gameInstance.MoveLeft(); } else if (output[0] >= 0.5) { gameInstance.MoveRight(); } if (output[1] >= 0.5) { gameInstance.Rotate(); } if (output[2] > 0.5) { gameInstance.FinishMove(); return(true); } return(false); }
public AudioMetadata(Stream stream, IGameInstance instance) { Instance = instance; Header = stream.ReadStruct<AudioMetadataHeader>(); if (Header.LipsyncSize > 0) { stream.Seek(0x24 + Header.LipsyncOffset, SeekOrigin.Begin); LipsyncData = new byte[Header.LipsyncSize]; stream.Read(LipsyncData, 0, LipsyncData.Length); } if (Header.SubtitleSize > 0) { stream.Seek(0x24 + Header.SubtitleOffset, SeekOrigin.Begin); SubtitleHeader = stream.ReadStruct<AudioMetadataSubtitleHeader>(); long subtitleOffset = stream.Position; for (int i = 0; i < SubtitleHeader.LocalizedVoiceSubtitleHeaders.Length; i++) { LocalizedVoiceSubtitleHeader localizedVoiceSubtitleHeader = SubtitleHeader.LocalizedVoiceSubtitleHeaders[i]; Language language = (Language)i; if (localizedVoiceSubtitleHeader.Length == 0) { Subtitles.Add(language, ""); continue; } long offset = subtitleOffset + localizedVoiceSubtitleHeader.Offset; stream.Seek(offset, SeekOrigin.Begin); byte[] subtitleData = new byte[localizedVoiceSubtitleHeader.Length]; stream.Read(subtitleData, 0, (int)localizedVoiceSubtitleHeader.Length); var map = LanguageUtility.GetDecodeCharMap(instance, language); StringBuilder subtitleBuilder = new StringBuilder(); for (int pos = 0; pos < subtitleData.Length; pos+=2) { char src = BitConverter.ToChar(subtitleData, pos); char value = src; if (map.ContainsKey(src)) value = map[src]; if (value == 0x00) continue; subtitleBuilder.Append(value); } string subtitle = subtitleBuilder.ToString(); Subtitles.Add(language, subtitle); } } }
public void InitField(IGameInstance gameObject) { WriteLine("Welcome to \"Battle Field\" game."); WriteLine(); PrintField(gameObject); WriteLine(); }
internal static void Prefix(UnityToSimulation __instance) { IGameInstance gameInstance = NGameInstance.GetGame(); int currentRound = __instance.simulation.GetSpawnedRound() + 1; var o = new GameEvents.RoundStartEvent(gameInstance, currentRound); //Create RoundStartEvent instance EventRegistry.instance.DispatchEvent(ref o); //Dispatch it }
public StringFile(Language language, IGameInstance instance) { GameInstance = instance; Language = language; Header = new StringHeader(); Header.ID = 0xA84C7F73; Header.Version = 0x0001; }
internal static void Prefix(InGame __instance) { IGameInstance gameInstance = NGameInstance.GetGame(); int currentRound = __instance.bridge.simulation.GetSpawnedRound(); var o = new GameEvents.RoundEndEvent(gameInstance, currentRound); //Create RoundEndEvent instance EventRegistry.instance.DispatchEvent(ref o); //Dispatch it }
public ServerWorld( IGameInstance gameInstance, WorldChunkComponent chunkComponent, Transform sceneGroup, string serverName, string serverMessage, System.Reflection.Assembly[] assemblies, INetDriver driver ) : base(gameInstance, null, chunkComponent, sceneGroup, GameManager.instance.staticData.defaultActorPrefab, () => GameManager.instance.staticObjectPoolRoot, () => GameManager.instance.transientObjectPoolRoot, serverName, serverMessage, assemblies, driver) { }
public int GetMine(IGameInstance battleField, int row, int col) { return battleField.Field[row, col].Select(); //string currMoveObject = battleField.Field[row, col]; //int mine = 0; //if (!int.TryParse(currMoveObject, out mine)) //{ // WriteLine("Invalid Move"); //} //return mine; }
public int GetMine(IGameInstance battleField, int row, int col) { return(battleField.Field[row, col].Select()); //string currMoveObject = battleField.Field[row, col]; //int mine = 0; //if (!int.TryParse(currMoveObject, out mine)) //{ // WriteLine("Invalid Move"); //} //return mine; }
public StringFile(UInt16 bucketCount, Language language, IGameInstance instance) { GameInstance = instance; Language = language; Header = new StringHeader(); Header.BucketCount = bucketCount; Header.ID = 0xA84C7F73; Header.Version = 0x0001; for (int i = 0; i < bucketCount; i++) { Buckets.Add(new Dictionary <UInt32, string>()); } }
public ClientWorld( IGameInstance gameInstance, Streaming sharedStreaming, WorldChunkComponent chunkComponent, Transform sceneGroup, GameObject defaultActorPrefab, GetObjectPoolRootDelegate getStaticPoolRoot, GetObjectPoolRootDelegate getTransientPoolRoot, System.Reflection.Assembly[] assemblies, INetDriver driver ) : base(gameInstance, sharedStreaming, chunkComponent, sceneGroup, defaultActorPrefab, getStaticPoolRoot, getTransientPoolRoot, new ClientSerializableObjectFactory(assemblies), driver, new ClientNetMsgFactory(assemblies)) { }
public static void ChangeGame(IGameInstance game, GameMode mode) { IGameInstance tmpGame = CurrentGame; CurrentGame = game ?? Games[0]; IsGameRunning = false; new Thread(new ThreadStart(() => { tmpGame?.Stop(); CurrentGame?.Start(mode); IsGameRunning = true; })).Start(); }
private void StartGameOnEnterPress(object sender, ConsoleKeyInfo e) { if (e.Key == ConsoleKey.Enter) //i.e. a newline was sent { _keyboard.KeySent -= StartGameOnEnterPress; _game = _gameFactory(); _game.StateChanged += UpdateOnStateChange; _render(_game.GameStateAsRenderableString); } if (e.Key == ConsoleKey.Escape) { Exited = true; } }
public void UpdateInstance(BaseModel baseModel) { // Sometimes, an instance may not be started before being updated, in which case, quickly add it. IGameInstance gameInstance = GetInstance(baseModel); if (gameInstance == null) { StartInstance(baseModel); } else { gameInstance.Update(baseModel); } }
public void Awake() { DataMgr.SetLog(this); Commander.SetLog(this); UIMgr.SetLog(this); //>======================== Starter.Initialized(this); AssetMgr.Initialized(LevelMgr); AssetBundleMgr.Initialized(LevelMgr, AssetBundleExtension); UIMgr.Initialized(AssetMgr, AssetBundleMgr); StageMgr.SetUpdateInterval(StageUpdateInterval); DontDestroyOnLoad(gameObject); Starter.RegisterOptionObject(gameObject); Starter.RegisterOptionByChildren(gameObject); Instance = GetComponent <IGameInstance>(); }
static void SetInputs(ISignalArray inputs, IGameInstance gameInstance) { /* * input * 0-6 next piece * game width * game height * */ BlockTypeToInput(inputs, 0, gameInstance.NextBlock); for (var I = BaseInputs; I < BaseInputs + GameBoardWidth * GameBoardHeight; ++I) { var Imin2 = I - BaseInputs; inputs[I] = gameInstance.IsBoardCoordinateOccupied(Imin2 % GameBoardWidth, Imin2 / GameBoardWidth) ? 1 : -1; } }
public ClientWorld( IGameInstance gameInstance, Streaming sharedStreaming, WorldChunkComponent chunkComponent, Transform sceneGroup, System.Reflection.Assembly[] assemblies, INetDriver driver ) : base(gameInstance, sharedStreaming, chunkComponent, sceneGroup, GameManager.instance.staticData.defaultActorPrefab, () => GameManager.instance.staticObjectPoolRoot, () => GameManager.instance.transientObjectPoolRoot, assemblies, driver) { #if UNITY_EDITOR #if DEV_STREAMING worldStreaming.shaderQualityLevel = Streaming.EShaderQualityLevel.LOW; #else worldStreaming.shaderQualityLevel = Streaming.debugHQShaderLevel; #endif #endif }
public ServerWorld( IGameInstance gameInstance, Streaming sharedStreaming, WorldChunkComponent chunkComponent, Transform sceneGroup, GameObject defaultActorPrefab, GetObjectPoolRootDelegate getStaticPoolRoot, GetObjectPoolRootDelegate getTransientPoolRoot, string serverName, string serverMessage, System.Reflection.Assembly[] assemblies, INetDriver driver ) : base(gameInstance, sharedStreaming, chunkComponent, sceneGroup, defaultActorPrefab, getStaticPoolRoot, getTransientPoolRoot, new ServerSerializableObjectFactory(assemblies), driver, new ServerNetMsgFactory(assemblies)) { this.serverName = serverName; this.serverMessage = serverMessage; _clientConnections = new ReadOnlyCollection <ActorReplicationChannel>(connectionList); }
private static void ExplodeLevelFour(int row, int col, int n, IGameInstance battleField, ICellObject explodedFieldCell) { ExplodeLevelThree(row, col, n, battleField, explodedFieldCell); if (row - 2 >= 0 && col - 1 >= 0) { battleField.Field[row - 2, col - 1] = explodedFieldCell; } if (row - 2 >= 0 && col < n - 1) { battleField.Field[row - 2, col + 1] = explodedFieldCell; } if (row - 1 >= 0 && col - 2 >= 0) { battleField.Field[row - 1, col - 2] = explodedFieldCell; } if (row - 1 >= 0 && col < n - 2) { battleField.Field[row - 1, col + 2] = explodedFieldCell; } if (row < n - 1 && col - 2 >= 0) { battleField.Field[row + 1, col - 2] = explodedFieldCell; } if (row < n - 1 && col < n - 2) { battleField.Field[row + 1, col + 2] = explodedFieldCell; } if (row < n - 2 && col - 1 > 0) { battleField.Field[row + 2, col - 1] = explodedFieldCell; } if (row < n - 2 && col < n - 1) { battleField.Field[row + 2, col + 1] = explodedFieldCell; } }
public static Dictionary<char, char> GetDecodeCharMap(IGameInstance instance, Language language) { string filename = null; string packfile = null; if (instance.Game == GameSteamID.SaintsRow2) { filename = String.Format("charlist_{0}.txt", GetLanguageCode(language).ToLowerInvariant()); packfile = "patch.vpp_pc"; } else { filename = String.Format("charlist_{0}.dat", GetLanguageCode(language).ToLowerInvariant()); packfile = "misc.vpp_pc"; } using (Stream stream = instance.OpenPackfileFile(filename, packfile)) { return GetDecodeCharMapInternal(stream, language); } }
static void LoadStrings(IGameInstance sriv) { var results = sriv.SearchForFiles("*.le_strings"); foreach (var result in results) { string filename = result.Value.Filename.ToLowerInvariant(); filename = Path.GetFileNameWithoutExtension(filename); string[] pieces = filename.Split('_'); string languageCode = pieces.Last(); Language language = LanguageUtility.GetLanguageFromCode(languageCode); if (!languageStrings.ContainsKey(language)) { languageStrings.Add(language, new Dictionary <uint, string>()); } Dictionary <uint, string> strings = languageStrings[language]; using (Stream s = sriv.OpenPackfileFile(result.Value.Filename, result.Value.Packfile)) { StringFile file = new StringFile(s, language, sriv); foreach (var hash in file.GetHashes()) { if (strings.ContainsKey(hash)) { continue; } strings.Add(hash, file.GetString(hash)); } } } }
static XElement FindCustomizationItem(string name, IGameInstance sriv) { string[] xtblNames = new string[] { "customization_items.xtbl", "dlc1_customization_items.xtbl", "dlc2_customization_items.xtbl", "dlc3_customization_items.xtbl", "dlc4_customization_items.xtbl", "dlc5_customization_items.xtbl", "dlc6_customization_items.xtbl" }; string targetName = name.ToLowerInvariant(); foreach (string xtblName in xtblNames) { using (Stream s = sriv.OpenPackfileFile(xtblName)) { XDocument xml = XDocument.Load(s); var table = xml.Descendants("Table"); foreach (var node in table.Descendants("Customization_Item")) { string itemName = node.Element("Name").Value.ToLowerInvariant(); if (itemName == targetName) { return(node); } } } } return(null); }
private static void ExplodeLevelThree(int row, int col, int n, IGameInstance battleField, ICellObject explodedFieldCell) { ExplodeLevelTwo(row, col, n, battleField, explodedFieldCell); if (row - 2 >= 0) { battleField.Field[row - 2, col] = explodedFieldCell; } if (col - 2 >= 0) { battleField.Field[row, col - 2] = explodedFieldCell; } if (col < n - 2) { battleField.Field[row, col + 2] = explodedFieldCell; } if (row < n - 2) { battleField.Field[row + 2, col] = explodedFieldCell; } }
private static void ExplodeLevelOne(int row, int col, int n, IGameInstance battleField, ICellObject explodedFieldCell) { if (row - 1 >= 0 && col - 1 >= 0) { battleField.Field[row - 1, col - 1] = explodedFieldCell; } if (row - 1 >= 0 && col < n - 1) { battleField.Field[row - 1, col + 1] = explodedFieldCell; } if (row < n - 1 && col - 1 > 0) { battleField.Field[row + 1, col - 1] = explodedFieldCell; } if (row < n - 1 && col < n - 1) { battleField.Field[row + 1, col + 1] = explodedFieldCell; } battleField.Field[row, col] = explodedFieldCell; }
private static void ExplodeLevelFive(int row, int col, int n, IGameInstance battleField, ICellObject explodedFieldCell) { ExplodeLevelFour(row, col, n, battleField, explodedFieldCell); if (row - 2 >= 0 && col - 2 >= 0) { battleField.Field[row - 2, col - 2] = explodedFieldCell; } if (row - 2 >= 0 && col < n - 2) { battleField.Field[row - 2, col + 2] = explodedFieldCell; } if (row < n - 2 && col - 2 >= 0) { battleField.Field[row + 2, col - 2] = explodedFieldCell; } if (row < n - 2 && col < n - 2) { battleField.Field[row + 2, col + 2] = explodedFieldCell; } }
public AudioMetadata(IGameInstance instance) { Instance = instance; Header = new AudioMetadataHeader(); }
static void Main(string[] args) { Options options = null; try { options = CommandLine.Parse <Options>(); } catch (CommandLineException exception) { Console.WriteLine(exception.ArgumentHelp.Message); Console.WriteLine(); Console.WriteLine(exception.ArgumentHelp.GetHelpText(Console.BufferWidth)); #if DEBUG Console.ReadLine(); #endif return; } IGameInstance instance = GameInstance.GetFromString(options.Game); string ww2ogg = Path.Combine(ExeLocation, "external", "ww2ogg.exe"); string codebooks = null; string codebooksPath = options.Codebooks; if (codebooks == null) { switch (instance.Game) { case GameSteamID.SaintsRowTheThird: codebooks = "packed_codebooks.bin"; break; case GameSteamID.SaintsRowIV: case GameSteamID.SaintsRowGatOutOfHell: codebooks = "packed_codebooks_aoTuV_603.bin"; break; default: throw new NotImplementedException(); } codebooksPath = Path.Combine(ExeLocation, "external", codebooks); } string revorb = Path.Combine(ExeLocation, "external", "revorb.exe"); bool failedToFindConversionRequirements = false; if (options.ConvertAudio) { if (!File.Exists(ww2ogg)) { Console.WriteLine("Could not find ww2ogg.exe at:\n{0}", ww2ogg); failedToFindConversionRequirements = true; } if (!File.Exists(codebooksPath)) { if (codebooks != null) { Console.WriteLine("Could not find {0} at:\n{1}", codebooks, codebooksPath); } else { Console.WriteLine("Could not find your specified codebooks at:\n{1}", codebooks, codebooksPath); } failedToFindConversionRequirements = true; } if (!File.Exists(revorb)) { Console.WriteLine("Could not find revorb.exe at:\n{0}", revorb); failedToFindConversionRequirements = true; } if (failedToFindConversionRequirements) { Console.WriteLine("Can't convert audio."); } } using (Stream stream = File.OpenRead(options.Source)) { var bnk = new StreamingSoundbank(stream); string bnkName = Path.GetFileName(options.Source); string folderName = (options.Output != null) ? options.Output : "extracted-" + bnkName; Console.WriteLine("Extracting {0} to {1}.", options.Source, folderName); Directory.CreateDirectory(folderName); if (File.Exists(Path.Combine(folderName, String.Format("{0}.xml", bnkName)))) { File.Delete(Path.Combine(folderName, String.Format("{0}.xml", bnkName))); } using (Stream xmlStream = File.Create(Path.Combine(folderName, Path.ChangeExtension(bnkName, "xml")))) { XmlWriterSettings settings = new XmlWriterSettings(); settings.Indent = true; settings.IndentChars = "\t"; settings.NewLineChars = "\r\n"; using (XmlWriter writer = XmlWriter.Create(xmlStream, settings)) { writer.WriteStartDocument(); writer.WriteStartElement("soundbank"); writer.WriteAttributeString("game", instance.Game.ToString()); writer.WriteAttributeString("wwiseId", bnk.Header.WwiseBankId.ToString()); //writer.WriteAttributeString() int currentFile = 0; foreach (SoundbankEntry entry in bnk.Files) { writer.WriteStartElement("file"); currentFile++; writer.WriteAttributeString("id", entry.Info.FileId.ToString()); Console.Write("[{0}/{1}] Extracting audio... ", currentFile, bnk.Files.Count); string audioFilename = String.Format("{0}_{1:D5}.wem", bnkName, currentFile); using (Stream outputStream = File.Create(Path.Combine(folderName, audioFilename))) { using (Stream inputStream = entry.GetAudioStream()) { inputStream.CopyTo(outputStream); } outputStream.Flush(); } Console.WriteLine("done."); writer.WriteAttributeString("audio", audioFilename); if (entry.Info.MetadataLength != 0) { Console.Write("[{0}/{1}] Extracting metadata... ", currentFile, bnk.Files.Count); using (Stream metadataStream = entry.GetMetadataStream()) { writer.WriteStartElement("metadata"); AudioMetadata metadata = new AudioMetadata(metadataStream, instance); writer.WriteAttributeString("version", metadata.Header.Version.ToString()); writer.WriteAttributeString("personaid", metadata.Header.PersonaID.ToString()); writer.WriteAttributeString("voicelineid", metadata.Header.VoicelineID.ToString()); writer.WriteAttributeString("wavlengthms", metadata.Header.WavLengthMs.ToString()); if (metadata.LipsyncData != null && metadata.LipsyncData.Length > 0) { writer.WriteStartElement("lipsync"); writer.WriteString(Convert.ToBase64String(metadata.LipsyncData)); writer.WriteEndElement(); // lipsync } if (metadata.Header.SubtitleSize > 0) { writer.WriteStartElement("subtitles"); writer.WriteAttributeString("version", metadata.SubtitleHeader.Version.ToString()); foreach (var subtitle in metadata.Subtitles) { Language language = subtitle.Key; string text = subtitle.Value; writer.WriteStartElement("subtitle"); writer.WriteAttributeString("language", language.ToString()); writer.WriteString(text); writer.WriteEndElement(); // subtitle } writer.WriteEndElement(); // subtitles } writer.WriteEndElement(); // metadata } Console.WriteLine("done."); } writer.WriteEndElement(); // file } writer.WriteEndElement(); // soundbank writer.WriteEndDocument(); } } if (options.ConvertAudio) { if (failedToFindConversionRequirements) { Console.WriteLine(); Console.WriteLine("Unable to convert extracted audio due to missing required files."); } else { Console.WriteLine(); Console.WriteLine("Converting extracted audio..."); for (int i = 1; i <= bnk.Files.Count; i++) { Console.Write("[{0}/{1}] Converting audio... ", i, bnk.Files.Count); string oggFilename = String.Format("{0}_{1:D5}.ogg", bnkName, i); string oggPath = Path.Combine(folderName, oggFilename); string audioFilename = String.Format("{0}_{1:D5}.wem", bnkName, i); string audioPath = Path.Combine(folderName, audioFilename); ProcessStartInfo ww2oggPsi = new ProcessStartInfo(ww2ogg, String.Format(@"--pcb ""{0}"" -o ""{1}"" ""{2}""", codebooksPath, oggPath, audioPath)); ww2oggPsi.WindowStyle = ProcessWindowStyle.Hidden; ww2oggPsi.CreateNoWindow = true; Process ww2oggP = Process.Start(ww2oggPsi); ww2oggP.WaitForExit(); Console.Write("revorb... "); ProcessStartInfo revorbPsi = new ProcessStartInfo(revorb, String.Format(@"""{0}""", oggPath)); revorbPsi.WindowStyle = ProcessWindowStyle.Hidden; revorbPsi.CreateNoWindow = true; Process revorbP = Process.Start(revorbPsi); revorbP.WaitForExit(); Console.WriteLine("done."); } } } Console.WriteLine(); Console.WriteLine("Done."); #if DEBUG Console.ReadLine(); #endif } }
public FileSearchResult(IGameInstance instance, string filename) : this(instance, filename, null) { }
public FileSearchResult(IGameInstance instance, string filename, string packfile) { GameInstance = instance; Filename = filename; Packfile = packfile; }
private static void ExplodeLevelTwo(int row, int col, int n, IGameInstance battleField, ICellObject explodedFieldCell) { ExplodeLevelOne(row, col, n, battleField, explodedFieldCell); if (row - 1 >= 0) { battleField.Field[row - 1, col] = explodedFieldCell; } if (col - 1 >= 0) { battleField.Field[row, col - 1] = explodedFieldCell; } if (col < n - 1) { battleField.Field[row, col + 1] = explodedFieldCell; } if (row < n - 1) { battleField.Field[row + 1, col] = explodedFieldCell; } }
public void GameEndMessage(IGameInstance battleField, int moveCounter) { this.PrintField(battleField); WriteLine("Game over!"); this.PrintMoves(moveCounter); }