示例#1
0
文件: AnimBP.cs 项目: zerzic/IcedTech
        public void WriteCPP(string fileName)
        {
            string __cppBuffer    = "";
            string __fileNameOnly = Path.GetFileName(fileName);

            __cppBuffer += string.Format("// {0} - This file has been auto generated by the BuildTool\n", __fileNameOnly);
            __cppBuffer += "// Please do NOT modify this file!\n";
            __cppBuffer += "\n";
            __cppBuffer += "#include \"game_precompiled.h\"\n";
            __cppBuffer += "#pragma hdrstop\n";
            __cppBuffer += "#include \"Game_local.h\"\n";
            __cppBuffer += "// This file has been auto generated by the BuildTool Please do NOT modify this file!\n";
            __cppBuffer += "\n";
            __cppBuffer += string.Format("CLASS_STATES_DECLARATION({0})\n", classname);
            for (int i = 0; i < _animBP.Count; i++)
            {
                AnimBP _anim = _animBP[i];

                foreach (AnimBPEvent ev in _anim._animBPEvents)
                {
                    __cppBuffer += string.Format("\tSTATE(\"{0}\", {1}::State_{2})\n", ev.EventName, classname, ev.EventName);
                }
            }
            __cppBuffer += "END_CLASS_STATES\n";

            __cppBuffer += "// This file has been auto generated by the BuildTool Please do NOT modify this file!\n";
            for (int i = 0; i < _animBP.Count; i++)
            {
                AnimBP _anim = _animBP[i];

                foreach (AnimBPEvent ev in _anim._animBPEvents)
                {
                    AnimBPCodeBlock codeBlock = _anim.FindCodeBlock(ev.CodeName);

                    __cppBuffer += string.Format("stateResult_t {0}::State_{1}(const stateParms_t&parms)\n", classname, ev.EventName);
                    __cppBuffer += EvaluateCodeBlock(codeBlock.buffer, ev.Macro);
                }
            }

            File.WriteAllText(fileName, __cppBuffer);
        }
示例#2
0
文件: AnimBP.cs 项目: zerzic/IcedTech
        void LoadAnimBP()
        {
            while (!_parser.EndOfFile)
            {
                string token = _parser.GetToken(false);

                if (token == "animbp")
                {
                    AnimBP animBP = new AnimBP(ref _parser);
                    _animBP.Add(animBP);
                }
                else if (token == "classname")
                {
                    classname = _parser.GetToken(false);
                }
                else
                {
                    throw new Exception("AnimBPFile unknown or unexpcted token " + token);
                }
            }
        }