void LoadAssetComplete(string sourceName, GameObject Obj) { //UIdata data = tdata as UIdata; UIdata data = null; GameObject gameobject = Obj; if (gameobject == null) { Loger.Error("Instantiate failed " + data.config.Prefab); } gameobject.transform.SetParent(GetParent(data.config.UI_Type)); gameobject.transform.localScale = Vector3.one; gameobject.transform.localRotation = Quaternion.identity; gameobject.layer = LayerMask.NameToLayer("UI"); int count = GetCountByUIType(data.config.UI_Type); gameobject.transform.localPosition = new Vector3(0, 0, m_StartDepth * (int)data.config.UI_Type + count * m_depth); //检测是否添加Canvas CheckCanvas(gameobject); //检测是否添加配置表对应的Script WindowBase wdbase = clazzAdder.AddClazz(gameobject, data.config.Script); //初始化 wdbase.F_SetId(data.id, data.config.E_ui, data.config.UI_Type); if (m_DataModule.ContainsKey(data.id) && m_DataModule[data.id] == data) { m_DataModule[data.id].windowBase = wdbase; m_UIList.Add(data.id, wdbase); m_EUIToIdDec[data.config.E_ui].Add(data.id); try { wdbase.F_InitPos(); wdbase.F_OnInit(); wdbase.F_IsInit(); wdbase.RegisterEvent(); wdbase.F_OnData(data.obj); wdbase.F_AddSound(); } catch (Exception e) { Loger.Error(e); } } else { Unload(wdbase); } //设置深度 ResetDepth(data.config.UI_Type); //是否添加遮罩 SetFullScreenMask((MaskType)data.config.ShowMask); TransformUtil.ChangeLayer(wdbase.transform, 5, 0); //回调 if (data.onComplete != null) { data.onComplete(wdbase); } }