示例#1
0
    public FightCoverItem CreateCoverItem(CoverInfo coverInfo)
    {
        if (coverInfo.IsNull())
        {
            return(null);
        }

        GameObject item = list.NewItem();

        item.name = coverInfo.posX + "_" + coverInfo.posY;

        FightCoverItem itemCtr = item.AddComponent <FightCoverItem>();

        itemCtr.type      = type;
        itemCtr.coverInfo = coverInfo;
        itemCtr.icon      = coverInfo.config.icon;
        itemCtr.rate      = coverInfo.rate;
        itemCtr.UpdateTip();
        PosMgr.SetFightCellPos(item.transform, coverInfo.posX, coverInfo.posY);

        if (coverInfo.show_type == CoverShowType.hide)
        {
            itemCtr.gameObject.transform.localScale = new Vector3(0, 1, 1);
        }

        return(itemCtr);
    }
示例#2
0
    public GameObject CreateBaseItem(int posX, int posY)
    {
        GameObject item = list.NewItem();

        item.name = posX + "_" + posY;
        item.AddComponent <BallBaseItem>();
        PosMgr.SetFightCellPos(item.transform, posX, posY);
        return(item);
    }
示例#3
0
    public void ShowLine(CellInfo cellA, CellInfo cellB)
    {
        GameObject item = list.NewItem();

        item.name = cellA.posX + "_" + cellA.posY + "_" + cellB.posX + "_" + cellB.posY;

        PosMgr.SetFightCellPos(item.transform, cellA.posX, cellA.posY);

        item.transform.Rotate(0, 0, PosMgr.VectorAngle(PosMgr.GetFightCellPos(cellA.posX, cellA.posY), PosMgr.GetFightCellPos(cellB.posX, cellB.posY)));
    }
示例#4
0
    private void Filling(FightStadus fightState = FightStadus.move, int waitmillisecond = 0)
    {
        CellModel.Instance.anims = new List <List <CellAnimInfo> >();
        FunMove.Move(false, isDeductStep);
        List <CellMoveInfo> moveAnims = CellModel.Instance.moveAnims;

        rootAction = new OrderAction();
        ParallelAction paralle = new ParallelAction();

        Dictionary <int, int> newStartPos = new Dictionary <int, int>();

        for (int i = 0; i < moveAnims.Count; i++)
        {
            CellMoveInfo cellMoveInfo = moveAnims[i];

            OrderAction orderAction = new OrderAction();
            paralle.AddNode(orderAction);

            FightCellItem item = GetItemByRunId(cellMoveInfo.cellInfo.runId);
            if (item == null)
            {
                item = CreateCellItem(cellMoveInfo.cellInfo).GetComponent <FightCellItem>();
                int xKey = (int)cellMoveInfo.paths[0].x;
                if (newStartPos.ContainsKey(xKey))
                {
                    int preIndex = newStartPos[xKey];
                    newStartPos[xKey] = preIndex - 1;
                }
                else
                {
                    newStartPos.Add(xKey, -1);
                }

                PosMgr.SetFightCellPos(item.transform, xKey, newStartPos[xKey]);
            }

            for (int j = 0; j < cellMoveInfo.paths.Count; j++)
            {
                Vector2 pathPoint = cellMoveInfo.paths[j];
                Vector2 toPos     = PosMgr.GetFightCellPos((int)pathPoint.x, (int)pathPoint.y);
                float   speed     = isDeductStep ? 1750 : 1350;
                orderAction.AddNode(new MoveActor((RectTransform)item.transform, new Vector3(toPos.x, toPos.y, 0), speed));
            }
            FightEffectItem effectItem = effectLayer.GetEffectItemByPos(cellMoveInfo.cellInfo.posX, cellMoveInfo.cellInfo.posY);
            orderAction.AddNode(new PlayCellMoveEndActor(item, effectItem, cellMoveInfo.cellInfo));
        }
        if (waitmillisecond > 0)
        {
            rootAction.AddNode(new WaitActor(waitmillisecond));
        }
        rootAction.AddNode(paralle);
        ExecuteAction(fightState);
    }
示例#5
0
    public GameObject ShowLine(CellInfo cellA, CellInfo cellB)
    {
        list.ForceChangeItemPrefab(lineItem);
        GameObject item = list.NewItem();

        item.name = cellA.posX + "_" + cellA.posY + "_" + cellB.posX + "_" + cellB.posY;

        PosMgr.SetFightCellPos(item.transform, cellB.posX, cellB.posY);

        item.transform.Rotate(0, 0, PosMgr.VectorAngle(PosMgr.GetFightCellPos(cellB.posX, cellB.posY), PosMgr.GetFightCellPos(cellA.posX, cellA.posY)));

        return(item);
    }
示例#6
0
    private FightEffectItem CreateEffectItem(int posX, int posY)
    {
        list.ForceChangeItemPrefab(effectItem);
        GameObject item = list.NewItem();

        FightEffectItem itemCtr = item.AddComponent <FightEffectItem>();

        PosMgr.SetFightCellPos(item.transform, posX, posY);
        itemCtr.control_x = posX;
        itemCtr.control_y = posY;
        item.name         = itemCtr.control_x + "_" + itemCtr.control_y;

        return(itemCtr);
    }
示例#7
0
    public GameObject CreateMonsterItem(int posX, int posY, MonsterInfo monsterInfo)
    {
        if (monsterInfo.IsNull())
        {
            return(null);
        }
        FightMonsterItem itemCtr = GetItemByRunId(monsterInfo.runId);

        if (itemCtr == null)
        {
            GameObject item = list.NewItem();
            item.name = posX + "_" + posY;
            itemCtr   = item.AddComponent <FightMonsterItem>();
            PosMgr.SetFightCellPos(item.transform, posX, posY);
        }
        UpdateMonsterItem(itemCtr, monsterInfo);
        return(itemCtr.gameObject);
    }
示例#8
0
    protected GameObject CreateBaseItem(int posX, int posY, int icon)
    {
        if (icon <= 0)
        {
            return(null);
        }

        GameObject item = list.NewItem();

        item.name = posX + "_" + posY;

        FightBaseItem itemCtr = item.AddComponent <FightBaseItem>();

        itemCtr.type = type;
        itemCtr.icon = icon;
        PosMgr.SetFightCellPos(item.transform, posX, posY);
        return(item);
    }
示例#9
0
    protected GameObject CreateHiderItem(HiderInfo hiderInfo)
    {
        if (hiderInfo.isNull)
        {
            return(null);
        }

        GameObject item = list.NewItem();

        item.name = hiderInfo.posX + "_" + hiderInfo.posY;

        FightHideItem itemCtr = item.AddComponent <FightHideItem>();

        itemCtr.hiderInfo = hiderInfo;
        itemCtr.type      = type;
        itemCtr.icon      = hiderInfo.configId;
        PosMgr.SetFightCellPos(item.transform, hiderInfo.posX, hiderInfo.posY);
        return(item);
    }
示例#10
0
    protected GameObject CreateFloorItem(int posX, int posY, FloorInfo floorInfo)
    {
        if (floorInfo.IsNull())
        {
            return(null);
        }

        GameObject item = list.NewItem();

        item.name = posX + "_" + posY;

        FightFloorItem itemCtr = item.AddComponent <FightFloorItem>();

        itemCtr.floorInfo = floorInfo;
        itemCtr.type      = type;
        itemCtr.icon      = floorInfo.config.icon;
        PosMgr.SetFightCellPos(item.transform, posX, posY);
        return(item);
    }
示例#11
0
    private Vector2 CreateBrushItem(int cX, int cY, int oX, int oY, int brushId)
    {
        GameObject item = list.NewItem();

        item.name = oX + "_" + oY;

        PropTouchItem itemCtr = item.GetComponent <PropTouchItem>();

        PosMgr.SetFightCellPos(item.transform, cX + oX, cY - oY);

        itemCtr.control_x  = cX + oX;
        itemCtr.control_y  = cY + oY;
        itemCtr.control_id = brushId;
        itemCtr.icon       = brushId;
        itemCtr.valid      = true;
        itemCtr.brushImage.gameObject.SetActive(true);
        EventTriggerListener.Get(item).onClick = OnClickSelectHander;

        return(new Vector2(cX + oX, cY - oY));
    }
示例#12
0
    private void UpdateCellInfo(FightCellItem itemCtr, CellInfo cellInfo, bool create)
    {
        itemCtr.cell_info = cellInfo;
        if (cellInfo.changer > 0)
        {
            itemCtr.icon = cellInfo.changer;
        }
        else
        {
            itemCtr.icon = cellInfo.config.icon;
        }
        itemCtr.UpdateTip();
        itemCtr.zrotate = cellInfo.config.rotate * FightConst.ROTATE_BASE;
        PosMgr.SetFightCellPos(itemCtr.transform, cellInfo.posX, cellInfo.posY);

        if (create)
        {
            itemCtr.stadus = CellItemStadus.normal;
        }
    }
示例#13
0
    private PropTouchItem CreateSelectItem(int posX, int posY, bool valid)
    {
        GameObject item = list.NewItem();

        item.name = posX + "_" + posY;

        PropTouchItem itemCtr = item.GetComponent <PropTouchItem>();

        PosMgr.SetFightCellPos(item.transform, posX, posY);

        itemCtr.valid = valid;

        itemCtr.control_x = posX;
        itemCtr.control_y = posY;

        if (itemCtr.valid)
        {
            EventTriggerListener.Get(item).onClick = OnClickSelectHander;
        }
        return(itemCtr);
    }
示例#14
0
    private void Invade()
    {
        rootAction = new OrderAction();

        if (!isDeductStep)
        {
            ParallelAction      paralle     = new ParallelAction();
            List <CellAnimInfo> invadeCells = InvadeModel.Instance.EffectInvade();
            for (int i = 0; i < invadeCells.Count; i++)
            {
                ParallelAction paralleMove = new ParallelAction();

                CellInfo fromCell = invadeCells[i].fromInfo;
                CellInfo toCell   = invadeCells[i].toInfo;
                //Vector2 fromPos = PosMgr.GetFightCellPos(fromCell.posX, fromCell.posY);
                Vector2       toPos = PosMgr.GetFightCellPos(toCell.posX, toCell.posY);
                FightCellItem item  = GetItemByRunId(toCell.runId);
                PosMgr.SetFightCellPos(item.transform, fromCell.posX, fromCell.posY);
                item.icon = toCell.config.icon;
                item.transform.localScale = new Vector3(0.5f, 0.5f, 1);

                OrderAction order1 = new OrderAction();
                order1.AddNode(new PlaySoundActor("Refresh"));
                order1.AddNode(new MoveActor((RectTransform)item.transform, new Vector3(toPos.x, toPos.y, 0), 0, 0.2f));
                paralleMove.AddNode(order1);

                OrderAction order2 = new OrderAction();
                order2.AddNode(new ScaleActor((RectTransform)item.transform, new Vector3(1, 1, 1), 0.15f));
                paralleMove.AddNode(order2);

                paralle.AddNode(paralleMove);
            }

            rootAction.AddNode(paralle);
        }

        ExecuteAction(FightStadus.invade);
    }