Exemplo n.º 1
0
    private void CreateControlItem(int posX, int posY)
    {
        GameObject item = list.NewItem();

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

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

        PosMgr.SetCellPos(item.transform, posX, posY);
        itemCtr.control_x = posX - BattleModel.Instance.crtBattle.start_x;
        itemCtr.control_y = -posY + BattleModel.Instance.crtBattle.start_y;

        EventTriggerListener.Get(item).onDown  += ItemDownHander;
        EventTriggerListener.Get(item).onEnter += ItemEnterHander;
        //EventTriggerListener.Get(item).onUp += ItemUpHander;
    }
Exemplo n.º 2
0
    private void ItemEnterHander(GameObject go)
    {
        if (CrossPlatformInputManager.GetButton("Fire1") && FightModule.crtFightStadus == FightStadus.line)
        {
            FightControlItem itemCtr  = go.GetComponent <FightControlItem>();
            CellInfo         cellInfo = CellModel.Instance.GetCellByPos(itemCtr.control_x, itemCtr.control_y);
            CellLineType     lineType = FuncLine.Line(cellInfo);
            int lineCount             = CellModel.Instance.lineCells.Count;

            if (lineType == CellLineType.success)
            {
                GameMgr.audioMgr.PlayeSound("ItemEnter");
                cellLayer.RollInCell(cellInfo);
                List <CellInfo> skillCells = SkillModel.Instance.OutCell(CellModel.Instance.lineCells[lineCount - 2]);
                cellLayer.ChangeCells(skillCells);
                skillCells = SkillModel.Instance.EnterCell(cellInfo);
                cellLayer.ChangeCells(skillCells);
                lineLayer.ShowLine(CellModel.Instance.lineCells[lineCount - 2], cellInfo);
            }

            if (lineType == CellLineType.rollback)
            {
                GameMgr.audioMgr.PlayeSound("rollback");
                cellLayer.RollBackCell(CellModel.Instance.rollbackCell);
                List <CellInfo> skillCells = SkillModel.Instance.OutCell(CellModel.Instance.rollbackCell);
                cellLayer.ChangeCells(skillCells);
                skillCells = SkillModel.Instance.EnterCell(cellInfo);
                cellLayer.ChangeCells(skillCells);

                lineLayer.DestroyLine(cellInfo, CellModel.Instance.rollbackCell);
            }
            fightUI.UpdateCollect(true);
            monsterLayer.UpdateList();
            cellLayer.UpdateList();
        }
    }
Exemplo n.º 3
0
    private void ItemDownHander(GameObject go)
    {
        if (FightModule.crtFightStadus == FightStadus.idle)
        {
            FightControlItem itemCtr  = go.GetComponent <FightControlItem>();
            CellInfo         cellInfo = CellModel.Instance.GetCellByPos(itemCtr.control_x, itemCtr.control_y);
            CellLineType     lineType = FuncLine.Line(cellInfo, true);
            if (lineType == CellLineType.success)
            {
                EventTriggerListener.Get(go).onUp += ItemUpHander;

                GameMgr.audioMgr.PlayeSound("ItemEnter");
                FightModule.crtFightStadus = FightStadus.line;
                cellLayer.RollInCell(cellInfo);
                List <CellInfo> skillCells = SkillModel.Instance.EnterCell(cellInfo);
                cellLayer.ChangeCells(skillCells);
                fightUI.UpdateCollect(true);
                //fightUI.propsPart.gameObject.SetActive(false);
                monsterLayer.UpdateList();
                cellLayer.UpdateList();
                fightUI.skillListPart.gameObject.SetActive(true);
            }
        }
    }