public override void OnEnter() { TurnBasedMatchObject temp = (TurnBasedMatchObject)matchObject.Value; TurnBasedMatch match = temp.Match; matchId.Value = match.MatchId; playerCount = match.PlayerCount; hasVacantSlot = match.HasVacantSlot; isMyTurn = match.IsMyTurn; currentParticipantId = match.CurrentParticipantId; selfParticipantId = match.SelfParticipantId; if (match.PlayerCount > 0) { participantIds.Resize(match.PlayerCount); Participant[] participants = match.Participants; for (int i = 0; i < match.PlayerCount; i++) { participantIds.Set(i, participants[i].ParticipantId); } } Finish(); }
void RematchCallback(bool isRematchSuccess, TurnBasedMatch match) { if (isRematchSuccess) { TurnBasedMatchObject temp = new TurnBasedMatchObject(); temp.Match = match; matchObjectOut.Value = temp; if (match.Data != null) { data.Value = Convert.ToBase64String(match.Data); } else { data.Value = null; } isSuccess.Value = true; Fsm.Event(eventTarget, isSuccessEvent); } else { isSuccess.Value = false; Fsm.Event(eventTarget, isNotSuccessEvent); } }
public override void OnEnter() { TurnBasedMatchObject temp = (TurnBasedMatchObject)matchObject.Value; TurnBasedMatch match = temp.Match; MatchOutcome outcome = null; switch (param) { case ResultParam.ParticipantResult: outcome = CreateMatchOutcomeWithResults(); break; case ResultParam.ParticipantPlacement: outcome = CreateMatchOutcomeWithPlacements(); break; default: outcome = CreateMatchOutcomeWithResultandPlacement(); break; } if (outcome != null) { byte[] binaryData = Convert.FromBase64String(data.Value); GameServices.TurnBased.Finish(match, binaryData, outcome, OutComeCallBack); return; } }
public override void OnEnter() { GameServices.TurnBased.GetAllMatches((allMatches) => { if (allMatches != null) { matchCount.Value = allMatches.Length; matches.Resize(matchCount.Value); for (int i = 0; i < matchCount.Value; i++) { TurnBasedMatchObject matchObject = new TurnBasedMatchObject(); matchObject.Match = allMatches[i]; matches.Set(i, matchObject); } Fsm.Event(eventTarget, isSuccessEvent); Finish(); } else { Fsm.Event(eventTarget, isNotSuccessEvent); Finish(); } }); }
public override void OnEnter() { TurnBasedMatchObject temp = (TurnBasedMatchObject)matchObject.Value; TurnBasedMatch match = temp.Match; GameServices.TurnBased.AcknowledgeFinished(match, AcknowledgeFinishedCallback); }
public override void OnEnter() { TurnBasedMatchObject temp = (TurnBasedMatchObject)matchObject.Value; TurnBasedMatch match = temp.Match; GameServices.TurnBased.Rematch(match, RematchCallback); }
void OnMatchArrives(TurnBasedMatch match, bool shouldAutoLaunchIn, bool playerWantsToQuitIn) { TurnBasedMatchObject temp = new TurnBasedMatchObject(); temp.Match = match; matchObject.Value = temp; shouldAutoLaunch.Value = shouldAutoLaunchIn; playerWantsToQuit.Value = playerWantsToQuitIn; Fsm.Event(eventTarget, onMatchArrivesEvent); }
public override void OnEnter() { DemoUtils_TurnBasedManager manager = turnBaseManager.Value.GetComponent <DemoUtils_TurnBasedManager>(); TurnBasedMatchObject temp = (TurnBasedMatchObject)matchObject.Value; TurnBasedMatch match = temp.Match; manager.OnMatchReceived(match, shouldAutoLaunch.Value, playerWantsToQuit.Value); Finish(); }
public override void OnEnter() { if (string.IsNullOrEmpty(nextParticipantId.Value)) { nextParticipantId.Value = null; } TurnBasedMatchObject temp = (TurnBasedMatchObject)matchObject.Value; TurnBasedMatch match = temp.Match; GameServices.TurnBased.LeaveMatchInTurn(match, nextParticipantId.Value, LeaveMatchInTurnCallBack); }
public override void OnEnter() { if (string.IsNullOrEmpty(nextParticipantId.Value)) { nextParticipantId.Value = null; } TurnBasedMatchObject temp = (TurnBasedMatchObject)matchObject.Value; TurnBasedMatch match = temp.Match; byte[] binaryData = Convert.FromBase64String(data.Value); GameServices.TurnBased.TakeTurn(match, binaryData, nextParticipantId.Value, TakeTurnCallBack); }
void OnCreateQuickMatch(bool isCreatedSuccess, TurnBasedMatch match) { if (isCreatedSuccess) { TurnBasedMatchObject temp = new TurnBasedMatchObject(); temp.Match = match; matchObject.Value = temp; isSuccess.Value = true; Fsm.Event(eventTarget, isSuccessEvent); } else { isSuccess.Value = false; Fsm.Event(eventTarget, isNotSuccessEvent); } }
public override void OnEnter() { DemoUtils_TurnBasedManager manager = turnBaseManager.Value.GetComponent <DemoUtils_TurnBasedManager>(); TurnBasedMatch currentMatch = manager.CurrentMatch; if (currentMatch == null) { alertString.Value = "Please create a match first."; Fsm.Event(eventTarget, isNotSuccessEvent); } else { TurnBasedMatchObject temp = new TurnBasedMatchObject(); temp.Match = currentMatch; matchObject.Value = temp; alertString.Value = manager.GetMatchDisplayString(currentMatch); currentMatchId.Value = currentMatch.MatchId; if (manager.SelectedParticipant != null) { nextParticipantId.Value = manager.SelectedParticipant.ParticipantId; } else { nextParticipantId.Value = null; } selectedParticipantLeftMatch.Value = manager.SelectedParticipantLeftMatch; isMyTurn.Value = manager.IsMyTurn; canRematch.Value = manager.CanRematch; Fsm.Event(eventTarget, isSuccessEvent); } }