Unity QFramework

1.
mModel = this.GetModel<ICounterAppModel>();

2.
public static class CanGetModelExtension
{
    
    
     public static T GetModel<T>(this ICanGetModel self) where T : class, IModel
     {
    
    
         return self.GetArchitecture().GetModel<T>();
     }
}

3.
public IArchitecture GetArchitecture()
{
    
    
	return CounterApp.Interface;
}
     
4.
public static IArchitecture Interface
{
    
    
    get
    {
    
    
        if (mArchitecture == null)
        {
    
    
            MakeSureArchitecture();
        }

        return mArchitecture;
    }
}

5.
 static void MakeSureArchitecture()
 {
    
    
     if (mArchitecture == null)
     {
    
    
         mArchitecture = new T();
         mArchitecture.Init();
         
6.
protected override void Init()
{
    
    
     // 注册 System 
     this.RegisterSystem<IAchievementSystem>(new AchievementSystem()); 

猜你喜欢

转载自blog.csdn.net/qq_38913715/article/details/127872030