示例#1
0
        public async Task <IActionResult> PutAb([FromRoute] int id, [FromBody] Ab ab)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != ab.Id)
            {
                return(BadRequest());
            }

            _context.Entry(ab).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!AbExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
示例#2
0
        public char GetInput(char input)
        {
            if (Reflector)
            {
                return(Layout[Ab.IndexOf(input)]);
            }

            int inputIndex     = Ab.IndexOf(input);
            int offsetIndex    = Ab.IndexOf(Offset);
            int innerRingIndex = Ab.IndexOf(InnerRingSetting);

            int index = inputIndex + offsetIndex - innerRingIndex;

            if (index > 25)
            {
                index = index - 26;
            }
            if (index < 0)
            {
                index = index + 26;
            }

            index = Ab.IndexOf(Layout[index]) - offsetIndex + innerRingIndex;
            if (index > 25)
            {
                index = index - 26;
            }
            if (index < 0)
            {
                index = index + 26;
            }

            char returnedChar      = NextRotor.GetInput(Ab[index]);
            int  returnedCharIndex = Ab.IndexOf(returnedChar);

            index = returnedCharIndex + offsetIndex - innerRingIndex;
            if (index > 25)
            {
                index = index - 26;
            }
            if (index < 0)
            {
                index = index + 26;
            }

            int layoutIndex = Layout.IndexOf(Ab[index]);

            index = layoutIndex - offsetIndex + innerRingIndex;
            if (index > 25)
            {
                index = index - 26;
            }
            if (index < 0)
            {
                index = index + 26;
            }

            return(Ab[index]);
        }
示例#3
0
 /// <summary>
 /// Convert this color to an hex string with format #AARRGGBB
 /// </summary>
 /// <returns>Hex string.</returns>
 public string ColorToHex()
 {
     return(String.Format("#{0}{1}{2}{3}"
                          , Ab.ToString("X").Length == 1 ? String.Format("0{0}", Ab.ToString("X")) : Ab.ToString("X")
                          , Rb.ToString("X").Length == 1 ? String.Format("0{0}", Rb.ToString("X")) : Rb.ToString("X")
                          , Gb.ToString("X").Length == 1 ? String.Format("0{0}", Gb.ToString("X")) : Gb.ToString("X")
                          , Bb.ToString("X").Length == 1 ? String.Format("0{0}", Bb.ToString("X")) : Bb.ToString("X")));
 }
示例#4
0
 public void SendAllBuff(Player Plr)
 {
     foreach (Ability Ab in ActiveBuff)
     {
         if (Ab != null)
         {
             Ab.SendEffect(Plr);
         }
     }
 }
示例#5
0
        public async Task <IActionResult> PostAb([FromBody] Ab ab)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.Ab.Add(ab);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetAb", new { id = ab.Id }, ab));
        }
示例#6
0
        /// <summary>
        /// The methods provided in this section are simply used to allow
        /// NavigationHelper to respond to the page's navigation methods.
        /// <para>
        /// Page specific logic should be placed in event handlers for the
        /// <see cref="NavigationHelper.LoadState"/>
        /// and <see cref="NavigationHelper.SaveState"/>.
        /// The navigation parameter is available in the LoadState method
        /// in addition to page state preserved during an earlier session.
        /// </para>
        /// </summary>
        /// <param name="e">Provides data for navigation methods and event
        /// handlers that cannot cancel the navigation request.</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            switch (HubPage.abo)
            {
            case 0:
                Ab.ScrollToSection(FAQ);
                break;

            case 1:
                Ab.ScrollToSection(sponsors);
                break;

            case 2: Ab.ScrollToSection(us);
                break;

            case 3: Ab.ScrollToSection(author);
                break;

            case 4: Ab.ScrollToSection(privacy);
                break;
            }

            this.navigationHelper.OnNavigatedTo(e);
        }