Exemplo n.º 1
0
 public virtual bool Register <T>(T module)
 {
     if (module is IInit)
     {
         IInit v = (IInit)module;
         v.Init();
     }
     if (module is IUpdate)
     {
         IUpdate v = (IUpdate)module;
         if (!m_UpdateList.Contains(v))
         {
             m_UpdateList.Add(v);
         }
     }
     if (module is IDestroy)
     {
         IDestroy v = (IDestroy)module;
         if (!m_DestroyList.Contains(v))
         {
             m_DestroyList.Add(v);
         }
     }
     return(true);
 }
Exemplo n.º 2
0
        // Start is called before the first frame update
        void Start()
        {
            //DataMgr.Instance.ClearAll();  // 数据修改的时候,作为清空重新加载使用

            GameStateModel.Instance.CurrentScene = SceneName.Main;
            IInit lifeCycle = LifeCycleMgr.Instance;

            lifeCycle.Init();

            AudioMgr.Instance.Init();

            UIMgr.Instance.Show(Paths.START_VIEW);
        }
    private IEnumerator Init()
    {
        yield return(TestMgr.Single.Init());

        //DataMgr.Single.ClearAll();
        GameStateModel.Single.CurrentScene = SceneName.Main;
        IInit lifeCycle = LifeCycleMgr.Single;

        lifeCycle.Init();

        UIManager.Single.Show(Paths.PREFAB_START_VIEW);

        DontDestroyOnLoad(gameObject);
    }
Exemplo n.º 4
0
        private Page GetView <TVM, TParameter>(TParameter param)
        {
            Type viewType;

            if (!_viewModelPageMapping.TryGetValue(typeof(TVM), out viewType))
            {
                throw new ArgumentException($"could not find view for {typeof(TVM)}");
            }
            var viewModel = _container.Resolve <TVM>();
            // get view ctor with no parameters
            var ctors    = viewType.GetTypeInfo().DeclaredConstructors;
            var viewCtor = viewType.GetTypeInfo().DeclaredConstructors.FirstOrDefault(ct => ct.GetParameters().Length == 0);
            var view     = viewCtor.Invoke(null) as Page;

            view.BindingContext = viewModel;
            IInit <TParameter> init = viewModel as IInit <TParameter>;

            if (init != null)
            {
                init.Init(param);
            }

            return(view);
        }