コード例 #1
0
        private Button CreateRemoveButton(SkillsStat skill, int top, string gridTag)
        {
            Button btn = CreateButton(LEFT_REMOVE_BUTTON, top, "-", gridTag, skill);

            btn.Click += BtnRemovePoints_Click;
            return(btn);
        }
コード例 #2
0
        private Button CreateAddButton(SkillsStat skill, int top, string gridTag)
        {
            Button btn = CreateButton(LEFT_ADD_BUTTON, top, "+", gridTag, skill);

            btn.Click += BtnAddPoints_Click;
            return(btn);
        }
コード例 #3
0
        private Label CreateLabel(SkillsStat skill, int top)
        {
            Label lb = new Label()
            {
                Content = skill.AssignedPoints,
                Margin  = new Thickness(LEFT_START_LABEL, top, 0, 0),
                HorizontalContentAlignment = HorizontalAlignment.Stretch,
                Foreground = new SolidColorBrush(Colors.White),
            };

            if (skill.AssignedPoints == skill.MaxAssignedPoints)
            {
                lb.Foreground = new SolidColorBrush(Colors.Yellow);
            }
            return(lb);
        }
コード例 #4
0
        private TextBlock CreateTextBlock(SkillsStat skill, int top)
        {
            TextBlock tb = new TextBlock()
            {
                Text                = skill.Type,
                Foreground          = new SolidColorBrush(Colors.White),
                Background          = new SolidColorBrush(Color.FromRgb(130, 142, 142)),
                Width               = 404,
                Height              = 25,
                Margin              = new Thickness(10, top, 0, 0),
                HorizontalAlignment = HorizontalAlignment.Left,
                VerticalAlignment   = VerticalAlignment.Top,
                TextWrapping        = TextWrapping.Wrap,
                Padding             = new Thickness(5, 5, 0, 0),
            };

            return(tb);
        }
コード例 #5
0
        private void AssignPoints(object sender, int pointsToAssign)
        {
            Button     btn   = (Button)sender;
            SkillsStat skill = (SkillsStat)btn.Tag;

            if (!AddingPoints)
            {
                pointsToAssign = -pointsToAssign;
            }

            switch (btn.Name)
            {
            case INTELLIGENCE_STRING:
                ActualSkills.AssignPointsInIntelligence(skill.Id, pointsToAssign);
                break;

            case STRENGTH_STRING:
                ActualSkills.AssignPointsInStrength(skill.Id, pointsToAssign);
                break;

            case AGILITY_STRING:
                ActualSkills.AssignPointsInAgility(skill.Id, pointsToAssign);
                break;

            case LUCK_STRING:
                ActualSkills.AssignPointsInLuck(skill.Id, pointsToAssign);
                break;

            case MAJOR_STRING:
                ActualSkills.AssignPointsInMajor(skill.Id, pointsToAssign);
                break;

            default:
                Console.WriteLine("Unknown button name");
                break;
            }
            UpdateView();
        }
コード例 #6
0
        private Button CreateButton(int left, int top, string content, string gridTag, SkillsStat skill)
        {
            Button btn = new Button()
            {
                Content             = content,
                Margin              = new Thickness(left, top, 0, 0),
                Height              = 25,
                Width               = 25,
                HorizontalAlignment = HorizontalAlignment.Left,
                VerticalAlignment   = VerticalAlignment.Top,
                Name = gridTag,
                Tag  = skill,
            };

            return(btn);
        }