public AbstractWorkerItemTaskViewModel(AbstractWorker recieveUpdatesFrom, IEnumerable <string> productionOptions) { recieveUpdatesFrom.PropertyChanged += (s, e) => { if (e.PropertyName == PropertyName(() => recieveUpdatesFrom.CurrentProduction)) { Detail = recieveUpdatesFrom.CurrentProduction; } if (e.PropertyName == PropertyName(() => recieveUpdatesFrom.ProductionCounter)) { Tokens = MakeTokens(recieveUpdatesFrom.ProductionCounter); } }; var lookup = ObjectFactory.ProductionLookup(); ProductionOptions = productionOptions .Select(key => new ProductionOptionItem(key, lookup.GetLabelFor(key), recieveUpdatesFrom)) .Concat(new[] { new ProductionOptionItem(null, "None", recieveUpdatesFrom) }) .ToList(); Label = lookup.GetLabelFor(recieveUpdatesFrom.ResourceKey); Detail = recieveUpdatesFrom.CurrentProduction; SpriteUri = ObjectFactory.AssetName(lookup.GetGlyphKeyFor(recieveUpdatesFrom.ResourceKey)); Tokens = MakeTokens(recieveUpdatesFrom.ProductionCounter); }
public ColonyItemViewModel ToColonyItemViewModel() { return(new ColonyItemViewModel { Label = "Basic Mine", Detail = string.Join(",", ProductType), SpriteUri = ObjectFactory.AssetName("BasicMine"), Tokens = new string(Enumerable.Repeat <char>('o', ProductionCounter).ToArray()) }); }
public ColonyItemViewModel ToColonyItemViewModel() { return(new ColonyItemViewModel { Label = "Habitat", Detail = string.Format("Capacity: {0}", Size), SpriteUri = ObjectFactory.AssetName("Habitat"), Tokens = string.Empty }); }
public ColonyItemViewModel ToColonyItemViewModel() { string glyph = ObjectFactory.ProductionLookup().GetGlyphKeyFor(Key); return(new ColonyItemViewModel { Label = Name, Detail = Quantity.ToString(), SpriteUri = ObjectFactory.AssetName(glyph), Tokens = "" }); }
public ColonyItemViewModel ToColonyItemViewModel() { var result = new BasicWorkerItemTaskViewModel(this, new List <string> { "smallstorage", "basicmine", "basicquarry", "habitat" }) { Label = "Basic Worker", Detail = base.CurrentProduction, SpriteUri = ObjectFactory.AssetName("BasicWorker"), Tokens = new string(Enumerable.Repeat <char>('o', base.ProductionCounter).ToArray()) }; return(result); }
public MainWindow() { InitializeComponent(); var colony = new Colony(); StorageContainer.Small().Link(colony); StorageContainer.Small().Link(colony); StorageContainer.Medium().Link(colony); new Habitat().Link(colony); //new BasicWorker(colony).Link(colony); var abstractWorker = new AbstractWorker(new Domain.State.AbstractWorkerState { ResourceKey = "basicworker", ProductionOptions = ObjectFactory.ProductionLookup().GetProductionOptionsFor("basicworker").ToList(), Sprite = ObjectFactory.AssetName(ObjectFactory.ProductionLookup().GetGlyphKeyFor("basicworker")), SubCategoryKey = "basicworker" }, 10); abstractWorker.Link(colony); var mine = ObjectFactory.ImprovementFactory().BuildImprovement("basicmine"); mine.Link(colony); colony.GetInventory("stone").Add(50); //colony = new Persister().Load("Save.xml"); ViewModel = new MainWindowViewModel(new ColonyController(colony)); System.Windows.Threading.DispatcherTimer dispatcherTimer = new System.Windows.Threading.DispatcherTimer(System.Windows.Threading.DispatcherPriority.Send); dispatcherTimer.Tick += new EventHandler(OnUpdate); dispatcherTimer.Interval = timePerFrame; dispatcherTimer.Start(); }
private StorageContainer(int size, string key, string label, string assetName) { Size = size; Label = label; SpriteUri = ObjectFactory.AssetName(assetName); }