Ejemplo n.º 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;
            }
        }
    }
Ejemplo n.º 2
0
    public static void DelCrtItem()
    {
        if (crt_item != null)
        {
            for (int i = 0; i < crt_config.GetDataCount(); i++)
            {
                config_item_base item = crt_config.GetItemAt(i);

                if (item.id == crt_item.id)
                {
                    switch (crt_config.name)
                    {
                    case CellWars_Editor.config_cell_name:
                        config_cell.data.RemoveAt(i);
                        break;

                    case CellWars_Editor.config_module_name:
                        config_module.data.RemoveAt(i);
                        break;
                    }
                    break;
                }
            }
        }
        FileUtil.Instance().WriteFile(crt_config.name, JsonMapper.ToJson(crt_config), true);
    }
Ejemplo n.º 3
0
    private void CreateItem(config_item_base itemInfo, FightLayerType type, int rotate = 0)
    {
        GameObject item = list.NewItem();

        item.name = "item_" + itemInfo.id;

        ToggleItem toggleItem = item.GetComponent <ToggleItem>();

        toggleItem.itemInfo = itemInfo;

        toggleItem.type = type;

        toggleItem.id      = itemInfo.id;
        toggleItem.icon    = itemInfo.icon;
        toggleItem.zrotate = rotate * FightConst.ROTATE_BASE;
        if (toggleItem.type == FightLayerType.map)
        {
            toggleItem.toggle.group = list.GetComponent <ToggleGroup>();
        }
        else
        {
            toggleItem.toggle.group = transform.parent.GetComponent <ToggleGroup>();
        }
        toggleItem.toggle.onValueChanged.AddListener(toggleItem.OnSelectChange);
    }
Ejemplo n.º 4
0
    private void FightMap(int mapId)
    {
        config_map_item config = (config_map_item)ResModel.Instance.config_map.GetItem(mapId);

        if (config != null)
        {
            int endlevel = (int)GameModel.Instance.GetGameConfig(1007);
            if (config.id > endlevel)
            {
                config_item_base mapconfigitem = ResModel.Instance.config_map.GetItem(endlevel);
                PromptModel.Instance.Pop(string.Format(LanguageUtil.GetTxt(11101), Convert.ToInt32(mapconfigitem.name)));
                return;
            }

            BattleModel.Instance.InitCrtBattle(config);
            BattleModel.Instance.InitFight();

            SkillTempletModel.Instance.UpdataTemplet();

            FillModel.Instance.InitFillInfo();

            ModuleModel.Instance.AddUIModule((int)ModuleEnum.PREPARE);
        }
        else
        {
            Debug.Log(LanguageUtil.GetTxt(11102));
        }
    }
Ejemplo n.º 5
0
    public virtual config_item_base Copy()
    {
        config_item_base item = new config_item_base();

        item.id      = id;
        item.icon    = icon;
        item.name    = name;
        item.desc    = desc;
        item.special = special;
        return(item);
    }
Ejemplo n.º 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);
         }
     }
 }
Ejemplo n.º 7
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 = GameMgr.resourceMgr.config_cell.GetItem(tempItem.hide_id);
             RecursionGetHides((config_cell_item)hideItem, hides);
         }
     }
 }
Ejemplo n.º 8
0
    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();
    }
Ejemplo n.º 9
0
    override public config_item_base GetItem(int id)
    {
        for (int i = 0; i < data.Count; i++)
        {
            config_item_base item = data[i];

            if (item.id == id)
            {
                return(item);
            }
        }
        return(null);
    }
Ejemplo n.º 10
0
    public void DelItem(int id)
    {
        if (id > 0)
        {
            for (int i = 0; i < data.Count; i++)
            {
                config_item_base item = data[i];

                if (item.id == id)
                {
                    data.RemoveAt(i);
                    return;
                }
            }
        }
    }
Ejemplo n.º 11
0
    public void ToggleChange(bool selected, FightLayerType type, int id, config_item_base itemInfo)
    {
        if (selected)
        {
            if (type == FightLayerType.map)
            {
                mapId = id;

                BattleInfo battleInfo = BattleModel.Instance.GetBattle(mapId);

                BattleModel.Instance.crtBattle = battleInfo;
                BattleModel.Instance.crtConfig = (config_map_item)itemInfo;

                GameObject EditPart = GameObject.FindGameObjectWithTag("EditPart");
                EditPart.GetComponent <EditPart>().ShowList(FightLayerType.all);
            }
            else
            {
                brushType = type;
                brushId   = id;
                if (mapId > 0)
                {
                    GameObject EditPart = GameObject.FindGameObjectWithTag("EditPart");
                    EditPart.GetComponent <EditPart>().ShowList(type);
                }
            }
        }
        else
        {
            if (type == FightLayerType.map)
            {
                mapId = 0;
                GameObject EditPart = GameObject.FindGameObjectWithTag("EditPart");
                EditPart.GetComponent <EditPart>().ShowList(FightLayerType.none);
            }
            else
            {
                brushType = FightLayerType.none;
                brushId   = 0;
            }
        }
    }
Ejemplo n.º 12
0
    private void OnMapClick(GameObject go)
    {
        MapItem itemCtr = go.GetComponent <MapItem>();

        config_map_item config = itemCtr.config;

        if (config != null)
        {
            int endlevel = (int)GameModel.Instance.GetGameConfig(1007);
            if (config.id > endlevel)
            {
                config_item_base mapconfigitem = ResModel.Instance.config_map.GetItem(endlevel);
                PromptModel.Instance.Pop(string.Format(LanguageUtil.GetTxt(11101), Convert.ToInt32(mapconfigitem.name)));
                return;
            }

            if (itemCtr.btn.interactable == false)
            {
                PromptModel.Instance.Pop(LanguageUtil.GetTxt(11103));
                return;
            }

            BattleModel.Instance.InitCrtBattle(config);
            BattleModel.Instance.InitFight();

            SkillTempletModel.Instance.UpdataTemplet();

            FillModel.Instance.InitFillInfo();

            ModuleModel.Instance.AddUIModule((int)ModuleEnum.PREPARE);
        }
        else
        {
            Debug.Log(LanguageUtil.GetTxt(11102));
        }
    }
Ejemplo n.º 13
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;
            }
        }
    }
Ejemplo n.º 14
0
    //用来排序
    virtual public int CompareTo(object obj)
    {
        config_item_base target = obj as config_item_base;

        return(id.CompareTo(target.id));
    }