Fortune Telling Collection - Zodiac Analysis - A tutorial on how to make a hole in a sheep hole.

A tutorial on how to make a hole in a sheep hole.

A music tutorial in sheep cave;

1, remove three cards.

2. The purpose of this prop is to take the first three cards out of the current card slot and temporarily put them above the card slot. The cards taken out can be added to the card slot again later.

3. When using the removed props, there may be two situations. One is that the number of cards in the current card slot is less than or equal to? 3? First, the number of cards in the current card slot is greater than? 3? Zhang.

4. These two situations have been explained above. In the second case (the number of cards is greater than 3? Zhang) One more step is needed to adjust the position of the remaining cards forward.

5. First, two new global variables are added.

6. Number of cards removed: How many cards need to be removed at present? If there are only two cards in the card slot, how many cards are taken out? 2. If there are more than three cards in the card slot, what is the number? 3。

7. Card-breaking position: record the current card-breaking position, because there are only three cards at most, so this position is recorded as 1, 2? Or? 3。 Add two notifications.

8. Position adjustment of removed cards: after removing cards, notify the remaining cards to adjust their positions.

9. Take out the card from the slot: notify the card in the slot to be taken out.

10, and then take a look, we added two new resources to the scene.

1 1, one is the button to remove the props (here I use the container as the button), and the other is "Remove the card". Here we have created a new "card transfer" wizard, which is responsible for the function and logic of card transfer.

1? 2. Remember the separation of duties mentioned earlier? We created "cards" and "slot cards", which are responsible for displaying and picking up cards in the stacked layout, and "slot cards" are responsible for placing, eliminating and adjusting the positions of picked cards. They only need to deal with their own affairs, so it is the same for us to create a new "card transfer", just need to deal with the logic of card transfer.

Let's take a look at the specific implementation logic. The first is the building block logic on the "Remove Prop Button".