Exemplo n.º 1
0
        private AegisNpc MatchNpc()
        {
            var an = new AegisNpc();

            Match(TokenType.npc);

            an.Map    = MatchString();
            an.Name   = MatchString();
            an.Sprite = MatchNumberOrIdent();
            an.X      = MatchNumber();
            an.Y      = MatchNumber();
            an.Dir    = MatchNumber();
            an.W      = MatchNumber();
            an.H      = MatchNumber();

            PushNode(an);
            MatchNewline();

            do
            {
                MatchNewline();
                curNode.Items.Add(MatchLabel());
                MatchNewline();
            } while (tk.Type == TokenType.Label);
            an = (AegisNpc)PopNode();

            return(an);
        }
Exemplo n.º 2
0
        private void GenNpc(AegisNpc ai)
        {
            curNpc = ai;

            if (ai.W != "0" || ai.H != "0")
            {
                WriteNewLine("{0},{1},{2},{3}\tscript\t{4}\t{5},{6},{7},{8}", ai.Map, ai.X, ai.Y, ai.Dir, ai.Name,
                             ai.Sprite, ai.W, ai.H, "{");
            }
            else
            {
                WriteNewLine("{0},{1},{2},{3}\tscript\t{4}\t{5},{6}", ai.Map, ai.X, ai.Y, ai.Dir, ai.Name, ai.Sprite,
                             "{");
            }

            foreach (AegisItem aii in ai.Items)
            {
                if (aii.GetType() == typeof(AegisLabel))
                {
                    var al = (AegisLabel)aii;
                    if (al.Name == "OnClick")
                    {
                        GenLabel(al);
                        break;
                    }
                }
                else
                {
                    var al = (AegisUnknown)aii;
                    GenUnk(al);
                }
            }

            foreach (AegisItem aii in ai.Items)
            {
                if (aii.GetType() == typeof(AegisLabel))
                {
                    var al = (AegisLabel)aii;
                    if (al.Name == "OnClick")
                    {
                        continue;
                    }

                    GenLabel(al);
                }
                else
                {
                    var al = (AegisUnknown)aii;
                    GenUnk(al);
                }
            }

            WriteNewLine("{0}\n", "}");
        }