Esempio n. 1
0
        internal override IEnumerable <TriggerViewModel> BuildTriggerList(AssetSourceViewModel assetViewModel)
        {
            var triggers    = new List <TriggerViewModel>();
            var leaderboard = assetViewModel.Asset as Leaderboard;

            if (leaderboard != null)
            {
                var numberFormat = ServiceRepository.Instance.FindService <ISettings>().HexValues ? NumberFormat.Hexadecimal : NumberFormat.Decimal;

                triggers.Add(new TriggerViewModel("Start Conditions", leaderboard.Start, numberFormat, _owner.Notes));
                triggers.Add(new TriggerViewModel("Cancel Conditions", leaderboard.Cancel, numberFormat, _owner.Notes));
                triggers.Add(new TriggerViewModel("Submit Conditions", leaderboard.Submit, numberFormat, _owner.Notes));
                triggers.Add(new ValueViewModel("Value", leaderboard.Value, numberFormat, _owner.Notes));

                if (assetViewModel.Source.StartsWith("Generated"))
                {
                    triggers[0].CopyToClipboardCommand = new DelegateCommand(CopyStartToClipboard);
                    triggers[1].CopyToClipboardCommand = new DelegateCommand(CopyCancelToClipboard);
                    triggers[2].CopyToClipboardCommand = new DelegateCommand(CopySubmitToClipboard);
                    triggers[3].CopyToClipboardCommand = new DelegateCommand(CopyValueToClipboard);
                }
            }

            return(triggers.ToArray());
        }
Esempio n. 2
0
        private void DeleteLocal()
        {
            UpdateLocal(null, Local.Asset, null, false);

            Local = new AssetSourceViewModel(this, "Local");
            OnPropertyChanged(() => Local);
            UpdateModified();
        }
Esempio n. 3
0
        protected bool IsModified(AssetSourceViewModel assetViewModel)
        {
            if (assetViewModel.Asset == null)
            {
                return(false);
            }

            bool isModified = false;

            if (assetViewModel.Title.Text != Generated.Title.Text)
            {
                IsTitleModified = isModified = true;
            }
            if (assetViewModel.Description.Text != Generated.Description.Text)
            {
                IsDescriptionModified = isModified = true;
            }

            isModified |= AreAssetSpecificPropertiesModified(assetViewModel, Generated);

            var compareTriggers = new List <TriggerViewModel>(assetViewModel.TriggerList);
            var triggers        = new List <TriggerViewModel>();
            var numberFormat    = ServiceRepository.Instance.FindService <ISettings>().HexValues ? NumberFormat.Hexadecimal : NumberFormat.Decimal;
            var emptyTrigger    = new TriggerViewModel("", (Achievement)null, numberFormat, null);

            foreach (var trigger in Generated.TriggerList)
            {
                var compareTrigger = compareTriggers.FirstOrDefault(t => t.Label == trigger.Label);
                if (compareTrigger != null)
                {
                    compareTriggers.Remove(compareTrigger);
                }
                else
                {
                    compareTrigger = emptyTrigger;
                }

                triggers.Add(new TriggerComparisonViewModel(trigger, compareTrigger, numberFormat, _owner.Notes)
                {
                    CopyToClipboardCommand = trigger.CopyToClipboardCommand
                });
            }

            foreach (var compareTrigger in compareTriggers)
            {
                triggers.Add(new TriggerComparisonViewModel(emptyTrigger, compareTrigger, numberFormat, _owner.Notes));
            }

            Triggers = triggers;

            return(isModified ||
                   triggers.Any(t => t.Groups.Any(g => g.Requirements.OfType <RequirementComparisonViewModel>().Any(r => r.IsModified))));
        }
Esempio n. 4
0
        protected override bool AreAssetSpecificPropertiesModified(AssetSourceViewModel left, AssetSourceViewModel right)
        {
            var leftLeaderboard  = left.Asset as Leaderboard;
            var rightLeaderboard = right.Asset as Leaderboard;

            if (leftLeaderboard == null || rightLeaderboard == null)
            {
                return(false);
            }

            bool isFormatModified      = (leftLeaderboard.Format != rightLeaderboard.Format);
            bool isLowerBetterModified = (leftLeaderboard.LowerIsBetter != rightLeaderboard.LowerIsBetter);

            return(isFormatModified || isLowerBetterModified);
        }
Esempio n. 5
0
        internal override IEnumerable <TriggerViewModel> BuildTriggerList(AssetSourceViewModel assetViewModel)
        {
            var achievement = assetViewModel.Asset as Achievement;

            if (achievement != null)
            {
                var numberFormat = ServiceRepository.Instance.FindService <ISettings>().HexValues ? NumberFormat.Hexadecimal : NumberFormat.Decimal;
                return(new TriggerViewModel[]
                {
                    new TriggerViewModel("", achievement, numberFormat, _owner.Notes)
                });
            }

            return(new TriggerViewModel[0]);
        }
Esempio n. 6
0
        public AssetViewModelBase(GameViewModel owner)
            : base(owner)
        {
            Generated = new AssetSourceViewModel(this, "Generated");
            Local     = new AssetSourceViewModel(this, "Local");
            Published = new AssetSourceViewModel(this, "Published");

            if (owner == null || String.IsNullOrEmpty(owner.RACacheDirectory))
            {
                UpdateLocalCommand = DisabledCommand.Instance;
                DeleteLocalCommand = DisabledCommand.Instance;
            }
            else
            {
                UpdateLocalCommand = new DelegateCommand(UpdateLocal);
                DeleteLocalCommand = new DelegateCommand(DeleteLocal);
            }
        }
Esempio n. 7
0
        internal void UpdateLocal(StringBuilder warning, bool validateAll)
        {
            var asset = Generated.Asset;

            if (asset.Id == 0)
            {
                asset.Id = Id;
            }

            if (String.IsNullOrEmpty(asset.BadgeName) || asset.BadgeName == "0")
            {
                asset.BadgeName = BadgeName;
            }

            UpdateLocal(asset, Local.Asset, warning, validateAll);

            Local       = new AssetSourceViewModel(this, "Local");
            Local.Asset = Generated.Asset;

            OnPropertyChanged(() => Local);
            UpdateModified();
        }
Esempio n. 8
0
 internal abstract IEnumerable <TriggerViewModel> BuildTriggerList(AssetSourceViewModel assetViewModel);
Esempio n. 9
0
 private void LoadViewModel(AssetSourceViewModel viewModel)
 {
     Title       = viewModel.Title.Text;
     Description = viewModel.Description.Text;
     Points      = viewModel.Points.Value.GetValueOrDefault();
 }
Esempio n. 10
0
 private void BindViewModel(AssetSourceViewModel viewModel)
 {
     SetBinding(TitleProperty, new ModelBinding(viewModel.Title, TextFieldViewModel.TextProperty, ModelBindingMode.OneWay));
     SetBinding(DescriptionProperty, new ModelBinding(viewModel.Description, TextFieldViewModel.TextProperty, ModelBindingMode.OneWay));
     SetBinding(PointsProperty, new ModelBinding(viewModel.Points, IntegerFieldViewModel.ValueProperty, ModelBindingMode.OneWay));
 }
Esempio n. 11
0
 protected virtual bool AreAssetSpecificPropertiesModified(AssetSourceViewModel left, AssetSourceViewModel right)
 {
     return(false);
 }
Esempio n. 12
0
 protected override bool AreAssetSpecificPropertiesModified(AssetSourceViewModel left, AssetSourceViewModel right)
 {
     IsPointsModified = (left.Points.Value != right.Points.Value);
     return(IsPointsModified);
 }