public void ActivateButton(JSButton selectedButton) { //if (speaker.isPlaying || selectedButton.ButtonAnimation.isPlaying) { // Debug.Log("Attempted to activate JSButton while already active"); // return; //} selectedButton.ButtonAnimation.Play(); PlayButtonAudio(selectedButton); if (this.currentMode == GameMode.Receiving && currentIndex < orderToMatch.Count) { selectedButton.ButtonAnimation.Play(); PlayButtonAudio(selectedButton); if (selectedButton == orderToMatch[currentIndex]) { currentIndex++; } else { GameOver(); } } if (currentIndex == orderToMatch.Count && currentIndex != 0) { NextLevel(); } }
private IEnumerable <HElement> GetPageContents(SessionData sessionData, string subUrl) { yield return(new HHeadline("Directoy Responses")); if (string.IsNullOrEmpty(subUrl)) { yield return(new HText($"Directoy Responses are called for all request targeting a specific sub-directory like '{URL}/<suburl>' for this {nameof(DirectoryElementResponse)}.")); yield return(new HText($"Enter a suburl to visit:")); // Create a text-field that changes the sub-url, a button should go to on click. JSVariable suburl = new JSVariable(); JSButton button = new JSButton("Go to Sub-URL"); button.onclick = new JScript(JSValue.CurrentBrowserURL.Set(new JSStringValue($"{URL}/") + suburl.Name)); JSInput input = new JSInput(HInput.EInputType.text, "suburl"); input.onchange = new JScript(suburl.Set(input.GetInnerValue())); yield return(new HContainer(new HScript(suburl.GetJsCode(sessionData)), input, button) { Class = "fit" }); } else { yield return(new HHeadline($"Sub-URL '{subUrl}' has been called.", 3)); yield return(new HTextBlock($"You can return to the main-page of this {nameof(DirectoryElementResponse)} by clicking ", new HLink("here", "/" + URL) { Style = "display: initial;" }, ".")); } }
private void PlayButtonAudio(JSButton buttonToPlay) { speaker.clip = buttonToPlay.ButtonAudioClip; speaker.Play(); }
private void PlayButtonAudio(JSButton selectedButton) { soundToPlay = selectedButton.GetComponent <AudioClip>(); buttonPlayer.clip = soundToPlay; buttonPlayer.Play(); }
// touch button, one location // touch button, two locations, draw line // touch button, three locations, draw next line // if (n-1), draw line ? public void GetButtonLocation(JSButton selectedButton) { pointsToConnect.Add(selectedButton.gameObject.transform); }