Exemplo n.º 1
0
    public void ShowList(FightLayerType type)
    {
        foreach (FightLayerType key in listDic.Keys)
        {
            EditList list = listDic[key];
            if (type == FightLayerType.all)
            {
                list.gameObject.SetActive(true);
            }
            else if (type == FightLayerType.none)
            {
                list.gameObject.SetActive(false);
            }
            else if (key == type)
            {
                if (key == FightLayerType.bg)
                {
                    list.gameObject.SetActive(false);
                }

                list.gameObject.SetActive(true);
            }
            else
            {
                if (key != FightLayerType.bg)
                {
                    list.gameObject.SetActive(false);
                }
            }
        }
    }
Exemplo n.º 2
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);
    }
Exemplo n.º 3
0
    private void CreatList(FightLayerType type, int index)
    {
        ToggleList listItem = GameObject.Instantiate <ToggleList>(listPrefab);

        listItem.gameObject.name = "" + type;
        listItem.transform.SetParent(transform, false);
        listItem.transform.localPosition = new Vector3(0, -130 * index, 0);
        listItem.InitList(type);
    }
Exemplo n.º 4
0
    private void CreatList(FightLayerType type, int index)
    {
        EditList list = GameObject.Instantiate <EditList>(listPrefab);

        list.type            = type;
        list.gameObject.name = "" + type;
        listDic.Add(type, list);
        list.transform.SetParent(transform, false);
    }
Exemplo n.º 5
0
    public ToggleList UpDateList(FightLayerType type)
    {
        Transform childTrans = transform.FindChild("" + type);

        if (childTrans)
        {
            ToggleList listItem = childTrans.GetComponent <ToggleList>();
            listItem.InitList(type);
            return(listItem);
        }
        return(null);
    }
Exemplo n.º 6
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;
            }
        }
    }
Exemplo n.º 7
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);
            }
        }
    }
Exemplo n.º 8
0
    private void CreateLayer(FightLayerType type)
    {
        GameObject layer = GameObject.Instantiate(fightLayerPrefab);

        layer.name = "" + type;

        FightBaseLayer layerCtr;

        switch (type)
        {
        case FightLayerType.bg:
            layerCtr = layer.AddComponent <BgLayer>();
            layer.transform.SetParent(animTrans, false);
            break;

        case FightLayerType.floor_hide:
            layerCtr = layer.AddComponent <FloorHideLayer>();
            layer.transform.SetParent(animTrans, false);
            break;

        case FightLayerType.floor:
            layerCtr = layer.AddComponent <FloorLayer>();
            layer.transform.SetParent(animTrans, false);
            break;

        case FightLayerType.line:
            layerCtr = layer.AddComponent <LineLayer>();
            layer.transform.SetParent(animTrans, false);
            break;

        case FightLayerType.cell:
            layerCtr = layer.AddComponent <CellLayer>();
            layer.transform.SetParent(animTrans, false);
            break;

        case FightLayerType.monster:
            layerCtr = layer.AddComponent <MonsterLayer>();
            layer.transform.SetParent(animTrans, false);
            break;

        case FightLayerType.fence:
            layerCtr = layer.AddComponent <FanceLayer>();
            layer.transform.SetParent(animTrans, false);
            break;

        case FightLayerType.cover:
            layerCtr = layer.AddComponent <CoverLayer>();
            layer.transform.SetParent(animTrans, false);
            break;

        case FightLayerType.fg:
            layerCtr = layer.AddComponent <FgLayer>();
            layer.transform.SetParent(layersTrans, false);
            break;

        case FightLayerType.effect:
            layerCtr = layer.AddComponent <EffectLayer>();
            layer.transform.SetParent(layersTrans, false);
            break;

        case FightLayerType.control:
            layerCtr = layer.AddComponent <ControlLayer>();
            layer.transform.SetParent(layersTrans, false);
            break;

        default:
            layerCtr = layer.AddComponent <FightBaseLayer>();
            break;
        }
        layerCtr.type = type;
        layerDic.Add(type, layerCtr);
    }