Beispiel #1
0
        public void WriteState(Structs.Game.StructGameState state)
        {
            WriteClassHeader(state.Name, "SynCState");
            ClassVars.Clear();
            AddVars(state.InitS.Code);
            AddVars(state.UpdateS.Code);
            AddVars(state.DrawS.Code);
            foreach (var nv in Vars)
            {
                ClassVars.Add(nv);
            }
            WriteVars();


            Write("     public override void Init()");
            Write("     {");

            WriteCode(state.InitS.Code);


            Write("     }");

            Write("     public override void Update()");
            Write("     {");

            WriteCode(state.UpdateS.Code);

            Write("     }");

            Write("     public override void Draw()");
            Write("     {");

            WriteCode(state.DrawS.Code);

            Write("     }");

            WriteClassFooter();

            ClassVars.Clear();
        }
Beispiel #2
0
        private void WriteModule(SynModule mod)
        {
            Tab = 1;
            WriteClassHeader(mod.DirectModule.ModuleName);

            ClassVars.Clear();

            foreach (var v in mod.DirectModule.Vars)
            {
                // WriteVar(v);
                Console.WriteLine("Var:" + v.Name);
                ClassVars.Add(v.Name);
            }

            foreach (var v in mod.DirectModule.StaticVars)
            {
                // WriteStaticVar(v);
                Console.WriteLine("Var:" + v.Name);
                ClassVars.Add(v.Name);
            }



            foreach (var meth in mod.DirectModule.Methods)
            {
                AddVars(meth.Code);
            }

            foreach (var func in mod.DirectModule.StaticFuncs)
            {
                AddVars(func.Code);
            }
            foreach (var v in Vars)
            {
                bool add = true;
                foreach (var cv in ClassVars)
                {
                    if (cv == v)
                    {
                        add = false;
                        break;
                    }
                }
                if (add)
                {
                    ClassVars.Add(v);
                }
            }

            foreach (var cv in ClassVars)
            {
                Tab = 2;
                Write("public dynamic " + cv + " = null;");
            }


            Vars.Clear();


            foreach (var meth in mod.DirectModule.Methods)
            {
                if (meth.FuncName == mod.DirectModule.ModuleName)
                {
                    Tab = 3;
                    WriteNewFunc(meth);
                }
                else
                {
                    Tab = 3;
                    WriteFunc(meth);
                }
            }
            Tab = 2;
            WriteClassFooter();
        }