protected override void BeforeProcessFunction() { if (duelScene.GetCurrentPhaseType() == phaseType) { Debug.LogError("当前流程已经是:" + phaseType + "无法重复进入!"); return; } switch (duelScene.GetCurrentPhaseType()) { case PhaseType.Unknown: break; case PhaseType.Draw: break; case PhaseType.Prepare: break; case PhaseType.Main: break; case PhaseType.Battle: EndBattlePhaseTypeEvent(); break; case PhaseType.Second: break; case PhaseType.End: break; default: break; } duelScene.SetCurrentPhaseType(phaseType); duelScene.ResetPhaseTypePanelInfo(); string ex = duelScene.GetCurrentPlayer() == duelScene.GetMyPlayer() ? "我方进入" : "对方进入"; PhaseTypeConfig phaseTypeConfig = ConfigManager.GetConfigByName("PhaseType") as PhaseTypeConfig; GameManager.ShowMessage(ex + phaseTypeConfig.GetRecordById((int)phaseType).value + "流程!"); duelScene.GetCurrentPlayer().GetOpponentPlayer().EnterPhaseNotify(phaseType); TimerFunction timerFunction = new TimerFunction(); timerFunction.SetFunction(1, () => { DoProcessFunction(); }); GameManager.AddTimerFunction(timerFunction); }
public void OpponentSelectFirstOrBack(bool selectFirstOrBack) { GuessFirstSceneScript guessFirstSceneScript = GameObject.Find("Main Camera").GetComponent <GuessFirstSceneScript>(); SetFirst(!selectFirstOrBack); TimerFunction timeFunction = new TimerFunction(); timeFunction.SetFunction(1, () => { GameManager.GetSingleInstance().EnterDuelScene(); }); GameManager.AddTimerFunction(timeFunction); guessFirstSceneScript.HideSelectFirstPanel(); }
/// <summary> /// 设置胜者 /// </summary> /// <param name="player"></param> public void SetWinner(Player player, DuelEndReason duelEndReason) { duelSceneScript.ShowDuelResultPanel(player, duelEndReason); TimerFunction timerFunction = new TimerFunction(); timerFunction.SetFunction(2, () => { Thread.Sleep(2000); GameManager.GetSingleInstance().CleanDuelScene(); GameManager.GetSingleInstance().EnterMainScene(); }); GameManager.AddTimerFunction(timerFunction); startDuel = false; }
/// <summary> /// 检查是否决斗双方都已经初始化完成 /// </summary> public void CheckPlayInit() { if (myPlayer.IAmReady() && opponentPlayer.IAmReady()) { currentPlayer = startPlayer; TimerFunction timerFunction = new TimerFunction(); timerFunction.SetFunction(1, () => { duelSceneScript = GameObject.Find("Main Camera").GetComponent <DuelSceneScript>(); myPlayer.SetHandPanel(myHandCardPanel); opponentPlayer.SetHandPanel(opponentHandCardPanel); StartDuel(); }); GameManager.AddTimerFunction(timerFunction); } }
/// <summary> /// 选择后手事件 /// </summary> public void SelectBackHandEvent() { if (iGuessWin == 1) { duelScene.SetFirst(false); TimerFunction timeFunction = new TimerFunction(); timeFunction.SetFunction(1, () => { GameManager.GetSingleInstance().EnterDuelScene(); }); GameManager.AddTimerFunction(timeFunction); selectFirstPanel.SetActive(false); } else { GameManager.ShowMessage("请等待对方选择!"); } }
public override void SelectFristOrBack() { System.Random random = new System.Random(); int i = random.Next(2); if (i == 0) { duelScene.SetFirst(true); } else { duelScene.SetFirst(false); } TimerFunction timerFunction = new TimerFunction(); timerFunction.SetFunction(1, () => { GameManager.GetSingleInstance().EnterDuelScene(); }); GameManager.AddTimerFunction(timerFunction); }
/// <summary> /// 开始决斗 /// </summary> void StartDuel() { myPlayer.InitBeforDuel(); opponentPlayer.InitBeforDuel(); GameManager.ShowMessage("决斗开始!"); startDuel = true; TimerFunction timerFunction = new TimerFunction(); timerFunction.SetFunction(1, () => { myPlayer.DrawAtFirst(); opponentPlayer.DrawAtFirst(); startPlayer.StartTurn(); }); GameManager.AddTimerFunction(timerFunction); }
/// <summary> /// 决定谁先出牌 /// </summary> public void DecideGuessFirst() { if (iGuessWin != 0) { return; } GuessEnum myGuessEnum = duelScene.GetMyPlayer().GetGuessEnum(); GuessEnum opponentGuessEnum = duelScene.GetOpponentPlayer().GetGuessEnum(); if (myGuessEnum != GuessEnum.Unknown && opponentGuessEnum != GuessEnum.Unknown) { if (myGuessEnum == opponentGuessEnum) { TimerFunction reguessTimeFunction = new TimerFunction(); reguessTimeFunction.SetFunction(1, () => { ClearChoose(); }); GameManager.AddTimerFunction(reguessTimeFunction); GameManager.ShowMessage("双方选择相同,需重新选择!"); return; } int tempValue = (int)myGuessEnum - (int)opponentGuessEnum; StringResConfig stringResConfig = ConfigManager.GetConfigByName("StringRes") as StringResConfig; string title; if (tempValue == 1 || tempValue == -2) { iGuessWin = 1; title = stringResConfig.GetRecordById(13).value; } else { iGuessWin = 2; title = stringResConfig.GetRecordById(14).value; } TimerFunction timerFunction = new TimerFunction(); timerFunction.SetFunction(1, () => { selectCardGroupPanel.SetActive(false); guessFirstPanel.SetActive(false); selectFirstPanel.SetActive(true); selectFirstPanel.transform.GetChild(0).GetComponent <Text>().text = title; if (iGuessWin == 1) { duelScene.GetMyPlayer().SelectFristOrBack(); } if (iGuessWin == 2) { duelScene.GetOpponentPlayer().SelectFristOrBack(); } }); GameManager.AddTimerFunction(timerFunction); } }