Пример #1
0
        public async Task <IActionResult> Edit(int id, [Bind("MantraId,MorningMantra,PlaceFound,ApplicationUserId")] Mantra mantra)
        {
            if (id != mantra.MantraId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(mantra);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MantraExists(mantra.MantraId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ApplicationUserId"] = new SelectList(_context.ApplicationUser, "Id", "Id", mantra.ApplicationUserId);
            return(View(mantra));
        }
Пример #2
0
        public async Task <IActionResult> Create([Bind("MantraId,MorningMantra,PlaceFound,ApplicationUserId")] Mantra mantra)
        {
            if (ModelState.IsValid)
            {
                _context.Add(mantra);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ApplicationUserId"] = new SelectList(_context.ApplicationUser, "Id", "Id", mantra.ApplicationUserId);
            return(View(mantra));
        }
Пример #3
0
        public override bool GetValue()
        {
            bool result;

            if (!Application.isPlaying)
            {
                result = false;
            }
            else
            {
                if (this.count < 1)
                {
                    return(false);
                }
                for (int i = 0; i < this.count; i++)
                {
                    Props props;
                    if (!this.isMantra)
                    {
                        Skill skill = Game.Data.Get <Skill>(sourceId) ?? Randomizer.GetOneFromData <Skill>(sourceId);
                        props = new Props
                        {
                            Id            = "scroll_" + skill.Id,
                            Description   = skill.Description,
                            PropsType     = PropsType.Medicine,
                            PropsCategory = skill.Type - 101 + 401,
                            Name          = skill.Name + "秘籍",
                            PropsEffect   = new List <PropsEffect>
                            {
                                new PropsLearnSkill(skill.Id)
                            },
                            PropsEffectDescription = "学会独特招式:" + skill.Name
                        };
                    }
                    else
                    {
                        Mantra mantra = Game.Data.Get <Mantra>(sourceId) ?? Randomizer.GetOneFromData <Mantra>(sourceId);
                        props = new Props
                        {
                            Id            = "scroll_" + mantra.Id,
                            Description   = mantra.Description,
                            PropsType     = PropsType.Medicine,
                            PropsCategory = PropsCategory.InternalStyle_Secret_Scroll,
                            Name          = mantra.Name + "秘籍",
                            PropsEffect   = new List <PropsEffect>
                            {
                                new PropsLearnMantra(mantra.Id)
                            },
                            PropsEffectDescription = "学会独特心法:" + mantra.Name
                        };
                    }
                    ModExtensionSaveData.AddUniqueItem(props);
                    Game.GameData.Inventory.Add(props.Id, 1, true);
                    if (base.Graph != null && (bool)base.Graph.GetVariable("IsShowMessage"))
                    {
                        this.ShowMessage(props.Name, 1);
                    }
                }
                result = true;
            }
            return(result);
        }