xna – How do I change a specific set of rendered buttons from gray to green?

I am a self-taught programmer.

I ran a Button class like this:

Texture texture;
Color color;
Color differentColor;

SpriteFont font;
button1 = new Button(texture, font, ... , color);
button2 = new Button(texture, font, ... , color);
button20 = new Button(texture, font, ... , color);

This button appears 20 times at a number of specific locations on the screen.

I want a set of 10 buttons in each level not to light up in a random green.

Level 1: Button 1,3,6,7,10,12,13,14,15,16 lights green (must be in this sequence)

Level 2: Button 2,5,6,7,9,11,13,14,19,20 lights green (must be in this sequence)

Level 3: etc …

There are 15 levels in total.

How do I do that in an intelligent way?

What I think might work:

Color() color1;
Color() color2;
Color() color20;

Repeat the spawn button 20 times and assign each level:

color1 = {Color.Green, Color.Gray, Color.Green... }
color2 = {Color.Gray, Color.Green, Color.Gray... }

I will add more functions to the button over time.
Will I benefit from using the command design pattern here?

2d – unit that manipulates the rendered sprite shape

I want to create a game object where you can start dragging it by touching the collision line and create those "dynamic shapes" by stretching the sprites and reshaping the look and collision of the sprites according to the handle.

Add an illustration to the share:
Enter image description here

Began to play with Sprite Shape Renderer However, to create these bent sprite tiles, I need to be able to create dynamic tiles with the mouse pointer and adjust all collisions.

I tried to add one AnchorDragger Screenplay for Sprite Shape Renderer Object:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.U2D;

public class AnchorDragger : MonoBehaviour

    public SpriteShapeController spriteShapeController;
    private Spline spline;
    private int inseretedPointIndex = INVALLID_INSERTED_POINT_INDEX;

    void Start()
        spline = spriteShapeController.spline;
        int pointCount = spline.GetPointCount();
        for (var i = 0; i < pointCount; i++)
            Vector3 currentPointPos = spline.GetPosition(i);
            Debug.Log("Point " + i + " position: " + currentPointPos);

    // Update is called once per frame
    void Update()
        if (inseretedPointIndex != INVALLID_INSERTED_POINT_INDEX)
            spline = spriteShapeController.spline;
            spline.SetPosition(inseretedPointIndex, Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, 1.0f)));
            // Debug.Log("Setting position to: " + Camera.main.ScreenToWorldPoint(Input.mousePosition));

    void OnMouseDown()
        Debug.Log("Mouse Down Position:" + Input.mousePosition);
        Vector3 mouseDownPos = Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, 1.0f));
        Debug.Log("World Position: " + mouseDownPos);
        spline = spriteShapeController.spline;
        int pointCount = spline.GetPointCount();
        int closestPointIndex = int.MaxValue;
        float minDistance = int.MaxValue;
        for (var i = 0; i < pointCount; i++)
            Vector3 currentPointPos = spline.GetPosition(i);
            float distance = Vector3.Distance(currentPointPos, mouseDownPos);
            if (distance < minDistance)
                minDistance = distance;
                closestPointIndex = i;
        spline.InsertPointAt(closestPointIndex, mouseDownPos);
        spline.SetTangentMode(closestPointIndex, ShapeTangentMode.Continuous);
        inseretedPointIndex = closestPointIndex;
        Debug.Log("Inserted point index: " + inseretedPointIndex);

    void OnMouseUp()
        Debug.Log("Mouse Up");
        spline = spriteShapeController.spline;
        inseretedPointIndex = INVALLID_INSERTED_POINT_INDEX;

Basically, we tried to find the closest point on the spline I clicked on and then insert a new point and set its position Update to where the mouse is located and delete the point with the mouse upwards.
At the moment I have a problem where the drawing position is not correct for some reason.
Where I clicked, where the new point position is set:
Enter image description here

Even as I tried to play with the mouse click and drag, I was not sure why I needed help.

I am also not sure how I would update this EdgeCollider2D? I know, I can get it in the Update Method with:

EdgeCollider2D edgeCollider = gameObject.GetComponent();

But how would I actually update it correctly to fit the new sprite?

SEO – Google can not retrieve a large sitemap with 50,000 URLs and is not rendered by browsers

My sitemap contains 50,000 URLs / 7.8 MB and the following URL syntax:

 https://www.ninjogos.com.br/resultados?pesquisa=vestido, maquiagem,   2019-10-03T17:12:01-03:00 

The problems are:

• The search console reports that the sitemap could not be read.

• Sitemap loading takes 1 hour and Chrome stops working.

Enter image description here

• In Firefox, the sitemap was downloaded in 1483 ms and fully loaded after 5 minutes.

Things that I have done without success:

• Disable GZip compression.

• Delete my .htaccess file;

• Create a test sitemap with 1 KB URLs and the same syntax, and send it to Search Console. However, the sitemap with 50 KB URLs still displays "" that no sitemap can be retrieved.

Enter image description here

• An attempt was made to directly check the URL, but an error occurred and you are asked to try again later while the 1KB URLs worked.

• An attempt was made to validate the sitemap on five different websites (YANDEX, ETC), and all worked without error / warning

Any light?

8 – How to set or change which user or role is referenced when an entity is rendered programmatically?

I have a situation where I have to render a node entity programmatically. I need to get the version of the node that will be displayed to anonymous users, but the rendering will be triggered by an authenticated user. Is there any idea how to specify or change which user (or ideally what role) is referenced when the entity is rendered?

Put simply, here is the rendering code:

$node = Node::load(1);
$render_controller = Drupal::entityTypeManager()->getViewBuilder('node');
$render_output = $render_controller->view($node);
return $render_output;

This renders the entire page. When this code section is triggered by an administrator, the rendered page includes the management toolbar, context tabs, and the like. I want to be able to render what an anonymous user would see.

SEO – Does rendered HTML from an angular app have to be nicely designed if it is only shown to search engine bots?

I have a square app, and while Google indexes it now, many other sites do not.

I have created middleware that crawls requests from crawlers and provides HTML pages that these crawlers can use to index.

My question is this. Since people do not see these pages, I have to make them pretty with CSS and follow the same theme as my website, or can I simply use basic HTML to get the content I need out there. Will basic HTML ever affect SEO?

The main page in question are jobs that our company publishes on a job page. We want these jobs to be indexed. So can I just have a simple HTML page with all job details?

Error – CSS and JS are not rendered from the pub / static folder after installing Magento 2.2.8

I have just installed Magento 2.2.8 and there is an error on a homepage

magento 2 homepage error

then I executed the following commands

php -dmemory_limit=6G bin/magento setup:static-content:deploy -f
php bin/magento cache:clean

But nothing has changed how to fix this error? why magento 2.2.8 does not take pub / static path for images, css and js files?

8 – Display the rendered node in jQuery Modal via JSON

I want to be able to have a link, and if there is a specefic class, I want to display it as a jQuery modal. I added the required data associated with the link to be able to use it as a modal.

I also created a route for nodes that has a custom controller that runs when a node is displayed ?_format=json, The controller returns the rendered node as JSON, which seems to work well.

Here is my controller:

public function json(EntityInterface $node, $view_mode = 'full', $langcode = NULL) {
  $build = $this->entityTypeManager->getViewBuilder('node')->view($node, $view_mode);
  $output = $this->renderer->renderRoot($build);

  return new JsonResponse($output);

And here's the JS that makes the link to a modal:

if ($(context).find('.node-open-modal').length > 0) {
  $(context).find('.node-open-modal').each(function () {
    $(this).attr('data-dialog-type', 'modal').addClass('use-ajax');

The only problem is that clicking the link will cause the following error message:

SyntaxError: JSON.parse: Unexpected character in line 2, column 1 of the JSON data

Does Drupal not send valid JSON data or what?

7 – How are translated nodes rendered in two languages?

I use entity_translation to translate the node body field, that is, a fully loaded node object body is an array of 2 languages ​​(& # 39; and & # 39; ru & # 39;).

For a specific node type, I would like to render body sequentially in both languages:

Russian version of the node body

English version of the node body

A change between the translations is therefore not required.

Which hook can I use to achieve this?

In implementation of hook_node_load() body is an array of 2 languages, but in hook_node_view_alter() body already contains only the current language value.

When using node_load() in the hook_preprocess_nodeGets the node object from the cache and its body has only one (current) language value.