示例#1
0
    /**
     * void OnMouseDown()
     *
     * {
     *
     *  if (!SystemUtil.IsTouchedUI())
     *  {
     *
     *      doClick();
     *
     *  }
     *
     *
     * }**/

    public override void doClick()
    {
        // 载入上楼图片...


        Character chara = roundController.getCurrentRoundChar();


        chara.setCurrentRoom(chara.getCurrentRoom());

        if (chara.getCurrentRoom()[2] == RoomConstant.ROOM_Z_GROUND)
        {
            camCtrl.setTargetPos(chara.getCurrentRoom(), RoomConstant.ROOM_Y_GROUND, true);
        }
        else if (chara.getCurrentRoom()[2] == RoomConstant.ROOM_Z_UP)
        {
            camCtrl.setTargetPos(chara.getCurrentRoom(), RoomConstant.ROOM_Y_UP, true);
        }
        else
        {
            camCtrl.setTargetPos(chara.getCurrentRoom(), RoomConstant.ROOM_Y_DOWN, true);
        }



        // 载入上楼图片结束。。。
    }
示例#2
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);

        // 载入上楼图片结束。。。
    }
示例#3
0
    void OnMouseDown()
    {
        if (showFlag)
        {
            Debug.Log("WoodDoor.cs OnMouseDown");
            //检查玩家的行动力
            bool opened = openDoor(roundController.getCurrentRoundChar());

            //这里有bug,玩家应该是只能点击 所在房间的几个门,其余房间的门都是不能点击的.
            //生成门时,门启用,但加锁;玩家进入房间,门解锁可点击;玩家离开房间,门加锁不可点击

            if (opened)
            {
                // 调用事件处理器处理事情

//				bool result = eventController.excuteLeaveRoomEvent (getRoom (), roundController.getCurrentRoundChar ()); 暂时禁用 运行时有异常,对象未被实例化

                //非正式测试用,只考虑行动力足够
                bool result = true;

                if (result == true)
                {
                    //离开门成功
                    int[] te = getNextRoomXYZ();
                    Debug.Log("点门移动!目标房间 " + te[0] + "," + te[1] + "," + te[2]);
                    //进入下一个房间
                    RoomInterface nextRoom = roomContraller.findRoomByXYZ(getNextRoomXYZ());

                    //摄像机移动到下一个房间坐标
                    camCtrl.setTargetPos(getNextRoomXYZ());

                    //当前人物坐标移动到下一个房间
                    roundController.getCurrentRoundChar().setCurrentRoom(getNextRoomXYZ());

                    //触发进门事件
//					eventController.excuteEnterRoomEvent (nextRoom, roundController.getCurrentRoundChar ());  暂时禁用 运行时有异常
                }
                else
                {
                    //离开失败
                    Debug.Log("WoodDoor.cs OnMouseDown 离开房间失败");
                }
            }
        }
    }
示例#4
0
    public void doNow(string gbCode)
    {
        GuangBoAction gb = eventGuangBoMap[gbCode];

        if (gb.getGuangBoType() == GuangBoConstant.GUANGBO_TYPE_MOVE_ROOM)
        {
            RoomInterface targetRoom = roomContraller.findRoomByRoomType(gb.getGuangBoTargetVaule());
            //targetRoom.getXYZ();
            camCtrl.setTargetPos(targetRoom.getXYZ(), targetRoom.getXYZ()[2], true);
            foreach (string name in gb.getWhiteList())
            {
                Character npc = roundController.getCharaByName(name);
                roomContraller.findRoomByXYZ(npc.getCurrentRoom()).removeChara(npc);
                this.roomContraller.setCharaInMiniMap(npc.getCurrentRoom(), npc, false);
                npc.setCurrentRoom(targetRoom.getXYZ());
                this.roomContraller.setCharaInMiniMap(targetRoom.getXYZ(), npc, true);
            }
            Character chara = roundController.getPlayerChara();
            roomContraller.findRoomByXYZ(chara.getCurrentRoom()).removeChara(chara);
            this.roomContraller.setCharaInMiniMap(chara.getCurrentRoom(), this.roundController.getCurrentRoundChar(), false);
            foreach (string name in gb.getWhiteList())
            {
                Character npc = roundController.getCharaByName(name);
                roomContraller.findRoomByXYZ(npc.getCurrentRoom()).removeChara(npc);
                this.roomContraller.setCharaInMiniMap(npc.getCurrentRoom(), npc, false);

                npc.setCurrentRoom(targetRoom.getXYZ());
                this.roomContraller.setCharaInMiniMap(targetRoom.getXYZ(), npc, true);
            }
            chara.setCurrentRoom(targetRoom.getXYZ());
            this.roomContraller.setCharaInMiniMap(targetRoom.getXYZ(), chara, true);
            Debug.Log("loading。。。ready to move room");

            //
        }
    }
示例#5
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;
            }
        }
    }