public IEnumerator TestPressableButtonHololens2Prefab() { GameObject buttonObject = InstantiateButtonFromPath(Vector3.zero, Quaternion.identity, TestButtonUtilities.PressableHoloLens2PrefabPath); ButtonConfigHelper bch = buttonObject.GetComponent <ButtonConfigHelper>(); bch.MainLabelText = "MainLabelText"; Assert.AreEqual(bch.MainLabelText, "MainLabelText"); bch.SeeItSayItLabelText = "SeeItSayItLabelText"; Assert.AreEqual(bch.SeeItSayItLabelText, "SeeItSayItLabelText"); bch.IconStyle = ButtonIconStyle.Char; bch.IconStyle = ButtonIconStyle.None; bch.IconStyle = ButtonIconStyle.Quad; bch.IconStyle = ButtonIconStyle.Sprite; bch.SeeItSayItLabelEnabled = false; bch.SetCharIcon(0); bch.SetQuadIcon(null); bch.SetSpriteIcon(null); bch.SetCharIconByName("EmptyIcon"); bch.SetQuadIconByName("EmptyIcon"); bch.SetSpriteIconByName("EmptyIcon"); bch.ForceRefresh(); bch.OnClick.AddListener(() => { Debug.Log("OnClick"); }); bch.IconSet = null; yield break; }
public void ManipulateScrew() { ButtonConfigHelper buttonConfig = GameObject.Find(Constants.SCREW_MANIPULATE_BUTTON).GetComponentInChildren <ButtonConfigHelper>(); if (manipulating) { manipulating = false; buttonConfig.SetQuadIconByName(Constants.ICON_HAND_GESTURE); } else { manipulating = true; buttonConfig.SetQuadIconByName(Constants.ICON_STOP_HAND_GESTURE); } SetCurrObjectManipulator(screws[screwIndex], manipulating); }
void OnToggle() { if (!fireStarted) { fireStarted = true; interactableScript.IsToggled = true; buttonConfigHelper.SetQuadIconByName("fire_icon_crossed_out_Zeichenfläche 1"); buttonConfigHelper.MainLabelText = "Feuer löschen"; buttonConfigHelper.SeeItSayItLabelText = "Feuer löschen"; brandschutzAnimator.SetTrigger("startFire"); } else { fireStarted = false; interactableScript.IsToggled = false; buttonConfigHelper.SetQuadIconByName("fire_icon_Zeichenfläche 1"); buttonConfigHelper.MainLabelText = "Feuer entfachen"; buttonConfigHelper.SeeItSayItLabelText = "Feuer entfachen"; brandschutzAnimator.SetTrigger("stopFire"); } }
GameObject CreateButton(Vector3 coordinate, string displayText, string iconName, GameObject parentButton, GameObject buttonType, string buttonTag, float scale) { GameObject button = Instantiate(buttonType); button.transform.parent = parentButton.transform; button.transform.localScale = new Vector3(scale, scale, scale); button.transform.localPosition = coordinate; button.transform.localRotation = Quaternion.identity; button.tag = buttonTag; ButtonConfigHelper configHelper = button.GetComponent <ButtonConfigHelper>(); configHelper.MainLabelText = displayText; configHelper.SeeItSayItLabelEnabled = false; configHelper.SetQuadIconByName(iconName); return(button); }
/// <summary> /// Test adding a config helper to a game object and attempting to modify it. /// </summary> public IEnumerator TestAddButtonConfigHelperAtRuntime() { GameObject newGameObject = new GameObject("ButtonTest"); ButtonConfigHelper bch = newGameObject.AddComponent <ButtonConfigHelper>(); bch.MainLabelText = "Test Text"; bch.SeeItSayItLabelText = "Test Text"; bch.IconStyle = ButtonIconStyle.Char; bch.IconStyle = ButtonIconStyle.None; bch.IconStyle = ButtonIconStyle.Quad; bch.IconStyle = ButtonIconStyle.Sprite; bch.SeeItSayItLabelEnabled = false; bch.SetCharIcon(0); bch.SetQuadIcon(null); bch.SetSpriteIcon(null); bch.SetCharIconByName("EmptyIcon"); bch.SetQuadIconByName("EmptyIcon"); bch.SetSpriteIconByName("EmptyIcon"); bch.ForceRefresh(); bch.OnClick.AddListener(() => { Debug.Log("OnClick"); }); bch.IconSet = null; yield break; }