Example #1
0
    private void Start()
    {
        skt = new PENet.PESocket <ClientSession, NetMsg>();
        skt.StartAsClient(IPCfg.srvIP, IPCfg.srvPort);

        skt.SetLog(true, (string msg, int lv) => {
            switch (lv)
            {
            case 0:
                msg = "Log:" + msg;
                Debug.Log(msg);
                break;

            case 1:
                msg = "Warn:" + msg;
                Debug.LogWarning(msg);
                break;

            case 2:
                msg = "Error:" + msg;
                Debug.LogError(msg);
                break;

            case 3:
                msg = "Info:" + msg;
                Debug.Log(msg);
                break;
            }
        });
    }
Example #2
0
    private void Start()
    {
        //启动客户端
        client = new PENet.PESocket <ClientSeesion, NetMsg>();
        client.StartAsClient(IPCfg.srvIP, IPCfg.srvPort);

        client.SetLog(true, (string msg, int lv) =>
        {
            switch (lv)
            {
            case 0:
                msg = "log" + msg;
                Debug.Log(msg);
                break;

            case 1:
                msg = "war" + msg;
                Debug.LogWarning(msg);
                break;

            case 2:
                msg = "err" + msg;
                Debug.LogError(msg);
                break;

            case 3:
                msg = "info" + msg;
                Debug.Log(msg);
                break;
            }
        });
    }
Example #3
0
    ///服务初始化
    public void InitSvc()
    {
        instance = this;

        client = new PENet.PESocket <ClientSession, GameMsg>();
        //日志输出设置
        client.SetLog(true, (string msg, int lv) =>
        {
            switch (lv)
            {
            case 0:
                msg = "Log:" + msg;
                Debug.Log(msg);
                break;

            case 1:
                msg = "Warn:" + msg;
                Debug.LogWarning(msg);
                break;

            case 2:
                msg = "Error:" + msg;
                Debug.LogError(msg);
                break;

            case 3:
                msg = "Info:" + msg;
                Debug.Log(msg);
                break;
            }
        });

        client.StartAsClient(SrvCfg.srvIP, SrvCfg.srvPort);
    }
Example #4
0
    public void InitSvc()
    {
        Instance = this;

        client = new PENet.PESocket <ClientSession, GameMsg>();
        client.SetLog(true, (string msg, int lv) => {
            switch (lv)
            {
            case 0:
                msg = "Log:" + msg;
                Debug.Log(msg);
                break;

            case 1:
                msg = "Warn:" + msg;
                Debug.LogWarning(msg);
                break;

            case 2:
                msg = "Error:" + msg;
                Debug.LogError(msg);
                break;

            case 3:
                msg = "Info:" + msg;
                Debug.Log(msg);
                break;

            default:
                break;
            }
        });
        client.StartAsClient(SrvCfg.srvIP, SrvCfg.srvPort);
        Common.Log(GetType() + "/InitSvc()/Init NetSvc...");
    }