public static void InitializeResources(Era era) { if (era == mLoadedEra) return; mLoadedEra = era; InitializeUnitPrefabs(mLoadedEra); }
private static GameObject UnitPrefab(Era era, string name) { string prefabPath = "Units/Prefabs/"; prefabPath += era.ToString(); prefabPath += "/"; prefabPath += name; return Resources.Load (prefabPath) as GameObject; }
public void ApplyDefault( Ruleset newDefault ) { m_Base = newDefault; Era = Era.UOR; m_Changed = false; m_Options = new BitArray( newDefault.m_Options ); ApplyFlavorsTo( this ); }
private static void InitializeUnitPrefabs(Era era) { mFriendlyUnitPrefabs = new Dictionary<UnitType, GameObject> (); mFriendlyUnitPrefabs.Add (UnitType.Swordsman, UnitPrefab(era, "SwordsmanPrefab")); mFriendlyUnitPrefabs.Add (UnitType.Archer, UnitPrefab(era, "ArcherPrefab")); mFriendlyUnitPrefabs.Add (UnitType.Mage, UnitPrefab(era, "MagePrefab")); mFriendlyUnitPrefabs.Add (UnitType.King, UnitPrefab(era, "KingPrefab")); mEnemyUnitPrefabs = new Dictionary<UnitType, GameObject> (); mEnemyUnitPrefabs.Add (UnitType.Swordsman, UnitPrefab(era, "EnemySwordsmanPrefab")); mEnemyUnitPrefabs.Add (UnitType.Archer, UnitPrefab(era, "EnemyArcherPrefab")); mEnemyUnitPrefabs.Add (UnitType.Peasant, UnitPrefab(era, "EnemyPeasantPrefab")); mEnemyUnitPrefabs.Add (UnitType.Mage, UnitPrefab(era, "EnemyMagePrefab")); mEnemyUnitPrefabs.Add (UnitType.Elite, UnitPrefab(era, "EnemyElitePrefab")); }
static void WriteEra(Era t) { switch (t) { case Era.Meiji: Console.WriteLine("明治"); break; case Era.Taisho: Console.WriteLine("大正"); break; case Era.Showa: Console.WriteLine("昭和"); break; case Era.Heisei: Console.WriteLine("平成"); break; } }
public override void LoadContent() { base.LoadContent(); selectedEra = Era.石器; //テクスチャ読み込み slideTextures = new Texture2D[16]; for (int i = 0; i < 16; i++) { slideTextures[i] = mainGame.Content.Load<Texture2D>("IjinSelect/EraSelect/" + (Era)i); } //スライドの位置 slideRectangles = new Rectangle[16]; for (int i = 0; i < 16; i++) { slideRectangles[i] = new Rectangle(600 * i + (width-600)/2, height/8, 580, height*6/8); } //偉人の一覧 personList = new ItemList<Person>[16]; for (int i = 0; i < personList.Length; i++) { //一覧を表示する領域 Rectangle rec = new Rectangle(slideRectangles[i].X + slideRectangles[i].Width*3/4,slideRectangles[i].Y,slideRectangles[i].Width/2,slideRectangles[i].Height); personList[i] = new ItemList<Person>(mainGame, Person.EraSelectPersons((Era)i), mainGame.Content.Load<SpriteFont>("Important/meirio_14"), rec); personList[i].LoadContent(); } //フェードインを開始 fadeIn.isEnabled = true; }
static TextureResource() { mLoadedEra = Era.None; }
public void BalanceTransferCreateMortalAccountToAliceTest1() { var _runtime = new RuntimeVersion { SpecVersion = 1, TransactionVersion = 1 }; Constants.AddressVersion = 0; // 0x310284278117fc144c72340f67d0f2316e8386ceffbf2b2428c9c51fef7c597f1d426e007c9777cf14fe0e14e8aef019695043be2fd153a75ff3381f4cc4850755d537b1a9d7920e509ee2e4e1f244dad670dc44ec3fc24388181e6465fdda13d59ae70063001c000400d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d02890700 // sender 5FfBQ3kwXrbdyoqLPvcXRp7ikWydXawpNs2Ceu3WwFdhZ8W4 // recent blocks 15,689 0xf8438a058c66ab33628249459d1f0bc8114c6550d3ddea45351a96cbf2999813 // nonce 7 // receiver 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY // Lifetime 12 //length: 140[2] //signatureVersion: 0x84 //sendPublicKey: 5CxW5DWQDpXi4cpACd62wzbPjbYrx4y67TZEmRXBcvmDTNaM[0x278117FC144C72340F67D0F2316E8386CEFFBF2B2428C9C51FEF7C597F1D426E] //sendPublicKeyType: 0x00 //signature: 0x7C9777CF14FE0E14E8AEF019695043BE2FD153A75FF3381F4CC4850755D537B1A9D7920E509EE2E4E1F244DAD670DC44EC3FC24388181E6465FDDA13D59AE700 //era: 0x6300 //nonce: 7[1] //tip: 0[1] //moduleIndex: 0x0400 //destPublicKey: 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY[0xD43593C715FDD31C61141ABD04A99FD6822C8558854CCDE39A5684E7A56DA27D] //amount: 123456[4] var privatKey = Utils.HexToByteArray( "0xf5e5767cf153319517630f226876b86c8160cc583bc013744c6bf255f5cc0ee5278117fc144c72340f67d0f2316e8386ceffbf2b2428c9c51fef7c597f1d426e"); var publicKey = Utils.HexToByteArray("0x278117fc144c72340f67d0f2316e8386ceffbf2b2428c9c51fef7c597f1d426e"); var account = Account.Build(KeyType.Ed25519, privatKey, publicKey); var bytes = new List <byte>(); bytes.AddRange(Utils.GetPublicKeyFrom("5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY")); CompactInteger amount = 123456; bytes.AddRange(amount.Encode()); var method = new Method(0x04, 0x00, bytes.ToArray()); var era = Era.Create(12, 15686); CompactInteger nonce = 7; CompactInteger tip = 0; var genesis = new Hash(); genesis.Create(Utils.HexToByteArray("0x9b443ea9cd42d9c3e0549757d029d28d03800631f9a9abf1d96d0c414b9aded9")); var startEra = new Hash(); startEra.Create( Utils.HexToByteArray( "0x4c4e0d1594e526c2392e7b6306f890fd0705085a5f83f9114caebb369bc1511f")); // FinalizedHead 15686 // mocked signature var signature = Utils.HexToByteArray( "0x7C9777CF14FE0E14E8AEF019695043BE2FD153A75FF3381F4CC4850755D537B1A9D7920E509EE2E4E1F244DAD670DC44EC3FC24388181E6465FDDA13D59AE700"); var uncheckedExtrinsic = new UnCheckedExtrinsic(true, account, method, era, nonce, tip, genesis, startEra); uncheckedExtrinsic.AddPayloadSignature(signature); var balanceTransferNode = "0x310284278117fc144c72340f67d0f2316e8386ceffbf2b2428c9c51fef7c597f1d426e007c9777cf14fe0e14e8aef019695043be2fd153a75ff3381f4cc4850755d537b1a9d7920e509ee2e4e1f244dad670dc44ec3fc24388181e6465fdda13d59ae70063001c000400d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d02890700"; //var uncheckedExtrinsicStr = Utils.Bytes2HexString(uncheckedExtrinsic.Encode()); Assert.AreEqual(Utils.HexToByteArray(balanceTransferNode), uncheckedExtrinsic.Encode()); var payload = uncheckedExtrinsic.GetPayload(_runtime).Encode(); //var payloadStr = Utils.Bytes2HexString(payload); if (payload.Length > 256) { payload = HashExtension.Blake2(payload, 256); } var simpleSign = Chaos.NaCl.Ed25519.Sign(payload, account.PrivateKey); //var simpleSignStr = Utils.Bytes2HexString(simpleSign); Assert.True(Chaos.NaCl.Ed25519.Verify(simpleSign, payload, publicKey)); Assert.True(Chaos.NaCl.Ed25519.Verify(signature, payload, publicKey)); var extrinsic = RequestGenerator.SubmitExtrinsic(true, account, method, era, nonce, tip, genesis, startEra, _runtime); Assert.True(Chaos.NaCl.Ed25519.Verify(extrinsic.Signature, extrinsic.GetPayload(_runtime).Encode(), publicKey)); Assert.True(Chaos.NaCl.Ed25519.Verify(signature, extrinsic.GetPayload(_runtime).Encode(), publicKey)); }
private CalendarSystem(CalendarOrdinal ordinal, string id, string name, YearMonthDayCalculator yearMonthDayCalculator, Era singleEra) : this(ordinal, id, name, yearMonthDayCalculator, new SingleEraCalculator(singleEra, yearMonthDayCalculator)) { }
/// <summary> /// Returns the primary name for the given era in this culture. /// </summary> /// <param name="era">The era to find the primary name of.</param> /// <returns>The primary name for the given era, or an empty string if the era name is not known.</returns> public string GetEraPrimaryName([NotNull] Era era) { Preconditions.CheckNotNull(era, nameof(era)); return(GetEraDescription(era).PrimaryName); }
/// <summary> /// Constructs an instance for the given era, year of era and month in the specified calendar. /// </summary> /// <param name="era">The era within which to create a year/month. Must be a valid era within the specified calendar.</param> /// <param name="yearOfEra">The year of era.</param> /// <param name="month">The month of year.</param> /// <param name="calendar">Calendar system in which to create the year/month.</param> /// <returns>The resulting year/month.</returns> /// <exception cref="ArgumentOutOfRangeException">The parameters do not form a valid year/month.</exception> public YearMonth(Era era, int yearOfEra, int month, CalendarSystem calendar) : this(Preconditions.CheckNotNull(calendar, nameof(calendar)).GetAbsoluteYear(yearOfEra, era), month, calendar) { }
/// <summary> /// Work out the year, based on fields of: /// - Year /// - YearOfEra /// - YearTwoDigits (implies YearOfEra) /// - Era /// /// If the year is specified, that trumps everything else - any other fields /// are just used for checking. /// /// If nothing is specified, the year of the template value is used. /// /// If just the era is specified, the year of the template value is used, /// and the specified era is checked against it. (Hopefully no-one will /// expect to get useful information from a format string with era but no year...) /// /// Otherwise, we have the year of era (possibly only two digits) and possibly the /// era. If the era isn't specified, take it from the template value. /// Finally, if we only have two digits, then use either the century of the template /// value or the previous century if the year-of-era is greater than TwoDigitYearMax... /// and if the template value isn't in the first century already. /// /// Phew. /// </summary> private ParseResult <LocalDate> DetermineYear(PatternFields usedFields, string text) { if (usedFields.HasAny(PatternFields.Year)) { if (Year > Calendar.MaxYear || Year < Calendar.MinYear) { return(ParseResult <LocalDate> .FieldValueOutOfRangePostParse(text, Year, 'u')); } if (usedFields.HasAny(PatternFields.Era) && Era != Calendar.GetEra(Year)) { return(ParseResult <LocalDate> .InconsistentValues(text, 'g', 'u')); } if (usedFields.HasAny(PatternFields.YearOfEra)) { int yearOfEraFromYear = Calendar.GetYearOfEra(Year); if (usedFields.HasAny(PatternFields.YearTwoDigits)) { // We're only checking the last two digits yearOfEraFromYear = yearOfEraFromYear % 100; } if (yearOfEraFromYear != YearOfEra) { return(ParseResult <LocalDate> .InconsistentValues(text, 'y', 'u')); } } return(null); } // Use the year from the template value, possibly checking the era. if (!usedFields.HasAny(PatternFields.YearOfEra)) { Year = TemplateValue.Year; return(usedFields.HasAny(PatternFields.Era) && Era != Calendar.GetEra(Year) ? ParseResult <LocalDate> .InconsistentValues(text, 'g', 'u') : null); } if (!usedFields.HasAny(PatternFields.Era)) { Era = TemplateValue.Era; } if (usedFields.HasAny(PatternFields.YearTwoDigits)) { int century = TemplateValue.YearOfEra / 100; if (YearOfEra > TwoDigitYearMax && century > 1) { century--; } YearOfEra += century * 100; } if (YearOfEra < Calendar.GetMinYearOfEra(Era) || YearOfEra > Calendar.GetMaxYearOfEra(Era)) { return(ParseResult <LocalDate> .YearOfEraOutOfRange(text, YearOfEra, Era, Calendar)); } Year = Calendar.GetAbsoluteYear(YearOfEra, Era); return(null); }
public void ResourcePresence(Era era) { Assert.NotNull(PatternResources.ResourceManager.GetString(era.ResourceIdentifier, CultureInfo.InvariantCulture), "Missing resource for " + era.ResourceIdentifier); }
/// <summary> /// Returns the "absolute year" (the one used throughout most of the API, without respect to eras) /// from a year-of-era and an era. /// </summary> /// <remarks> /// For example, in the Gregorian and Julian calendar systems, the BCE era starts at year 1, which is /// equivalent to an "absolute year" of 0 (then BCE year 2 has an absolute year of -1, and so on). The absolute /// year is the year that is used throughout the API; year-of-era is typically used primarily when formatting /// and parsing date values to and from text. /// </remarks> /// <param name="yearOfEra">The year within the era.</param> /// <param name="era">The era in which to consider the year</param> /// <returns>The absolute year represented by the specified year of era.</returns> /// <exception cref="ArgumentOutOfRangeException"><paramref name="yearOfEra"/> is out of the range of years for the given era.</exception> /// <exception cref="ArgumentException"><paramref name="era"/> is not an era used in this calendar.</exception> public int GetAbsoluteYear(int yearOfEra, [NotNull] Era era) { return(GetAbsoluteYear(yearOfEra, GetEraIndex(era))); }
static TextureResource() { mLoadedEra = Era.None; }
public static void Init(ConcertDbContext ctx) { return; //ctx.Database.EnsureCreated(); if (!ctx.Cc_Venues.Any()) { var venues = new Venue[] { new Venue("Casper Events Center", "Casper", "Wyoming"), new Venue("Utah State Fairpark Coliseum", "Salt Lake City", "Utah"), new Venue("Worcester Centrum", "Worcester", "Massachusetts"), new Venue("WPI (Pub? Gompei's Place?)", "Worcester", "Massachusetts"), new Venue("Worcester Artist Group", "Worcester", "Massachusetts"), new Venue("Heart of the Commonwealth Theater", "Worcester", "Massachusetts"), new Venue("Foxboro Stadium", "Foxboro", "Massachusetts"), new Venue("Great Woods Center for the Performing Arts", "Mansfield", "Massachusetts"), new Venue("Hatch Shell", "Boston", "Massachusetts"), new Venue("Mile High Stadium", "Denver", "Colorado"), new Venue("Fiddler's Green", "Denver", "Colorado"), new Venue("A&S Auditorium", "Laramie", "Wyoming"), new Venue("Wyoming Union", "Laramie", "Wyoming"), new Venue("Autzen Stadium", "Eugene", "Oregon"), new Venue("Montana St. U. Field House", "Bozeman", "Montana"), new Venue("Denver Coliseum", "Denver", "Colorado"), new Venue("Red Rocks", "Denver", "Colorado"), new Venue("McNichols Arena", "Denver", "Colorado"), new Venue("UW Fine Arts Concert Hall", "Laramie", "Wyoming"), new Venue("Folsom Field", "Boulder", "Colorado"), new Venue("Pepsi Center", "Denver", "Colorado"), new Venue("Frontier Park", "Cheyenne", "Wyoming"), new Venue("Fillmore", "Denver", "Colorado"), new Venue("Moda Center", "Portland", "Oregon"), }; foreach (var v in venues) { ctx.Cc_Venues.Add(v); } ctx.SaveChanges(); } if (!ctx.Cc_People.Any()) { var people = new Person[] { new Person("Bert", "Weidt"), new Person("Jason", "Marsden"), new Person("Marcus", "Bracke"), new Person("some Zeta Psis"), new Person("Rob", "Weitz"), new Person("other I2s"), new Person("Erin", "Fowler"), new Person("some other TKEs"), new Person("Vince", "Schutte"), new Person("Kim the waitress"), new Person("Tim the cook"), new Person("Sarah", "Frazer"), new Person("Brianna", "Johnson"), new Person("Krista", "Patten"), new Person("Jake", "Bendrick"), new Person("Scott", "Brown"), new Person("Jason", "Horsley"), new Person("Dan", "Leonard"), new Person("Vanessa", "Hastings"), new Person("Melissa", "Davidson"), new Person("Ryan", "Johnson"), new Person("lots from the CST"), new Person("Jeff", "Tollefson"), new Person("Zach", "Snyder"), new Person("others"), new Person("Kathy", "McManus"), new Person("Bernie", "McManus"), new Person("Kelly", "Milner"), new Person("Tom", "Morton"), new Person("Brian", "Fowler"), new Person("Jim", "Diehl"), new Person("Junior", "Diehl"), new Person("Junior Diehl's girlfriend"), new Person("Ron", "Roden"), new Person("Kari", "Keating"), new Person("Ryan", "Roden?"), new Person("Laura", "Gervais"), new Person("Jen", "Cousins"), new Person("Phil", "Ellsworth"), new Person("Chelsea", "Robirds"), new Person("Jenni", "Luckett"), }; foreach (var p in people) { ctx.Cc_People.Add(p); } ctx.SaveChanges(); } if (!ctx.Cc_Artists.Any()) { var artists = new Artist[] { new Artist("Bon Jovi"), new Artist("Skid Row"), new Artist("They Might Be Giants"), new Artist("Van Halen"), new Artist("Alice in Chains"), new Artist("Mighty Mighty Bosstones"), new Artist("Antfarm"), new Artist("Steve Miller Band"), new Artist("Kinks"), new Artist("Midnight Oil"), new Artist("Violent Femmes"), new Artist("Indigo Girls"), new Artist("Metallica"), new Artist("B-52s"), new Artist("U2"), new Artist("Primus"), new Artist("Dinosaur Jr."), new Artist("Arrested Development"), new Artist("Fishbone"), new Artist("Big Head Todd and the Monsters"), new Artist("Samples"), new Artist("Grateful Dead"), new Artist("Cracker"), new Artist("Phish"), new Artist("Beastie Boys"), new Artist("John Spencer Blues Explosion"), new Artist("R.E.M."), new Artist("Sonic Youth"), new Artist("Pearl Jam"), new Artist("Sarah McLaughlin"), new Artist("Sheryl Crow"), new Artist("Blues Traveler"), new Artist("Moody Blues"), new Artist("Def Leppard"), new Artist("Joan Jett"), new Artist("Bob Dylan"), new Artist("Dave Matthews Band"), new Artist("Styx"), new Artist("REO Speedwagon"), new Artist("Tom Petty"), new Artist("Staind"), new Artist("3 Doors Down"), new Artist("Wilco"), new Artist("Ed Harcourt"), new Artist("White Stripes"), new Artist("Pixies"), new Artist("Counting Crows"), new Artist("Goo Goo Dolls"), new Artist("Steve Winwood"), }; foreach (var a in artists) { ctx.Cc_Artists.Add(a); } ctx.SaveChanges(); } if (!ctx.Cc_Eras.Any()) { var eras = new Era[] { new Era("High School"), new Era("College WPI"), new Era("College Sheridan"), new Era("College UW"), new Era("Casper"), new Era("Cheyenne"), new Era("Forest Grove"), }; foreach (var e in eras) { ctx.Cc_Eras.Add(e); } ctx.SaveChanges(); } if (!ctx.Cc_Concerts.Any()) { var concerts = new Concert[] { MakeConcert(ctx, "High School", "9/1/1989", "Casper Events Center", "New Jersey Tour", ""), MakeConcert(ctx, "High School", "8/10/1990", "Utah State Fairpark Coliseum", "", ""), MakeConcert(ctx, "College UW", "6/18/1994", "Autzen Stadium", "", ""), MakeConcert(ctx, "College UW", "6/19/1994", "Autzen Stadium", "", ""), MakeConcert(ctx, "Forest Grove", "8/12/2014", "Moda Center", "", ""), }; foreach (var c in concerts) { ctx.Cc_Concerts.Add(c); } ctx.SaveChanges(); ctx.Cc_ConcertArtists.Add(new ConcertArtist(concerts[0], ctx.Cc_Artists.First(a => a.Name == "Bon Jovi"))); ctx.Cc_ConcertArtists.Add(new ConcertArtist(concerts[0], ctx.Cc_Artists.First(a => a.Name == "Skid Row"))); ctx.Cc_ConcertArtists.Add(new ConcertArtist(concerts[1], ctx.Cc_Artists.First(a => a.Name == "They Might Be Giants"))); ctx.Cc_ConcertArtists.Add(new ConcertArtist(concerts[2], ctx.Cc_Artists.First(a => a.Name == "Grateful Dead"))); ctx.Cc_ConcertArtists.Add(new ConcertArtist(concerts[2], ctx.Cc_Artists.First(a => a.Name == "Cracker"))); ctx.Cc_ConcertArtists.Add(new ConcertArtist(concerts[3], ctx.Cc_Artists.First(a => a.Name == "Grateful Dead"))); ctx.Cc_ConcertArtists.Add(new ConcertArtist(concerts[3], ctx.Cc_Artists.First(a => a.Name == "Cracker"))); ctx.Cc_ConcertArtists.Add(new ConcertArtist(concerts[4], ctx.Cc_Artists.First(a => a.Name == "Tom Petty"))); ctx.Cc_ConcertArtists.Add(new ConcertArtist(concerts[4], ctx.Cc_Artists.First(a => a.Name == "Steve Winwood"))); ctx.Cc_ConcertPeople.Add(new ConcertPerson(concerts[0], ctx.Cc_People.First(p => p.FirstName == "Bert"))); ctx.Cc_ConcertPeople.Add(new ConcertPerson(concerts[1], ctx.Cc_People.First(p => p.FirstName == "Jason"))); ctx.Cc_ConcertPeople.Add(new ConcertPerson(concerts[2], ctx.Cc_People.First(p => p.FirstName == "Kim the waitress"))); ctx.Cc_ConcertPeople.Add(new ConcertPerson(concerts[2], ctx.Cc_People.First(p => p.FirstName == "Tim the cook"))); ctx.Cc_ConcertPeople.Add(new ConcertPerson(concerts[3], ctx.Cc_People.First(p => p.FirstName == "Kim the waitress"))); ctx.Cc_ConcertPeople.Add(new ConcertPerson(concerts[3], ctx.Cc_People.First(p => p.FirstName == "Tim the cook"))); ctx.Cc_ConcertPeople.Add(new ConcertPerson(concerts[4], ctx.Cc_People.First(p => p.FirstName == "Jenni"))); ctx.SaveChanges(); } }
internal static UnCheckedExtrinsic SubmitExtrinsic(bool signed, Account account, Method method, Era era, uint nonce, uint tip, Hash genesis, Hash startEra) { var uncheckedExtrinsic = new UnCheckedExtrinsic(signed, account, method, era, nonce, tip, genesis, startEra); if (!signed) { return(uncheckedExtrinsic); } var payload = uncheckedExtrinsic.GetPayload().Encode(); /// Payloads longer than 256 bytes are going to be `blake2_256`-hashed. if (payload.Length > 256) { payload = HashExtension.Blake2(payload, 256); } byte[] signature; switch (account.KeyType) { case KeyType.SR25519: signature = Sr25519v091.SignSimple(account.PublicKey, account.PrivateKey, payload); break; case KeyType.ED25519: signature = Ed25519.Sign(payload, account.PrivateKey); break; default: throw new Exception($"Unknown key type found '{account.KeyType}'."); } uncheckedExtrinsic.AddPayloadSignature(signature); return(uncheckedExtrinsic); }
internal static ParseResult <T> YearOfEraOutOfRange(string text, int value, Era era, CalendarSystem calendar) => ForInvalidValuePostParse(text, Messages.Parse_YearOfEraOutOfRange, value, era.Name, calendar.Name);
public void BalanceTransferMockedTest2() { var _runtime = new RuntimeVersion { SpecVersion = 1, TransactionVersion = 1 }; Constants.AddressVersion = 0; //[ // { // "signature": { // "signer": "5CxW5DWQDpXi4cpACd62wzbPjbYrx4y67TZEmRXBcvmDTNaM", // "signature": { // "Ed25519": "0x97176876e9cb26b2449855a332efee478768b31e215ed025ce57dd8e6bdfa63df3adfcf29091eb53c326173a5aad23661e074d132ae804bbd91126cd19093302" // }, // "era": { // "MortalEra": "0x7500" // }, // "nonce": 6, // "tip": 1234 // }, // "method": { // "callIndex": "0x0400", // "args": { // "dest": "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY", // "value": 7654321 // } // } // } //] byte publicKeyType = 0x00; var publicKey = Utils.GetPublicKeyFrom("5CxW5DWQDpXi4cpACd62wzbPjbYrx4y67TZEmRXBcvmDTNaM"); CompactInteger nonce = 6; byte moduleIndex = 0x04; byte callIndex = 0x00; var destPublicKey = Utils.GetPublicKeyFrom("5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY"); CompactInteger amount = 7654321; var parameters = destPublicKey.Concat(amount.Encode()).ToArray(); var genesisHash = Utils.HexToByteArray("0x9b443ea9cd42d9c3e0549757d029d28d03800631f9a9abf1d96d0c414b9aded9"); var currentBlockHash = Utils.HexToByteArray("0xcfa2f9c52f94bc50658735d0f18f72590c981fdc15657636a99c437553c53253"); ; ulong currentBlockNumber = 7; CompactInteger tip = 1234; // mocked signature var signature = Utils.HexToByteArray( "0x97176876e9cb26b2449855a332efee478768b31e215ed025ce57dd8e6bdfa63df3adfcf29091eb53c326173a5aad23661e074d132ae804bbd91126cd19093302"); var method = new Method(moduleIndex, callIndex, parameters); var era = new Era(Constants.ExtrinsicEraPeriodDefault, currentBlockNumber, currentBlockNumber == 0 ? true : false); var genesis = new Hash(); genesis.Create(genesisHash); var currentBlock = new Hash(); currentBlock.Create(currentBlockHash); var uncheckedExtrinsic = new UnCheckedExtrinsic(true, Account.Build(KeyType.Ed25519, new byte[0], publicKey), method, era, nonce, tip, genesis, currentBlock); var balanceTransfer = "0x350284278117fc144c72340f67d0f2316e8386ceffbf2b2428c9c51fef7c597f1d426e0097176876e9cb26b2449855a332efee478768b31e215ed025ce57dd8e6bdfa63df3adfcf29091eb53c326173a5aad23661e074d132ae804bbd91126cd1909330275001849130400d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27dc62ed301"; uncheckedExtrinsic.AddPayloadSignature(signature); Assert.AreEqual(Utils.HexToByteArray(balanceTransfer), uncheckedExtrinsic.Encode()); var _ = uncheckedExtrinsic.GetPayload(_runtime).Encode(); }
public void BalanceTransferAccountTest() { var _runtime = new RuntimeVersion { SpecVersion = 259, TransactionVersion = 1 }; Constants.AddressVersion = 1; // 797447 --> 0xe7b99ee484e6369dd3c2a66d6306bffde5048ddf2090e990faae83e66f5275f4 //var accountZurich = Account.Build( // KeyType.Ed25519, // Utils.HexToByteArray( // "0xf5e5767cf153319517630f226876b86c8160cc583bc013744c6bf255f5cc0ee5278117fc144c72340f67d0f2316e8386ceffbf2b2428c9c51fef7c597f1d426e"), // Utils.GetPublicKeyFrom("5CxW5DWQDpXi4cpACd62wzbPjbYrx4y67TZEmRXBcvmDTNaM")); var privatKey = Utils.HexToByteArray( "0xf5e5767cf153319517630f226876b86c8160cc583bc013744c6bf255f5cc0ee5278117fc144c72340f67d0f2316e8386ceffbf2b2428c9c51fef7c597f1d426e"); var publicKey = Utils.HexToByteArray("0x278117fc144c72340f67d0f2316e8386ceffbf2b2428c9c51fef7c597f1d426e"); //var receiverPublicKey = // Utils.Bytes2HexString(Utils.GetPublicKeyFrom("5DotMog6fcsVhMPqniyopz5sEJ5SMhHpz7ymgubr56gDxXwH")); var referenceExtrinsic = "0x450284ff278117fc144c72340f67d0f2316e8386ceffbf2b2428c9c51fef7c597f1d426e00d6a14aac2c0da8330f67a04f9ff4154b3c31d02529eaf112a23d59f5a5e1d1766efbb7f4dd56e6ed84a543de94342bdec8c80bdac62373d22387ea980a42270f36000c000600ff4d2b23d27e1f6e3733d7ebf3dc04f3d5d0010cd18038055f9bbbab48f460b61e0b00b04e2bde6f"; // "0x450284FF278117FC144C72340F67D0F2316E8386CEFFBF2B2428C9C51FEF7C597F1D426E00D6A14AAC2C0DA8330F67A04F9FF4154B3C31D02529EAF112A23D59F5A5E1D1766EFBB7F4DD56E6ED84A543DE94342BDEC8C80BDAC62373D22387EA980A42270F35000C000600FF4D2B23D27E1F6E3733D7EBF3DC04F3D5D0010CD18038055F9BBBAB48F460B61E0B00B04E2BDE6F" // "0x450284FF278117FC144C72340F67D0F2316E8386CEFFBF2B2428C9C51FEF7C597F1D426E00D6A14AAC2C0DA8330F67A04F9FF4154B3C31D02529EAF112A23D59F5A5E1D1766EFBB7F4DD56E6ED84A543DE94342BDEC8C80BDAC62373D22387EA980A42270F36000C000600FF4D2B23D27E1F6E3733D7EBF3DC04F3D5D0010CD18038055F9BBBAB48F460B61E0B00B04E2BDE6F" //var bytes = new List<byte>(); //bytes.Add(0xFF); //bytes.AddRange(Utils.GetPublicKeyFrom("5DotMog6fcsVhMPqniyopz5sEJ5SMhHpz7ymgubr56gDxXwH")); //CompactInteger amount = 123000000000000; //bytes.AddRange(amount.Encode()); //byte[] parameters = bytes.ToArray(); ////var method = new Method(0x06, 0x00, parameters); var accountId = new AccountId(); accountId.Create(Utils.GetPublicKeyFrom("5DotMog6fcsVhMPqniyopz5sEJ5SMhHpz7ymgubr56gDxXwH")); var balance = new Balance(); balance.Create(123000000000000); var extrinsic = ExtrinsicCall.BalanceTransfer(accountId, balance); var method = new Method(0x06, 0x00, extrinsic.Encode()); //var era = Era.Create(64, 797443); var era = new Era(128, 3, false); CompactInteger nonce = 3; CompactInteger tip = 0; var genesis = new Hash(); genesis.Create(Utils.HexToByteArray("0x778c4bb53621114939206c9c9874c5fa1da38d2e14293d053a0b8dd6125b4042")); var startEra = new Hash(); startEra.Create(Utils.HexToByteArray("0xd5a0f4467c6c8885b531f12028789e83c2e473b8d2d44edbc09811fd2f903f1f")); var uncheckedExtrinsic = new UnCheckedExtrinsic(true , Account.Build(KeyType.Ed25519, privatKey, publicKey) , method , era , nonce , tip , genesis , startEra // currentblock ); //uncheckedExtrinsic.AddPayloadSignature(Utils.HexToByteArray("0xd6a14aac2c0da8330f67a04f9ff4154b3c31d02529eaf112a23d59f5a5e1d1766efbb7f4dd56e6ed84a543de94342bdec8c80bdac62373d22387ea980a42270f")); var payload = uncheckedExtrinsic.GetPayload(_runtime).Encode(); /// Payloads longer than 256 bytes are going to be `blake2_256`-hashed. if (payload.Length > 256) { payload = HashExtension.Blake2(payload, 256); } byte[] signature; signature = Chaos.NaCl.Ed25519.Sign(payload, privatKey); //var signatureStr = Utils.Bytes2HexString(signature); uncheckedExtrinsic.AddPayloadSignature(signature); var uncheckedExtrinsicStr = Utils.Bytes2HexString(uncheckedExtrinsic.Encode()); Assert.AreEqual(referenceExtrinsic, uncheckedExtrinsicStr.ToLower()); //{ // isSigned: true, // method: // { // args:[ // 5DotMog6fcsVhMPqniyopz5sEJ5SMhHpz7ymgubr56gDxXwH, // 123.0000 mUnit // ], // method: transfer, // section: balances // }, // era: // { // MortalEra: // { // period: 128, // phase: 3 // } // }, // nonce: 3, // signature: 0xd6a14aac2c0da8330f67a04f9ff4154b3c31d02529eaf112a23d59f5a5e1d1766efbb7f4dd56e6ed84a543de94342bdec8c80bdac62373d22387ea980a42270f, // signer: 5CxW5DWQDpXi4cpACd62wzbPjbYrx4y67TZEmRXBcvmDTNaM, // tip: 0 //} //{ // "Signed": true, // "TransactionVersion": 4, // "Account": { // "KeyType": 0, // "Address": "5CxW5DWQDpXi4cpACd62wzbPjbYrx4y67TZEmRXBcvmDTNaM", // "PublicKey": "J4EX/BRMcjQPZ9DyMW6Dhs7/vyskKMnFH+98WX8dQm4=" // }, // "Era": { // "IsImmortal": false, // "Period": 128, // "Phase": 3 // }, // "Nonce": { // "Value": 3 // }, // "Tip": { // "Value": 0 // }, // "Method": { // "ModuleName": "Balances", // "ModuleIndex": 6, // "CallName": "transfer", // "CallIndex": 0, // "Arguments": [ // { // "Name": "dest", // "Type": "<T::Lookup as StaticLookup>::Source", // "Value": "5DotMog6fcsVhMPqniyopz5sEJ5SMhHpz7ymgubr56gDxXwH" // }, // { // "Name": "value", // "Type": "Compact<T::Balance>", // "Value": { // "Value": 123000000000000 // } // } // ], // "Parameters": "/00rI9J+H243M9fr89wE89XQAQzRgDgFX5u7q0j0YLYeCwCwTivebw==" // }, // "Signature": "1qFKrCwNqDMPZ6BPn/QVSzwx0CUp6vESoj1Z9aXh0XZu+7f03Vbm7YSlQ96UNCveyMgL2sYjc9Ijh+qYCkInDw==" //} }
/// <summary> /// 時代検索からの人を見つかる /// </summary> /// <param name="era">時代</param> /// <returns></returns> public static Person[] EraSelectPersons(Era era) { Person[] persons; Person p; switch (era) { case Era.江戸: persons = new Person[2]; persons[0] = new Person(); p = persons[0]; p.name = "坂本竜馬"; p.nameKana = "さかもとりょうま"; p.from = "土佐"; p.fromKana = "とさ"; p.fromAreaGroup = AreaGroup.四国; p.ID = 0; p.job = "武士"; p.birthYear = 1836; p.deathYear = 1867; p.profile = "土佐の武士だぜ"; p.sex = Sex.Male; p.era = Era.江戸; persons[1] = new Person(); p = persons[1]; p.name = "西郷隆盛"; p.nameKana = "さいごうたかもり"; p.from = "薩摩"; p.fromKana = "さつま"; p.fromAreaGroup = AreaGroup.九州; p.ID = 0; p.job = "武士"; p.birthYear = 1828; p.deathYear = 1877; p.profile = "薩摩の武士だぜ"; p.sex = Sex.Male; p.era = Era.江戸; return persons; default: Random r = new Random(); persons = new Person[5]; for (int i = 0; i < 5; i++) { persons[i] = new Person(); p = persons[i]; p.name = "さんぷる" + "第" + r.Next(10, 100).ToString() +"号"; p.nameKana = "さんぷる"; p.from = "香川"; p.fromKana = "かがわ"; p.fromAreaGroup = AreaGroup.四国; p.ID = 2; p.job = "さんぷる"; p.birthYear = 2011; p.deathYear = 2011; p.profile = "さんぷる"; p.sex = Sex.Male; p.era = Era.平成; } return persons; } }
public void AddToEras(Era era) { base.AddObject("Eras", era); }
/// <summary> /// Returns the minimum valid year-of-era in the given era. /// </summary> /// <param name="era">The era in which to find the greatest year</param> /// <returns>The minimum valid year in the given eraera.</returns> /// <exception cref="ArgumentException"><paramref name="era"/> is not an era used in this calendar.</exception> public int GetMinYearOfEra([NotNull] Era era) { return(GetMinYearOfEra(GetEraIndex(era))); }
private EraDescription GetEraDescription(Era era) => eraDescriptions.GetOrAdd(era, key => EraDescription.ForEra(key, CultureInfo));
/// <summary> /// Returns a local instant, at the start of the day formed from the given year of era, month, day, and era arguments. /// The set of given values must refer to a valid datetime. /// </summary> /// <param name="era">Era to use. This must be one of the eras used in this calendar</param> /// <param name="yearOfEra">Year of era to use</param> /// <param name="monthOfYear">Month to use</param> /// <param name="dayOfMonth">Day of month to use</param> /// <exception cref="ArgumentException"><paramref name="era"/> is not an era used in this calendar.</exception> /// <exception cref="ArgumentOutOfRangeException">The year of era, month of year and day of month values don't /// form a valid date.</exception> /// <returns>A <see cref="LocalInstant"/> with the given year, month, day and era.</returns> internal LocalInstant GetLocalInstant([NotNull] Era era, int yearOfEra, int monthOfYear, int dayOfMonth) { return(yearMonthDayCalculator.GetLocalInstant(era, yearOfEra, monthOfYear, dayOfMonth)); }
/// <summary> /// Constructs an instance for the given era, year of era and month in the ISO calendar. /// </summary> /// <param name="era">The era within which to create a year/month. Must be a valid era within the ISO calendar.</param> /// <param name="yearOfEra">The year of era.</param> /// <param name="month">The month of year.</param> /// <returns>The resulting year/month.</returns> /// <exception cref="ArgumentOutOfRangeException">The parameters do not form a valid year/month.</exception> public YearMonth(Era era, int yearOfEra, int month) : this(era, yearOfEra, month, CalendarSystem.Iso) { }
private ParseResult <LocalDate> DetermineYear(PatternFields usedFields, string text) { int yearFromEra = 0; if (IsFieldUsed(usedFields, PatternFields.YearOfEra)) { // Odd to have a year-of-era without era, but it's valid... if (!IsFieldUsed(usedFields, PatternFields.Era)) { Era = Calendar.GetEra(templateValue.YearMonthDay); } // Find the absolute year from the year-of-era and era if (YearOfEra < Calendar.GetMinYearOfEra(Era) || YearOfEra > Calendar.GetMaxYearOfEra(Era)) { return(ParseResult <LocalDate> .YearOfEraOutOfRange(text, YearOfEra, Era, Calendar)); } yearFromEra = Calendar.GetAbsoluteYear(YearOfEra, Era); } // Note: we can't have YearTwoDigits without Year, hence there are only 6 options here rather than 8. switch (usedFields & (PatternFields.Year | PatternFields.YearOfEra | PatternFields.YearTwoDigits)) { case PatternFields.Year: // Fine, we'll just use the Year value we've been provided break; case PatternFields.Year | PatternFields.YearTwoDigits: Year = GetAbsoluteYearFromTwoDigits(templateValue.Year, Year); break; case PatternFields.YearOfEra: Year = yearFromEra; break; case PatternFields.YearOfEra | PatternFields.Year | PatternFields.YearTwoDigits: // We've been given a year of era, but only a two digit year. The year of era // takes precedence, so we just check that the two digits are correct. // This is a pretty bizarre situation... if ((Math.Abs(yearFromEra) % 100) != Year) { return(ParseResult <LocalDate> .InconsistentValues(text, 'y', 'Y')); } Year = yearFromEra; break; case PatternFields.YearOfEra | PatternFields.Year: if (Year != yearFromEra) { return(ParseResult <LocalDate> .InconsistentValues(text, 'y', 'Y')); } Year = yearFromEra; break; case 0: Year = templateValue.Year; break; // No default: it would be impossible. } if (Year > Calendar.MaxYear || Year < Calendar.MinYear) { // The field can't be YearOfEra, as we've already validated that earlier. return(ParseResult <LocalDate> .FieldValueOutOfRangePostParse(text, Year, 'y')); } return(null); }
/// <summary> /// Returns the names for the given era in this culture. /// </summary> /// <param name="era">The era to find the names of.</param> /// <returns>A read-only list of names for the given era, or an empty list if /// the era is not known in this culture.</returns> public IList <string> GetEraNames([NotNull] Era era) { Preconditions.CheckNotNull(era, nameof(era)); return(GetEraDescription(era).AllNames); }
/// <summary> /// Returns the minimum valid year-of-era in the given era. /// </summary> /// <remarks>Note that depending on the calendar system, it's possible that only /// part of the returned year falls within the given era. It is also possible that /// the returned value represents the latest year of the era rather than the earliest /// year. (See the BC era in the Gregorian calendar, for example.)</remarks> /// <param name="era">The era in which to find the greatest year</param> /// <returns>The minimum valid year in the given eraera.</returns> /// <exception cref="ArgumentException"><paramref name="era"/> is not an era used in this calendar.</exception> public int GetMinYearOfEra([NotNull] Era era) => eraCalculator.GetMinYearOfEra(era);
public override int GetHashCode() { return(Era.GetHashCode()); }
public EraPrinter(Era era, World world) { _era = era; _world = world; }
/// <summary> /// Returns the "absolute year" (the one used throughout most of the API, without respect to eras) /// from a year-of-era and an era. /// </summary> /// <remarks> /// For example, in the Gregorian and Julian calendar systems, the BCE era starts at year 1, which is /// equivalent to an "absolute year" of 0 (then BCE year 2 has an absolute year of -1, and so on). The absolute /// year is the year that is used throughout the API; year-of-era is typically used primarily when formatting /// and parsing date values to and from text. /// </remarks> /// <param name="yearOfEra">The year within the era.</param> /// <param name="era">The era in which to consider the year</param> /// <returns>The absolute year represented by the specified year of era.</returns> /// <exception cref="ArgumentOutOfRangeException"><paramref name="yearOfEra"/> is out of the range of years for the given era.</exception> /// <exception cref="ArgumentException"><paramref name="era"/> is not an era used in this calendar.</exception> public int GetAbsoluteYear(int yearOfEra, [NotNull] Era era) => eraCalculator.GetAbsoluteYear(yearOfEra, era);
public void DmogCreateMortalAliceTest1() { var _runtime = new RuntimeVersion { SpecVersion = 1, TransactionVersion = 1 }; Constants.AddressVersion = 0; //length: 104[2] //signatureVersion: 0x84 //sendPublicKey: 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY[0xD43593C715FDD31C61141ABD04A99FD6822C8558854CCDE39A5684E7A56DA27D] //sendPublicKeyType: 0x01 //signature: 0x448082984004E4DC7CB964EBA2EB7201C5686D80E666944E2AA01C2BE95EAA5BE9D547DA63616A82631E87E4078A647FBD07920F97C8EA0993207C0FBDD2A98E //era: 0x1503 //nonce: 5[1] //tip: 0[1] //moduleIndex: 0x0602 //[ // { // isSigned: true, // method: // { // args:[], // method: createMogwai, // section: dmog // }, // era: // { // MortalEra: // { // period: 64, // phase: 49 // } // }, // nonce: 5, // signature: 0x448082984004e4dc7cb964eba2eb7201c5686d80e666944e2aa01c2be95eaa5be9d547da63616a82631e87e4078a647fbd07920f97c8ea0993207c0fbdd2a98e, // signer: 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY, // tip: 0 // } //] //0xcd36f4e312289c56a3d9a464cc9b555e4f3634cd91409a7e05de58f37f9e0289 // [{ "signature":{ "signer":"5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY","signature":{ "Sr25519":"0x448082984004e4dc7cb964eba2eb7201c5686d80e666944e2aa01c2be95eaa5be9d547da63616a82631e87e4078a647fbd07920f97c8ea0993207c0fbdd2a98e"},"era":{ "MortalEra":"0x1503"},"nonce":5,"tip":0},"method":{ "callIndex":"0x0602","args":{ } } }] // { block: { header: { parentHash: 0xaad3e1fd9da755971ccb9e07bd7cd4c335dffc236fd03a870178c211ce15ea06, number: 1587, stateRoot: 0x90469b87f5e818c5c8496a188997a057d14948fb421c62bb64eea52c442bde0f, extrinsicsRoot: 0x9882c28bc845ac3a17dcb244a5f1eaaf470ce43da24693cf9ef2fe1352da319f, digest: { logs:[{ "PreRuntime":[1634891105,"0x4457e60f00000000"]}, { "Seal":[1634891105,"0x42f94aef7c67e271aab99da484f83dda673cf5ecc0fc1a796aa2a06d0350d67afbf398fcf936d1574ccd89fef9397d09070921238e7c1f5742db795316084889"]}]} }, extrinsics:[{ "signature":{ "signer":"5C4hrfjw9DjXZTzV3MwzrrAr9P1MJhSrvWGWqi1eSuyUpnhM","signature":{ "Ed25519":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"},"era":{ "ImmortalEra":"0x00"},"nonce":0,"tip":0},"method":{ "callIndex":"0x0200","args":{ "now":1600523160000} } }]}, justification: 0x} var privatKey = Utils.HexToByteArray( "0x33A6F3093F158A7109F679410BEF1A0C54168145E0CECB4DF006C1C2FFFB1F09925A225D97AA00682D6A59B95B18780C10D7032336E88F3442B42361F4A66011"); //byte publicKeyType = 0x01; var publicKey = Utils.GetPublicKeyFrom("5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY"); // Alice CompactInteger nonce = 5; byte moduleIndex = 0x06; byte callIndex = 0x02; var parameters = new byte[0]; var genesisHash = Utils.HexToByteArray("0x9b443ea9cd42d9c3e0549757d029d28d03800631f9a9abf1d96d0c414b9aded9"); var currentBlockHash = Utils.HexToByteArray("0xdce5a3ddc16196c00041d716e0cca8a8bf88b8aeebdb2714778fcdc0fe20079f"); ; var era = new Era(64, 49, false); //var blockHash = era.EraStart(1587); CompactInteger tip = 0; // mocked signature var signature = Utils.HexToByteArray( "0x448082984004e4dc7cb964eba2eb7201c5686d80e666944e2aa01c2be95eaa5be9d547da63616a82631e87e4078a647fbd07920f97c8ea0993207c0fbdd2a98e"); var method = new Method(moduleIndex, callIndex, parameters); var genesis = new Hash(); genesis.Create(genesisHash); var currentBlock = new Hash(); currentBlock.Create(currentBlockHash); var uncheckedExtrinsic = new UnCheckedExtrinsic(true, Account.Build(KeyType.Sr25519, new byte[0], publicKey), method, era, nonce, tip, genesis, currentBlock); var dmogCreateMortal = "0xa10184d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d01448082984004e4dc7cb964eba2eb7201c5686d80e666944e2aa01c2be95eaa5be9d547da63616a82631e87e4078a647fbd07920f97c8ea0993207c0fbdd2a98e150314000602"; uncheckedExtrinsic.AddPayloadSignature(signature); //var uncheckedExtrinsicStr = Utils.Bytes2HexString(uncheckedExtrinsic.Encode()); Assert.AreEqual(Utils.HexToByteArray(dmogCreateMortal), uncheckedExtrinsic.Encode()); var payload = uncheckedExtrinsic.GetPayload(_runtime).Encode(); //var payloadStr = Utils.Bytes2HexString(payload); if (payload.Length > 256) { payload = HashExtension.Blake2(payload, 256); } var simpleSign = Sr25519v091.SignSimple(publicKey, privatKey, payload); //var simpleSignStr = Utils.Bytes2HexString(simpleSign); Assert.True(Sr25519v091.Verify(simpleSign, publicKey, payload)); Assert.True(Sr25519v091.Verify(signature, publicKey, payload)); }
public void EraBeginTest() { var era = new Era(64, 49, false); Assert.AreEqual(1585, era.EraStart(1587)); }
public PartEra(Era era, int yearStart, int yearEnd) { this.era = era; this.yearStart = yearStart; this.yearEnd = yearEnd; }
public EraPrinter(Era era) { Era = era; }
/// <summary> /// Constructs an instance for the given era, year of era, month and day in the ISO calendar. /// </summary> /// <param name="era">The era within which to create a date. Must be a valid era within the ISO calendar.</param> /// <param name="yearOfEra">The year of era.</param> /// <param name="month">The month of year.</param> /// <param name="day">The day of month.</param> /// <returns>The resulting date.</returns> /// <exception cref="ArgumentOutOfRangeException">The parameters do not form a valid date.</exception> public LocalDate([NotNull] Era era, int yearOfEra, int month, int day) : this(era, yearOfEra, month, day, CalendarSystem.Iso) { }
public override void Update() { //次のスライド if (beforeKeyboardState.IsKeyUp(Microsoft.Xna.Framework.Input.Keys.Right) && nowKeyboardState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Right) &&(int)selectedEra<15) { for (int i = 0; i < slideRectangles.Length; i++) { slideRectangles[i].X -= 600; personList[i].rectangle.X -= 600; } selectedEra = selectedEra +1; } //前のスライド if (beforeKeyboardState.IsKeyUp(Microsoft.Xna.Framework.Input.Keys.Left) && nowKeyboardState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Left) &&(int)selectedEra>0) { for (int i = 0; i < slideRectangles.Length; i++) { slideRectangles[i].X += 600; personList[i].rectangle.X += 600; } selectedEra = selectedEra - 1; } //一覧を更新 personList[(int)selectedEra].Update(); //フェードアウト開始 if (beforeKeyboardState.IsKeyUp(Microsoft.Xna.Framework.Input.Keys.Enter) && nowKeyboardState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Enter)) { fadeOut.isEnabled = true; //注目している偉人を変更する mainGame.person = personList[(int)selectedEra].items[personList[(int)selectedEra].selectedIndex]; //人が切り替わるためもう一度コンテンツをロードする mainGame.statusMains[(int)Status.Profile].LoadContent(); } //次の状態(Profile)に移る if (fadeOut.count >= 0.9f) //ちょっとごまかしてみる(;^ω^) { mainGame.status = Status.Profile; } base.Update(); }
/// <summary> /// Method adds an era to the GregorianEraHandler instance. /// </summary> /// <param name="nr">The integer number of the era. /// </param> /// <param name="rd_start">The fixed day number defining the /// first day of the era. /// </param> /// <param name="rd_end">The fixed day number that defines the /// last day of the era. /// </param> public void appendEra(int nr, int rd_start, int rd_end) { Era era = new Era(nr, rd_start, rd_end); _Eras[(System.Object)nr] = era; }
/// <summary> /// Constructs an instance for the given era, year of era, month and day in the specified calendar. /// </summary> /// <param name="era">The era within which to create a date. Must be a valid era within the specified calendar.</param> /// <param name="yearOfEra">The year of era.</param> /// <param name="month">The month of year.</param> /// <param name="day">The day of month.</param> /// <param name="calendar">Calendar system in which to create the date.</param> /// <returns>The resulting date.</returns> /// <exception cref="ArgumentOutOfRangeException">The parameters do not form a valid date.</exception> public LocalDate([NotNull] Era era, int yearOfEra, int month, int day, [NotNull] CalendarSystem calendar) : this(Preconditions.CheckNotNull(calendar, nameof(calendar)).GetAbsoluteYear(yearOfEra, era), month, day, calendar) { }
private static string FormatLevelData(UnitType unitType, Era era) { string data = ""; data += String.Format("{0,-20}", unitType.ToString()); data += " "; data += String.Format("{0,-20}", era.ToString()); data += " "; data += String.Format("{0,5}", mUnitLevels[(int) unitType, (int) era]); data += " "; data += String.Format("{0,5}", mUnitExperience[(int) unitType, (int) era]); return data; }
public SpecificDate(Era era, long year, int?month = null, int?day = null, int?hour = null) { _dateInfo = new PartialDateInfo(era, year, month, day, hour); }
/// <summary> /// Returns the minimum valid year-of-era in the given era. /// </summary> /// <remarks>Note that depending on the calendar system, it's possible that only /// part of the returned year falls within the given era. It is also possible that /// the returned value represents the latest year of the era rather than the earliest /// year. (See the BC era in the Gregorian calendar, for example.)</remarks> /// <param name="era">The era in which to find the greatest year</param> /// <returns>The minimum valid year in the given era.</returns> /// <exception cref="ArgumentException"><paramref name="era"/> is not an era used in this calendar.</exception> public int GetMinYearOfEra(Era era) => eraCalculator.GetMinYearOfEra(era);
public void appendEra (int nr, int rd_start, int rd_end) { Era era = new Era (nr, rd_start, rd_end); _Eras [nr] = era; }
public static Era CreateEra(int eraId, string name, string dates) { Era era = new Era(); era.EraId = eraId; era.Name = name; era.Dates = dates; return era; }