public void OnResponseReady(ExtendedEventArgs eventArgs) { ResponseReadyEventArgs args = eventArgs as ResponseReadyEventArgs; if (Constants.USER_ID == -1) // Haven't joined, but got ready message { opReady = true; } else { if (args.user_id == Constants.OP_ID) { opReady = true; } else if (args.user_id == Constants.USER_ID) { ready = true; } else { Debug.Log("ERROR: Invalid user_id in ResponseReady: " + args.user_id); messageBoxMsg.text = "Error starting game. Network returned invalid response."; messageBox.SetActive(true); return; } } if (ready && opReady) { StartNetworkGame(); } }
public void ResponseReady(ExtendedEventArgs eventArgs) { ResponseReadyEventArgs args = eventArgs as ResponseReadyEventArgs; // player[0] represents the the current client player = players[0]; // Ready screen GameObject readyScreen = player.transform.GetChild(1).gameObject; if (args.readyPlayer == 1) { Debug.Log("Activating player 1 ready button"); readyScreen.transform.GetChild(6).gameObject.GetComponent <Toggle>().isOn = true; player1Ready = true; // If both players ready then make start button interactive for player 1. } else if (args.readyPlayer == 2) { Debug.Log("Activating player 2 ready button"); readyScreen.transform.GetChild(7).gameObject.GetComponent <Toggle>().isOn = true; player2Ready = true; } if (player1Ready == true && player2Ready == true) { readyScreen.transform.GetChild(3).gameObject.GetComponent <Button>().interactable = true; } }
public override ExtendedEventArgs process() { ResponseReadyEventArgs args = new ResponseReadyEventArgs(); args.status = status; args.username = username; return args; }
public override ExtendedEventArgs process() { ResponseReadyEventArgs args = new ResponseReadyEventArgs { user_id = user_id }; return(args); }
public override ExtendedEventArgs process() { ResponseReadyEventArgs args = new ResponseReadyEventArgs(); args.status = status; args.username = username; return(args); }
public override ExtendedEventArgs process() { ResponseReadyEventArgs args = null; args = new ResponseReadyEventArgs(); args.readyPlayer = readyPlayer; Debug.Log("Player is ready."); return(args); }