我是编程的菜鸟,但在我们开始之前,请回答我为什么更新执行不止一次,并像我是个傻瓜一样解释一下。
无论如何,所以我试图让这段代码只运行一次,因为到目前为止它执行了不止一次。
protected override void Update(GameTime gameTime)
{
// Allows the game to exit
if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
this.Exit();
// TODO: Add your update logic here
button = Mouse.GetState();
if (button.X < buttonPosition.X || button.Y < buttonPosition.Y || button.X > buttonPosition.X + font1.MeasureString(buttonText).X ||
button.Y > buttonPosition.Y + font1.MeasureString(buttonText).Y)
buttonColour = new Color(0, 0, 0);//if the mouse if not hovering over the font it stays that color
else
buttonColour = new Color(0, 255, 255);//changes to this color if it is …Run Code Online (Sandbox Code Playgroud) 当我运行我的角度应用程序时,我得到了一个 CORS,尽管我已经在我的 .NET Core 应用程序中启用了它,但常规的 http 请求似乎工作正常,只是 SignalR 遇到了问题。任何建议将不胜感激。提前致谢。
\n\nCross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://localhost:5001/api/chat/negotiate. (Reason: expected \xe2\x80\x98true\xe2\x80\x99 in CORS header \xe2\x80\x98Access-Control-Allow-Credentials\xe2\x80\x99).\n\nCross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://localhost:5001/api/chat/negotiate. (Reason: CORS request did not succeed).\n\n[2019-07-06T19:34:25.061Z] Warning: Error from HTTP request. 0: . Utils.js:206\n[2019-07-06T19:34:25.065Z] Error: Failed to complete negotiation with the server: Error Utils.js:203\n[2019-07-06T19:34:25.070Z] Error: Failed to start the connection: Error Utils.js:203\nError while establishing connection :( …Run Code Online (Sandbox Code Playgroud)