Giter Site home page Giter Site logo

Comments (3)

outfrost avatar outfrost commented on September 16, 2024

To use card prerequisites, you would populate the prerequisites list in a Card instance. Each entry is an ICardPrerequisite, and has a Status property, which describes, as a bit field, what has to have happened to some other card, in order for the card holding the prerequisite to be shown.

In your example case:

Suppose we have some Card a whose id in storage is 6, and some Card b whose id is 9. We only want a to be shown to the player if the player has swiped b to the left before.

a.prerequisites will therefore contain at least one item, perhaps constructed like so:

	CardPrerequisite p = new CardPrerequisite();
	p.id = 9;
	p.status = CardStatus.LeftActionTaken;

(I didn't create a special constructor for CardPrerequisite and SpecialCardPrerequisite because they were usually imported from Google Sheets)

Prerequisites are checked during loading of player's progress. Then, whenever a card is shown or swiped, each of its dependent cards is checked, and added to the pool of drawable cards if its prerequisites are now satisfied.

from deckswipe.

yeter1 avatar yeter1 commented on September 16, 2024

Thank you again, your answer is exactly what i was trying to understand...
Also is there a way to show a card only once?

from deckswipe.

outfrost avatar outfrost commented on September 16, 2024

No, there isn't. Once a card is added to drawable ones, it's never removed. That is something you would have to implement yourself.

If you do, and would like to have it integrated here, I am accepting PRs :)

from deckswipe.

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.