コード例 #1
0
ファイル: AutoMapper.cs プロジェクト: mRowlinson27/DndMarkII
 public SkillUpdateRequest MapToSvcRequest(UiSkill uiSkill)
 {
     return(new SkillUpdateRequest
     {
         Id = uiSkill.Id,
         Ranks = int.Parse(uiSkill.Ranks),
         Class = uiSkill.Class
     });
 }
コード例 #2
0
ファイル: UiSkillManager.cs プロジェクト: fabros64/Batalion
    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]);
        }
    }
コード例 #3
0
        public ISkillViewModel Create(UiSkill skill)
        {
            var skillViewModel = new SkillViewModel(_logger, _skillModelFactory.Create(), _asyncCommandAdaptorFactory, _uiThreadInvoker)
            {
                Skill = skill
            };

            skillViewModel.Init();
            return(skillViewModel);
        }
コード例 #4
0
        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();
        }
コード例 #5
0
        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();
        }
コード例 #6
0
    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);
    }
コード例 #7
0
ファイル: SkillWindowsUI.cs プロジェクト: zuojiashun/ZmSkill
    /// <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;
                }
            }
        }
    }
コード例 #8
0
        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();
        }
コード例 #9
0
        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);
        }
コード例 #10
0
 public void RemoveSkill(UiSkill uiSkill)
 {
     UpdateBackEnd();
     PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Skills"));
 }
コード例 #11
0
ファイル: SkillModel.cs プロジェクト: mRowlinson27/DndMarkII
 public void Update(UiSkill uiSkill)
 {
     _skillsService.UpdateSkill(_autoMapper.MapToSvcRequest(uiSkill));
 }