Beispiel #1
0
        public void Save(string path)
        {
            try {
                Directory.CreateDirectory(path);
            } catch {}
            ;
            try {
                Directory.CreateDirectory(path + "/units");
            } catch {}
            ;
            foreach (var s in Directory.GetFiles(path + "/units", "*.lua"))
            {
                try {
                    File.Delete(s);
                } catch {}
                ;
            }

            foreach (DictionaryEntry de in Units)
            {
                string key = de.Key.ToString().ToLower();
                string s   = String.Format("unitDef = {0}\r\n\r\nreturn lowerkeys({{ {1} = unitDef }})\r\n", TableProxy.Export((LuaTable)de.Value, 0), key);
                File.WriteAllText(path + "/units/" + key + ".lua", s);
            }
        }
Beispiel #2
0
 public string GetUnitSource(string unitId)
 {
     return(TableProxy.Export((LuaTable)Units[unitId], 0));
 }