当前位置: 首页>>代码示例>>C#>>正文


C# CompileMessages类代码示例

本文整理汇总了C#中CompileMessages的典型用法代码示例。如果您正苦于以下问题:C# CompileMessages类的具体用法?C# CompileMessages怎么用?C# CompileMessages使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CompileMessages类属于命名空间,在下文中一共展示了CompileMessages类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ConvertGameDialogScripts

        public string ConvertGameDialogScripts(Game game, CompileMessages errors, bool rebuildAll)
        {
            int stringBuilderCapacity = 1000 * game.RootDialogFolder.GetAllItemsCount() + _DefaultDialogScriptsScript.Length;
            StringBuilder sb = new StringBuilder(_DefaultDialogScriptsScript, stringBuilderCapacity);

            foreach (Dialog dialog in game.RootDialogFolder.AllItemsFlat)
            {
                sb.AppendLine(AGS.CScript.Compiler.Constants.NEW_SCRIPT_MARKER + "Dialog " + dialog.ID + "\"");

                if ((dialog.CachedConvertedScript == null) ||
                    (dialog.ScriptChangedSinceLastConverted) ||
                    (rebuildAll))
                {
                    int errorCountBefore = errors.Count;
                    this.ConvertDialogScriptToRealScript(dialog, game, errors);

                    if (errors.Count > errorCountBefore)
                    {
                        dialog.ScriptChangedSinceLastConverted = true;
                    }
                    else
                    {
                        dialog.ScriptChangedSinceLastConverted = false;
                    }
                }

                sb.Append(dialog.CachedConvertedScript);
            }

            return sb.ToString();
        }
开发者ID:Aquilon96,项目名称:ags,代码行数:31,代码来源:DialogScriptConverter.cs

示例2: NumberSpeechLines

        public CompileMessages NumberSpeechLines(Game game, bool includeNarrator, bool combineIdenticalLines, bool removeNumbering, int? characterID)
        {
            _speechableFunctionCalls = GetFunctionCallsToProcessForSpeech(includeNarrator);

            _errors = new CompileMessages();
            _game = game;
            _includeNarrator = includeNarrator;
            _combineIdenticalLines = combineIdenticalLines;
            _removeNumbering = removeNumbering;
            _characterID = characterID;

            if (Factory.AGSEditor.AttemptToGetWriteAccess(SPEECH_REFERENCE_FILE_NAME))
            {
                using (_referenceFile = new StreamWriter(SPEECH_REFERENCE_FILE_NAME, false))
                {
                    _referenceFile.WriteLine("// AGS auto-numbered speech lines output. This file was automatically generated.");
                    PerformNumbering(game);
                }
            }
            else
            {
                _errors.Add(new CompileError("unable to create file " + SPEECH_REFERENCE_FILE_NAME));
            }

            return _errors;
        }
开发者ID:smarinel,项目名称:ags-web,代码行数:26,代码来源:SpeechLinesNumbering.cs

示例3: ConvertDialogScriptToRealScript

        public void ConvertDialogScriptToRealScript(Dialog dialog, Game game, CompileMessages errors)
        {
            string thisLine;
            _currentlyInsideCodeArea = false;
            _hadFirstEntryPoint = false;
            _game = game;
            _currentDialog = dialog;
            _existingEntryPoints.Clear();
            _currentLineNumber = 0;

            StringReader sr = new StringReader(dialog.Script);
            StringWriter sw = new StringWriter();
            sw.Write(string.Format("function _run_dialog{0}(int entryPoint) {1} ", dialog.ID, "{"));
            while ((thisLine = sr.ReadLine()) != null)
            {
                _currentLineNumber++;
                try
                {
                    ConvertDialogScriptLine(thisLine, sw, errors);
                }
                catch (CompileMessage ex)
                {
                    errors.Add(ex);
                }
            }
            if (_currentlyInsideCodeArea)
            {
                sw.WriteLine("}");
            }
            sw.WriteLine("return RUN_DIALOG_RETURN; }"); // end the function
            dialog.CachedConvertedScript = sw.ToString();
            sw.Close();
            sr.Close();
        }
开发者ID:Aquilon96,项目名称:ags,代码行数:34,代码来源:DialogScriptConverter.cs

示例4: VoiceActorScriptProcessor

 public VoiceActorScriptProcessor(Game game, CompileMessages errors,
     Dictionary<string, FunctionCallType> speechableFunctionCalls)
     : base(game, errors, false, false, speechableFunctionCalls)
 {
     _linesByCharacter = new Dictionary<int, Dictionary<string, string>>();
     _linesInOrder = new List<GameTextLine>();
 }
开发者ID:smarinel,项目名称:ags-web,代码行数:7,代码来源:VoiceActorScriptProcessor.cs

示例5: CreateInteractionScripts

        public static bool CreateInteractionScripts(Room room, CompileMessages errors)
        {
            Script theScript = room.Script;
            bool convertedSome = CreateScriptsForInteraction("room", theScript, room.Interactions, errors);

            foreach (RoomHotspot hotspot in room.Hotspots)
            {
                if (hotspot.Name.Length < 1)
                {
                    hotspot.Name = "hHotspot" + hotspot.ID;
                }
                convertedSome |= CreateScriptsForInteraction(hotspot.Name, theScript, hotspot.Interactions, errors);
            }
            foreach (RoomObject obj in room.Objects)
            {
                if (obj.Name.Length < 1)
                {
                    obj.Name = "oObject" + obj.ID;
                }
                convertedSome |= CreateScriptsForInteraction(obj.Name, theScript, obj.Interactions, errors);
            }
            foreach (RoomRegion region in room.Regions)
            {
                string useName = "region" + region.ID;
                convertedSome |= CreateScriptsForInteraction(useName, theScript, region.Interactions, errors);
            }
            return convertedSome;
        }
开发者ID:sonneveld,项目名称:agscj,代码行数:28,代码来源:ImportExport.cs

示例6: GameSpeechProcessor

 public GameSpeechProcessor(Game game, CompileMessages errors, bool makesChanges, bool processHotspotAndObjectDescriptions)
 {
     _game = game;
     _errors = errors;
     _makesChanges = makesChanges;
     _processHotspotAndObjectDescriptions = processHotspotAndObjectDescriptions;
 }
开发者ID:sonneveld,项目名称:agscj,代码行数:7,代码来源:GameSpeechProcessor.cs

示例7: CompilePAMFile

        private SpeechLipSyncLine CompilePAMFile(string fileName, CompileMessages errors)
        {
            SpeechLipSyncLine syncDataForThisFile = new SpeechLipSyncLine();
            syncDataForThisFile.FileName = Path.GetFileNameWithoutExtension(fileName);

            string thisLine;
            bool inMainSection = false;
            int lineNumber = 0;

            StreamReader sr = new StreamReader(fileName);
            while ((thisLine = sr.ReadLine()) != null)
            {
                lineNumber++;
                if (thisLine.ToLower().StartsWith("[speech]"))
                {
                    inMainSection = true;
                    continue;
                }
                if (inMainSection)
                {
                    if (thisLine.TrimStart().StartsWith("["))
                    {
                        // moved onto another section
                        break;
                    }
                    if (thisLine.IndexOf(':') > 0)
                    {
                        string[] parts = thisLine.Split(':');
                        // Convert from Pamela XPOS into milliseconds
                        int milliSeconds = ((Convert.ToInt32(parts[0]) / 15) * 1000) / 24;
                        string phenomeCode = parts[1].Trim().ToUpper();
                        int frameID = FindFrameNumberForPhenome(phenomeCode);
                        if (frameID < 0)
                        {
                            string friendlyFileName = Path.GetFileName(fileName);
                            errors.Add(new CompileError("No frame found to match phenome code '" + phenomeCode + "'", friendlyFileName, lineNumber));
                        }
                        else
                        {
                            syncDataForThisFile.Phenomes.Add(new SpeechLipSyncPhenome(milliSeconds, (short)frameID));
                        }
                    }
                }
            }
            sr.Close();
            syncDataForThisFile.Phenomes.Sort();

            // The PAM file contains start times: Convert to end times
            for (int i = 0; i < syncDataForThisFile.Phenomes.Count - 1; i++)
            {
                syncDataForThisFile.Phenomes[i].EndTimeOffset = syncDataForThisFile.Phenomes[i + 1].EndTimeOffset;
            }

            if (syncDataForThisFile.Phenomes.Count > 1)
            {
                syncDataForThisFile.Phenomes[syncDataForThisFile.Phenomes.Count - 1].EndTimeOffset = syncDataForThisFile.Phenomes[syncDataForThisFile.Phenomes.Count - 2].EndTimeOffset + 1000;
            }

            return syncDataForThisFile;
        }
开发者ID:sonneveld,项目名称:agscj,代码行数:60,代码来源:SpeechComponent.cs

示例8: ProcessAllGameText

        public static void ProcessAllGameText(IGameTextProcessor processor, Game game, CompileMessages errors)
        {
            foreach (Dialog dialog in game.RootDialogFolder.AllItemsFlat)
            {
                foreach (DialogOption option in dialog.Options)
                {
                    option.Text = processor.ProcessText(option.Text, GameTextType.DialogOption, game.PlayerCharacter.ID);
                }

                dialog.Script = processor.ProcessText(dialog.Script, GameTextType.DialogScript);
            }

            foreach (ScriptAndHeader script in game.RootScriptFolder.AllItemsFlat)
            {                                
                string newScript = processor.ProcessText(script.Script.Text, GameTextType.Script);
                if (newScript != script.Script.Text)
                {
                    // Only cause it to flag Modified if we changed it
                    script.Script.Text = newScript;
                }                
            }

            foreach (GUI gui in game.RootGUIFolder.AllItemsFlat)
            {
                foreach (GUIControl control in gui.Controls)
                {
                    GUILabel label = control as GUILabel;
                    if (label != null)
                    {
                        label.Text = processor.ProcessText(label.Text, GameTextType.ItemDescription);
                    }
                    else
                    {
                        GUIButton button = control as GUIButton;
                        if (button != null)
                        {
                            button.Text = processor.ProcessText(button.Text, GameTextType.ItemDescription);
                        }
                    }
                }
            }

            foreach (Character character in game.RootCharacterFolder.AllItemsFlat)
            {
                character.RealName = processor.ProcessText(character.RealName, GameTextType.ItemDescription);
            }

            foreach (InventoryItem item in game.RootInventoryItemFolder.AllItemsFlat)
            {
                item.Description = processor.ProcessText(item.Description, GameTextType.ItemDescription);
            }

			for (int i = 0; i < game.GlobalMessages.Length; i++)
			{
				game.GlobalMessages[i] = processor.ProcessText(game.GlobalMessages[i], GameTextType.Message);
			}

            Factory.AGSEditor.RunProcessAllGameTextsEvent(processor, errors);
        }
开发者ID:Aquilon96,项目名称:ags,代码行数:59,代码来源:TextProcessingHelper.cs

示例9: ProcessAllGameText

        public static void ProcessAllGameText(IGameTextProcessor processor, Game game, CompileMessages errors)
        {
            foreach (Dialog dialog in game.Dialogs)
            {
                foreach (DialogOption option in dialog.Options)
                {
                    option.Text = processor.ProcessText(option.Text, GameTextType.DialogOption, game.PlayerCharacter.ID);
                }

                dialog.Script = processor.ProcessText(dialog.Script, GameTextType.DialogScript);
            }

            foreach (Script script in game.Scripts)
            {
                if (!script.IsHeader)
                {
                    string newScript = processor.ProcessText(script.Text, GameTextType.Script);
                    if (newScript != script.Text)
                    {
                        // Only cause it to flag Modified if we changed it
                        script.Text = newScript;
                    }
                }
            }

            foreach (GUI gui in game.GUIs)
            {
                foreach (GUIControl control in gui.Controls)
                {
                    if (control is GUILabel)
                    {
                        ((GUILabel)control).Text = processor.ProcessText(((GUILabel)control).Text, GameTextType.ItemDescription);
                    }
                    else if (control is GUIButton)
                    {
                        ((GUIButton)control).Text = processor.ProcessText(((GUIButton)control).Text, GameTextType.ItemDescription);
                    }
                }
            }

            foreach (Character character in game.Characters)
            {
                character.RealName = processor.ProcessText(character.RealName, GameTextType.ItemDescription);
            }

            foreach (InventoryItem item in game.InventoryItems)
            {
                item.Description = processor.ProcessText(item.Description, GameTextType.ItemDescription);
            }

            for (int i = 0; i < game.GlobalMessages.Length; i++)
            {
                game.GlobalMessages[i] = processor.ProcessText(game.GlobalMessages[i], GameTextType.Message);
            }

            Factory.AGSEditor.RunProcessAllGameTextsEvent(processor, errors);
        }
开发者ID:smarinel,项目名称:ags-web,代码行数:57,代码来源:TextProcessingHelper.cs

示例10: ReplaceAllGameText

        public static CompileMessages ReplaceAllGameText(Game game, Translation withTranslation)
        {
            CompileMessages errors = new CompileMessages();

            TextImportProcessor processor = new TextImportProcessor(game, errors, withTranslation.TranslatedLines);

            TextProcessingHelper.ProcessAllGameText(processor, game, errors);

            return errors;
        }
开发者ID:Aquilon96,项目名称:ags,代码行数:10,代码来源:TextImporter.cs

示例11: CreateTranslationList

        public CompileMessages CreateTranslationList(Game game)
        {
            CompileMessages errors = new CompileMessages();

            TranslationSourceProcessor processor = new TranslationSourceProcessor(game, errors);

            TextProcessingHelper.ProcessAllGameText(processor, game, errors);

            _linesForTranslation = processor.LinesForTranslation;

            return errors;
        }
开发者ID:Aquilon96,项目名称:ags,代码行数:12,代码来源:TranslationGenerator.cs

示例12: CreateVoiceActingScript

		public CompileMessages CreateVoiceActingScript(Game game)
		{
			CompileMessages errors = new CompileMessages();

			VoiceActorScriptProcessor processor = new VoiceActorScriptProcessor(game, errors, GetFunctionCallsToProcessForSpeech(true));

			TextProcessingHelper.ProcessAllGameText(processor, game, errors);

			_linesByCharacter = processor.LinesByCharacter;
			_linesInOrder = processor.LinesInOrder;

			return errors;
		}
开发者ID:Aquilon96,项目名称:ags,代码行数:13,代码来源:VoiceActorScriptGenerator.cs

示例13: Build

 public override bool Build(CompileMessages errors, bool forceRebuild)
 {
     if (!base.Build(errors, forceRebuild)) return false;
     try
     {
         string baseGameFileName = Factory.AGSEditor.BaseGameFileName;
         string exeFileName = baseGameFileName + ".exe";
         IBuildTarget targetWin = BuildTargetsInfo.FindBuildTargetByName("Windows");
         if (targetWin == null)
         {
             errors.Add(new CompileError("Debug build depends on Windows build target being available! Your AGS installation may be corrupted!"));
             return false;
         }
         string compiledEXE = targetWin.GetCompiledPath(exeFileName);
         string sourceEXE = Path.Combine(Factory.AGSEditor.EditorDirectory, AGSEditor.ENGINE_EXE_FILE_NAME);
         Utilities.DeleteFileIfExists(compiledEXE);
         File.Copy(sourceEXE, exeFileName, true);
         BusyDialog.Show("Please wait while we prepare to run the game...", new BusyDialog.ProcessingHandler(CreateDebugFiles), errors);
         if (errors.HasErrors)
         {
             return false;
         }
         Utilities.DeleteFileIfExists(GetDebugPath(exeFileName));
         File.Move(exeFileName, GetDebugPath(exeFileName));
         // copy configuration from Compiled folder to use with Debugging
         string cfgFilePath = targetWin.GetCompiledPath(AGSEditor.CONFIG_FILE_NAME);
         if (File.Exists(cfgFilePath))
         {
             File.Copy(cfgFilePath, GetDebugPath(AGSEditor.CONFIG_FILE_NAME), true);
         }
         else
         {
             cfgFilePath = Path.Combine(AGSEditor.OUTPUT_DIRECTORY, Path.Combine(AGSEditor.DATA_OUTPUT_DIRECTORY, AGSEditor.CONFIG_FILE_NAME));
             if (File.Exists(cfgFilePath))
             {
                 File.Copy(cfgFilePath, GetDebugPath(AGSEditor.CONFIG_FILE_NAME), true);
             }
         }
         foreach (Plugin plugin in Factory.AGSEditor.CurrentGame.Plugins)
         {
             File.Copy(Path.Combine(Factory.AGSEditor.EditorDirectory, plugin.FileName), GetDebugPath(plugin.FileName), true);
         }
     }
     catch (Exception ex)
     {
         errors.Add(new CompileError("Unexpected error: " + ex.Message));
         return false;
     }
     return true;
 }
开发者ID:CisBetter,项目名称:ags,代码行数:50,代码来源:BuildTargetDebug.cs

示例14: Build

 public override bool Build(CompileMessages errors, bool forceRebuild)
 {
     if (!base.Build(errors, forceRebuild)) return false;
     string compiledDataDir = Path.Combine(AGSEditor.OUTPUT_DIRECTORY, AGSEditor.DATA_OUTPUT_DIRECTORY);
     string baseGameFileName = Factory.AGSEditor.BaseGameFileName;
     string newExeName = GetCompiledPath(baseGameFileName + ".exe");
     string sourceEXE = Path.Combine(Factory.AGSEditor.EditorDirectory, AGSEditor.ENGINE_EXE_FILE_NAME);
     File.Copy(sourceEXE, newExeName, true);
     UpdateWindowsEXE(newExeName, errors);
     CreateCompiledSetupProgram();
     Environment.CurrentDirectory = Factory.AGSEditor.CurrentGame.DirectoryPath;
     foreach (string fileName in Utilities.GetDirectoryFileList(compiledDataDir, "*"))
     {
         if (fileName.EndsWith(".ags"))
         {
             using (FileStream ostream = File.Open(GetCompiledPath(baseGameFileName + ".exe"), FileMode.Append,
                 FileAccess.Write))
             {
                 int startPosition = (int)ostream.Position;
                 using (FileStream istream = File.Open(fileName, FileMode.Open, FileAccess.Read))
                 {
                     const int bufferSize = 4096;
                     byte[] buffer = new byte[bufferSize];
                     for (int count = istream.Read(buffer, 0, bufferSize); count > 0;
                         count = istream.Read(buffer, 0, bufferSize))
                     {
                         ostream.Write(buffer, 0, count);
                     }
                 }
                 // write the offset into the EXE where the first data file resides
                 ostream.Write(BitConverter.GetBytes(startPosition), 0, 4);
                 // write the CLIB end signature so the engine knows this is a valid EXE
                 ostream.Write(Encoding.UTF8.GetBytes(NativeConstants.CLIB_END_SIGNATURE.ToCharArray()), 0,
                     NativeConstants.CLIB_END_SIGNATURE.Length);
             }
         }
         else if (!fileName.EndsWith(AGSEditor.CONFIG_FILE_NAME))
         {
             Utilities.CreateHardLink(GetCompiledPath(Path.GetFileName(fileName)), fileName, true);
         }
     }
     // Update config file with current game parameters
     Factory.AGSEditor.WriteConfigFile(GetCompiledPath());
     // Copy Windows plugins
     CopyPlugins(errors);
     return true;
 }
开发者ID:CisBetter,项目名称:ags,代码行数:47,代码来源:BuildTargetWindows.cs

示例15: SpeechLineProcessor

        public SpeechLineProcessor(Game game, bool includeNarrator, bool combineIdenticalLines, 
            bool removeNumbering, int? characterID,
            Dictionary<string, FunctionCallType> speechableFunctionCalls, 
            CompileMessages errors, StreamWriter referenceFile)
            : base(game, errors, true, false, speechableFunctionCalls)
        {
            _speechLineCount = new Dictionary<int, int>();
            _combineIdenticalLines = combineIdenticalLines;
            _includeNarrator = includeNarrator;
            _referenceFile = referenceFile;
            _removeNumbering = removeNumbering;
            _characterID = characterID;

            if (combineIdenticalLines)
            {
                _existingLines = new Dictionary<int, Dictionary<string, string>>();
            }
        }
开发者ID:smarinel,项目名称:ags-web,代码行数:18,代码来源:SpeechLineProcessor.cs


注:本文中的CompileMessages类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。