Ejemplo n.º 1
0
        public ActionResult SendCharacter(string name, int initiative)
        {
            var character = new EncounterCreature()
            {
                Name = name, Initiative = initiative
            };

            return(RedirectToAction("SaveCreature", "Add", character));
        }
Ejemplo n.º 2
0
        //[HttpPost]
        public ActionResult SaveCreature(EncounterCreature encounterCreature)
        {
            var encounterView = new EncounterViewModel();

            EncounterViewModel.encounterCreatures.Add(encounterCreature);

            if (EncounterViewModel.creaturesQueue.Count != 0)
            {
                int i = EncounterViewModel.creaturesQueue.Count;
                while (EncounterViewModel.creaturesQueue.Peek().Initiative > encounterCreature.Initiative && i > 0)
                {
                    EncounterViewModel.creaturesQueue.Enqueue(EncounterViewModel.creaturesQueue.Dequeue());
                    i--;
                }
                for (int j = EncounterViewModel.encounterCreatures.Count - i; j > 0; j--)
                {
                    EncounterViewModel.creaturesQueue.Enqueue(EncounterViewModel.creaturesQueue.Dequeue());
                }
            }

            return(RedirectToAction("_EncounterLayout", "Encounter", encounterView));
        }