private T LoadUI <T>(string resName) where T : UIPanel { T ui = (T)FindUI(resName); if (ui == null) { GameObject original = UIRes.LoadPrefab(resName); if (original != null) { GameObject go = GameObject.Instantiate(original); ui = go.EnsureAddComponent <T>(); if (ui != null) { go.name = resName; UIRoot.AddChild(ui, ui.UILayer); m_mapLoadedPanel.Add(resName, ui); } else { LogMgr.LogError("No Find Component<{0}>", typeof(T).Name); } } else { LogMgr.LogError("Res Not Found: {0}", resName); } } return(ui); }
public static GameObject GetLayer(string layerName) { if (m_dicLayer == null) { m_dicLayer = new Dictionary <string, GameObject>(); } GameObject layer; if (!m_dicLayer.ContainsKey(layerName)) { layer = Find(layerName); if (layer != null) { m_dicLayer[layerName] = layer; } else { LogMgr.LogError("UIRoot@GetLayer, {0} Is Not Exist!", layerName); } } else { layer = m_dicLayer[layerName]; } return(layer); }
public void RegisterCommand(string commandName) { Type type = Type.GetType(m_domain + "." + commandName); if (type == null) { LogMgr.LogError("Register Command<{0}> Type Not Exist!", commandName); return; } m_controller.RegisterCommand(type); }
public ManagerModule CreateManager(string mgrName) { if (this.GetManager(mgrName) != null) { LogMgr.LogError("The Manager<{0}> Has Existed!", mgrName); return(null); } Type type = Type.GetType(m_domain + "." + mgrName); if (type == null) { LogMgr.LogError("The Manager<{0}> Type Is Error!", mgrName); return(null); } return(AddManager(type)); }
public void ReleaseModule(BusinessModule module) { if (module != null) { if (m_mapModules.ContainsKey(module.Name)) { LogMgr.Log("ReleaseModule name = {0}", module.Name); m_mapModules.Remove(module.Name); module.Release(); } else { LogMgr.LogError("模块不是由ModuleManager创建的! name = {0}", module.Name); } } else { LogMgr.LogError("module = null!"); } }
private void SendConnect_Thread(string ip, int port) { AddressFamily net_type = AddressFamily.InterNetwork; if (this.m_is_ipv6) { net_type = AddressFamily.InterNetworkV6; } try { this.mSock = new Socket(net_type, SocketType.Stream, ProtocolType.Tcp); this.mSock.NoDelay = true; this.mSock.LingerState = new LingerOption(false, 0); this.mSock.SendTimeout = 1000; this.mSock.ReceiveBufferSize = 8192; this.mSock.BeginConnect(IPAddress.Parse(ip), port, new AsyncCallback(this.OnConnectThread), this); } catch (Exception e) { this.Close(); LogMgr.LogError("network connect error:" + e.Message); } }