コード例 #1
0
ファイル: AlterationList.cs プロジェクト: cl4nk/RPGRogueLike
        private void Update()
        {
            if (transform.childCount > 0)
            {
                Alteration alteration = transform.GetChild(0).GetComponent <Alteration>();

                if (alteration.PotionState == Alteration.POTIONSTATES.Neutral)
                {
                    AlterationManager.Instance.UpdateFeedBackPotion(alterateStat, alteration.Time);
                    StartCoroutine(alteration.TimeAlteraction());
                }

                if (nbAlteration != transform.childCount)
                {
                    nbAlteration = transform.childCount;
                    AlterationManager.Instance.UpdateFeedBackNumberPotion(alterateStat, nbAlteration);
                }
            }
        }
コード例 #2
0
ファイル: Alphabet.cs プロジェクト: fargonauts/musicat
        /// <summary>
        ///  Returns an alphabet for a scale in the given key.
        /// </summary>
        /// <param name="bass"></param>
        /// <returns></returns>
        public static Alphabet GetScaleAlphabet(Key k, bool harmonicMinor = false, bool melodicMinor = false)
        {
            Alphabet a = new Alphabet();

            for (int i = 1; i < 8; i++)
            {
                Alteration alteration = Alteration.None;
                if (k.Mode == KeyMode.Minor)
                {
                    if (i == 3 || (i == 6 && !melodicMinor) || (i == 7 && !harmonicMinor && !melodicMinor))
                    {
                        alteration = Alteration.Lowered;
                    }
                }
                int stability;
                switch (i)
                {
                case 1:
                    stability = 3;                              //root
                    break;

                case 3:
                    stability = 1;                              //3rd
                    break;

                case 5:
                    stability = 2;                              //dominant
                    break;

                default:
                    stability = 0;
                    break;
                }
                a.Add(new ScaleDegreeWithStability(i, alteration, stability));
            }

            a.Name            = k.ToString();
            a.RootScaleDegree = new ScaleDegree(1, Alteration.None);
            a.RootPitchClass  = k.GetScaleDegreePitchClass(a.RootScaleDegree);
            a.StepCollection  = true;
            return(a);
        }
コード例 #3
0
        public async Task DeleteTest()
        {
            var a = new Alteration
            {
                Id          = 1,
                LeftLength  = 1,
                RightLength = 1,
                Status      = StatusEnum.Created,
                Type        = AlterationTypeEnum.Sleeve
            };

            _serviceMock.Setup(x => x.DetailAsync(a.Id)).ReturnsAsync(a);

            var actualResult = await _controller.Delete(a.Id);

            var viewData = ((ViewResult)actualResult).ViewData;

            Assert.IsInstanceOfType(actualResult, typeof(ViewResult));
            Assert.AreEqual(((Alteration)viewData.Model).Id, a.Id);
        }
コード例 #4
0
        public async Task DeleteConfirmedTest()
        {
            var a = new Alteration
            {
                Id          = 1,
                LeftLength  = 3,
                RightLength = 3,
                Status      = StatusEnum.Created,
                Type        = AlterationTypeEnum.Sleeve
            };

            _serviceMock.Setup(x => x.DeleteAsync(a.Id)).ReturnsAsync(1);

            var actualResult = await _controller.DeleteConfirmed(a.Id);

            var actionName = ((RedirectToActionResult)actualResult).ActionName;

            Assert.IsInstanceOfType(actualResult, typeof(RedirectToActionResult));
            Assert.AreEqual("Index", actionName);
        }
コード例 #5
0
        public async Task DetailsTest()
        {
            //Arrange
            var a = new Alteration
            {
                Id          = 1,
                LeftLength  = 1,
                RightLength = 1,
                Status      = StatusEnum.Created,
                Type        = AlterationTypeEnum.Sleeve
            };

            _serviceMock.Setup(x => x.DetailAsync(a.Id)).ReturnsAsync(a);
            //Act
            var actualResult = (ViewResult)await _controller.Details(a.Id);

            //Assert
            Assert.AreEqual(a.Id, (actualResult.Model as Alteration).Id);
            Assert.AreEqual(a.Type, (actualResult.Model as Alteration).Type);
        }
コード例 #6
0
        public void Test_GetChordTriade(Key tonic, Alteration tonicAlteration, ChordQuality chordQuality,
                                        Key expectedNoteKey1, Alteration expectedNoteAlteration1,
                                        Key expectedNoteKey2, Alteration expectedNoteAlteration2,
                                        Key expectedNoteKey3, Alteration expectedNoteAlteration3)
        {
            var chord         = _chordService.GetChord(new Note(tonic, tonicAlteration), chordQuality);
            var expectedNotes = new []
            {
                new Note(expectedNoteKey1, expectedNoteAlteration1),
                new Note(expectedNoteKey2, expectedNoteAlteration2),
                new Note(expectedNoteKey3, expectedNoteAlteration3)
            };

            Assert.That(chord.Notes.Length, Is.EqualTo(expectedNotes.Length));

            foreach (var expectedNote in expectedNotes)
            {
                Assert.Contains(expectedNote, chord.Notes);
            }
        }
コード例 #7
0
        public async Task EditTest_ValidModel_Successful()
        {
            var a = new Alteration
            {
                Id          = 1,
                LeftLength  = 3,
                RightLength = 3,
                Status      = StatusEnum.Created,
                Type        = AlterationTypeEnum.Sleeve
            };

            _serviceMock.Setup(x => x.UpdateAsync(a)).ReturnsAsync(1);

            var actualResult = await _controller.Edit(a.Id, a);

            var actionName = ((RedirectToActionResult)actualResult).ActionName;

            Assert.IsInstanceOfType(actualResult, typeof(RedirectToActionResult));
            Assert.AreEqual("Index", actionName);
        }
コード例 #8
0
        private long?RelinkMissingDelete(Dictionary <long, Record> records, Alteration x)
        {
            // Attempt to repair a possible disaster
            var  rec    = Get <Objects.Record>(x.PriorRecord.Value);
            long?result = null;

            foreach (var z in records)
            {
                if (z.Value.CanonicalNameId == rec.CanonicalNameId && z.Value.UniqueIdentifier == rec.UniqueIdentifier)
                {
                    result = z.Key;
                    break;
                }
            }
            if (!result.HasValue)
            {
                foreach (var z in records)
                {
                    if (z.Value.CanonicalNameId == rec.CanonicalNameId)
                    {
                        if (z.Value.DataIdentifier == rec.DataIdentifier)
                        {
                            result = z.Key;
                            break;
                        }
                    }
                }
            }
            if (result.HasValue)
            {
                records.Remove(result.Value);
                x.PriorRecord = result.Value;
                Update(x);
            }
            else if (x.NewRecord.HasValue && records.ContainsKey(x.NewRecord.Value))
            {
                Delete(x);
                return(x.NewRecord);
            }
            return(result);
        }
コード例 #9
0
        public double GetFrequency()
        {
            var ReferenceNote = new Note {
                Pitch = Notes.Do, Ocatve = 4
            };

            if (this.Alteration == Alteration.Flat)
            {
                if (this.Pitch == Notes.Do)
                {
                    this.Pitch = Notes.Si;
                }
                else
                {
                    this.Pitch     -= 1;
                    this.Alteration = Alteration.Sharp;
                }
            }

            List <string> notes = new List <string>()
            {
                "A", "A#", "B", "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#"
            };

            string stringNote = String.Format("{0}{1}", Pitch, Alteration == Alteration.Sharp ? "#" : "");

            int keyNumber = notes.IndexOf(stringNote);

            if (keyNumber < 3)
            {
                keyNumber = keyNumber + 12 + ((Ocatve - 1) * 12) + 1;
            }
            else
            {
                keyNumber = keyNumber + 12 + ((Ocatve - 1) * 12) + 1;
            }

            double result = 440 * Math.Pow(1.059463, -GetMargin(ReferenceNote, this));

            return(result);
        }
コード例 #10
0
ファイル: AlterationVM.cs プロジェクト: eatplayhate/versionr
        public AlterationVM(Alteration alteration, Area area, Version version)
        {
            _alteration = alteration;
            _area       = area;
            _version    = version;

            if (_alteration.PriorRecord.HasValue)
            {
                _priorRecord = _area.GetRecord(_alteration.PriorRecord.Value);
            }
            if (_alteration.NewRecord.HasValue)
            {
                _newRecord = _area.GetRecord(_alteration.NewRecord.Value);
            }

            DiffWithPreviousCommand = new DelegateCommand(DiffWithPrevious, CanDiffWithPrevious);
            DiffWithCurrentCommand  = new DelegateCommand(DiffWithCurrent, CanDiffWithCurrent);
            LogCommand            = new DelegateCommand(Log);
            SaveVersionAsCommand  = new DelegateCommand(SaveVersionAs, CanSaveVersionAs);
            OpenInExplorerCommand = new DelegateCommand(OpenInExplorer);
        }
        public void Verify()
        {
            var container = new Optimizations();
            var sut       = new Alteration(container);
            var support   = new SerializationSupport(new ConfigurationContainer().Alter(sut).Create());

            const float number = 4.5678f;
            var         actual = support.Assert(number, @"<?xml version=""1.0"" encoding=""utf-8""?><float xmlns=""https://extendedxmlserializer.github.io/system"">4.5678</float>");

            Assert.Equal(number, actual);

            var converter = sut.Get(FloatConverter.Default);
            var format    = converter.Format(number);

            for (var i = 0; i < 10; i++)
            {
                Assert.Same(format, converter.Format(number));
            }
            container.Clear();
            Assert.NotSame(format, converter.Format(number));
        }
コード例 #12
0
        public async Task CreateTest_WithAlterationModel_Sucessfully()
        {
            //Arrange
            var a = new Alteration
            {
                Id          = 1,
                LeftLength  = 1,
                RightLength = 1,
                Status      = StatusEnum.Created,
                Type        = AlterationTypeEnum.Sleeve
            };

            _serviceMock.Setup(x => x.CreateAsync(a)).Verifiable();
            //Act
            var actualResult = await _controller.Create(a);

            var actionNameResult = (RedirectToActionResult)actualResult;

            Assert.IsInstanceOfType(actualResult, typeof(RedirectToActionResult));
            Assert.AreEqual("Index", actionNameResult.ActionName);
            _serviceMock.Verify(x => x.CreateAsync(It.IsAny <Alteration>()), Times.Once);
        }
コード例 #13
0
ファイル: ChordBusiness.cs プロジェクト: marc68128/tmp
        public ChordViewModel GetChordViewModel(Key key, Alteration alteration, string chordQuality)
        {
            var dbChordQuality = _chordQualityService.GetByName(chordQuality);
            var chord          = _chordService.GetChord(new Note(key, alteration), dbChordQuality);

            var vm = new ChordViewModel();

            vm.Name  = chord.Name;
            vm.Notes = chord.Notes.Select((n, i) => new NoteViewModel {
                Note = n, Interval = dbChordQuality.ChordQualityIntervals.ElementAt(i).Interval
            }).ToList();
            vm.Notes.Add(new NoteViewModel
            {
                Interval = new Interval {
                    Number = IntervalNumber.Fundamental, Quality = IntervalQuality.Perfect
                },
                Note = chord.Fundamental
            });
            vm.Notes = vm.Notes.OrderBy(n => n.Interval.Number).ToList();

            return(vm);
        }
コード例 #14
0
ファイル: AlterationsController.cs プロジェクト: vanvo1412/SS
        public async Task <IActionResult> Edit(int id, [Bind("Id,Status,Type,LeftLength,RightLength")] Alteration alteration)
        {
            if (id != alteration.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    await _service.UpdateAsync(alteration);
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!_service.Any(e => e.Id == id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }

                if (alteration.Status == StatusEnum.Paid || alteration.Status == StatusEnum.Done)
                {
                    // Send message to service bus
                    var messageBody = JsonConvert.SerializeObject(alteration);
                    var message     = new Message(Encoding.UTF8.GetBytes(messageBody));
                    await _client.SendAsync(message);
                }

                return(RedirectToAction(nameof(Index)));
            }
            return(View(alteration));
        }
コード例 #15
0
 public void RemoveAlteration(Alteration alteration)
 {
     alteration.transform.parent = null;
     Destroy(alteration.gameObject);
 }
コード例 #16
0
        public void Test_GetByInterval(Interval interval, IntervalQuality intervalQuality, Key inputKey, Alteration inputAlteration, Key expectedKey, Alteration expectedAlteration)
        {
            var result = _noteService.GetByInterval(new Note(inputKey, inputAlteration), interval, intervalQuality);

            Assert.That(result.Key, Is.EqualTo(expectedKey));
            Assert.That(result.Alteration, Is.EqualTo(expectedAlteration));
        }
コード例 #17
0
        public async Task <Alteration> CreateAlterationAsync(Alteration alteration)
        {
            NotifyAndException(alteration);

            return(await _alterationRepository.AddAsync(alteration));
        }
コード例 #18
0
 public RouteInputPolicy()
 {
     _inputBuilders = new Alteration<IRouteDefinition, ActionCall>(addInputs);
     _propertyAlterations = new Alteration<IRouteDefinition, PropertyInfo>(addPropertyInput);
 }
コード例 #19
0
        public JsonResult GetChord(Key key, Alteration alteration, string chordQuality)
        {
            var viewModel = _chordBusiness.GetChordViewModel(key, alteration, chordQuality);

            return(Json(viewModel));
        }
コード例 #20
0
ファイル: AlterationService.cs プロジェクト: vanvo1412/SS
 public Task <int> UpdateAsync(Alteration alteration)
 {
     _context.Update(alteration);
     return(_context.SaveChangesAsync());
 }
コード例 #21
0
ファイル: AlterationService.cs プロジェクト: vanvo1412/SS
 public Task <int> CreateAsync(Alteration alteration)
 {
     _context.Add(alteration);
     return(_context.SaveChangesAsync());
 }
コード例 #22
0
ファイル: currency.cs プロジェクト: danis420/AutismFlipper
 public Currency(Blacksmith_whetstone blacksmith_whetstone, Armourer_scrap armourer_scrap, Glassblower_bauble glassblower_bauble, Gemcutter_prism gemcutter_prism, Cartographer_chisel cartographer_chisel, Transmutation transmutation, Alteration alteration, Annulment annulment, Chance chance, Augment augment, Exalted exalted, Mirror mirror, Regal regal, Alchemy alchemy, Chaos chaos, Blessed blessed, Divine divine, Jeweller jeweller, Fusing fusing, Chromatic chromatic, Scouring scouring, Regret regret, Vaal vaal, Silver_coin silver_coin, Perandus_coin perandus_coin, Apprentice_sextant apprentice_sextant, Journeyman_sextant journeyman_sextant, Master_sextant master_sextant)
 {
     this.blacksmith_whetstone = blacksmith_whetstone;
     this.armourer_scrap       = armourer_scrap;
     this.glassblower_bauble   = glassblower_bauble;
     this.gemcutter_prism      = gemcutter_prism;
     this.cartographer_chisel  = cartographer_chisel;
     this.transmutation        = transmutation;
     this.alteration           = alteration;
     this.annulment            = annulment;
     this.chance             = chance;
     this.augment            = augment;
     this.exalted            = exalted;
     this.mirror             = mirror;
     this.regal              = regal;
     this.alchemy            = alchemy;
     this.chaos              = chaos;
     this.blessed            = blessed;
     this.divine             = divine;
     this.jeweller           = jeweller;
     this.fusing             = fusing;
     this.chromatic          = chromatic;
     this.scouring           = scouring;
     this.regret             = regret;
     this.vaal               = vaal;
     this.silver_coin        = silver_coin;
     this.perandus_coin      = perandus_coin;
     this.apprentice_sextant = apprentice_sextant;
     this.journeyman_sextant = journeyman_sextant;
     this.master_sextant     = master_sextant;
 }
コード例 #23
0
ファイル: QualityTest.cs プロジェクト: bishoprook/Cadd9
 public void CanAlter(Quality start, Alteration alt, params string[] intervals)
 {
     Assert.Equal(intervals.Select(W), start.Alter(alt).Intervals);
 }
コード例 #24
0
        public AlterationTest()
        {
            var customer = new Customer("Marcelo Bidoli Fernandes", "*****@*****.**");

            ValidAlteration = new Alteration(customer, EAlterationSide.Both, 3.2, EAlterationType.Sleeve);
        }
コード例 #25
0
ファイル: MelodyBase.cs プロジェクト: oggy22/MusicTools
 public NoteWithDuration(int note, Fraction duration)
 {
     this.note     = note;
     this.alter    = Alteration.Natural;
     this.Duration = duration;
 }
コード例 #26
0
 public void Create(Alteration alteration)
 {
     this._context.Alterations.Add(alteration);
 }
コード例 #27
0
 public AlterationStatusChanged(Alteration alteration)
 {
     this.alteration = alteration;
 }
コード例 #28
0
 public AlterationCreated(Alteration alteration)
 {
     this.alteration = alteration;
 }
コード例 #29
0
        public async Task ChangeAlterationAsync(Alteration alteration)
        {
            NotifyAndException(alteration);

            await _alterationRepository.UpdateAsync(alteration);
        }
コード例 #30
0
        public JsonResult GetChords(Key key1, Alteration alteration1, Key key2, Alteration alteration2, Key key3, Alteration alteration3)
        {
            var viewModel = _chordBusiness.GetChordsViewModels(key1, alteration1, key2, alteration2, key3, alteration3);

            return(Json(viewModel));
        }
コード例 #31
0
ファイル: Note.cs プロジェクト: marc68128/tmp
 public Note(Key key, Alteration alteration = Alteration.None)
 {
     Key        = key;
     Alteration = alteration;
 }