Inheritance: ViewModelBase
示例#1
0
        private void _UpdateAttributes()
        {
            foreach (var attribute in _player.Attributes.Keys)
            {
                if (attribute == Sanguosha.Expansions.Battle.Cards.Jiu.Drank)
                {
                    IsDrank = (_player[attribute] == 1);
                }
                else if (attribute == Player.IsDying)
                {
                    IsDying = (_player[attribute] == 1);
                }
                else if (attribute.IsMark)
                {
                    int count = _player[attribute];
                    MarkViewModel model = null;
                    foreach (var mark in Marks)
                    {
                        if (mark.PlayerAttribute == attribute)
                        {
                            model = mark;
                            break;
                        }
                    }

                    if (model == null)
                    {
                        model = new MarkViewModel() { PlayerAttribute = attribute };
                        Marks.Add(model);
                    }

                    model.Number = _player[attribute];
                }
                else if (attribute.IsStatus)
                {
                    int count = _player[attribute];
                    MarkViewModel model = null;
                    foreach (var mark in StatusMarks)
                    {
                        if (mark.PlayerAttribute == attribute)
                        {
                            model = mark;
                            break;
                        }
                    }

                    if (model == null)
                    {
                        model = new MarkViewModel() { PlayerAttribute = attribute };
                        StatusMarks.Add(model);
                    }

                    model.Number = _player[attribute];
                }
            }
        }
示例#2
0
        private void _UpdateAttributes()
        {
            foreach (var attribute in _player.Attributes.Keys)
            {
                if (!attribute.IsMark) continue;
                int count = _player[attribute];
                MarkViewModel model = null;
                foreach (var mark in Marks)
                {
                    if (mark.PlayerAttribute == attribute)
                    {
                        model = mark;
                        break;
                    }
                }

                if (model == null)
                {
                    model = new MarkViewModel() { PlayerAttribute = attribute };
                    Marks.Add(model);
                }

                model.Number = _player[attribute];
            }
        }