Beispiel #1
0
    public static void SaveCrtItem(bool isDelete = false)
    {
        if (crt_item != null)
        {
            switch (crt_config.name)
            {
            case CellWars_Editor.config_cell_name:
                config_cell_item config_cell_item = (config_cell_item)config_cell.GetItem(crt_item.id);
                if (config_cell_item == null)
                {
                    config_cell.data.Add((config_cell_item)crt_item);
                }
                break;

            case CellWars_Editor.config_module_name:
                config_module_item config_module_item = (config_module_item)config_module.GetItem(crt_item.id);
                if (config_module_item == null)
                {
                    config_module.data.Add((config_module_item)crt_item);
                }
                break;
            }
        }

        switch (crt_config.name)
        {
        case CellWars_Editor.config_cell_name:
            config_cell.data.Sort();
            FileUtil.Instance().WriteFile(crt_config.name, JsonMapper.ToJson(config_cell), true);
            break;

        case CellWars_Editor.config_module_name:
            config_module.data.Sort();
            FileUtil.Instance().WriteFile(crt_config.name, JsonMapper.ToJson(config_module), true);
            break;
        }
    }
Beispiel #2
0
    public static void SaveCrtItem(bool isDelete = false)
    {
        if (crt_item != null)
        {
            switch (crt_config.name)
            {
            case CellWars_Editor.config_cell_name:
                config_cell_item config_cell_item = (config_cell_item)config_cell.GetItem(crt_item.id);
                if (config_cell_item == null)
                {
                    config_cell.data.Add((config_cell_item)crt_item);
                }
                break;

            case CellWars_Editor.config_wall_name:
                config_wall_item config_wall_item = (config_wall_item)config_wall.GetItem(crt_item.id);
                if (config_wall_item == null)
                {
                    config_wall.data.Add((config_wall_item)crt_item);
                }
                break;

            case CellWars_Editor.config_map_name:
                config_map_item config_map_item = (config_map_item)config_map.GetItem(crt_item.id);
                if (config_map_item == null)
                {
                    config_map.data.Add((config_map_item)crt_item);
                }

//				int cellCount = config_cell.data.Count;
//				int coverCount = config_cover.data.Count;
//				int monsterCount = config_monster.data.Count;
//				int allCount = cellCount + coverCount + monsterCount;
//
//				int dataCount = config_map.GetDataCount();
//				for (int i = 0; i < dataCount; i++)
//				{
//					config_map_item = (config_map_item)config_map.GetItemAt(i);
//					if(config_map_item.id > 20010)
//					{
//						config_map_item.special = "";
//						int randomIndex = Random.Range(0,allCount);
//						if(randomIndex < cellCount)
//						{
//							config_map_item.special = "cell_" + config_cell.GetItemAt(randomIndex).icon;
//						}else if(randomIndex < (cellCount + coverCount))
//						{
//							config_map_item.special = "cover_" + config_cover.GetItemAt(randomIndex - cellCount).icon;
//						}else
//						{
//							config_map_item.special = "monster_" + config_monster.GetItemAt(randomIndex - cellCount - coverCount).icon;
//						}
//					}
//				}

                break;

            case CellWars_Editor.config_cover_name:
                config_cover_item config_cover_item = (config_cover_item)config_cover.GetItem(crt_item.id);
                if (config_cover_item == null)
                {
                    config_cover.data.Add((config_cover_item)crt_item);
                }
                break;

            case CellWars_Editor.config_monster_name:
                config_monster_item config_monster_item = (config_monster_item)config_monster.GetItem(crt_item.id);
                if (config_monster_item == null)
                {
                    config_monster.data.Add((config_monster_item)crt_item);
                }
                break;

            case CellWars_Editor.config_prop_name:
                config_prop_item config_prop_item = (config_prop_item)config_prop.GetItem(crt_item.id);
                if (config_prop_item == null)
                {
                    config_prop.data.Add((config_prop_item)crt_item);
                }
                break;

            case CellWars_Editor.config_module_name:
                config_module_item config_module_item = (config_module_item)config_module.GetItem(crt_item.id);
                if (config_module_item == null)
                {
                    config_module.data.Add((config_module_item)crt_item);
                }
                break;

            case CellWars_Editor.config_guild_name:
                config_guild_item config_guild_item = (config_guild_item)config_guild.GetItem(crt_item.id);
                if (config_guild_item == null)
                {
                    config_guild.data.Add((config_guild_item)crt_item);
                }
                break;

            case CellWars_Editor.config_chapter_name:
                config_chapter_item config_chapter_item = (config_chapter_item)config_chapter.GetItem(crt_item.id);
                if (config_chapter_item == null)
                {
                    config_chapter.data.Add((config_chapter_item)crt_item);
                }
                break;

            case CellWars_Editor.config_wealth_name:
                config_wealth_item config_wealth_item = (config_wealth_item)config_wealth.GetItem(crt_item.id);
                if (config_wealth_item == null)
                {
                    config_wealth.data.Add((config_wealth_item)crt_item);
                }
                break;

            case CellWars_Editor.config_skill_name:
                config_skill_item config_skill_item = (config_skill_item)config_skill.GetItem(crt_item.id);
                if (config_skill_item == null)
                {
                    config_skill.data.Add((config_skill_item)crt_item);
                }
                break;

            case CellWars_Editor.config_sort_name:
                config_sort_item config_sort_item = (config_sort_item)config_sort.GetItem(crt_item.id);
                if (config_sort_item == null)
                {
                    config_sort.data.Add((config_sort_item)crt_item);
                }
                break;
            }
        }

        switch (crt_config.name)
        {
        case CellWars_Editor.config_cell_name:
            config_cell.data.Sort();
            FileUtil.Instance().WriteFile(crt_config.name, JsonMapper.ToJson(config_cell), true);
            break;

        case CellWars_Editor.config_wall_name:
            config_wall.data.Sort();
            FileUtil.Instance().WriteFile(crt_config.name, JsonMapper.ToJson(config_wall), true);
            break;

        case CellWars_Editor.config_map_name:
            config_map.data.Sort();
            FileUtil.Instance().WriteFile(crt_config.name, JsonMapper.ToJson(config_map), true);
            break;

        case CellWars_Editor.config_cover_name:
            config_cover.data.Sort();
            FileUtil.Instance().WriteFile(crt_config.name, JsonMapper.ToJson(config_cover), true);
            break;

        case CellWars_Editor.config_monster_name:
            config_monster.data.Sort();
            FileUtil.Instance().WriteFile(crt_config.name, JsonMapper.ToJson(config_monster), true);
            break;

        case CellWars_Editor.config_prop_name:
            config_prop.data.Sort();
            FileUtil.Instance().WriteFile(crt_config.name, JsonMapper.ToJson(config_prop), true);
            break;

        case CellWars_Editor.config_module_name:
            config_module.data.Sort();
            FileUtil.Instance().WriteFile(crt_config.name, JsonMapper.ToJson(config_module), true);
            break;

        case CellWars_Editor.config_guild_name:
            config_guild.data.Sort();
            FileUtil.Instance().WriteFile(crt_config.name, JsonMapper.ToJson(config_guild), true);
            break;

        case CellWars_Editor.config_chapter_name:
            config_chapter.data.Sort();
            FileUtil.Instance().WriteFile(crt_config.name, JsonMapper.ToJson(config_chapter), true);
            break;

        case CellWars_Editor.config_wealth_name:
            config_wealth.data.Sort();
            FileUtil.Instance().WriteFile(crt_config.name, JsonMapper.ToJson(config_wealth), true);
            break;

        case CellWars_Editor.config_skill_name:
            config_skill.data.Sort();
            FileUtil.Instance().WriteFile(crt_config.name, JsonMapper.ToJson(config_skill), true);
            break;

        case CellWars_Editor.config_sort_name:
            config_sort.data.Sort();
            FileUtil.Instance().WriteFile(crt_config.name, JsonMapper.ToJson(config_sort), true);
            break;
        }
    }