Beispiel #1
0
    /**
     * void OnCollisionEnter2D(Collision2D coll)
     * {
     *  Debug.Log(coll.gameObject.name);
     *  doClick();
     *
     * }
     * void OnMouseDown()
     *
     * {
     *
     *  if (!SystemUtil.IsTouchedUI())
     *  {
     *
     *      doClick();
     *
     *  }
     *
     *
     * }**/

    public override void doClick()
    {
        // 载入上楼图片...
        RoomInterface upStairBackRoom = roomContraller.findRoomByRoomType(RoomConstant.ROOM_TYPE_UPSTAIR);
        Character     chara           = roundController.getCurrentRoundChar();

        roomContraller.findRoomByXYZ(chara.getCurrentRoom()).removeChara(chara);
        this.roomContraller.setCharaInMiniMap(chara.getCurrentRoom(), this.roundController.getCurrentRoundChar(), false);
        upStairBackRoom.setChara(chara);
        chara.setCurrentRoom(upStairBackRoom.getXYZ());
        camCtrl.setTargetPos(upStairBackRoom.getXYZ(), RoomConstant.ROOM_Y_GROUND, true);
        this.roomContraller.setCharaInMiniMap(upStairBackRoom.getXYZ(), this.roundController.getCurrentRoundChar(), true);

        // 载入上楼图片结束。。。
    }
Beispiel #2
0
    public bool excuteFallRoomEvent(EventInterface eventI, Character chara)
    {
        this.eventI = eventI;
        if (this.eventI != null)
        {
            if (chara.isPlayer())
            {
                fallRoomExecuted = false;
                this.chara       = chara;
                phase            = 1;
                messageUI.getResult().setDone(false);
                showMessageUi(eventI.getEventBeginInfo(), eventI.getSelectItem());
            }
            else
            {
                result = eventI.excute(chara, messageUI.getResult().getResult(), 0);

                if (result.getResultCode() == EventConstant.FALL_DOWN__EVENT_GOOD)
                {
                }
                else if (result.getResultCode() == EventConstant.FALL_DOWN__EVENT_NORMAL)
                {
                    roomContraller.findRoomByXYZ(chara.getCurrentRoom()).removeChara(chara);
                    this.roomContraller.setCharaInMiniMap(chara.getCurrentRoom(), chara, false);
                    RoomInterface ri = roomContraller.getRandomDownRoom();
                    ri.setChara(chara);
                    chara.setCurrentRoom(ri.getXYZ());
                    this.roomContraller.setCharaInMiniMap(ri.getXYZ(), chara, true);
                    //  camCtrl.setTargetPos(upStairRoom.getXYZ(), RoomConstant.ROOM_Y_DOWN, true);
                }
                else
                {
                    RollDiceParam param = new RollDiceParam(this.eventI.getBadDiceNum());
                    rollVaue = uiManager.showRollDiceImmediately(param);
                    chara.getAbilityInfo()[0] = chara.getAbilityInfo()[0] - rollVaue;
                    roomContraller.findRoomByXYZ(chara.getCurrentRoom()).removeChara(chara);
                    this.roomContraller.setCharaInMiniMap(chara.getCurrentRoom(), chara, false);
                    RoomInterface ri = roomContraller.getRandomDownRoom();
                    ri.setChara(chara);
                    chara.setCurrentRoom(ri.getXYZ());
                    this.roomContraller.setCharaInMiniMap(ri.getXYZ(), chara, true);
                }
            }
        }
        return(true);
    }
Beispiel #3
0
    void Update()
    {
        if (!leaveExecuted)
        {
            if (phase == 1 && messageUI.getResult().getDone())
            {
                Debug.Log("phase =1 and " + messageUI.getResult().getDone());
                phase = 2;
            }

            if (phase == 2 && !uiManager.getResult().getDone() && messageUI.isClosed())
            {
                Debug.Log("wait mesui end");
                RollDiceParam param = new RollDiceParam(chara.getAbilityInfo()[1] + chara.getDiceNumberBuffer());
                rollVaue = uiManager.showRollDiceImmediately(param);
                phase    = 3;
            }

            if (phase == 3 && !uiManager.isClosedPlane())
            {
                result = eventI.excute(chara, messageUI.getResult().getResult(), rollVaue);
                Debug.Log("event result is " + result);
                showMessageUi(eventI.getEventEndInfo(result.getResultCode()), null);
                phase = 4;
            }

            else if (phase == 4 && messageUI.getResult().getDone())
            {
                if (result.getResultCode() == EventConstant.LEAVE_EVENT_SAFE)
                {
                    this.door.playerOpenDoorResult(true);
                }
                else
                {
                    chara.updateActionPoint(0);
                    this.door.playerOpenDoorResult(false);
                }
                leaveExecuted = true;
            }
        }

        if (!this.sanCheckExecuted)
        {
            if (phase == 1 && messageUI.getResult().getDone())
            {
                Debug.Log("phase =1 and " + messageUI.getResult().getDone());
                phase = 2;
            }

            if (phase == 2 && !uiManager.getResult().getDone() && messageUI.isClosed())
            {
                Debug.Log("wait mesui end");
                RollDiceParam param = new RollDiceParam(chara.getAbilityInfo()[3] + chara.getDiceNumberBuffer());
                rollVaue = uiManager.showRollDiceImmediately(param);
                phase    = 3;
            }

            if (phase == 3 && !uiManager.isClosedPlane())
            {
                result = eventI.excute(chara, messageUI.getResult().getResult(), rollVaue);
                Debug.Log("event result is " + result);
                showMessageUi(eventI.getEventEndInfo(result.getResultCode()), null);
                phase = 4;
            }

            else if (phase == 4 && messageUI.getResult().getDone())
            {
                if (result.getResultCode() == EventConstant.SANCHECK_EVENT_BED)
                {
                    RollDiceParam param = new RollDiceParam(eventI.getBadDiceNum());
                    rollVaue = uiManager.showRollDiceImmediately(param);
                    chara.getAbilityInfo()[3] = chara.getAbilityInfo()[3] - rollVaue;
                }
                else if (result.getResultCode() == EventConstant.SANCHECK_EVENT_NORMAL)
                {
                    chara.getAbilityInfo()[3] = chara.getAbilityInfo()[3] + eventI.getNormalValue();
                }
                else
                {
                    chara.getAbilityInfo()[3] = chara.getAbilityInfo()[3] + eventI.getGoodValue();
                }
                sanCheckExecuted = true;
            }
        }

        if (!this.fallRoomExecuted)
        {
            // Debug.LogError(eventI);
            if (phase == 1 && messageUI.getResult().getDone())
            {
                Debug.Log("phase =1 and " + messageUI.getResult().getDone());

                if (eventI.getSelectItem() == null || eventI.getSelectItem().Count == 0)
                {
                    phase = 3;
                }
                else
                {
                    phase = 2;
                    this.selectedOptionCode = messageUI.getResult().getResult();
                    showMessageUi(eventI.getSelectItem()[this.selectedOptionCode][1]);
                }
            }
            else if (phase == 2 && messageUI.getResult().getDone())
            {
                phase = 3;
            }

            else if (phase == 3 && !uiManager.getResult().getDone() && messageUI.isClosed())
            {
                Debug.Log("wait mesui end");
                int rollNum;
                if (this.selectedOptionCode == EventConstant.OPTION_CODE_1)
                {
                    rollNum = chara.getAbilityInfo()[3];
                }
                else
                {
                    rollNum = chara.getAbilityInfo()[1];
                }
                RollDiceParam param = new RollDiceParam(rollNum + chara.getDiceNumberBuffer());
                rollVaue = uiManager.showRollDiceImmediately(param);
                phase    = 4;
            }
            else if (phase == 4 && !uiManager.isClosedPlane())
            {
                // Debug.LogError(eventI);
                // Debug.LogError(messageUI.getResult());
                result = eventI.excute(chara, this.selectedOptionCode, rollVaue);
                Debug.Log("event result is " + result);
                showMessageUi(eventI.getEventEndInfo(result.getResultCode()), null);
                phase = 5;
            }

            else if (phase == 5 && messageUI.getResult().getDone())
            {
                if (result.getResultCode() == EventConstant.FALL_DOWN__EVENT_GOOD)
                {
                }
                else if (result.getResultCode() == EventConstant.FALL_DOWN__EVENT_NORMAL)
                {
                    roomContraller.findRoomByXYZ(chara.getCurrentRoom()).removeChara(chara);
                    this.roomContraller.setCharaInMiniMap(chara.getCurrentRoom(), chara, false);
                    RoomInterface ri = roomContraller.getRandomDownRoom();
                    ri.setChara(chara);
                    chara.setCurrentRoom(ri.getXYZ());
                    this.roomContraller.setCharaInMiniMap(ri.getXYZ(), chara, true);
                    camCtrl.setTargetPos(ri.getXYZ(), RoomConstant.ROOM_Y_DOWN, true);
                    fallRoomExecuted = true;
                }
                else
                {
                    RollDiceParam param = new RollDiceParam(this.eventI.getBadDiceNum());
                    rollVaue = uiManager.showRollDiceImmediately(param) + 1;
                    chara.getAbilityInfo()[0]    = chara.getAbilityInfo()[0] - rollVaue;
                    chara.getMaxAbilityInfo()[3] = chara.getMaxAbilityInfo()[3] + rollVaue;
                    chara.getAbilityInfo()[3]    = chara.getAbilityInfo()[3] + rollVaue;
                    messageUI.getResult().setDone(false);
                    showMessageUi(new string[] { "你的力量下降:" + rollVaue + "点,神志上升:" + rollVaue + "点" }, null);
                    phase = 6;
                }
            }
            else if (phase == 6 && messageUI.getResult().getDone())
            {
                roomContraller.findRoomByXYZ(chara.getCurrentRoom()).removeChara(chara);
                this.roomContraller.setCharaInMiniMap(chara.getCurrentRoom(), chara, false);
                RoomInterface ri = roomContraller.getRandomDownRoom();
                ri.setChara(chara);
                chara.setCurrentRoom(ri.getXYZ());
                this.roomContraller.setCharaInMiniMap(ri.getXYZ(), chara, true);
                camCtrl.setTargetPos(ri.getXYZ(), RoomConstant.ROOM_Y_DOWN, true);
                if (ri.isLock())
                {
                    ri.setLock(false);
                }
                fallRoomExecuted = true;
            }
        }
    }
Beispiel #4
0
    public void playerOpenDoorResult(bool result)
    {
        if (result == true)
        {
            //离开门成功
            Debug.Log("离开房间成功");
            //进入下一个房间

            //计算朝什么方向移动
            int[]  Nxyz     = getNextRoomXYZ();
            int[]  Cxyz     = this.getRoom().getXYZ();
            string nextDoor = "";
            if (Nxyz[0] - Cxyz[0] == 0)
            {
                if (Nxyz[1] - Cxyz[1] == 1)
                {
                    // up move
                    nextDoor = "D";
                }
                else
                {
                    //donw move
                    nextDoor = "U";
                }
            }
            else
            {
                if (Nxyz[0] - Cxyz[0] == -1)
                {
                    // left move
                    nextDoor = "L";
                }
                else
                {
                    //right move
                    nextDoor = "R";
                }
            }

            RoomInterface nextRoom = getRooController().findRoomByXYZ(getNextRoomXYZ());

            //摄像机移动到下一个房间坐标

            getCameraCtrl().setTargetPos(getNextRoomXYZ());

            //当前人物坐标移动到下一个房间
            getRoundController().getCurrentRoundChar().setCurrentRoom(nextRoom, nextDoor);
            nextRoom.setChara(this.getRoundController().getCurrentRoundChar());
            this.getRooController().setCharaInMiniMap(getNextRoomXYZ(), this.getRoundController().getCurrentRoundChar(), true);
            this.getRoom().removeChara(this.getRoundController().getCurrentRoundChar());
            this.getRooController().setCharaInMiniMap(this.getRoom().getXYZ(), this.getRoundController().getCurrentRoundChar(), false);
            //触发进门事件
            getEventController().excuteEnterRoomEvent(nextRoom, getRoundController().getCurrentRoundChar());  //暂时禁用 运行时有异常
        }
        else
        {
            //离开失败
            Debug.Log("离开房间失败");
            //FindObjectOfType<MessageUI>().ShowMessge("离开房间失败 ", 0);
        }
    }