Beispiel #1
0
 public static void NotifyAll(GoalItem item)
 {
     foreach (AbstractGoal goal in singleton.goals)
     {
         if (goal.Type == item.type)
         {
             goal.Notify(item);
         }
     }
 }
Beispiel #2
0
        public bool CreateGoalItem(GoalItemCreate model)
        {
            var entity =
                new GoalItem()
            {
                UserID           = _userID,
                GoalItemName     = model.GoalItemName,
                GoalItemPrice    = model.GoalItemPrice,
                GoalItemLocation = model.GoalItemLocation,
                CreatedUTC       = DateTimeOffset.Now
            };

            using (var ctx = new ApplicationDbContext())
            {
                ctx.GoalItems.Add(entity);
                return(ctx.SaveChanges() == 1);
            }
        }
Beispiel #3
0
        public ActionResult CreateGoalItem(GoalItem goalItem)
        {
            try
            {
                var userId    = this.User.FindFirstValue(ClaimTypes.NameIdentifier);
                var budgeteer = _repo.Budgeteers.GetBudgeteerByUserId(userId);

                var newGoalItem = new GoalItem
                {
                    GoalItemName = goalItem.GoalItemName,
                    Category     = goalItem.Category,
                    Amount       = goalItem.Amount,
                    BudgeteerId  = budgeteer.BudgeteerId
                };
                _repo.GoalItems.Create(newGoalItem);
                _repo.Save();
                return(RedirectToAction(nameof(Index)));
            }
            catch
            {
                return(View(goalItem));
            }
        }
Beispiel #4
0
 internal void SetGoal(List <ObjectHome> listObject)
 {
     foreach (ObjectHome objHome in listObject)
     {
         GameObject instance = Instantiate(Resources.Load("GoalItem", typeof(GameObject))) as GameObject;
         instance.transform.SetParent(transform, false);
         instance.transform.SetAsFirstSibling();
         GoalItem draggableItemComponent = instance.GetComponent <GoalItem>();
         if (draggableItemComponent != null)
         {
             foreach (Sprite sprite in m_itemSprites)
             {
                 if (sprite.name.Contains(objHome.nameFile))
                 {
                     draggableItemComponent.SetImage(sprite);
                     draggableItemComponent.SetText(objHome.numberObject + "");
                 }
             }
         }
         goalItemNameLink.Add(objHome.nameFile, draggableItemComponent);
         goalItemCountLink.Add(objHome.nameFile, objHome.numberObject);
     }
 }
Beispiel #5
0
 public override void Notify(GoalItem item)
 {
     nbSpaceshipDestroyed++;
 }
Beispiel #6
0
 public virtual void Notify(GoalItem item)
 {
 }