public SkillUpdateRequest MapToSvcRequest(UiSkill uiSkill) { return(new SkillUpdateRequest { Id = uiSkill.Id, Ranks = int.Parse(uiSkill.Ranks), Class = uiSkill.Class }); }
private void InitUiSkills() { List <SkillData> skills = character.FightController.GetSkills(); for (int i = 0; i < skills.Count; i++) { UiSkill uiSkill = Instantiate(UiSkillPrefab, UiSkillsHolder); uiSkill.InitSkillUi(skills[i]); } }
public ISkillViewModel Create(UiSkill skill) { var skillViewModel = new SkillViewModel(_logger, _skillModelFactory.Create(), _asyncCommandAdaptorFactory, _uiThreadInvoker) { Skill = skill }; skillViewModel.Init(); return(skillViewModel); }
public async Task UpdateSkill_CallsModel() { //Arrange var uiSkill = new UiSkill(); _skillViewModel.Skill = uiSkill; //Act await _skillViewModel.UpdateSkill.ExecuteAsync(); //Assert A.CallTo(() => _model.Update(uiSkill)).MustHaveHappened(); }
public void Update_MapsAndSendsToService() { //Arrange var uiSkill = new UiSkill(); var skillUpdateRequest = new SkillUpdateRequest(); A.CallTo(() => _autoMapper.MapToSvcRequest(uiSkill)).Returns(skillUpdateRequest); //Act _skillModel.Update(uiSkill); //Assert A.CallTo(() => _skillsService.UpdateSkill(skillUpdateRequest)).MustHaveHappened(); }
public void ShowSkill(BasicEntity entity) { if (skill != null) { return; } skill = (GameObject)Resources.Load("Prefabs/UI/Panel/UISkill"); skill = Instantiate(skill); skill.transform.SetParent(gameObject.transform); skill.transform.localPosition = skill.transform.position; skill.transform.localScale = Vector3.one; UiSkill uiSkill = skill.transform.GetChild(1).gameObject.AddComponent <UiSkill>(); uiSkill.AddClick(entity); }
/// <summary> /// 添加一个技能 /// </summary> /// <param name="skill"></param> public void Pickup(SkillBase skill) { bool end = false; Item = Instantiate(UiItem); UiSkill uiSkill = Item.GetComponent <UiSkill>(); uiSkill.skill = skill; uiSkill.text = Info.GetComponent <Text>(); Image imagesingle = Item.transform.GetComponent <Image>(); imagesingle.overrideSprite = skill.GetIcon(); for (int i = 0; i < UCellList.Count; i++) { if (UCellList[i].transform.childCount > 0) { if (skill.Id == UCellList[i].transform.GetChild(0).GetComponent <UiSkill>().skill.Id) { end = true; StartCoroutine(ReturnToPool()); Item.transform.SetParent(UIManager.Instance.PoolCanvas.transform); } } } if (!end) { for (int i = 0; i < UCellList.Count; i++) { if (UCellList[i].transform.childCount == 0) { Item.transform.SetParent(UCellList[i].transform); Item.transform.localPosition = Vector3.zero; //存储格子信息 //ShowItem.Store(UCell[i].transform.name,baseitem); break; } } } }
public void Rebind_HasValueToBeginWith_Overwrites() { //Arrange var newUiSkill = new UiSkill { Id = Guid.NewGuid() }; var newData = new List <UiSkill> { newUiSkill }; var fakeSkillViewModel = A.Fake <ISkillViewModel>(); var currentData = new ObservableCollection <ISkillViewModel> { fakeSkillViewModel }; //Act _skillTableViewModelBindingHelper.Rebind(currentData, newData); //Assert A.CallToSet(() => fakeSkillViewModel.Skill).To(newUiSkill).MustHaveHappened(); }
public void Rebind_EmptyToBeginWith_CreatesNewViewModels() { //Arrange var currentData = new ObservableCollection <ISkillViewModel>(); var newUiSkill = new UiSkill { Id = Guid.NewGuid() }; var newData = new List <UiSkill> { newUiSkill }; var fakeSkillViewModel = A.Fake <ISkillViewModel>(); A.CallTo(() => _skillViewModelFactory.Create(newUiSkill)).Returns(fakeSkillViewModel); //Act _skillTableViewModelBindingHelper.Rebind(currentData, newData); //Assert currentData.FirstOrDefault().Should().Be(fakeSkillViewModel); }
public void RemoveSkill(UiSkill uiSkill) { UpdateBackEnd(); PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Skills")); }
public void Update(UiSkill uiSkill) { _skillsService.UpdateSkill(_autoMapper.MapToSvcRequest(uiSkill)); }