示例#1
0
        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;
        }
示例#2
0
        /// <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;
        }