private T Load <T>(string name, Type implType) where T : UIPanel { T ui = default(T); GameObject original = UIRes.LoadPrefab(name); if (original != null) { GameObject go = GameObject.Instantiate(original); ui = go.GetComponent <T>(); if (ui == null) { try { ui = go.AddComponent(implType) as T; } catch (Exception e) { Debug.LogError("无法自动添加抽象的UIPanel"); } } if (ui != null) { go.name = GetShortUIName(name); UIRoot.AddChild(ui); } else { Debug.LogError("Prefab没有增加对应组件: " + name); } } else { Debug.LogError("Res Not Found: " + name); } return(ui); }