Example #1
0
        private AegisLabel MatchLabel()
        {
            string n   = tk.Value;
            Expr   exp = null;

            Match(TokenType.Label);

            if (tk.Type == TokenType.NewLine)
            {
                MatchNewline();
            }
            else
            {
                exp = MatchExpr();

                MatchNewline();
            }

            var al = new AegisLabel();

            al.Exp  = exp;
            al.Name = n;
            PushNode(al);

            curNode.Items = MatchBlock().Items;

            al = (AegisLabel)PopNode();

            return(al);
        }
Example #2
0
        private void GenTrader(AegisTrader at)
        {
            AegisLabel oninit = null;

            foreach (AegisLabel al in at.Items)
            {
                if (al.Name == "OnInit")
                {
                    oninit = al;
                    break;
                }
            }

            if (oninit == null)
            {
                return;
            }

            var items = new List <string>();

            foreach (AegisFunc af in oninit.Items)
            {
                if (af != null && af.Name == "sellitem")
                {
                    curArgs = af.Items;
                    items.Add(FindArg(0));
                }
            }

            WriteNew("{0},{1},{2},{3}\tshop\t{4},{5},", at.Map, at.X, at.Y, at.Dir, at.Name, at.Sprite);

            for (int i = 0; i < items.Count; i++)
            {
                if (i == items.Count - 1)
                {
                    Write("{0}:-1", GetItemId(items[i]));
                }
                else
                {
                    Write("{0}:-1,", GetItemId(items[i]));
                }
            }

            WriteLine("\n");
        }
Example #3
0
        private void GenLabel(AegisLabel al)
        {
            string tmp = al.Name.ToLower();

            if (tmp == "onclick")
            {
            }
            else if (al.Exp != null)
            {
                string lblExp = al.Exp.ToString();
                lblExp = lblExp.Substring(1, lblExp.Length - 1).ToLower();

                if (lblExp == "reset")
                {
                    WriteLine("OnReset:");
                }
                else if (lblExp == "on")
                {
                    WriteLine("OnCommandOn:");
                }
                else if (lblExp == "off")
                {
                    WriteLine("OnCommandOff:");
                }
                else
                {
                    WriteLine("{0}{1}:", al.Name, al.Exp.ToString().Trim('"'));
                }
            }
            else
            {
                WriteLine("{0}:", al.Name);
            }

            tabLevel++;

            GenBlock(al.Items);

            tabLevel--;
        }
Example #4
0
        private void GenWarp(AegisWarp aw)
        {
            AegisLabel ontouch = null;

            foreach (AegisLabel al in aw.Items)
            {
                if (al.Name == "OnTouch")
                {
                    ontouch = al;
                    break;
                }
            }

            if (ontouch == null)
            {
                return;
            }

            AegisFunc moveto = null;

            foreach (AegisFunc af in ontouch.Items)
            {
                if (af.Name == "moveto")
                {
                    moveto = af;
                    break;
                }
            }

            if (moveto == null)
            {
                return;
            }

            curArgs = moveto.Items;

            WriteNewLine("{0},{1},{2},{3}\twarp\t{4}\t{5},{6},{7},{8},{9}\n", aw.MapName, aw.x, aw.y, "0", aw.name,
                         aw.spanx, aw.spany, FindArg(0).Substring(1, FindArg(0).Length - 2), FindArg(1), FindArg(2));
        }