Giter Site home page Giter Site logo

Comments (10)

Agarian avatar Agarian commented on July 1, 2024

@mafiakb Si bien podría hacerlo a través del cliente, creo que sería mucho más fácil editar eso en el lado del servidor. Y solo una pregunta, ¿quiere que el texto de la tabla de clasificación muestre específicamente "Usuario" y luego un número anterior? Nota al margen: la edición de la tabla de clasificación no funcionará en HTML. Y lo siento si mi gramática española es mala, culpen a Google traducir y mi pobre conocimiento de español.

from cigar-client.

mafiakb avatar mafiakb commented on July 1, 2024

Claro, seria en el lado del cliente. La idea es que se cada usuario en el leaderboard tenga <li>user1</li> para poder darle ediciones en un futuro.

from cigar-client.

Agarian avatar Agarian commented on July 1, 2024

De la forma en que lo veo, tendrás que cambiar el siguiente código de:

 for (ctx.font = "20px Ubuntu", b = 0; b < leaderBoard.length; ++b) {
    c = leaderBoard[b].name || "An unnamed cell";
    if (!showName) c = "An unnamed cell";
    if (-1 != nodesOnScreen.indexOf(leaderBoard[b].id)) {
        playerCells[0].name && (c = playerCells[0].name);
        var userLBColor = String($("#lbColor").val());
        ctx.fillStyle = "#" + userLBColor;
        if (!noRanking) c = b + 1 + ". " + c;
        ctx.fillText(c, 100 - ctx.measureText(c).width / 2, 70 + 24 * b);
    } else {
        ctx.fillStyle = "#FFF";
        if (!noRanking) c = b + 1 + ". " + c;
        ctx.fillText(c, 100 - ctx.measureText(c).width / 2, 70 + 24 * b);
    }
}

A:

for (ctx.font = "20px Ubuntu", b = 0; b < leaderBoard.length; ++b) {
    c = leaderBoard[b].name || "User";
    if (!showName) c = "User";
    if (-1 != nodesOnScreen.indexOf(leaderBoard[b].id)) {
        playerCells[0].name && (c = playerCells[0].name);
        var userLBColor = String($("#lbColor").val());
        ctx.fillStyle = "#" + userLBColor;
        if (!noRanking) c = b + 1 + ". " + c;
        ctx.fillText("User", 100 - ctx.measureText("User").width / 2, 70 + 24 * b);
    } else {
        ctx.fillStyle = "#FFF";
        if (!noRanking) c = b + 1 + ". " + c;
        ctx.fillText("User", 100 - ctx.measureText("User").width / 2, 70 + 24 * b);
    }
}

Este código se encuentra en:
https://github.com/Agarian/agarian.github.io/blob/master/assets/js/main_out.js#L1058

from cigar-client.

Agarian avatar Agarian commented on July 1, 2024

@mafiakb Lo que este cambio efectivamente hace es hacer que todos los nombres en la pantalla de la tabla de clasificación sean "Usuario". En cuanto a los números anteriores después del texto, como 1, 2, 3, 4 ..., esta es la razón por la que sugerí editar el código del servidor para esta función, ya que no hay forma de que sepa agregar los números anteriores en el cliente.

from cigar-client.

mafiakb avatar mafiakb commented on July 1, 2024

@Agarian Claro solo creo que me entendiste mal digamos yo en el cliente html tengo esto:

          <div id="leaderboard-content-wrapper">
            <span id="leaderboard-header">Leaderboard</span>
            <li></li>
          </div>
        </div>

Lo que quiero que se emprima son los nicks en la etiqueta <li></li> esta funcion:

if (!noRanking) c = b + 1 + ". " + c;

algo asi seria $("#leaderboard-header .li").html(c); pero no funciona solo muestra el primer nick no muestra todos.

Tiene que mostrar asi todos los nicks.

<div id="leaderboard-wrapper" style="display: block;">
          <div id="leaderboard-content-wrapper">
            <span id="leaderboard-header">Leaderboard</span>
              <li>agarian</li>
              <li>mafiakb</li>
              <li>agarian</li>
              <li>mafiakb</li>
              <li>agarian</li>
              <li>mafiakb</li>
              <li>agarian</li>
              <li>mafiakb</li>
          </div>
        </div>

from cigar-client.

Agarian avatar Agarian commented on July 1, 2024

@mafiakb Oh, está bien, veo lo que quieres. Dame algo de tiempo para ver si puedo hacer que funcione. Aunque no estoy seguro de cómo funcionará, intentaré hacerlo lo mejor posible.

from cigar-client.

Agarian avatar Agarian commented on July 1, 2024

Seré honesto contigo, no estoy seguro por dónde empezar con esto. Pero gracias por señalar:
if (!noRanking) c = b + 1 + ". " + c;. Ese código lo hace un poco más fácil. Esto es lo que tengo hasta ahora, he conseguido que la tabla de clasificación muestre Usuario luego un número anterior. El código para eso está abajo.

for (ctx.font = "20px Ubuntu", b = 0; b < leaderBoard.length; ++b) {
    c = leaderBoard[b].name || "An unnamed cell";
    if (!showName) c = "An unnamed cell";
    if (-1 != nodesOnScreen.indexOf(leaderBoard[b].id)) {
        playerCells[0].name && (c = playerCells[0].name);
        var userLBColor = String($("#lbColor").val());
        ctx.fillStyle = "#" + userLBColor;
        if (!noRanking) c = b + 1 + ". " + "User " + b;
        ctx.fillText(c, 100 - ctx.measureText(c).width / 2, 70 + 24 * b);
    } else {
        ctx.fillStyle = "#FFF";
        if (!noRanking) c = b + 1 + ". " + "User " + b;
        ctx.fillText(c, 100 - ctx.measureText(c).width / 2, 70 + 24 * b);
    }
}

from cigar-client.

mafiakb avatar mafiakb commented on July 1, 2024

@Agarian ok buscare mas afondo para lograr y poner avances aqui.

from cigar-client.

RevengePlayz avatar RevengePlayz commented on July 1, 2024

@mafiakb and @Agarian add me on discord Revenge#5285 its urgent (do capital R)

from cigar-client.

Agarian avatar Agarian commented on July 1, 2024

Closing this.

from cigar-client.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.