Пример #1
0
        void PhraseALine(KAGWords line)
        {
            KAGWord op = line[0];

            if (op.WordType == KAGWord.Type.TEXT)
            {
                PhraseText(line);
            }
            else if (op.WordType == KAGWord.Type.NAME)
            {
                PhraseName(line);
            }
            else
            {
                TagInfo tagInfo = new TagInfo(op.Value.ToLower());
                foreach (KAGWord param in line)
                {
                    if (op != param)
                    {
                        tagInfo.Params[param.Name] = param.Value;
                    }
                }
                CreateAndSendTagToEngine(tagInfo);
            }
        }
Пример #2
0
        private void ReadAttribute()
        {
            //	CCLOG("read attribute");
            int    npos = 0;
            string op   = NextString(" =", out npos);

            //if (op)

            IgnoreBlanks();
            if (_line[_pos] == '=')
            {
                ++_pos;
                IgnoreBlanks();
                string value = NextString(" ]", out npos);
                //	auto value = StringUtil::nextStringStopUntil(_line, " ]", _pos, &npos);
                //	_pos = npos;

                KAGWord attr = new KAGWord(KAGWord.Type.ATTRIBUTE, op, value);
                _words.Add(attr);
            }
            else
            {
                Debug.LogFormat("read attribute wrong! op = {0}", op);
            }
        }
Пример #3
0
        private void ReadScenario()
        {
            int npos = 0;
            //auto str = StringUtil::nextStringStopUntil(_line, '[', _pos, &npos);
            string  str = NextString("[\n", out npos);
            KAGWord op  = new KAGWord(KAGWord.Type.SCENARIO, "op", "scenario");
            KAGWord tag = new KAGWord(KAGWord.Type.SCENARIO, "scenario", str);

            _words.Add(op);
            _words.Add(tag);
        }
Пример #4
0
        private void ReadTag()
        {
            int    npos = 0;
            string op   = NextString(" ]", out npos);

            //if there is a tag
            if (op != "")
            {
                KAGWord tag = new KAGWord(KAGWord.Type.TAG, "op", op);
                _words.Add(tag);
            }

            ChangeReadMode(Mode.ATTRIBUTE);
        }
Пример #5
0
        private void ReadName()
        {
            int npos = 0;

            KAGWord tag1;

            if (_line == "#")   //No Name
            {
                tag1 = new KAGWord(KAGWord.Type.NAME, "text", "");
            }
            else
            {
                string str = StringUtil.NextStringStopUntil(_line, "[\n", _pos + 1, out npos);
                tag1 = new KAGWord(KAGWord.Type.NAME, "text", str);
            }

            _words.Add(tag1);
        }
Пример #6
0
        private void ReadText()
        {
            int npos = 0;
            //	CCLOG("read Text!");

            string str = StringUtil.NextStringStopUntil(_line, "[\n", _pos, out npos);

            //auto str = nextString("[\n", &npos);
            //if (str)
            //{
            if (_pos < npos)
            {
                // KAGWord tag0 = new KAGWord(KAGWord.Type.TEXT, "op", "print");
                KAGWord tag1 = new KAGWord(KAGWord.Type.TEXT, "text", str);
                // _words.Add(tag0);
                _words.Add(tag1);
            }
            //}
            _pos = npos;
            ChangeReadMode(Mode.TAG);
        }