# UMVC **Repository Path**: code_livestock/UMVC ## Basic Information - **Project Name**: UMVC - **Description**: MVC Pattern Framework for Unity3d GUI System (UGUI) - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-03-10 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # UMVC === MVC Pattern Framework for Unity3d GUI System ![Diagram](/Pic/Diagram.png) ### Model * Holds no view data nor view state data. * Is accessed by the `Controller` and other `Models` only * Will trigger events to notify external system of changes. ### View * UGUI Prefabs ### Presenter * Each Presenter corresponds to a View * Holds references to elements needed for drawing * Receive User Input * Notify `Controller` when an user input * This script is a UI refresh operation function set ### Controller * Controls view flow. * Holds the application state needed for that view * Will trigger events to notify external system of changes. * Handles events either triggered by the player in the `View` or triggered by the `Models` * Each Controller corresponds to a Presenter and holds the reference of it's `Presenter`   * Holds the references of the small `Controllers` under this controller ### NotificationCenter * A notification dispatch mechanism that enables the broadcast of information to registered observers. * Add observer in `Controllers` * Post notifications in `Models` ``` void Start() { NotificationCenter.DefaultCenter.AddObserver(this, "UserDataChanged", UserDataChanged); } void OnDestroy() { NotificationCenter.DefaultCenter.RemoveObserver(this, "UserDataChanged"); } ``` ### Create Controller and Presenter from Template * Click menu `Template Scripts` and `Create` * Type class name and namespace * Then it will create two scripts, one `Controller` and one `Presenter` ![Diagram](/Pic/EditorTool.png)