/// <summary> ///初始化 /// </summary> public override void Init() { //TODO //一般情况下 打开unity.或者reloadAssembly 会重新初始化框架 //但是ExitPlaymode后不会触发ReloadAssembly,所以有些静态对象会缓存 if (MainLayer != null) { // Debug.LogError("已经执行过Awake -" + this.GetHashCode()); return; } base.Init(); // MainLayer = this.AddLayer(); // foreach (var classData in this.GetAllClassDatas()) { var attr = classData.Attribute as ScreenViewAttribute; var sv = CreateInstance <IScreenView>(attr.IntTag); //设置name属性 sv.Name = attr.IntTag; MainLayer.RegisterScreen(sv); // //BDebug.Log("创建screen:" + attr.IntTag, "green"); } }
/// <summary> ///初始化 /// </summary> public override void Init() { if (MainLayer != null) { Debug.LogError("已经执行过Awake"); return; } base.Init(); // MainLayer = this.AddLayer(); // foreach (var classData in this.ClassDataMap.Values) { var attr = classData.Attribute as ScreenViewAttribute; var sv = CreateInstance <IScreenView>(attr.Tag); //设置name属性 var t = sv.GetType(); t.GetProperty("Name").SetValue(sv, attr.Tag, null); MainLayer.RegScreen(sv); // BDebug.Log("创建screen:" + attr.Tag, "green"); // if (attr.IsDefault && string.IsNullOrEmpty(defaultScreenName) == true) { defaultScreenName = attr.Tag; } } }
//委托的变量是函数指针,委托Action<Exception>里面的Exception就是函数的参数 /// <summary> /// 导航任务构造函数 /// </summary> /// <param name="type">导航任务类型枚举</param> /// <param name="view">导航任务关联的IScreenView</param> /// <param name="_callback">导航任务关联的回调函数</param> /// <param name="layer">导航任务关联的ScreenViewLayer</param> public NavTask(NavTaskType type, IScreenView view, Action <Exception> _callback, ScreenViewLayer layer) { this.type = type; this.view = view; this.callback = _callback; this.layer = layer; }
/// <summary> ///初始化 /// </summary> public override void Init() { if (MainLayer != null) { Debug.LogError("已经执行过Awake"); return; } base.Init(); // MainLayer = this.AddLayer(); // foreach (var classData in this.GetAllClassDatas()) { var attr = classData.Attribute as ScreenViewAttribute; var sv = CreateInstance <IScreenView>(attr.IntTag); //设置name属性 var t = sv.GetType(); t.GetProperty("Name").SetValue(sv, attr.IntTag, null); MainLayer.RegisterScreen(sv); // BDebug.Log("创建screen:" + attr.IntTag, "green"); } }
public ScreenViewLayer AddLayer() { ScreenViewLayer layer = null; layer = new ScreenViewLayer(this.screenViewList.Count); this.screenViewList.Add(layer); return(layer); }
/// <summary> ///唤起 /// </summary> public override void Awake() { if (mainLayer != null) { Debug.LogError("已经执行过Awake"); return; } base.Awake(); screenViewCenter.AddLayer(); mainLayer = screenViewCenter.GetLayer(0); // string defaultLayer = null; // foreach (var classData in this.ClassDataMap.Values) { var attr = classData.Attribute as ScreenViewAttribute; var sv = GetTypeInst <IScreenView>(attr.Name); //设置name属性 sv.GetType().GetProperty("Name").SetValue(sv, attr.Name, null); mainLayer.RegScreen(sv); // BDeBug.I.Log("创建screen:" + attr.Name, Styles.Color.Green); // if (attr.isDefault) { defaultLayer = attr.Name; } } if (string.IsNullOrEmpty(defaultLayer) == false) { mainLayer.BeginNavTo(defaultLayer); } else { BDeBug.I.Log("没有默认导航的ScreenView"); } }
public void BeginInit(Action <Exception> onInit, ScreenViewLayer layer) { appdomain.Invoke(methodMap["BeginInit"], this.ilrobject, new object[] { onInit, layer }); }