Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access card values easily in pages #58

Closed
Phrancis opened this issue Aug 13, 2015 · 1 comment
Closed

Access card values easily in pages #58

Phrancis opened this issue Aug 13, 2015 · 1 comment

Comments

@Phrancis
Copy link
Contributor

Here is a card in JSON for illustration purposes, from my understanding in the format it is passed from the server when the deck builder is brought up:

{
  "MAX_HEALTH" : 10,
  "SICKNESS" : 1,
  "MANA_COST" : 30,
  "ATTACK" : 3,
  "HEALTH" : 10,
  "ATTACK_AVAILABLE" : 1,
  "flavor" : "The Great Grandfather, Emperor of all Deities, Vanquisher of Evil.",
  "name" : "JADE EMPEROR",
  "description" : "Give creatures of type Chinese owned by you on Battlefield 3 HEALTH\nGive creatures on Battlefield -1 ATTACK\n",
  "type" : "Chinese God"
}

I have mentioned this a few times in chat, but we haven't really reached anything conclusive. This will be needed for some of the pages, namely the deck builder, game board and card model.

Right now, taking some code from src/deck_builder/template.html, there is Angular code that references a card's name to display on the page:

            <td>
                <a data-ng-click="showDetails(card)">{{card.properties.name}}</a>
            </td>

There is also a small loop that checks card information using what appears to be a different method, and those values are shown in a different section of the page:

    <ul>
        <li data-ng-repeat="(name, value) in cardInfo" data-ng-show="value">
            <b>{{name}}</b>: {{value}}
        </li>
    </ul>

What we really need to be able to do is to explicitly reference each of the key/value pairs in HTML/JS so that we can flexibly display card information where and how we like in the client. How can this best be done?

I have tried doing something like this, but it does not display any data on the page, so it must be an invalid reference:

            <!-- Creature Type -->
            <td>
                {{card.properties.type}}
            </td>
@Phrancis
Copy link
Contributor Author

The solution to this is likely in #60 where the fields are. It appears this issue was a naming issue, largely. Will test while updating the deck builder section and close this once confirmed it is working ok.

@Phrancis Phrancis self-assigned this Aug 21, 2015
@Zomis Zomis closed this as completed Aug 23, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants