Exemple #1
0
        public BasicWorkerItemTaskViewModel(BasicWorker recieveUpdatesFrom, IList <string> productionOptions)
        {
            recieveUpdatesFrom.PropertyChanged += (s, e) =>
            {
                if (e.PropertyName == PropertyName(() => recieveUpdatesFrom.CurrentProduction))
                {
                    Detail = recieveUpdatesFrom.CurrentProduction;
                }
                if (e.PropertyName == PropertyName(() => recieveUpdatesFrom.ProductionCounter))
                {
                    Tokens = new string(Enumerable.Repeat <char>('o', recieveUpdatesFrom.ProductionCounter).ToArray());
                }
            };

            var lookup = ObjectFactory.ProductionLookup();

            productionOptions.Select(key => new List <ProductionOptionItem>
            {
                new ProductionOptionItem(key, lookup.GetLabelFor(key), recieveUpdatesFrom)
            });

            ProductionOptions = new List <ProductionOptionItem>
            {
                new ProductionOptionItem("smallstorage", "Storage", recieveUpdatesFrom),
                new ProductionOptionItem("basicmine", "Mine", recieveUpdatesFrom),
                new ProductionOptionItem("basicquarry", "Quarry", recieveUpdatesFrom),
                new ProductionOptionItem(null, "None", recieveUpdatesFrom)
            };
        }
Exemple #2
0
 public ProductionOptionItem(string key, string label, BasicWorker target)
 {
     Key               = key;
     Label             = label;
     Target            = target;
     MeetsRequirements = true;
     Click             = new CommandHandler <ProductionOptionItem>(vm => vm.Apply());
 }
Exemple #3
0
 public void DeactivateWorker(BasicWorker worker, WaypointNode target)
 {
     worker.gameObject.SetActive(false);
     if (targets.IndexOf(target) != -1)
     {
         workersOnTarget[targets.IndexOf(target)]--;
     }
     waiting.Add(worker);
     workers.Remove(worker);
 }
Exemple #4
0
 private void SendWorker(BasicWorker worker, WaypointNode target)
 {
     worker.gameObject.SetActive(true);
     worker.SetTarget(target);
     workers.Add(worker);
 }