コード例 #1
0
    public static void EditConfigItem(int id = 0)
    {
        if (id > 0)
        {
            crt_item = crt_config.GetItem(id);
        }
        else
        {
            switch (crt_config.name)
            {
            case CellWars_Editor.config_cell_name:
                crt_item = new config_cell_item();
                config_cell_item config_cell_item = (config_cell_item)crt_item;
                config_cell_item.Clear();
                config_cell_item.id      = config_cell.data[config_cell.GetDataCount() - 1].id + 1;
                config_cell_item.hide_id = config_cell_item.id;
                config_cell_item.icon    = config_cell_item.id;
                break;

            case CellWars_Editor.config_module_name:
                crt_item = new config_module_item();
                config_module_item config_module_item = (config_module_item)crt_item;
                config_module_item.Clear();
                config_module_item.id = config_module.data[config_module.GetDataCount() - 1].id + 1;
                break;
            }
        }
    }
コード例 #2
0
    public void UpdateItem(int posx, int posy, int posn, int id)
    {
        EditList list = listDic[GridModel.Instance.brushType];
        EditItem item = list.GetItemByPos(posx, posy, posn);

        if (GridModel.Instance.brushType == FightLayerType.cell)
        {
            config_cell_item config_cell = (config_cell_item)GridMain.resourceMgr.config_cell.GetItem(id);
            item.icon    = config_cell.icon;
            item.zrotate = config_cell.rotate * FightConst.ROTATE_BASE;
        }
        else if (GridModel.Instance.brushType == FightLayerType.monster)
        {
            config_monster_item config_monster = (config_monster_item)GridMain.resourceMgr.config_monster.GetItem(id);
            item.icon    = config_monster.icon;
            item.zrotate = config_monster.rotate * FightConst.ROTATE_BASE;
        }
        else if (GridModel.Instance.brushType == FightLayerType.cover)
        {
            config_cover_item config_cover = (config_cover_item)GridMain.resourceMgr.config_cover.GetItem(id);
            item.icon = config_cover.icon;
        }
        else
        {
            item.icon = id;
        }
    }
コード例 #3
0
 public void SetConfig(int id)
 {
     if (id == 10400)
     {
         id = 0;
     }
     config = (config_cell_item)ResModel.Instance.config_cell.GetItem(id);
 }
コード例 #4
0
 public void SetConfig(int id)
 {
     if (id == 10400)
     {
         id = 0;
     }
     config = (config_cell_item)GameMgr.resourceMgr.config_cell.GetItem(id);
 }
コード例 #5
0
ファイル: config_cell_item.cs プロジェクト: ErrorMee/update
 private void RecursionGetHides(config_cell_item tempItem, List <int> hides)
 {
     if (tempItem != null)
     {
         if (tempItem.hide_id != tempItem.id)
         {
             hides.Add(tempItem.hide_id);
             config_item_base hideItem = GameMgr.resourceMgr.config_cell.GetItem(tempItem.hide_id);
             RecursionGetHides((config_cell_item)hideItem, hides);
         }
     }
 }
コード例 #6
0
 private void RecursionGetHides(config_cell_item tempItem, List <int> hides)
 {
     if (tempItem != null)
     {
         if (tempItem.hide_id != tempItem.id)
         {
             hides.Add(tempItem.hide_id);
             config_item_base hideItem = ResModel.Instance.config_cell.GetItem(tempItem.hide_id);
             RecursionGetHides((config_cell_item)hideItem, hides);
         }
     }
 }
コード例 #7
0
ファイル: ConfigWnd.cs プロジェクト: ErrorMee/update
    private void InitList()
    {
        int dataCount = CellWars_Editor.crt_config.GetDataCount();

        EditorGUILayout.LabelField("data.Count:" + dataCount);

        scrollPos = EditorGUILayout.BeginScrollView(scrollPos, GUILayout.Width(instance.minSize.x - 10), GUILayout.Height(instance.minSize.y - 40));
        int groupIndex = 0;

        for (int i = 0; i < dataCount; i++)
        {
            if (groupIndex == 0)
            {
                EditorGUILayout.BeginHorizontal();
            }
            groupIndex++;


            config_item_base item = CellWars_Editor.crt_config.GetItemAt(i);

            string itemName = " " + item.id;
            if (CellWars_Editor.crt_config.name == "config_cell")
            {
                config_cell_item config_cell_item = (config_cell_item)item;
                itemName = (int)config_cell_item.cell_type + " " + item.id;
            }
            if (CellWars_Editor.crt_config.name == "config_monster")
            {
                config_monster_item config_monster_item = (config_monster_item)item;
                itemName = (int)config_monster_item.monster_type + " " + item.id;
            }
            if (GUILayout.Button(itemName, GUILayout.Width(80)))
            {
                ConfigSet levelSet = (ConfigSet)EditorWindow.GetWindow(typeof(ConfigSet));
                if (levelSet != null)
                {
                    levelSet.Close();
                }
                ConfigSet.InstanceShow(item.id);
            }

            if (groupIndex == 10)
            {
                groupIndex = 0;
                EditorGUILayout.EndHorizontal();
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField(" ");
                EditorGUILayout.EndHorizontal();
            }
        }
        EditorGUILayout.EndScrollView();
    }
コード例 #8
0
    public bool SetConfig(int id)
    {
        special0 = 0;
        special1 = 0;
        if (id == 10000)
        {
            id = 0;
        }
        if (originalConfigId <= 0)
        {
            originalConfigId = id;
        }

        if (configId == id)
        {
            return(false);
        }

        configId = id;
        config   = (config_cell_item)ResModel.Instance.config_cell.GetItem(configId);

        if (changer > 0)
        {
            changer = configId + 15;
        }

        if (configId <= 0)
        {
            isBlank = true;
        }
        else
        {
            isBlank = false;
        }

        if (timer < 0 && config != null)
        {
            if (config.cell_type == (int)CellType.timer)
            {
                addCount = config.GetSpecialValue(0);
                timer    = config.GetSpecialValue(1);
            }
        }

        if (config != null)
        {
            special0 = config.GetSpecialValue(0);
            special1 = config.GetSpecialValue(1);
        }

        return(true);
    }
コード例 #9
0
    private void ShowCell()
    {
        ShowBase(10000, 19999);

        config_cell_item config_cell_item = (config_cell_item)CellWars_Editor.crt_item;

        config_cell_item.hide_id   = (int)EditorGUILayout.Slider("hide_id " + CellWars_Editor.config_cell.template.hide_id, config_cell_item.hide_id, 10000, 19999);
        config_cell_item.cell_type = (int)EditorGUILayout.Slider("cell_type " + CellWars_Editor.config_cell.template.cell_type, config_cell_item.cell_type, 0, 20);
        config_cell_item.line_type = (int)EditorGUILayout.Slider("line_type " + CellWars_Editor.config_cell.template.line_type, config_cell_item.line_type, -1, 5);

        config_cell_item.life   = (int)EditorGUILayout.Slider("life " + CellWars_Editor.config_cell.template.life, config_cell_item.life, -2, 3);
        config_cell_item.move   = EditorGUILayout.Toggle("move " + CellWars_Editor.config_cell.template.move, config_cell_item.move);
        config_cell_item.atk    = EditorGUILayout.Toggle("atk " + CellWars_Editor.config_cell.template.atk, config_cell_item.atk);
        config_cell_item.rotate = (int)EditorGUILayout.Slider("rotate " + CellWars_Editor.config_cell.template.rotate, config_cell_item.rotate, 0, 5);
    }
コード例 #10
0
    public override config_item_base Copy()
    {
        config_cell_item item = new config_cell_item();

        item.id   = id;
        item.icon = icon;
        item.name = name;
        item.desc = desc;

        item.hide_id   = hide_id;
        item.cell_type = cell_type;
        item.line_type = line_type;
        item.life      = life;
        item.move      = move;
        item.atk       = atk;
        item.rotate    = rotate;
        return(item);
    }
コード例 #11
0
    public void SelectTemplet(int id)
    {
        config_cell_item cellTarget = (config_cell_item)ResModel.Instance.config_cell.GetItem(id);
        int i;

        for (i = 0; i < skillSelects.Count; i++)
        {
            int skillId           = SkillTempletModel.Instance.skillSelects[i];
            config_cell_item cell = (config_cell_item)ResModel.Instance.config_cell.GetItem(skillId);

            if (cellTarget.hide_id == cell.hide_id)
            {
                SkillTempletModel.Instance.skillSelects[i] = id;
                SaveSelect();
                if (updateSelectEvent != null)
                {
                    updateSelectEvent();
                }
                return;
            }
        }
    }
コード例 #12
0
    private void FindSwicthNext()
    {
        nextTempletInfo = null;

        config_cell_item cell = (config_cell_item)GameMgr.resourceMgr.config_cell.GetItem(skillTempletInfo.config.cellId);

        List <SkillTempletInfo> skillTemplets = SkillTempletModel.Instance.GetGroup(cell.hide_id).skillTemplets;

        int i;

        for (i = 0; i < skillTemplets.Count; i++)
        {
            SkillTempletInfo skillTemplet = skillTemplets[i];

            if (skillTemplet.config.cellId == skillTempletInfo.config.cellId)
            {
                break;
            }
        }

        if (i == (skillTemplets.Count - 1))
        {
            nextTempletInfo = skillTemplets[0];
        }
        else
        {
            nextTempletInfo = skillTemplets[i + 1];
        }

        if (nextTempletInfo.IsUnlock() == false)
        {
            nextTempletInfo = null;
            switchTip.gameObject.SetActive(false);
        }
        else
        {
            switchTip.gameObject.SetActive(true);
        }
    }
コード例 #13
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;
        }
    }
コード例 #14
0
    void OnEnable()
    {
        if (BattleModel.Instance.crtBattle != null)
        {
            switch (type)
            {
            case FightLayerType.bg:
                int i;
                for (i = 0; i < BattleModel.Instance.crtBattle.battle_height; i++)
                {
                    for (int j = 0; j < BattleModel.Instance.crtBattle.battle_width; j++)
                    {
                        BattleCellInfo cell = BattleModel.Instance.crtBattle.allCells[i][j];
                        CreateCellItem(j + BattleModel.Instance.crtBattle.start_x, -i + BattleModel.Instance.crtBattle.start_y, cell.bg_id);
                    }
                }
                break;

            case FightLayerType.monster:
                for (i = 0; i < BattleModel.Instance.crtBattle.battle_height; i++)
                {
                    for (int j = 0; j < BattleModel.Instance.crtBattle.battle_width; j++)
                    {
                        BattleCellInfo cell = BattleModel.Instance.crtBattle.allCells[i][j];

                        config_monster_item config_monster = (config_monster_item)GridMain.resourceMgr.config_monster.GetItem(cell.monster_id);
                        if (config_monster != null)
                        {
                            CreateCellItem(j + BattleModel.Instance.crtBattle.start_x, -i + BattleModel.Instance.crtBattle.start_y, config_monster.icon, config_monster.rotate);
                        }
                        else
                        {
                            CreateCellItem(j + BattleModel.Instance.crtBattle.start_x, -i + BattleModel.Instance.crtBattle.start_y, cell.monster_id);
                        }
                    }
                }
                break;

            case FightLayerType.floor:
                for (i = 0; i < BattleModel.Instance.crtBattle.battle_height; i++)
                {
                    for (int j = 0; j < BattleModel.Instance.crtBattle.battle_width; j++)
                    {
                        BattleCellInfo cell = BattleModel.Instance.crtBattle.allCells[i][j];
                        CreateCellItem(j + BattleModel.Instance.crtBattle.start_x, -i + BattleModel.Instance.crtBattle.start_y, cell.floor_id);
                    }
                }
                break;

            case FightLayerType.cell:
                for (i = 0; i < BattleModel.Instance.crtBattle.battle_height; i++)
                {
                    for (int j = 0; j < BattleModel.Instance.crtBattle.battle_width; j++)
                    {
                        BattleCellInfo   cell        = BattleModel.Instance.crtBattle.allCells[i][j];
                        config_cell_item config_cell = (config_cell_item)GridMain.resourceMgr.config_cell.GetItem(cell.cell_id);

                        CreateCellItem(j + BattleModel.Instance.crtBattle.start_x, -i + BattleModel.Instance.crtBattle.start_y, config_cell.icon, config_cell.rotate);
                    }
                }
                break;

            case FightLayerType.fence:
                for (i = 0; i < BattleModel.Instance.crtBattle.battle_height; i++)
                {
                    for (int j = 0; j < BattleModel.Instance.crtBattle.battle_width; j++)
                    {
                        BattleCellInfo cell = BattleModel.Instance.crtBattle.allCells[i][j];
                        CreateWallItem(j + BattleModel.Instance.crtBattle.start_x, -i + BattleModel.Instance.crtBattle.start_y, 0, cell.walls[0]);
                        CreateWallItem(j + BattleModel.Instance.crtBattle.start_x, -i + BattleModel.Instance.crtBattle.start_y, 1, cell.walls[1]);
                        CreateWallItem(j + BattleModel.Instance.crtBattle.start_x, -i + BattleModel.Instance.crtBattle.start_y, 2, cell.walls[2]);
                    }
                }
                break;

            case FightLayerType.cover:
                for (i = 0; i < BattleModel.Instance.crtBattle.battle_height; i++)
                {
                    for (int j = 0; j < BattleModel.Instance.crtBattle.battle_width; j++)
                    {
                        BattleCellInfo    cell         = BattleModel.Instance.crtBattle.allCells[i][j];
                        config_cover_item config_cover = (config_cover_item)GridMain.resourceMgr.config_cover.GetItem(cell.cover_id);

                        if (config_cover != null)
                        {
                            CreateCoverItem(j + BattleModel.Instance.crtBattle.start_x, -i + BattleModel.Instance.crtBattle.start_y, config_cover.icon);
                        }
                        else
                        {
                            CreateCoverItem(j + BattleModel.Instance.crtBattle.start_x, -i + BattleModel.Instance.crtBattle.start_y, cell.cover_id);
                        }
                    }
                }
                break;

            case FightLayerType.fg:
                int index = 0;
                for (i = (int)PosMgr.Y_HALF_COUNT; i >= -PosMgr.Y_HALF_COUNT; i--)
                {
                    for (int j = -(int)PosMgr.X_HALF_COUNT; j <= PosMgr.X_HALF_COUNT; j++)
                    {
                        int id = BattleModel.Instance.crtBattle.fgIds[index];
                        CreateCellItem(j, i, id);
                        index++;
                    }
                }
                break;
            }
        }
    }
コード例 #15
0
    public List <CellInfo> ReleaseList(int monsterId)
    {
        List <CellInfo> releaseList = new List <CellInfo>();

        MonsterInfo monster = GetMonsterInfoByRunId(monsterId);

        if (monster != null && monster.releaseList.Count > 0)
        {
            TIVInfo tiv = monster.releaseList[0];

            CellModel.Instance.anims = new List <List <CellAnimInfo> >();

            List <CellInfo> waitList = new List <CellInfo>();

            if ((int)tiv.value <= 0)
            {
                CellInfo    centerCell = CellModel.Instance.GetCellByPos(monster.posX, monster.posY);
                CellDirType dirType    = WallModel.Instance.GetGapWallDir(centerCell);
                if (dirType != CellDirType.no)
                {
                    waitList = CellModel.Instance.GetDirCells(centerCell, dirType);
                }

                for (int i = 0; i < waitList.Count; i++)
                {
                    CellInfo cellInfo = waitList[i];
                    if (cellInfo != null && cellInfo.isBlank == false && cellInfo.config.cell_type == (int)CellType.five)
                    {
                        cellInfo.SetConfig((int)tiv.id);
                        releaseList.Add(cellInfo);
                    }
                }
            }
            else
            {
                if (monster.progress > 0)
                {
                    if (monster.progress >= 1)
                    {
                        monster.progress = 0;
                        CellInfo centerCell = CellModel.Instance.GetCellByPos(monster.posX, monster.posY);
                        waitList = CellModel.Instance.GetNeighbors(centerCell);
                        for (int i = 0; i < waitList.Count; i++)
                        {
                            CellInfo cellInfo = waitList[i];
                            if (cellInfo != null && cellInfo.isBlank == false && cellInfo.config.cell_type == (int)CellType.five)
                            {
                                cellInfo.SetConfig((int)tiv.id);
                                releaseList.Add(cellInfo);
                            }
                        }
                    }
                }
                else if (monster.banCount >= 0)
                {
                    if (monster.banCount == 0)
                    {
                        CellInfo domnCell = CellModel.Instance.GetCellByPos(monster.posX, monster.posY + 1);
                        if (domnCell != null)
                        {
                            if (domnCell.isBlank)
                            {
                                domnCell.SetConfig(monster.releaseId);
                                CellModel.Instance.RemoveFromLines(domnCell.posX, domnCell.posY);
                                releaseList.Add(domnCell);
                            }
                            else
                            {
                                if (domnCell.config.id != monster.releaseId && domnCell.config.cell_type != (int)CellType.terrain)
                                {
                                    config_cell_item config_cell = (config_cell_item)ResModel.Instance.config_cell.GetItem(monster.releaseId);

                                    bool       inHide = false;
                                    List <int> hides  = config_cell.GetHides();
                                    for (int h = 0; h < hides.Count; h++)
                                    {
                                        if (domnCell.config.id == hides[h])
                                        {
                                            inHide = true;
                                        }
                                    }

                                    if (inHide == false)
                                    {
                                        domnCell.SetConfig(monster.releaseId);
                                        CellModel.Instance.RemoveFromLines(domnCell.posX, domnCell.posY);
                                        releaseList.Add(domnCell);
                                    }
                                }
                            }
                        }
                    }
                }
                else
                {
                    for (int i = 0; i < BattleModel.Instance.crtBattle.ShowHeight(); i++)
                    {
                        List <CellInfo> xCells = CellModel.Instance.allCells[i];
                        for (int j = 0; j < xCells.Count; j++)
                        {
                            CellInfo cellInfo = xCells[j];
                            if (cellInfo.isBlank == false && cellInfo.config.cell_type == (int)CellType.five && cellInfo.changer == 0)
                            {
                                if (tiv.id != cellInfo.config.id)
                                {
                                    waitList.Add(cellInfo);
                                }
                            }
                        }
                    }
                    int minCount = Mathf.Min((int)tiv.value, waitList.Count);
                    for (int i = 0; i < minCount; i++)
                    {
                        int rangeIndex = Random.Range(0, waitList.Count);

                        CellInfo cellInfo = waitList[rangeIndex];
                        cellInfo.SetConfig((int)tiv.id);

                        waitList.RemoveAt(rangeIndex);

                        releaseList.Add(cellInfo);
                    }
                }
            }
        }
        return(releaseList);
    }
コード例 #16
0
    public void InitList(FightLayerType type)
    {
        toggleItemListType = type;

        list.ClearList();

        List <config_item_base> datas = new List <config_item_base>();
        int i;

        switch (toggleItemListType)
        {
        case FightLayerType.map:
            for (i = 0; i < GridMain.resourceMgr.config_map.data.Count; i++)
            {
                datas.Add(GridMain.resourceMgr.config_map.data[i]);
            }
            break;

        case FightLayerType.monster:
            for (i = 0; i < GridMain.resourceMgr.config_monster.data.Count; i++)
            {
                config_monster_item config_monster = GridMain.resourceMgr.config_monster.data[i];
                datas.Add(config_monster);
            }
            break;

        case FightLayerType.bg:
            for (i = 0; i < GridMain.resourceMgr.config_cell.data.Count; i++)
            {
                config_cell_item config_cell = GridMain.resourceMgr.config_cell.data[i];
                if (config_cell.cell_type == (int)CellType.bg)
                {
                    datas.Add(GridMain.resourceMgr.config_cell.data[i]);
                }
            }
            break;

        case FightLayerType.floor:
            for (i = 0; i < GridMain.resourceMgr.config_cell.data.Count; i++)
            {
                config_cell_item config_cell = GridMain.resourceMgr.config_cell.data[i];
                if (config_cell.cell_type == (int)CellType.floor)
                {
                    datas.Add(GridMain.resourceMgr.config_cell.data[i]);
                }
            }
            break;

        case FightLayerType.cell:
            for (i = 0; i < GridMain.resourceMgr.config_cell.data.Count; i++)
            {
                config_cell_item config_cell = GridMain.resourceMgr.config_cell.data[i];
                if (config_cell.cell_type == (int)CellType.five || config_cell.cell_type == (int)CellType.changer ||
                    config_cell.cell_type == (int)CellType.invade || config_cell.cell_type == (int)CellType.terrain)
                {
                    datas.Add(GridMain.resourceMgr.config_cell.data[i]);
                }
            }
            break;

        case FightLayerType.cell_add:
            for (i = 0; i < GridMain.resourceMgr.config_cell.data.Count; i++)
            {
                config_cell_item config_cell = GridMain.resourceMgr.config_cell.data[i];
                if (config_cell.cell_type == (int)CellType.radiate || config_cell.cell_type == (int)CellType.bomb ||
                    config_cell.cell_type == (int)CellType.timer || config_cell.cell_type == (int)CellType.line_bomb ||
                    config_cell.cell_type == (int)CellType.line_bomb_r || config_cell.cell_type == (int)CellType.three_bomb ||
                    config_cell.cell_type == (int)CellType.three_bomb_r)
                {
                    datas.Add(GridMain.resourceMgr.config_cell.data[i]);
                }
            }
            break;

        case FightLayerType.fence:
            for (i = 0; i < GridMain.resourceMgr.config_wall.data.Count; i++)
            {
                config_wall_item config_wall = GridMain.resourceMgr.config_wall.data[i];
                datas.Add(config_wall);
            }
            break;

        case FightLayerType.cover:
            for (i = 0; i < GridMain.resourceMgr.config_cover.data.Count; i++)
            {
                config_cover_item config_cover = GridMain.resourceMgr.config_cover.data[i];
                datas.Add(config_cover);
            }
            break;

        case FightLayerType.fg:
            for (i = 0; i < GridMain.resourceMgr.config_cell.data.Count; i++)
            {
                config_cell_item config_cell = GridMain.resourceMgr.config_cell.data[i];
                if (config_cell.cell_type == (int)CellType.fg)
                {
                    datas.Add(GridMain.resourceMgr.config_cell.data[i]);
                }
            }
            break;
        }

        for (i = 0; i < datas.Count; i++)
        {
            if (type == FightLayerType.cell || type == FightLayerType.cell_add)
            {
                config_cell_item config_cell = (config_cell_item)datas[i];
                CreateItem(datas[i], FightLayerType.cell, config_cell.rotate);
            }
            else if (type == FightLayerType.monster)
            {
                config_monster_item config_monster = (config_monster_item)datas[i];
                CreateItem(datas[i], type, config_monster.rotate);
            }
            else
            {
                CreateItem(datas[i], type);
            }
        }
    }
コード例 #17
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;
        }
    }
コード例 #18
0
    public static void EditConfigItem(int id = 0)
    {
        if (id > 0)
        {
            crt_item = crt_config.GetItem(id);
        }
        else
        {
            switch (crt_config.name)
            {
            case CellWars_Editor.config_cell_name:
                crt_item = new config_cell_item();
                config_cell_item config_cell_item = (config_cell_item)crt_item;
                config_cell_item.Clear();
                config_cell_item.id      = config_cell.data[config_cell.GetDataCount() - 1].id + 1;
                config_cell_item.hide_id = config_cell_item.id;
                config_cell_item.icon    = config_cell_item.id;
                break;

            case CellWars_Editor.config_wall_name:
                crt_item = new config_wall_item();
                config_wall_item config_wall_item = (config_wall_item)crt_item;
                config_wall_item.Clear();
                config_wall_item.id = config_wall.data[config_wall.GetDataCount() - 1].id + 1;
                break;

            case CellWars_Editor.config_map_name:
                crt_item = new config_map_item();
                config_map_item config_map_item = (config_map_item)crt_item;
                config_map_item.Clear();
                config_map_item.id           = config_map.data[config_map.GetDataCount() - 1].id + 1;
                config_map_item.name         = "" + (config_map_item.id % 10000);
                config_map_item.icon         = config_map_item.id;
                config_map_item.step         = 20;
                config_map_item.pre_id       = (config_map_item.id - 1);
                config_map_item.task         = "10101|20,10102|21,10103|22,10104|23,10105|24";
                config_map_item.build        = 10000;
                config_map_item.fill         = 10000;
                config_map_item.judge        = "1000,2000,3000";
                config_map_item.forbid_skill = "10106,10112,10108,10114,10110";
                config_map_item.forbid_prop  = "";
                break;

            case CellWars_Editor.config_cover_name:
                crt_item = new config_cover_item();
                config_cover_item config_cover_item = (config_cover_item)crt_item;
                config_cover_item.Clear();
                config_cover_item.id = config_cover.data[config_cover.GetDataCount() - 1].id + 1;
                break;

            case CellWars_Editor.config_monster_name:
                crt_item = new config_monster_item();
                config_monster_item config_monster_item = (config_monster_item)crt_item;
                config_monster_item.Clear();
                config_monster_item.id = config_monster.data[config_monster.GetDataCount() - 1].id + 1;
                break;

            case CellWars_Editor.config_prop_name:
                crt_item = new config_prop_item();
                config_prop_item config_prop_item = (config_prop_item)crt_item;
                config_prop_item.Clear();
                config_prop_item.id = config_prop.data[config_prop.GetDataCount() - 1].id + 1;
                break;

            case CellWars_Editor.config_module_name:
                crt_item = new config_module_item();
                config_module_item config_module_item = (config_module_item)crt_item;
                config_module_item.Clear();
                config_module_item.id = config_module.data[config_module.GetDataCount() - 1].id + 1;
                break;

            case CellWars_Editor.config_guild_name:
                crt_item = new config_guild_item();
                config_guild_item config_guild_item = (config_guild_item)crt_item;
                config_guild_item.Clear();
                config_guild_item.id = config_guild.data[config_guild.GetDataCount() - 1].id + 1;
                break;

            case CellWars_Editor.config_chapter_name:
                crt_item = new config_chapter_item();
                config_chapter_item config_chapter_item = (config_chapter_item)crt_item;
                config_chapter_item.Clear();
                config_chapter_item.id = config_chapter.data[config_chapter.GetDataCount() - 1].id + 1;
                break;

            case CellWars_Editor.config_wealth_name:
                crt_item = new config_wealth_item();
                config_wealth_item config_wealth_item = (config_wealth_item)crt_item;
                config_wealth_item.Clear();
                config_wealth_item.id = config_wealth.data[config_wealth.GetDataCount() - 1].id + 1;
                break;

            case CellWars_Editor.config_skill_name:
                crt_item = new config_skill_item();
                config_skill_item config_skill_item = (config_skill_item)crt_item;
                config_skill_item.Clear();
                config_skill_item.id = config_skill.data[config_skill.GetDataCount() - 1].id + 1;
                break;

            case CellWars_Editor.config_sort_name:
                crt_item = new config_sort_item();
                config_sort_item config_sort_item = (config_sort_item)crt_item;
                config_sort_item.Clear();
                config_sort_item.id = config_sort.data[config_sort.GetDataCount() - 1].id + 1;
                break;
            }
        }
    }