예제 #1
0
 protected override void OnSessionClosed(CloseReason reason)
 {
     #if KCP
     KCPUpdate.GetInstance().Remove(Update);
     #endif
     base.OnSessionClosed(reason);
 }
예제 #2
0
    protected override void OnSessionStarted()
    {
        base.OnSessionStarted();
        Debug.Log("OnSessionStarted ");
#if KCP
        if (s_protocolInfo == null)
        {
            s_protocolInfo = ReadProtocolInfo(FileTool.ReadStringByFile(Environment.CurrentDirectory + "/Network/" + c_ProtocolFileName + ".txt"));
            ReadMethodNameInfo(
                out s_methodNameInfo,
                out s_methodIndexInfo,
                FileTool.ReadStringByFile(Environment.CurrentDirectory + "/Network/" + c_methodNameInfoFileName + ".txt"));
        }

        init_kcp((UInt32) new Random((int)DateTime.Now.Ticks).Next(1, Int32.MaxValue));
        KCPUpdate.GetInstance().Add(Update);
#endif
    }