Architectural Design appreciation of hearth stone (6): organization of cards and skill data during operation,

Source: Internet
Author: User

Architectural Design appreciation of hearth stone (6): runtime organization of card and skill data,

In the previous article, we saw the storage of core card data in hearth stone. Today we continue to explore Cards & skills.


Through previous analysis, the main classes involved several classes of cards and Skills: Entity, Actor, Card, and Spell, which are very confusing, especially the first two. Here we will explain the basic positioning of these classes in a slightly arbitrary way:
  • Entity is mainly used for network data synchronization;
  • Actor is mainly used to control rendering objects on the client, and is mounted as a Component on the resource object;
  • Spell is the script for skill Prefab mounting;
  • Card is a script mounted to the Card Prefab. It is in a central position during runtime and handles the contact between the first three users.
Entity
  • Entity is created through Network data, mainly the Message Network. PacketID. POWER_HISTORY. For details, see the GameState. CreateNewEntities () function. Because Entity is not a MonoBehavior derived class, it is new and then added to GameState for Management (GameState. addEntity (), the Entity data sent from the network is mainly Tags (each Tag is a name-> value Pair), and then calls Entity. initEntity ();
Actor
  • Actor is also a resource that is loaded through AssetLoader. LoadActor;
  • Corresponds to AssetFamily. Actor;
  • The corresponding resource package is "actor ?. Unity3d ", the package is GameObject;
  • The Actor loading entry is in: Card. DetermineActorThenTransitionToZone ()
Spell
  • The Spell loading entry is in Entity. ProcessCardDefAssetRequest ()
Card
  • Entity. InitCard () is called in InitEntity. It only creates an empty GameObject and adds the Card with AddComponent.
  • The real card Prefab is loaded in Entity. LoadCard (). This function is called in GameState. OnShowEntity () when processing PowerTask;
  • The specific loading operation is carried out through DefLoader. LoadCardDef (), and it calls AssetLoader. LoadCardPrefab () internally to load resources;
The creation of Entity in Card and skill loading processes and Card and Spell loading are all triggered by network messages. The whole process is complicated, mainly because there are many asynchronous callbacks, it is difficult to use text descriptions. See:

What are the different card types in legend of hearth stone?

In Firestone, once you choose the hero you want to use, you can use three cards to build your deck: spells, weapons, and followers. Each card type has two levels: "Basic Level" and "expert level.
 
The legend of hearth stone matches friends with incomplete cards

That's the card you got. If you want to use it, click my favorites. There is a new set of cards in it, and add the cards you want to use (up to 30 cards) to it. Then you can use them.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.