예제 #1
0
        /// <summary>
        /// New implementation of the Init function, to allocate a BuildProject instance rather than a
        /// CompilationProject.
        /// </summary>
        /// <param name="path">The path of the file to parser</param>
        /// <param name="format">The resulting document format</param>
        /// <returns>The BuildProject instance created</returns>
        public new BuildProject Init(string path, DocumentFormat format = null)
        {
            FileCompiler compiler;

            if (Compilers.TryGetValue(path, out compiler))
            {
                return(m_Projects[path]);
            }
            string        directory = Directory.GetParent(path).FullName;
            string        filename  = Path.GetFileName(path);
            DirectoryInfo root      = new DirectoryInfo(directory);

            if (format == null)
            {
                format = GetFormat(path);
            }
            TypeCobolOptions options = new TypeCobolOptions();
            BuildProject     project = new BuildProject(BuilderEngine, path, root.FullName, new string[] { "*.cbl", "*.cpy" },
                                                        format.Encoding, format.EndOfLineDelimiter, format.FixedLineLength, format.ColumnsLayout, options);

            m_Projects[path] = project;
            compiler         = new FileCompiler(null, filename, project.SourceFileProvider, project, format.ColumnsLayout, options, CustomSymbols, false);
            Compilers.Add(path, compiler);
            Inits.Add(path, false);
            return(project);
        }
예제 #2
0
        public override void ReceiveExtraAI(BinaryReader reader)
        {
            projectile.owner = reader.ReadInt32();
            int starType  = reader.ReadInt32();
            int crossType = reader.ReadInt32();
            int moonType  = reader.ReadInt32();

            projectile.damage = reader.ReadInt32();
            bool minionCaster = reader.ReadBoolean();

            Caster = minionCaster ? Main.projectile[reader.ReadInt32()] : (Entity)Main.player[reader.ReadInt32()];
            List <GlyphModifier> modifiers = new List <GlyphModifier>();
            int count = reader.ReadInt32();

            for (int i = 0; i < count; i += 1)
            {
                modifiers.Add(GlyphModifier.Modifiers[reader.ReadInt32()]);
            }
            if (Source == null)
            {
                Source = new ProceduralSpell(mod);
                Source.Glyphs[(byte)GlyphType.Star].SetDefaults(starType, true);
                Source.Glyphs[(byte)GlyphType.Cross].SetDefaults(crossType, true);
                Source.Glyphs[(byte)GlyphType.Moon].SetDefaults(moonType, true);
                Source.ModifierOverride = modifiers;
            }

            foreach (Item item in Source.Glyphs)
            {
                Glyph glyph = (Glyph)item.modItem;
                if (glyph.GetAiAction() != null)
                {
                    Ai.Add(glyph.GetAiAction());
                }
                if (glyph.GetInitAction() != null)
                {
                    Inits.Add(glyph.GetInitAction());
                }
                if (glyph.GetImpactAction() != null)
                {
                    Impacts.Add(glyph.GetImpactAction());
                }
                if (glyph.GetKillAction() != null)
                {
                    Kills.Add(glyph.GetKillAction());
                }
            }

            foreach (GlyphModifier modifier in modifiers)
            {
                if (modifier.Impact != null)
                {
                    Impacts.Add(modifier.Impact);
                }
                if (modifier.Draw != null)
                {
                    SpellDraw.Add(modifier.Draw);
                }
                if (modifier.Init != null)
                {
                    Inits.Add(modifier.Init);
                }
            }

            Initialize();
        }