// Update is called once per frame void Update() { if (listenRoll) { if (phase == 1 && messageUI.getResult().getDone()) { phase = 2; } if (phase == 2 && !uiManager.getResult().getDone() && messageUI.isClosed()) { NPC chara = (NPC)roundController.getCurrentRoundChar(); RollDiceParam param = new RollDiceParam(chara.getAbilityInfo()[1]); uiManager.setRollDiceParam(param); uiManager.showRollDice(); } else if (phase == 2 && uiManager.getResult().getDone()) { rollValue = uiManager.getResult().getResult(); phase = 3; } else if (phase == 3 && !uiManager.isClosedPlane()) { this.openEvent(rollValue); } } }
public void rollDice() { RollDiceParam param = new RollDiceParam(fighter.getAbilityInfo()[0] + this.fighter.getDiceNumberBuffer()); param.setDiceType("D2"); // uiManager.setRollDiceParam(param); int result = uiManager.showRollDiceImmediately(param); this.diceValue = result; this.battleButton.SetActive(false); this.useButton.SetActive(false); StartCoroutine(WaitAIAction(3.5f)); }
public void OnPointerClick(PointerEventData eventData) { if (ply.ActionPointrolled()) { RollDiceParam para = new RollDiceParam(this.ply.getAbilityInfo()[1] + this.ply.getDiceNumberBuffer()); // rollUI.setRollDiceParam(para); ply.updateActionPoint(rollUI.showRollDiceImmediately(para) + this.ply.getDiceValueBuffer()); ply.setActionPointrolled(false); isRoll = true; } else { isRoll = false; msgUI.ShowMessge("你已经丢过行动力骰子了", 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); }
public int showRollDiceImmediately(RollDiceParam para) { UIrollPlane.SetActive(true); UIrollPlane.transform.localPosition = showPos; int res = 0; if (para.getDiceType() == "D2") { res = diceRoll.calculateDice(para.getDiceNum(), 0); } else { res = diceRoll.calculateDice(0, para.getDiceNum()); } displayDices(para.getDiceNum(), 0); StartCoroutine(ChangeDicePicture(0.5f)); StartCoroutine(DelayColseUI(1.5f)); return(res); }
public bool excuteSanCheckEvent(EventInterface eventI, Character chara) { this.eventI = eventI; if (this.eventI != null) { if (chara.isPlayer()) { sanCheckExecuted = 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.SANCHECK_EVENT_GOOD) { chara.getMaxAbilityInfo()[3] = chara.getMaxAbilityInfo()[3] + this.eventI.getGoodValue(); chara.getAbilityInfo()[3] = chara.getAbilityInfo()[3] + this.eventI.getGoodValue(); } else if (result.getResultCode() == EventConstant.SANCHECK_EVENT_NORMAL) { chara.getAbilityInfo()[3] = chara.getAbilityInfo()[3] + this.eventI.getNormalValue(); } else { RollDiceParam param = new RollDiceParam(this.eventI.getBadDiceNum()); rollVaue = uiManager.showRollDiceImmediately(param); chara.getAbilityInfo()[3] = chara.getAbilityInfo()[3] - rollVaue; } } } return(true); }
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; } } }
// Update is called once per frame void Update() { if (isBattle) { if (!fighteEnd) { if (this.fighter.isPlayer()) { //弹出丢骰子ui RollDiceParam param = new RollDiceParam(fighter.getAbilityInfo()[0] + this.fighter.getDiceNumberBuffer()); uiManager.setRollDiceParam(param); if (!uiManager.getResult().getDone()) { uiManager.showRollDice(); } else if (uiManager.getResult().getDone()) { attackValue = uiManager.getResult().getResult() + this.fighter.getDiceValueBuffer(); fighteEnd = true; Debug.Log("玩家 打出了 " + attackValue + " 伤害"); } } else { int str = this.fighter.getAbilityInfo()[0] + this.fighter.getDiceNumberBuffer(); attackValue = diceRoll.calculateDice(str) + this.fighter.getDiceValueBuffer(); Debug.Log("NPC 打出了 " + attackValue + " 伤害"); fighteEnd = true; } } if (fighteEnd && !victimEnd) { if (this.victim.isPlayer()) { // this.fighter.setWaitPlayer(true); RollDiceParam param = new RollDiceParam(victim.getAbilityInfo()[0] + this.victim.getDiceNumberBuffer()); uiManager.setRollDiceParam(param); if (!uiManager.getResult().getDone()) { uiManager.showRollDice(); } else if (uiManager.getResult().getDone()) { defendValue = uiManager.getResult().getResult() + this.victim.getDiceValueBuffer(); victimEnd = true; Debug.Log("玩家 打出了 " + defendValue + " 伤害"); } } else { int str = this.victim.getAbilityInfo() [0] + this.victim.getDiceNumberBuffer(); defendValue = diceRoll.calculateDice(str) + this.victim.getDiceValueBuffer(); Debug.Log("NPC 打出了 " + defendValue + " 伤害"); victimEnd = true; } //弹出丢骰子ui } if (fighteEnd && victimEnd) { int trueDamge; if (attackValue > defendValue) { trueDamge = (attackValue - defendValue) * this.fighter.getDamgeBuffer(); this.victim.getAbilityInfo()[0] = this.victim.getAbilityInfo()[0] - trueDamge; Debug.Log("打斗结算:被攻击者受到了 " + trueDamge + " 点伤害, 还剩下 " + this.victim.getAbilityInfo()[0]); } else if (attackValue < defendValue) { trueDamge = (defendValue - attackValue) * this.victim.getDamgeBuffer(); this.fighter.getAbilityInfo()[0] = this.fighter.getAbilityInfo()[0] - trueDamge; Debug.Log("打斗结算:攻击者受到了 " + trueDamge + " 点伤害, 还剩下 " + this.fighter.getAbilityInfo()[0]); } this.fighter.setWaitPlayer(false); isBattle = false; } } }
public void setRollDiceParam(RollDiceParam para) { this.para = para; }