public ConstellationInfo Info() { ConstellationInfo info; if (((int)Global.AppState.State) < (int)ApplicationState.Running) { info = new ConstellationInfo { State = Global.AppState.State } } ; else { var network = new ConstellationInfo.Network( Global.StellarNetwork.Network.NetworkPassphrase, Global.StellarNetwork.Horizon ); var assets = Global.Constellation.Assets.Select(a => ConstellationInfo.Asset.FromAssetSettings(a)).ToArray(); info = new ConstellationInfo { State = Global.AppState.State, Vault = ((KeyPair)Global.Constellation.Vault).AccountId, Auditors = Global.Constellation.Auditors.Select(a => ((KeyPair)a).AccountId).ToArray(), MinAccountBalance = Global.Constellation.MinAccountBalance, MinAllowedLotSize = Global.Constellation.MinAllowedLotSize, StellarNetwork = network, Assets = assets, RequestRateLimits = Global.Constellation.RequestRateLimits }; } return(info); }
public void SendTarget(Mobile m) { m.SendLocalizedMessage(1158494); // Which telescope do you wish to create the star chart from? m.BeginTarget(10, false, TargetFlags.None, (from, targeted) => { if (!Deleted && IsChildOf(from.Backpack) && targeted is PersonalTelescope) { PersonalTelescope tele = (PersonalTelescope)targeted; ConstellationInfo constellation = AstronomySystem.GetConstellation(tele.TimeCoordinate, tele.RA, tele.DEC); if (constellation != null) { from.SendLocalizedMessage(1158496); // You successfully map the time-coordinate of the constellation. ChartedBy = from; ChartedOn = DateTime.Now; Constellation = constellation.Identifier; from.PlaySound(0x249); } else { from.SendLocalizedMessage(1158495); // There is nothing to chart at these coordinates at this time. } } }); }
/// <summary> /// Populates the page with content passed during navigation. Any saved state is also /// provided when recreating a page from a prior session. /// </summary> /// <param name="navigationParameter">The parameter value passed to /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested. /// </param> /// <param name="pageState">A dictionary of state preserved by this page during an earlier /// session. This will be null the first time a page is visited.</param> protected override async void LoadState(Object navigationParameter, Dictionary <String, Object> pageState) { _baby = await BabyManager.Load(); if (string.IsNullOrEmpty(_baby.Name)) { this.pageTitle.Text = "请输入宝宝信息"; return; } else { ConstellationType type = GetConstellationType(_baby.Birthday); string constellation = GetConstellationName(type); string title = string.Format("{0}的星座是{1}", _baby.NickName, constellation); this.pageTitle.Text = title; //BitmapImage image = new BitmapImage(new Uri(@"ms-appx:/Assets/Constellation/巨蟹座.jpg")); string imagePath = string.Format(@"ms-appx:/Assets/Constellation/{0}.jpg", constellation); BitmapImage image = new BitmapImage(new Uri(imagePath)); this.image.Source = image; string jsonPath = constellation + ".json"; ConstellationInfo info = await FileHelper.LoadData <ConstellationInfo>(jsonPath, "Assets\\Constellation", true); this.description.Text = info.Description; } }
public override void AddGumpLayout() { ConstellationInfo info = AstronomySystem.GetConstellation(Chart.Constellation); AddPage(0); AddBackground(0, 0, 454, 350, 0x24AE); AddHtmlLocalized(32, 68, 112, 36, 1158505, false, false); // Constellation Name: AddHtml(154, 68, 300, 36, Color("#0040FF", string.IsNullOrEmpty(Chart.ConstellationName) ? "This constellation has not yet been named" : Chart.ConstellationName), false, false); AddHtmlLocalized(32, 104, 75, 36, 1158502, false, false); // Charted By: AddHtml(112, 104, 50, 36, Color("#0040FF", Chart.ChartedBy == null ? string.Empty : Chart.ChartedBy.Name), false, false); AddHtmlLocalized(32, 140, 75, 36, 1158503, false, false); // Charted On: AddHtml(112, 140, 80, 36, Color("#0040FF", Chart.ChartedOn.ToShortDateString()), false, false); AddHtmlLocalized(32, 176, 125, 18, 1158504, false, false); // Time-Coordinate: AddHtmlLocalized(47, 199, 60, 36, AstronomySystem.TimeCoordinateLocalization(info.TimeCoordinate), 0x1F, false, false); AddHtmlLocalized(157, 199, 20, 36, 1158489, false, false); // RA AddHtml(182, 199, 20, 36, Color("#0040FF", info.CoordRA.ToString()), false, false); AddHtmlLocalized(242, 199, 25, 36, 1158490, false, false); // DEC AddHtml(272, 199, 50, 36, Color("#0040FF", info.CoordDEC.ToString()), false, false); AddBackground(32, 253, 343, 22, 0x2486); AddTextEntry(34, 255, 339, 18, 0, 1, string.Empty, 34); AddButton(375, 245, 0x232C, 0x232D, 1, GumpButtonType.Reply, 0); }
public CentaurusClient(Uri alphaWebSocketAddress, KeyPair keyPair, ConstellationInfo constellationInfo) { this.alphaWebSocketAddress = alphaWebSocketAddress ?? throw new ArgumentNullException(nameof(alphaWebSocketAddress)); this.keyPair = keyPair ?? throw new ArgumentNullException(nameof(keyPair)); this.constellation = constellationInfo ?? throw new ArgumentNullException(nameof(constellationInfo)); Network.Use(new Network(constellation.StellarNetwork.Passphrase)); }
GameObject CreateTextOverlayInstance(ConstellationInfo constellation, Transform parent) { var instance = GameObject.Instantiate(overlayPrefab); instance.transform.SetParent(parent, false); instance.GetComponent <ConstellationOverlayText>().SetConstellation(constellation); instance.name = constellation.name; return(instance); }
public void Init() { foreach (GameObject constellation in constellations) { ConstellationInfo info = constellation.GetComponent <ConstellationInfo>(); if (info.IsAvailable) { info.DotLineActivate(); } } }
public static async Task <Transaction> GetDepositTx(KeyPair sourceAccount, ConstellationInfo constellation, string amount, ConstellationInfo.Asset asset) { using (var server = constellation.StellarNetwork.GetServer()) { var txBuilder = await GetTxBuilder(server, sourceAccount); txBuilder.AddOperation(new PaymentOperation.Builder((KeyPair)constellation.VaultPubKey, asset.StellarAsset, amount).Build()); var tx = txBuilder.Build(); return(tx); } }
// 星座の解放。 public void Enable(ConstellationType targetConstelltionType) { // 星座を探し使用可能にする foreach (GameObject constellation in constellations) { ConstellationInfo info = constellation.GetComponent <ConstellationInfo>(); if (info.Name == targetConstelltionType) { info.Enable(); } } }
public ConstellationInfo Info() { ConstellationInfo info; var state = (int)(Context.AppState?.State ?? 0); if (state < (int)ApplicationState.Running) { info = new ConstellationInfo { State = (ApplicationState)state } } ; else { var network = new ConstellationInfo.Network( Context.StellarDataProvider.NetworkPassphrase, Context.StellarDataProvider.Horizon ); var assets = Context.Constellation.Assets.Select(a => ConstellationInfo.Asset.FromAssetSettings(a)).ToArray(); info = new ConstellationInfo { State = Context.AppState.State, Vault = ((KeyPair)Context.Constellation.Vault).AccountId, Auditors = Context.Constellation.Auditors.Select(a => ((KeyPair)a).AccountId).ToArray(), MinAccountBalance = Context.Constellation.MinAccountBalance, MinAllowedLotSize = Context.Constellation.MinAllowedLotSize, StellarNetwork = network, Assets = assets, RequestRateLimits = Context.Constellation.RequestRateLimits }; } return(info); }
public override void OnResponse(RelayInfo info) { if (!User.InRange(Tele.Location, 2) || User.Map != Tele.Map) { return; } Tele.LastUse = DateTime.UtcNow; switch (info.ButtonID) { case 60000: // RA 10's Up if (Tele.RA >= 20) { Tele.RA -= 20; } else { Tele.RA += 10; } User.SendSound(0x4A); break; case 60001: // RA 10's Down if (Tele.RA < 10) { Tele.RA += 20; } else { Tele.RA -= 10; } User.SendSound(0x4A); break; case 60002: // RA 1's Up int raOnes = GetPlace(Tele.RA, 1); if (raOnes >= 9) { Tele.RA -= 9; } else { Tele.RA++; } User.SendSound(0x4A); break; case 60003: // RA 1's Down int raOnes1 = GetPlace(Tele.RA, 1); if (raOnes1 == 0) { Tele.RA += 9; } else { Tele.RA--; } User.SendSound(0x4A); break; case 60004: // DEC 10's Up if (Tele.DEC >= 90) { Tele.DEC -= 90; } else { Tele.DEC += 10; } User.SendSound(0x4A); break; case 60005: // DEC 10's Down if (Tele.DEC < 10) { Tele.DEC += 90; } else { Tele.DEC -= 10; } User.SendSound(0x4A); break; case 60006: // DEC 1's Up int decOnes = GetPlace((int)Math.Truncate(Tele.DEC), 1); if (decOnes >= 9) { Tele.DEC -= 9; } else { Tele.DEC++; } User.SendSound(0x4A); break; case 60007: // DEC 1's Down int decOnes1 = GetPlace((int)Math.Truncate(Tele.DEC), 1); if (decOnes1 <= 0) { Tele.DEC += 9; } else { Tele.DEC--; } User.SendSound(0x4A); break; case 60008: // DEC .2 Up int dec = GetDecimalPlace(Tele.DEC); if (dec >= 8) { Tele.DEC = Math.Truncate(Tele.DEC); } else { Tele.DEC += .2; } User.SendSound(0x4A); break; case 60009: // DEC .2 Down int dec1 = GetDecimalPlace(Tele.DEC); if (dec1 < 2) { Tele.DEC += 0.8; } else if (dec1 == 2) { Tele.DEC = Math.Truncate(Tele.DEC); } else { Tele.DEC -= 0.2; } User.SendSound(0x4A); break; case 70000: // View Coord if (Tele.RA > AstronomySystem.MaxRA || Tele.DEC > AstronomySystem.MaxDEC) { User.SendLocalizedMessage(1158488); // You have entered invalid coordinates. User.SendSound(81); } else { InterstellarObject = null; Constellation = null; ImageID = AstronomySystem.RandomSkyImage(User); TimeCoordinate timeCoord = Tele.TimeCoordinate; if (timeCoord == TimeCoordinate.Day) { User.SendLocalizedMessage(1158513); // You won't have much luck seeing the night sky during the day... } else { ConstellationInfo constellation = AstronomySystem.GetConstellation(timeCoord, Tele.RA, Tele.DEC); if (constellation != null) { Constellation = constellation; User.SendLocalizedMessage(1158492, "", 0xBF); // You peer into the heavens and see...a constellation! User.SendSound(User.Female ? 0x32B : 0x43D); } else if (0.2 > Utility.RandomDouble()) { InterstellarObject = AstronomySystem.GetRandomInterstellarObject(); User.SendLocalizedMessage(InterstellarObject.Item2, "", 0xBF); // User.SendSound(User.Female ? 0x32B : 0x43D); } else { User.SendLocalizedMessage(1158491, "", 0xBF); // You peer into the heavens and see...only empty space... } } } Refresh(); return; } if (info.ButtonID != 0) { Refresh(); } }
public static async Task <Transaction> GetWithdrawalTx(KeyPair sourceAccount, ConstellationInfo constellation, KeyPair destination, string amount, ConstellationInfo.Asset asset) { using (var server = constellation.StellarNetwork.GetServer()) { var txBuilder = await GetTxBuilder(server, sourceAccount); if ((await server.GetAccountData(destination.AccountId)) == null) { throw new Exception($"{destination.AccountId} is not a part of Stellar Network."); } txBuilder.AddOperation(new PaymentOperation.Builder(destination, asset.StellarAsset, amount).SetSourceAccount(KeyPair.FromAccountId(constellation.Vault)).Build()); txBuilder.AddTimeBounds(new stellar_dotnet_sdk.TimeBounds(maxTime: DateTimeOffset.UtcNow.AddSeconds(60))); var tx = txBuilder.Build(); return(tx); } }
public void SetConstellation(ConstellationInfo _info) { constellationInfo = _info; text.text = constellationInfo.name; }
public static async Task <SubmitTransactionResponse> Submit(this stellar_dotnet_sdk.Transaction tx, ConstellationInfo constellation) { using (var server = constellation.StellarNetwork.GetServer()) { var res = await server.SubmitTransaction(tx); if (!res.IsSuccess()) { throw new Exception($"Tx submit error. Result xdr: {res.ResultXdr}"); } return(res); } }