Example #1
0
    void Start()
    {
        MonsterModel.Instance.InitCrawlCreators();
        MonsterModel.Instance.InitCrawl();

        foreach (FightLayerType key in layerDic.Keys)
        {
            FightBaseLayer layer = layerDic[key];
            layer.ShowList();
        }
        LeanTween.delayedCall(0.1f, fightUI.InitView);

        int hideHeight = BattleModel.Instance.crtBattle.HideHeight();

        if (hideHeight > 0)
        {
            crtFightStadus = FightStadus.roll;

            animTrans.anchoredPosition = new Vector2(0, hideHeight * PosUtil.CELL_H);

            float tweenTime = hideHeight * 0.5f;
            LeanTween.move(animTrans, new Vector2(0, 0), tweenTime).onComplete = AllRollComplete;
        }
        else
        {
            crtFightStadus             = FightStadus.idle;
            animTrans.anchoredPosition = new Vector2(0, 0);
        }

        LeanTween.delayedCall(0.2f, ShowControl);
    }
Example #2
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);
                }

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

            for (int j = 0; j < cellMoveInfo.paths.Count; j++)
            {
                Vector2 pathPoint = cellMoveInfo.paths[j];
                Vector2 toPos     = PosUtil.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);
    }
Example #3
0
    public bool CheckRoll()
    {
        rollCount = CoverModel.Instance.RollCount();
        if (rollCount > 0)
        {
            crtFightStadus = FightStadus.roll;
            float tweenTime = rollCount * 0.5f;
            LeanTween.move(animTrans, new Vector2(0, rollCount * PosUtil.CELL_H), tweenTime).onComplete = StepRollComplete;

            return(true);
        }
        return(false);
    }
Example #4
0
    private void StepRollComplete()
    {
        BattleModel.Instance.RollCut(rollCount);
        animTrans.anchoredPosition = new Vector2(0, 0);
        foreach (FightLayerType key in layerDic.Keys)
        {
            FightBaseLayer layer = layerDic[key];
            layer.ShowList();

            if (key == FightLayerType.cell)
            {
                CellLayer cellLayer = (CellLayer)layer;
                cellLayer.CheckAutoRefresh();
            }
        }
        crtFightStadus = FightStadus.idle;
    }
Example #5
0
    private void Refresh(int waitmillisecond = 0, List <CellInfo> cells = null, FightStadus fightStadus = FightStadus.prop_refresh)
    {
        bool hasRefresh = false;

        rootAction = new OrderAction();
        ParallelAction scale1 = new ParallelAction();
        ParallelAction movos  = new ParallelAction();
        ParallelAction scale2 = new ParallelAction();

        if (cells == null)
        {
            for (int i = 0; i < CellModel.Instance.allCells.Count; i++)
            {
                List <CellInfo> xCells = CellModel.Instance.allCells[i];
                for (int j = 0; j < xCells.Count; j++)
                {
                    CellInfo  cellInfo  = xCells[j];
                    CoverInfo coverInfo = CoverModel.Instance.GetCoverByPos(cellInfo.posY, cellInfo.posX);
                    if (cellInfo.isBlank == false && cellInfo.config.cell_type == (int)CellType.five && coverInfo.IsNull())
                    {
                        hasRefresh = true;

                        FightCellItem item = GetItemByRunId(cellInfo.runId);

                        if (fightStadus == FightStadus.changer)
                        {
                            item.transform.localRotation = Quaternion.identity;
                            scale1.AddNode(new RoatateActor((RectTransform)item.transform, new Vector3(0, 0, 180), 0.2f));
                        }
                        else
                        {
                            scale1.AddNode(new ScaleActor((RectTransform)item.transform, new Vector3(0, 0, 0), 0.3f));
                        }

                        if (fightStadus == FightStadus.changer)
                        {
                            scale2.AddNode(new RoatateActor((RectTransform)item.transform, new Vector3(0, 0, 360), 0.2f));
                        }
                        else
                        {
                            Vector2 toPos = PosUtil.GetFightCellPos(cellInfo.posX, cellInfo.posY);
                            movos.AddNode(new MoveActor((RectTransform)item.transform, new Vector3(toPos.x, toPos.y, 0), 0, 0.1f));

                            scale2.AddNode(new ScaleActor((RectTransform)item.transform, new Vector3(1, 1, 1), 0.3f));
                        }
                    }
                }
            }
        }
        else
        {
            for (int j = 0; j < cells.Count; j++)
            {
                CellInfo cellInfo = cells[j];
                if (cellInfo.isBlank == false && cellInfo.config.cell_type == (int)CellType.five)
                {
                    hasRefresh = true;

                    FightCellItem item = GetItemByRunId(cellInfo.runId);

                    if (fightStadus == FightStadus.changer)
                    {
                        item.transform.localRotation = Quaternion.identity;
                        scale1.AddNode(new RoatateActor((RectTransform)item.transform, new Vector3(0, 0, 180), 0.2f));
                    }
                    else
                    {
                        scale1.AddNode(new ScaleActor((RectTransform)item.transform, new Vector3(0, 0, 0), 0.3f));
                    }


                    if (fightStadus == FightStadus.changer)
                    {
                        scale2.AddNode(new RoatateActor((RectTransform)item.transform, new Vector3(0, 0, 360), 0.2f));
                    }
                    else
                    {
                        Vector2 toPos = PosUtil.GetFightCellPos(cellInfo.posX, cellInfo.posY);
                        movos.AddNode(new MoveActor((RectTransform)item.transform, new Vector3(toPos.x, toPos.y, 0), 0, 0.1f));

                        scale2.AddNode(new ScaleActor((RectTransform)item.transform, new Vector3(1, 1, 1), 0.3f));
                    }
                }
            }
        }

        if (waitmillisecond > 0)
        {
            rootAction.AddNode(new WaitActor(waitmillisecond));
        }

        if (hasRefresh)
        {
            rootAction.AddNode(new PlaySoundActor("Refresh"));
        }

        rootAction.AddNode(scale1);
        rootAction.AddNode(movos);
        rootAction.AddNode(scale2);

        ExecuteAction(fightStadus);
    }
Example #6
0
 private void ExecuteAction(FightStadus fightStadus)
 {
     FightModule.crtFightStadus = fightStadus;
     rootAction.EventHandler   += OnEventHandler;
     rootAction.OnExecute();
 }
Example #7
0
    private void Filling(List <CellMoveInfo> moveAnims, FightStadus fightState = FightStadus.move, int waitmillisecond = 0)
    {
        rootAction = new OrderAction();
        ParallelAction paralle = new ParallelAction();

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

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

            GameObject item = ballLayer.CreateBaseItem((int)cellMoveInfo.paths[0].x, -1);

            for (int j = 0; j < cellMoveInfo.paths.Count; j++)
            {
                ParallelAction paralleMove = new ParallelAction();
                orderAction.AddNode(paralleMove);

                Vector2 pathPoint = cellMoveInfo.paths[j];
                Vector2 toPos     = PosMgr.GetFightCellPos((int)pathPoint.x, (int)pathPoint.y);
                paralleMove.AddNode(new MoveActor((RectTransform)item.transform, new Vector3(toPos.x, toPos.y, 0), 0, 0.2f));

                if (j > 0)
                {
                    Vector2     fromPoint   = cellMoveInfo.paths[j - 1];
                    Vector2     fromPos     = PosMgr.GetFightCellPos((int)fromPoint.x, (int)fromPoint.y);
                    OrderAction orderRot    = new OrderAction();
                    GameObject  itembarrier = barrierLayer.GetItemByPos((int)fromPoint.x, (int)fromPoint.y);

                    if (itembarrier != null)
                    {
                        if (fromPos.x > toPos.x)
                        {
                            orderRot.AddNode(new RoatateActor((RectTransform)itembarrier.transform, new Vector3(0, 0, -60), 0.15f));
                            orderRot.AddNode(new RoatateActor((RectTransform)itembarrier.transform, new Vector3(0, 0, 0), 0.05f));
                            paralleMove.AddNode(orderRot);
                            paralleMove.AddNode(new RoatateActor((RectTransform)item.transform, new Vector3(0, 0, -30), 0.2f));
                        }
                        if (fromPos.x < toPos.x)
                        {
                            orderRot.AddNode(new RoatateActor((RectTransform)itembarrier.transform, new Vector3(0, 0, 60), 0.15f));
                            orderRot.AddNode(new RoatateActor((RectTransform)itembarrier.transform, new Vector3(0, 0, 0), 0.05f));
                            paralleMove.AddNode(orderRot);
                            paralleMove.AddNode(new RoatateActor((RectTransform)item.transform, new Vector3(0, 0, 30), 0.2f));
                        }
                    }
                    List <TIVInfo> p  = new List <TIVInfo>();
                    TIVInfo        px = new TIVInfo();
                    px.value = pathPoint.x;
                    TIVInfo py = new TIVInfo();
                    py.value = pathPoint.y;
                    p.Add(px);
                    p.Add(py);
                    if (fromPos.x > toPos.x)
                    {
                        paralleMove.AddNode(new FuncTIVActor(Harvest, p));
                    }
                    if (fromPos.x < toPos.x)
                    {
                        paralleMove.AddNode(new FuncTIVActor(Harvest, p));
                    }
                }
            }
            BallBaseItem itemCtr = item.GetComponent <BallBaseItem>();
            orderAction.AddNode(new PlayBallMoveEndActor(itemCtr));
        }
        if (waitmillisecond > 0)
        {
            rootAction.AddNode(new WaitActor(waitmillisecond));
        }
        rootAction.AddNode(paralle);
        ExecuteAction(fightState);
    }
Example #8
0
 private void AllRollComplete()
 {
     crtFightStadus = FightStadus.idle;
 }