예제 #1
0
        /// <inheritdoc />
        public override bool UpdateContext(IContext context)
        {
            return(this.IsChanged(() =>
            {
                bool changed = false;

                foreach (var pair in this.Values)
                {
                    PlayerType type = pair.Key;
                    InvariantHashSet values = pair.Value;
                    InvariantHashSet oldValues = new InvariantHashSet(values);

                    values.Clear();

                    if (this.MarkReady(this.IsPlayerLoaded()))
                    {
                        Farmer player = type == PlayerType.HostPlayer
                            ? Game1.MasterPlayer
                            : Game1.player;

                        if (player != null)
                        {
                            foreach (string value in this.FetchValues(player))
                            {
                                values.Add(value);
                            }
                        }
                    }

                    changed |= this.IsChanged(oldValues, values);
                }

                return changed;
            }));
        }