MVC Pattern Framework for Unity3d GUI System (UGUI)
Switch branches/tags
Clone or download
Latest commit 22dfc95 Feb 9, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.vs/ShipHunter 2.0/v15 remove dir Feb 8, 2018
.vscode remove dir Feb 8, 2018
Assets eg add Feb 8, 2018
Library remove dir Feb 8, 2018
Pic update pic Feb 8, 2018
ProjectSettings remove dir Feb 8, 2018
obj/Debug add pic Feb 8, 2018
Assembly-CSharp-Editor.csproj remove dir Feb 8, 2018
Assembly-CSharp.csproj remove dir Feb 8, 2018
LICENSE Create LICENSE Feb 9, 2018
README.md update readme Feb 8, 2018
UMVC.sln remove dir Feb 8, 2018

README.md

UMVC

=== MVC Pattern Framework for Unity3d GUI System

Diagram

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