"The Legend of the Furnace Stone" Architectural Design Appreciation (6): Card & Organizational ability when executing data

Source: Internet
Author: User

The previous article we saw the "furnace Stone Legend" core memory card data, today, we continue to explore the card & skill.


Basic classes through previous analysis, cards & skills involve several class systems: Entity. Actor. Card. Spell, it is very confusing, especially the former two. Here the basic positioning of these classes is slightly arbitrary:
    • Entity is mainly used to do network data synchronization;
    • The actor mainly handles the control of the client's render object, which is mounted as a component on the resource object;
    • Spell is the script that the skill prefab mounts.
    • Card is a script that is mounted on a prefab. In the implementation of the central position to deal with the first 3 contacts.

Entity
    • Entity is created through network data, mainly Network.PacketID.POWER_HISTORY this message.

      See gamestate.createnewentities () function. Because entity is not a monobehavior derived class. So is new out, and then added to the GameState management (Gamestate.addentity ()), the network came from the entity data is mainly tags (each tag is a name->value pair). Then call Entity.initentity ();

Actor
    • Actor is also a resource, loaded through Assetloader.loadactor ();
    • corresponding to Assetfamily.actor.
    • The corresponding resource bundle is "actor?". Unity3d ", in the package for the Gameobject;
    • The actor's loading entry is in: Card.determineactorthentransitiontozone ()
Spell
    • The loading entrance of the spell is at Entity.processcarddefassetrequest ()
Card
    • Called Entity.initcard () in initentity, it does the job of simply creating an empty gameobject, and then using addcomponent to add the card.
    • The real card prefab is loaded in Entity.loadcard (), which is called in gamestate.onshowentity () when processing powertask.
    • The detailed loading is done through Defloader.loadcarddef (). It internally calls Assetloader.loadcardprefab () for resource onboarding.
Card & Skill loading process entity creation, as well as card, spell loading, are triggered by the network message, the whole process is more complex, mainly there are very many asynchronous callbacks. More difficult to describe in words. Please see:

Watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvtmvpbdne/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70 /gravity/southeast ">

Copyright notice: This article Bo Master original articles, blogs, without consent may not be reproduced.

"The Legend of the Furnace Stone" Architectural Design Appreciation (6): Card & Organizational ability when executing data

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.