Exemplo n.º 1
0
        //根据目前选择的操作,修改配置文件
        public void ExcuteModified(int branchIdx)
        {
            table  bt               = currentLuaTableData.tables[branchIdx + 1];
            string serverContent    = bt.GenString(null, true);
            string clientContent    = bt.GenString(null, false);
            string serverAimTmpPath = GetBranchServerLuaPath(bt.name, branchIdx);
            string clientAimTmpPath = GetBranchClientLuaPath(currentExcelpath, branchIdx);

            FileUtil.WriteTextFile(serverContent, serverAimTmpPath);
            FileUtil.WriteTextFile(clientContent, clientAimTmpPath);
            //loptimal.optimal(aimTmpPath, );
            Instance.ClearCurrent();
        }
Exemplo n.º 2
0
        //static string gen_metatable(Dictionary<string, Dictionary<string, int>> basedic)

        static string gen_normal(table table, Dictionary <string, string> basekv)
        {
            //去除不需要生成的属性
            property temp;

            for (int i = 0; i < table.configs.Count; i++)
            {
                for (int j = 0; j < table.configs[i].properties.Count; j++)
                {
                    temp = table.configs[i].properties[j];
                    if (basekv.ContainsKey(temp.name) && basekv[temp.name] == temp.value)
                    {
                        table.configs[i].properties.RemoveAt(j--);
                    }
                }
            }

            Func <string> genmeta = () =>
            {
                string meta = "local __default = {\n";
                foreach (var item in basekv)
                {
                    meta = string.Format("{0}\t{1} = {2},\n", meta, item.Key, item.Value);
                }
                meta = string.Format("{0}}}\ndo\n\tlocal base = {{\n\t\t__index = __default,\n\t\t--__newindex = function()\n\t\t\t--禁止写入新值\n\t\t\t--error(\"Attempt to modify read-only table\")\n\t\t--end\n\t}}\n\tfor k, v in pairs({1}) do\n\t\tsetmetatable(v, base)\n\tend\n\tbase.__metatable = false\nend\n", meta, table.name);
                return(meta);
            };

            return(table.GenString(genmeta));
        }
Exemplo n.º 3
0
        //根据目前选择的操作,修改配置文件
        public void ExcuteModified(int branchIdx)
        {
            table     bt         = currentLuaTableData.tables[branchIdx + 1]; //branch table
            tablediff btd        = currentLuaTableData.tableDiffs[branchIdx]; //branch tablediff
            string    tmp        = bt.GenString(null, btd);
            string    aimTmpPath = TmpTableRealPaths[branchIdx];

            FileUtil.WriteTextFile(tmp, aimTmpPath);
        }
Exemplo n.º 4
0
        static string gen_group(table table, List <List <config> > group)
        {
            Dictionary <string, Dictionary <string, string> >        basedic;
            Dictionary <List <config>, Dictionary <string, string> > groupdic;

            build_datamap(group, out basedic, out groupdic);

            //去除不需要生成的属性
            table_deduplication(ref table, basedic);

            Func <string> genmeta = () =>
            {
                return(gen_group_metatable(groupdic, table.name));
            };

            return(table.GenString(genmeta));
        }