/** * Private methods */ void Register (string clientId, Response.Room room) { // Add room data to ConnectionInfo connection.clientId = clientId; connection.room = room; // Listen for dropped clients Co.InvokeWhileTrue (0.5f, () => { return Application.isPlaying && connection.connected; }, () => { Emit<Response.DroppedClients> ("checkDropped", connection.roomId, (Response.DroppedClients res) => { // Ignore if this client has been dropped if (dropped) return; // Send a message if a client was dropped or if previously dropped clients have reconnected if (res.dropped && !hasDroppedClients) { if (onUpdateDroppedClients != null) onUpdateDroppedClients (true); hasDroppedClients = true; } else if (!res.dropped && hasDroppedClients) { if (onUpdateDroppedClients != null) onUpdateDroppedClients (false); hasDroppedClients = false; } }); }); }
protected override void OnInputEnabled() { List <AvatarInlineElementUI> childElements = SortPlayers(); int counter = 0; Co.WaitForSeconds(1f, () => { Avatar.gameObject.SetActive(true); Avatar.RandomAnimations = false; Co.InvokeWhileTrue(2.5f, 0.33f, () => { return(counter < childElements.Count); }, () => { childElements[counter].Animate(new UIAnimator.FadeIn(0.75f)); counter++; }, () => { Co.WaitForSeconds(0.75f, () => { ContinueButton.Visible = true; ContinueButton.Animate(new UIAnimator.FadeIn(0.5f)); }); }); }); }
protected override void OnInputEnabled() { foreach (AvatarElementUI avatar in RoleList.ChildElements) { avatar.playerName.gameObject.SetActive(false); avatar.playerRole.gameObject.SetActive(false); } // Introduce roles over time, ending with the Decider Co.InvokeWhileTrue(0.25f, 0.75f, () => { return(Loaded && roleCounter < RoleList.ChildElements.Count * 2); }, () => { RoleList.Visible = true; for (int i = 0; i < RoleList.ChildElements.Count * 2; i++) { int index = Mathf.FloorToInt((float)i / 2f); int roleIndex = Mathf.FloorToInt((float)roleCounter / 2f); AvatarElementUI t = RoleList.ChildElements[index]; bool wasActive = t.playerName.gameObject.activeSelf; bool active = index <= roleIndex; t.gameObject.SetActive(active); if (active && !wasActive) { t.PlayAudio(); } if (index == roleIndex) { t.playerName.gameObject.SetActive(true); if (roleCounter % 2 != 0) { t.playerRole.gameObject.SetActive(true); } } } roleCounter++; }, () => { Elements["play"].Animate(new UIAnimator.FadeIn(0.5f)); }); }
protected override void OnInputEnabled() { Co.InvokeWhileTrue(0.3f, () => { return(Loaded); }, () => { if (Searching.Text.text.Contains("Searching")) { string text = searchingText; for (int i = 0; i < ellipsisIndex; i++) { text += "."; } if (ellipsisIndex < 3) { ellipsisIndex++; } else { ellipsisIndex = 0; } Searching.Text.text = text; } }); }
protected override void OnInputEnabled() { List <AvatarInlineElementUI> childElements = SortPlayers(); int counter = childElements.Count - 1; Co.InvokeWhileTrue(0.5f, 2f, () => { return(counter >= 0); }, () => { childElements[counter].PlayAudio(); childElements[counter].Animate(new UIAnimator.FadeIn(0.75f)); counter--; }, () => { Co.WaitForSeconds(0.75f, () => { ContinueButton.Visible = true; ContinueButton.Animate(new UIAnimator.FadeIn(0.5f)); }); TextElementUI instructions; if (TryGetElement <TextElementUI> ("decider_instructions", out instructions)) { instructions.Visible = true; instructions.Animate(new UIAnimator.FadeIn(0.5f)); } }); }