static void OnPostprocessAllAssets( string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths) { foreach (var str in importedAssets) { // Detect a new unity package if (str.Contains(".unitypackage") && str.Contains(PACKNAME)) { QuickStart.InstallUpdate(); break; } // An upgrade has taken place if (str.Contains("ProBuilderCore.dll")) { System.Type upgradeUtil = System.Type.GetType("pb_Upgrade_Utility"); MethodInfo onUpgrade = upgradeUtil.GetMethod("OnProBuilderUpgrade"); onUpgrade.Invoke(null, null); break; } } }
void Awake() { if (QLoading.Ended) { QuickStart.Warning("Reload? Destroy.", "QLoading"); Destroy(this); return; } if (!QSettings.Instance.enablePauseOnFlight || !QSettings.Instance.Enabled || QSettings.Instance.gameScene != (int)GameScenes.FLIGHT) { QuickStart.Log("Not need to keep it loaded.", "QFlight"); QLoading.Ended = true; Destroy(this); return; } if (Instance != null) { QuickStart.Warning("There's already an Instance", "QFlight"); Destroy(this); return; } Instance = this; GameEvents.onFlightReady.Add(OnFlightReady); QuickStart.Log("Awake", "QFlight"); }
public void SaveText() { str = inputField.textComponent.text; Debug.Log(str); /* * string namae = PlayerPrefs.GetString("NAME", ""); * string token = PlayerPrefs.GetString("TOKEN", ""); */ string namae = "たくと"; string token = "d3402f501cbeb69161f208d7bb11f190c1e154ca"; //StartCoroutine(Post()); RestClient.Post <Message>(url, new InputText { text = str, name = namae, token = token }).Then(message => { //string response = JsonUtility.ToJson(message, true); //EditorUtility.DisplayDialog("JSON", message.message, "Ok"); //Debug.Log(message.message); m = message.message; Debug.Log(m); text.GetComponent <Text>().text = m; QuickStart.CreateRequest(m); //Fukidashi.fukidashi(m); }); //Debug.Log(m); //m = "hello"; inputField.text = ""; }
public void AddTest2(int value1, int value2, int expectedResult) { // Act var result = QuickStart.Add(value1, value2); // Assert Assert.AreEqual(expectedResult, result); }
void OnFlightReady() { PauseMenu.Display(); QLoading.Ended = true; QuickStart.Log("Not need to keep it loaded.", "QFlight"); Destroy(this); return; }
protected override void Awake() { base.Awake(); print("AbstractGameMgr_Awake——这句话应该只显示一次"); RegisterSceneEvent(); WorkForOnlyOnce(); QuickStart.RegisterUi(this.GetType()); }
public static void Main() { QuickStart.Go(); UsingNonSerializedFields.Go(); OptionalField.Go(); ISerializableVersioning.Go(); SerializingSingletons.Go(); SerializationSurrogates.Go(); SerializationBinderDemo.Go(); }
public void AddTest() { // Arrange const int value1 = 5; const int value2 = 3; // Act var result = QuickStart.Add(value1, value2); // Assert Assert.AreEqual(8, result); }
//private void Start() //{ // DisableSimulationEntitiesWarning(); //} void OnServicesReady() { if (!string.IsNullOrEmpty(ExtraCommands)) { GameConsole.ExecuteCommandLineStyleInvokables(ExtraCommands); } if (QuickStart.HasEverQuickStarted == false) { if (StartFromScratch || EditorLaunchData.playFromScratch) { QuickStart.StartFromScratch(EditorLaunchData.profileLocalId); } else { QuickStartSettings settings = new QuickStartSettings() { localProfileId = EditorLaunchData.profileLocalId, level = EditorLaunchData.level, serverName = EditorLaunchData.serverName }; if (EditorLaunchData.playOnline) { settings.playMode = EditorLaunchData.whoIsServerId == EditorLaunchData.profileLocalId ? QuickStartSettings.PlayMode.OnlineServer : QuickStartSettings.PlayMode.OnlineClient; } else { settings.playMode = QuickStartSettings.PlayMode.Local; } if (OverridePlayMode) { settings.playMode = PlayMode; } if (OverrideServerName) { settings.serverName = ServerName; } if (OverrideLevel) { settings.level = Level ? Level.name : ""; } QuickStart.Start(settings); } } }
static void OnPostprocessAllAssets( string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths) { foreach (var str in importedAssets) { // Detect a new unity package if (str.Contains(".unitypackage") && str.Contains(PACKNAME)) { QuickStart.MenuInstallUpdate(); break; } } }
public void GeneratePrivateKey63() { // Hash of the validator index (as little endian bytes), is converted to integer as little endian, // then that integer (after modulus) is used as the big endian private key. // However, Hash(63) is small enough that it only has 31 bytes (not 32), // so when writing we have to ensure the padding is at the correct end. // // i.e. little endian 63 = 0x3f, // Hash(0x3f00000000000000000000000000000000000000000000000000000000000000) // = 0xbdd4daa5482af796206dc02a6780cfb51efe5e16c491c61bd9bf64cfc0da6e00 // Little endian this is 195862955980072989385619164996948568652240008241846978685122117889393611965 // When converted to bytes big endian (as per Eth BLS), this is only 31 bytes: // 0x6edac0cf64bfd91bc691c4165efe1eb5cf80672ac06d2096f72a48a5dad4bd // If written to an array/span it would pad on the right, but needs to pad on the left: // 0x006edac0cf64bfd91bc691c4165efe1eb5cf80672ac06d2096f72a48a5dad4bd // Arrange IServiceCollection testServiceCollection = TestSystem.BuildTestServiceCollection(useStore: true); IConfigurationRoot configuration = new ConfigurationBuilder() .AddInMemoryCollection(new Dictionary <string, string> { ["QuickStart:ValidatorCount"] = "64" }) .Build(); testServiceCollection.AddBeaconNodeQuickStart(configuration); ServiceProvider testServiceProvider = testServiceCollection.BuildServiceProvider(); // Act QuickStart quickStart = (testServiceProvider.GetService <INodeStart>() as QuickStart) !; byte[] privateKey = quickStart.GeneratePrivateKey(63); // Assert privateKey.Length.ShouldBe(32); privateKey[0].ShouldBe((byte)0x00); privateKey[1].ShouldBe((byte)0x6e); privateKey[31].ShouldBe((byte)0xbd); }
public virtual void Test() { QuickStart.Maing(); /*SR = new Microsoft.Bing.Speech.SpeechRecognizer("en-US", credentials); * * // Add speech recognition event handlers. * SR.onaudiocapturestatechanged = SR_AudioCaptureStateChanged; * SR.onaudiolevelchanged = SR_AudioLevelChanged; * SR.onrecognizerresultreceived = SR_RecognizerResultReceived; * * Plugin.BingSpeech.BingSpeech.Current * Plugin.BingSpeech.BingSpeech.Current.MicrophoneService.StartRecording("ex.lol"); */ //SpeechRecognitionEngine en = new SpeechRecognitionEngine(); //en. // speechrecognitions // en.SetInputToAudioStream() ; //RequestMetadata mt = new RequestMetadata(new Guid(), new DeviceMetadata(DeviceType.Near, DeviceFamily.Laptop, NetworkType.CellLTE, OsName.Windows, "10", "", ""), new ApplicationMetadata("8", "8.8"), "999"); //Microsoft.Bing.Speech.SpeechInput si = new SpeechInput(File.OpenRead(@"c:\example.wav"), mt); }
void OnCoreServicesReady() { // read the command line arguments Log.Info("CommandLine: " + CommandLine.CompleteCommandLine); QuickStartSettings quickStartSettings = new QuickStartSettings(); CommandLine.TryGetInt("-profileId", out quickStartSettings.localProfileId); if (CommandLine.TryGetInt("-playmode", out int playModeValue)) { CommandLine.TryGetString("-servername", out quickStartSettings.serverName); CommandLine.TryGetString("-level", out quickStartSettings.level); quickStartSettings.playMode = (QuickStartSettings.PlayMode)playModeValue; QuickStart.Start(quickStartSettings); } else { QuickStart.StartFromScratch(quickStartSettings.localProfileId); } }
public async Task BasicNewBlock() { // Arrange int numberOfValidators = 64; int genesisTime = 1578009600; IServiceCollection testServiceCollection = TestSystem.BuildTestServiceCollection(useStore: true); IConfigurationRoot configuration = new ConfigurationBuilder() .AddInMemoryCollection(new Dictionary <string, string> { ["QuickStart:ValidatorCount"] = $"{numberOfValidators}", ["QuickStart:GenesisTime"] = $"{genesisTime}" }) .Build(); testServiceCollection.AddBeaconNodeQuickStart(configuration); testServiceCollection.AddSingleton <IHostEnvironment>(Substitute.For <IHostEnvironment>()); ServiceProvider testServiceProvider = testServiceCollection.BuildServiceProvider(); QuickStart quickStart = (QuickStart)testServiceProvider.GetService <INodeStart>(); await quickStart.InitializeNodeAsync(); IBeaconNodeApi beaconNode = testServiceProvider.GetService <IBeaconNodeApi>(); Core2.Containers.Fork fork = await beaconNode.GetNodeForkAsync(CancellationToken.None); fork.CurrentVersion.ShouldBe(new ForkVersion()); // Act BlockProducer blockProducer = testServiceProvider.GetService <BlockProducer>(); Slot targetSlot = new Slot(1); // With QuickStart64, proposer for Slot 1 is validator index 20, 0xa1c76af1... byte[] privateKey = quickStart.GeneratePrivateKey(20); BlsSignature randaoReveal = GetEpochSignature(testServiceProvider, privateKey, fork.CurrentVersion, targetSlot); // value for quickstart 20/64, fork 0, slot 1 randaoReveal.ToString().ShouldBe("0xa3426b6391a29c88f2280428d5fdae9e20f4c75a8d38d0714e3aa5b9e55594dbd555c4bc685191e83d39158c3be9744d06adc34b21d2885998a206e3b3fd435eab424cf1c01b8fd562deb411348a601e83d7332d8774d1fd3bf8b88d7a33c67c"); BeaconBlock newBlock = await blockProducer.NewBlockAsync(targetSlot, randaoReveal); // Assert newBlock.Slot.ShouldBe(targetSlot); newBlock.Body.RandaoReveal.ShouldBe(randaoReveal); Hash32 expectedParentRoot = new Hash32("0x91b06cbcd6dc97b89dc8b95e0b01a497932683b182e6c722ddfa10cd005b2180"); newBlock.ParentRoot.ShouldBe(expectedParentRoot); newBlock.Body.Eth1Data.DepositCount.ShouldBe((ulong)numberOfValidators); Hash32 expectedEth1DataDepositRoot = new Hash32("0x66687aadf862bd776c8fc18b8e9f8e20089714856ee233b3902a591d0d5f2925"); newBlock.Body.Eth1Data.DepositRoot.ShouldBe(expectedEth1DataDepositRoot); Hash32 expectedStateRoot = new Hash32("0xe05ccf6347cac0b0dab0ad0d5c941fe7c7e2ed4c69550ed9a628bc9d62914242"); newBlock.StateRoot.ShouldBe(expectedStateRoot); newBlock.Signature.ShouldBe(new BlsSignature(new byte[96])); // signature should be empty newBlock.Body.Attestations.Count.ShouldBe(0); newBlock.Body.Deposits.Count.ShouldBe(0); }
void OnDestroy() { GameEvents.onFlightReady.Remove(OnFlightReady); QuickStart.Log("OnDestroy", "QFlight"); }
void Start() { QuickStart.Log("Start", "QFlight"); }
void Awake() { quickStart = this; startTime = Time.time; }
private void initializeUI() { try { this.Width = Globals.ThisAddIn.iTempWidth; this.Height = Globals.ThisAddIn.iTempHeight; BrightIdeasSoftware.TextOverlay textOverlay = this.listItems.EmptyListMsgOverlay as BrightIdeasSoftware.TextOverlay; textOverlay.TextColor = Color.FromArgb(255, 96, 96, 96); textOverlay.BackColor = System.Drawing.Color.White; textOverlay.BorderWidth = 0; textOverlay.InsetY = 0; textOverlay.Font = new System.Drawing.Font("Serif", 9); rbd = new BrightIdeasSoftware.RowBorderDecoration(); rbd.BorderPen = new Pen(Color.FromArgb(170, Color.DarkGray), 1); rbd.FillBrush = new SolidBrush(Color.FromArgb(40, Color.Black)); rbd.BoundsPadding = new Size(-2, -2); rbd.CornerRounding = 6.0f; this.listItems.SelectedRowDecoration = rbd; this.listItems.CellToolTip.ReshowDelay = 0; alternateRBD = new BrightIdeasSoftware.RowBorderDecoration(); alternateRBD.BorderPen = new Pen(Color.LightGray, 1); alternateRBD.FillBrush = null; alternateRBD.BoundsPadding = new Size(2, 0); alternateRBD.CornerRounding = 0; this.menuitemSortBy.DropDownItems.AddRange(getSortByMenuItems()); this.menuitemSortBy.DropDownItems.Add(new ToolStripSeparator()); this.menuitemSortBy.DropDownItems.AddRange(getSortByDirectionMenuItems()); ((ToolStripMenuItem)this.menuitemSortBy.DropDownItems[Properties.Settings.Default.DEFAULT_SORTBY + ""]).CheckState = CheckState.Indeterminate; ((ToolStripMenuItem)this.menuitemSortBy.DropDownItems[Properties.Settings.Default.DEFAULT_SORTBY + ""]).Checked = true; this.contextmenuSortBy.Items.AddRange(getSortByMenuItems()); this.contextmenuSortBy.Items.Add(new ToolStripSeparator()); this.contextmenuSortBy.Items.AddRange(getSortByDirectionMenuItems()); ((ToolStripMenuItem)this.contextmenuSortBy.Items[Properties.Settings.Default.DEFAULT_SORTBY + ""]).CheckState = CheckState.Indeterminate; ((ToolStripMenuItem)this.contextmenuSortBy.Items[Properties.Settings.Default.DEFAULT_SORTBY + ""]).Checked = true; currentSortBy = (SortByType)Properties.Settings.Default.DEFAULT_SORTBY; DragSource dragSource = new DragSource(); this.listItems.DragSource = dragSource; dragSource.endDragEvent +=new EndDragDelegate(dragSource_endDragEvent); this.treeFolders.ShowNodeToolTips = true; this.treeFolders.ShowLines = true; this.btnMore.Enabled = false; this.btnSearch.BackgroundImageLayout = ImageLayout.Center; buildSearchOptionsContextMenu(); buildFilterFieldsContextMenu(); buildImageList(); prepareLayout(); positionSplitter(); //將來可能需要加上開關QuickStart的checkbox by Gene if (this.chkQuickStartTip.Checked) { Properties.Settings.Default.DEFAULT_SHOWQUICKSTART = true; } try { disableClickSounds(); } catch { } if (Properties.Settings.Default.DEFAULT_SHOWQUICKSTART) { QuickStart quickstart = new QuickStart(Properties.Settings.Default.URL_QUICKSTART); quickstart.Show(); } btnTemplate.PerformClick(); } catch (Exception ex) { this.log.WriteLine(LogType.Error, "MasterControl::initializeUI", ex.ToString()); } }
public int AddTest3(int value1, int value2) { // AAA return(QuickStart.Add(value1, value2)); }
public void TestMain() { // Main() will throw an exception on failure QuickStart.Main(new string[] { }); Assert.True(true); }
static void Main(string[] args) { QuickStart.Samples(); Properties.Samples(); }
public async Task BasicNewBlock() { // Arrange int numberOfValidators = 64; int genesisTime = 1578009600; IServiceCollection testServiceCollection = TestSystem.BuildTestServiceCollection(useStore: true); IConfigurationRoot configuration = new ConfigurationBuilder() .AddInMemoryCollection(new Dictionary <string, string> { ["QuickStart:ValidatorCount"] = $"{numberOfValidators}", ["QuickStart:GenesisTime"] = $"{genesisTime}" }) .Build(); testServiceCollection.AddQuickStart(configuration); testServiceCollection.AddSingleton <IHostEnvironment>(Substitute.For <IHostEnvironment>()); ServiceProvider testServiceProvider = testServiceCollection.BuildServiceProvider(); QuickStart quickStart = (QuickStart)testServiceProvider.GetService <INodeStart>(); await quickStart.InitializeNodeAsync(); IBeaconNodeApi beaconNode = testServiceProvider.GetService <IBeaconNodeApi>(); Core2.Containers.Fork fork = await beaconNode.GetNodeForkAsync(); fork.CurrentVersion.ShouldBe(new ForkVersion()); // Act BlockProducer blockProducer = testServiceProvider.GetService <BlockProducer>(); Slot targetSlot = new Slot(1); // With QuickStart64, proposer for Slot 1 is validator index 20, 0xa1c76af1... byte[] privateKey = quickStart.GeneratePrivateKey(20); BlsSignature randaoReveal = GetEpochSignature(testServiceProvider, privateKey, fork.CurrentVersion, targetSlot); // value for quickstart 20/64, fork 0, slot 1 randaoReveal.ToString().ShouldBe("0xa3426b6391a29c88f2280428d5fdae9e20f4c75a8d38d0714e3aa5b9e55594dbd555c4bc685191e83d39158c3be9744d06adc34b21d2885998a206e3b3fd435eab424cf1c01b8fd562deb411348a601e83d7332d8774d1fd3bf8b88d7a33c67c"); BeaconBlock newBlock = await blockProducer.NewBlockAsync(targetSlot, randaoReveal); // Assert newBlock.Slot.ShouldBe(targetSlot); newBlock.Body.RandaoReveal.ShouldBe(randaoReveal); Hash32 expectedParentRoot = new Hash32(Bytes.FromHexString("0x3111350140726cc0501223143ae5c7baad7f5a06764fcc7d444a657016e7d616")); newBlock.ParentRoot.ShouldBe(expectedParentRoot); newBlock.Body.Eth1Data.DepositCount.ShouldBe((ulong)numberOfValidators); Hash32 expectedEth1DataDepositRoot = new Hash32(Bytes.FromHexString("0x66687aadf862bd776c8fc18b8e9f8e20089714856ee233b3902a591d0d5f2925")); newBlock.Body.Eth1Data.DepositRoot.ShouldBe(expectedEth1DataDepositRoot); Hash32 expectedStateRoot = new Hash32(Bytes.FromHexString("0x9c7d3e5180f95175691511fd56f8a610299f0b5a682b6fe178230493d74f6d13")); newBlock.StateRoot.ShouldBe(expectedStateRoot); newBlock.Signature.ShouldBe(new BlsSignature(new byte[96])); // signature should be empty newBlock.Body.Attestations.Count.ShouldBe(0); newBlock.Body.Deposits.Count.ShouldBe(0); }