public FPanel OpenPanel(Type type) { FPanel panel = GetPanel(type); if (null == panel) { var pinfo = pinfoByType[type]; var component = UIPackage.CreateObject(pinfo.package, pinfo.type.Name) as GComponent; layers[(int)pinfo.layer].AddChild(component); panel = Activator.CreateInstance(type) as FPanel; panel.Init(component); panels.Add(type, panel); } panel.Visible = true; return(panel); }
public void ClosePanel(Type type, bool destroy = false) { FPanel panel = GetPanel(type); if (null != panel) { if (destroy) { panel.Dispose(); panels.Remove(type); } else { panel.Visible = false; } } }