示例#1
0
        public void BeforeTest()
        {
            _status = new GameObject().AddComponent <TestCompanionStatusHUDComponent>();
            _status.TestDispatcher   = new UnityMessageEventDispatcher();
            _status.IconDisableAlpha = 0.3f;

            _primaryStatusElement = new CompanionStatusHUDComponent.CompanionStatus
            {
                CompanionSlider       = new GameObject().AddComponent <Slider>(),
                CompanionSliderFill   = new GameObject().AddComponent <Image>(),
                CompanionUseCountText = new GameObject().AddComponent <Text>()
            };

            _secondaryStatusElement = new CompanionStatusHUDComponent.CompanionStatus
            {
                CompanionSlider       = new GameObject().AddComponent <Slider>(),
                CompanionSliderFill   = new GameObject().AddComponent <Image>(),
                CompanionUseCountText = new GameObject().AddComponent <Text>()
            };

            _status.CompanionStates.Add(new CompanionStatusHUDComponent.CompanionStatusPairing {
                Slot = ECompanionSlot.Primary, Status = _primaryStatusElement
            });
            _status.CompanionStates.Add(new CompanionStatusHUDComponent.CompanionStatusPairing {
                Slot = ECompanionSlot.Secondary, Status = _secondaryStatusElement
            });

            _setSprite = Resources.Load <Sprite>(SpritePath);

            _status.TestStart();
        }
示例#2
0
 private void AssertSlotUpdated(CompanionStatusHUDComponent.CompanionStatus status,
                                PriorCompanionSlotState state)
 {
     Assert.AreEqual(status.CompanionUseCountText.text, state.PriorUseCount.ToString());
     Assert.AreSame(status.CompanionSliderFill.sprite, state.PriorUIIcon);
     Assert.AreEqual(status.CompanionSlider.value, state.PriorCooldown);
 }
示例#3
0
        public void AfterTest()
        {
            _status.TestDestroy();

            _setSprite = null;

            _secondaryStatusElement = null;
            _primaryStatusElement   = null;
            _status = null;
        }