예제 #1
0
 private static void WriteScripts(IList <KeyValuePair <string, GMScript> > _data, Stream _s, IFF _iff)
 {
     WriteDataKVP(_data, _s, _iff, delegate(KeyValuePair <string, GMScript> _kvp, Stream __s, IFF __iff, long __index)
     {
         __s.PatchOffset(__index);
         __iff.AddString(__s, _kvp.Key);
         GMScript value = _kvp.Value;
         __iff.AddString(__s, value.Script);
     });
 }
예제 #2
0
        public void Compile(GMAssets _assets)
        {
            switch (Kind)
            {
            case eAction.ACT_VARIABLE:
                if (Relative)
                {
                    Code = Code + Args[0] + " += " + Args[1];
                }
                else
                {
                    Code = Code + Args[0] + " = " + Args[1];
                }
                Kind = eAction.ACT_NORMAL;
                Args.Clear();
                break;

            case eAction.ACT_CODE:
                Code = Args[0];
                Kind = eAction.ACT_NORMAL;
                Args.Clear();
                if (Program.RemoveDND)
                {
                    List <GMLError> _errors            = null;
                    bool            inhibitErrorOutput = Program.InhibitErrorOutput;
                    Program.InhibitErrorOutput = true;
                    GMLCompile.Compile(_assets, "test_compile", Code, out _errors);
                    Program.InhibitErrorOutput = inhibitErrorOutput;
                    if (_errors.Count > 0)
                    {
                        foreach (GMLError item2 in _errors)
                        {
                            eErrorKind kind = item2.Kind;
                            if (kind == eErrorKind.Warning_Unclosed_Comment)
                            {
                                Code += "*/";
                            }
                        }
                    }
                }
                break;
            }
            if (IsQuestion && ExeType == eExecuteTypes.EXE_CODE)
            {
                Name = string.Format("__script{0}__", countScript);
                GMScript value = new GMScript(Code);
                KeyValuePair <string, GMScript> item = new KeyValuePair <string, GMScript>(Name, value);
                _assets.Scripts.Add(item);
                countScript++;
                ExeType = eExecuteTypes.EXE_FUNCTION;
            }
        }
예제 #3
0
        public void Script_Load(Stream _s)
        {
            int num  = _s.ReadInteger();
            int num2 = _s.ReadInteger();

            for (int i = 0; i < num2; i++)
            {
                Stream s = _s;
                if (num == 800)
                {
                    s = _s.ReadStreamC();
                }
                bool flag = s.ReadBoolean();
                KeyValuePair <string, GMScript> item = default(KeyValuePair <string, GMScript>);
                if (flag)
                {
                    string   key   = s.ReadString();
                    GMScript value = new GMScript(this, s);
                    item = new KeyValuePair <string, GMScript>(key, value);
                }
                Scripts.Add(item);
            }
        }