private void OnParticipantStateChanged(object sender, InteractiveParticipantStateChangedEventArgs e) { // Every time a new participant joins randomly assign them to a new group. Groups can // be used to show different sets of controls to your audience. InteractiveParticipant participant = e.Participant; if (participant.State == InteractiveParticipantState.Joined && MixerInteractive.Groups.Count >= 2) { InteractiveGroup group1 = MixerInteractive.Groups[0]; InteractiveGroup group2 = MixerInteractive.Groups[1]; InteractiveGroup group3 = MixerInteractive.Groups[2]; int group = Mathf.CeilToInt(Random.value * 3); if (group == 1) { participant.Group = group1; group1Text.text += "\n" + participant.UserName; } else if (group == 2) { participant.Group = group2; group2Text.text += "\n" + participant.UserName; } else if (group == 3) { participant.Group = group3; group3Text.text += "\n" + participant.UserName; } } }
/// <summary> /// Special leave handling for either of player 1 or 2 /// </summary> private void HandleParticipantLeave(InteractiveParticipant participant) { if (participant == _stateMachine.ParticipantOne || participant == _stateMachine.ParticipantTwo) { if (_stateMachine.GameIsActive) { var tank = _playerTanks.ToList().First(x => x.OnlineParticipant != participant); tank._wins = _numRoundsToWin; tank._instance.SetActive(false); } else if (participant == _stateMachine.ParticipantOne) { _redPlayer.OnlineParticipant = null; _stateMachine.ParticipantOne = null; MixerInteractive.GetControl(OnlineConstants.CONTROL_P1_JOIN).SetDisabled(false); _stateMachine.UpdateLobbyStatus(); } else if (participant == _stateMachine.ParticipantTwo) { _bluePlayer.OnlineParticipant = null; _stateMachine.ParticipantTwo = null; MixerInteractive.GetControl(OnlineConstants.CONTROL_P2_JOIN).SetDisabled(false); _stateMachine.UpdateLobbyStatus(); } } }
public void RelinquishControl(InteractiveParticipant participant = null) { var group = InteractivityManager.SingletonInstance.GetGroup("default"); (participant ?? this.participant).Group = group; sessionId = null; SaveMaster.SyncSave(); }
private void GiveControl(InteractiveParticipant participant) { SaveMaster.SyncLoad(); var group = InteractivityManager.SingletonInstance.GetGroup("controlling"); participant.Group = group; this.joinTime = Time.time; this.participant = participant; sessionId = participant.SessionID; username = participant.UserName ?? "HUMAN"; }
public void ResetToDefault() { GameIsActive = false; ParticipantOne = null; ParticipantTwo = null; MixerInteractive.GetControl(OnlineConstants.CONTROL_P1_JOIN).SetDisabled(false); MixerInteractive.GetControl(OnlineConstants.CONTROL_P2_JOIN).SetDisabled(false); UpdateLobbyStatus(); }
public void ResetToDefault() { _p1Joined = _p2Joined = false; ParticipantOne = null; ParticipantTwo = null; MixerInteractive.OnInteractiveButtonEvent -= OnJoinButtonEvents; MixerInteractive.GetControl(OnlineConstants.CONTROL_P1_JOIN).SetDisabled(false); MixerInteractive.GetControl(OnlineConstants.CONTROL_P2_JOIN).SetDisabled(false); UpdateLobbyStatus(); }
private void OnJoinButtonEvents(object sender, InteractiveButtonEventArgs ev) { if (ev.ControlID == OnlineConstants.CONTROL_P1_JOIN) { _p1Joined = true; ParticipantOne = ev.Participant; UpdateControlsAfterJoin(ev); } else if (ev.ControlID == OnlineConstants.CONTROL_P2_JOIN) { _p2Joined = true; ParticipantTwo = ev.Participant; UpdateControlsAfterJoin(ev); } }
void ParticipantStateChanged(object sender, InteractiveParticipantStateChangedEventArgs e) { InteractiveParticipant participant = e.Participant; if (e.State == InteractiveParticipantState.Joined) { print(participant.UserName + " joined"); } if (e.State == InteractiveParticipantState.Left) { print(participant.UserName + " left"); } if (e.State == InteractiveParticipantState.InputDisabled) { print(participant.UserName + " input disabled"); } }
// Update is called once per frame void Update() { // If the button with an ID of "giveHealth" is pressed, then increase // the player's health by 1. if (MixerInteractive.GetButton("giveHealth")) { int currentHealth = int.Parse(healthText.text); currentHealth++; healthText.text = currentHealth.ToString(); // It's always a good idea to recognize the viewer. They love seeing their name // on the screen. InteractiveParticipant participant = MixerInteractive.GetParticipantWhoGaveInputForControl("giveHealth"); if (participant != null) { viewerRecognitionText.text = participant.UserName + " gave you health!"; } } }
internal ParticipantJoinEventArgs(InteractiveParticipant participant) : base(InteractiveEventType.ParticipantStateChanged) { }
internal ParticipantLeaveEventArgs(InteractiveParticipant participant) { }
public void OnInteractiveButtonEvent(object sender, InteractiveButtonEventArgs e) { //e.CaptureTransaction(); -charges sparks InteractiveParticipant participant = e.Participant; if (MixerInteractive.GetButtonDown("chooseColor")) { participant.Group = MixerInteractive.GetGroup("color"); } if (MixerInteractive.GetButtonDown("cameraSettings")) { participant.Group = MixerInteractive.GetGroup("camera"); } if (MixerInteractive.GetButtonDown("mirrorAdjustments")) { participant.Group = MixerInteractive.GetGroup("mirror"); } if (MixerInteractive.GetButtonDown("glitchEffect")) { participant.Group = MixerInteractive.GetGroup("glitch"); } if (MixerInteractive.GetButtonDown("datamoshEffect")) { participant.Group = MixerInteractive.GetGroup("datamosh"); } if (MixerInteractive.GetButtonDown("avatarFun")) { participant.Group = MixerInteractive.GetGroup("avatar"); } if (MixerInteractive.GetButtonDown("backColor")) { participant.Group = MixerInteractive.GetGroup("default"); } if (MixerInteractive.GetButtonDown("backCamera")) { participant.Group = MixerInteractive.GetGroup("default"); } if (MixerInteractive.GetButtonDown("backMirror")) { participant.Group = MixerInteractive.GetGroup("default"); } if (MixerInteractive.GetButtonDown("backGlitch")) { participant.Group = MixerInteractive.GetGroup("default"); } if (MixerInteractive.GetButtonDown("backDatamosh")) { participant.Group = MixerInteractive.GetGroup("default"); } if (MixerInteractive.GetButtonDown("backAvatar")) { participant.Group = MixerInteractive.GetGroup("default"); } if (MixerInteractive.GetButtonDown("resetCamera")) { mirror.ChangeCamera(-15.717f, -0.7f, -47.387f, 0f, 90f, 0f, 90f); } if (MixerInteractive.GetButtonDown("resetMirror")) { scaleX = 0; BroadcastMessage("ChangeScaleX"); scaleY = 1; BroadcastMessage("ChangeScaleY"); scaleZ = 0; BroadcastMessage("ChangeScaleZ"); mirror.ResetMirror(); } if (MixerInteractive.GetButtonDown("colorBackground")) { BroadcastMessage("RandomBackgroundColor"); } if (MixerInteractive.GetButtonDown("randomColor")) { BroadcastMessage("RandomColor"); } if (MixerInteractive.GetButtonDown("randomColorAll")) { vRandomAll = new Color32((byte)Random.Range(0, 255), (byte)Random.Range(0, 255), (byte)Random.Range(0, 255), 255); BroadcastMessage("RandomColorAll"); } if (MixerInteractive.GetButtonDown("randomRed")) { BroadcastMessage("RandomRed"); } if (MixerInteractive.GetButtonDown("randomGreen")) { BroadcastMessage("RandomGreen"); } if (MixerInteractive.GetButtonDown("randomBlue")) { BroadcastMessage("RandomBlue"); } if (MixerInteractive.GetButtonDown("mirrorRepeat")) { mirror.RandomRepeat(); } if (MixerInteractive.GetButtonDown("mirrorOffset")) { mirror.RandomOffset(); } if (MixerInteractive.GetButtonDown("mirrorRoll")) { mirror.RandomRoll(); } if (MixerInteractive.GetButtonDown("mirrorSymmetric")) { mirror.SwitchSymmetric(); } if (MixerInteractive.GetButtonDown("scaleX")) { scaleX = Random.Range(0.1f, 1f); BroadcastMessage("ChangeScaleX"); } if (MixerInteractive.GetButtonDown("scaleY")) { scaleY = Random.Range(0.1f, 1f); BroadcastMessage("ChangeScaleY"); } if (MixerInteractive.GetButtonDown("scaleZ")) { scaleZ = Random.Range(0.1f, 1f); BroadcastMessage("ChangeScaleZ"); } if (MixerInteractive.GetButtonDown("cameraPosX")) { //mirror.RandomCamPos(); mirror.ChangeCameraX(Random.Range(-9f, -14f)); } if (MixerInteractive.GetButtonDown("cameraPosY")) { mirror.ChangeCameraY(Random.Range(7f, -3f)); } if (MixerInteractive.GetButtonDown("cameraPosZ")) { mirror.ChangeCameraZ(Random.Range(-35f, -55f)); } if (MixerInteractive.GetButtonDown("cameraRotX")) { mirror.ChangeRotX(Random.Range(11f, -40f)); } if (MixerInteractive.GetButtonDown("cameraRotY")) { mirror.ChangeRotY(Random.Range(115f, 35f)); } if (MixerInteractive.GetButtonDown("cameraRotZ")) { mirror.ChangeRotZ(Random.Range(61f, -28f)); } if (MixerInteractive.GetButtonDown("cameraFOV")) { mirror.RandomFOV(); } if (MixerInteractive.GetButtonDown("randomGlitchIntensity")) { glitchEffect.RandomGlitchIntensity(); } if (MixerInteractive.GetButtonDown("randomGlitchFlip")) { glitchEffect.RandomGlitchFlip(); } if (MixerInteractive.GetButtonDown("randomGlitchColor")) { glitchEffect.RandomGlitchColor(); } if (MixerInteractive.GetButtonDown("resetGlitch")) { glitchEffect.resetGlitch(); } if (MixerInteractive.GetButtonDown("DatamoshOn")) { datamosh.DatamoshOn(); } if (MixerInteractive.GetButtonDown("DatamoshOff")) { datamosh.DatamoshOff(); } if (MixerInteractive.GetButtonDown("RandomBlock")) { datamosh.RandomBlock(); } if (MixerInteractive.GetButtonDown("RandomEntropy")) { datamosh.RandomEntropy(); } if (MixerInteractive.GetButtonDown("RandomNoiseContrast")) { datamosh.RandomNoiseContrast(); } if (MixerInteractive.GetButtonDown("RandomVelocityScale")) { datamosh.RandomVelocityScale(); } if (MixerInteractive.GetButtonDown("RandomDiffusion")) { datamosh.RandomDiffusion(); } if (MixerInteractive.GetButtonDown("avatarOn")) { int userID = (int)participant.UserID; grabbyTheAvatar.AvatarOn(userID); } if (MixerInteractive.GetButtonDown("avatarOff")) { grabbyTheAvatar.AvatarOff(); } if (MixerInteractive.GetButtonDown("avatarCats")) { grabbyTheAvatar.AvatarOn(267345); } if (MixerInteractive.GetButtonDown("avatarLychi")) { grabbyTheAvatar.AvatarOn(604453); } if (MixerInteractive.GetButtonDown("avatarMatt")) { grabbyTheAvatar.AvatarOn(137); } if (MixerInteractive.GetButtonDown("avatarJames")) { grabbyTheAvatar.AvatarOn(294); } if (MixerInteractive.GetButtonDown("avatarRandomRotateOn")) { grabbyTheAvatar.AvatarRandomRotateOn(); } if (MixerInteractive.GetButtonDown("avatarRandomRotateOff")) { grabbyTheAvatar.AvatarRandomRotateOff(); } if (MixerInteractive.GetButtonDown("avatarRandomOffsetOn")) { grabbyTheAvatar.AvatarRandomOffsetOn(); } if (MixerInteractive.GetButtonDown("avatarRandomOffsetOff")) { grabbyTheAvatar.AvatarRandomOffsetOff(); } if (MixerInteractive.GetButtonDown("avatarColorMess")) { grabbyTheAvatar.AvatarColorMess(); } if (MixerInteractive.GetButtonDown("avatarColorReset")) { grabbyTheAvatar.AvatarColorReset(); } if (MixerInteractive.GetButtonDown("avatarRandomAlpha")) { grabbyTheAvatar.AvatarRandomAlpha(); } #region Not using ATM //if (MixerInteractive.GetButtonDown("Purple")) //{ // print(e.Participant.UserName); // mirror.ChangeState(4, 90f, 30f, true); // scaleX = 1f; scaleY = 1f; scaleZ = 0.94f; // BroadcastMessage("ChangeScale"); // mirror.ChangeCamera(-15.717f, -0.27f, -50.8f, 0f, 90f, 0f, 60f); // ColorChange("Purple"); //} //if (MixerInteractive.GetButton("Blue")) //{ // print(e.Participant.UserName); // mirror.ChangeState(3, 90f, 30f, true); // scaleX = 0.1f; scaleY = 1f; scaleZ = 0.1f; // BroadcastMessage("ChangeScale"); // mirror.ChangeCamera(-15.717f, -0.27f, -47.29f, 0f, 90f, 0f, 76.2f); // ColorChange("Blue"); //} //if (MixerInteractive.GetButton("Green")) //{ // print(e.Participant.UserName); // mirror.ChangeState(3, 90f, 30f, true); // scaleX = 0.35f; scaleY = 1.99f; scaleZ = 0.03f; // BroadcastMessage("ChangeScale"); // mirror.ChangeCamera(-15.717f, -0.7f, -47.29f, 0f, 90f, 0f, 90f); // ColorChange("Green"); //} //if (MixerInteractive.GetButton("White")) //{ // print(e.Participant.UserName); // mirror.ChangeState(3, 30f, 30f, false); // scaleX = 1.2f; scaleY = 0.9f; scaleZ = 1.1f; // BroadcastMessage("ChangeScale"); // mirror.ChangeCamera(-15.717f, -1.7f, -49.59f, 0f, 90f, 0f, 60f); // ColorChange("White"); //} }