private void Start()
        {
            m_EventComponent = GameEntry.GetComponent <EventComponent>();
            if (m_EventComponent == null)
            {
                Log.Fatal("Event component is invalid.");
                return;
            }

            NetworkHelperBase networkHelper = Helper.CreateHelper(m_NetworkHelperTypeName, m_CustomNetworkHelper);

            if (networkHelper == null)
            {
                Log.Error("Can not create network helper.");
                return;
            }

            networkHelper.name = string.Format("Network Helper");
            Transform transform = networkHelper.transform;

            transform.SetParent(this.transform);
            transform.localScale = Vector3.one;

            m_NetworkManager.SetNetworkHelper(networkHelper);

            for (int i = 0; i < m_NetworkChannels.Count; i++)
            {
                m_NetworkChannels[i].SetNetworkChannel(m_NetworkManager.CreateNetworkChannel(m_NetworkChannels[i].Name));
            }
        }
예제 #2
0
 /// <summary>
 /// 创建网络频道。
 /// </summary>
 /// <param name="name">网络频道名称。</param>
 /// <param name="serviceType">网络服务类型。</param>
 /// <param name="networkChannelHelper">网络频道辅助器。</param>
 /// <returns>要创建的网络频道。</returns>
 public INetworkChannel CreateNetworkChannel(string name, ServiceType serviceType, INetworkChannelHelper networkChannelHelper)
 {
     return(m_NetworkManager.CreateNetworkChannel(name, serviceType, networkChannelHelper));
 }
예제 #3
0
 /// <summary>
 /// 创建网络频道。
 /// </summary>
 /// <param name="name">网络频道名称。</param>
 /// <returns>要创建的网络频道。</returns>
 public INetworkChannel CreateNetworkChannel(string name)
 {
     return(m_NetworkManager.CreateNetworkChannel(name));
 }