/// <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; } } }
/// <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"); } }