Пример #1
0
    private static void Logined(Dictionary <string, MsgPack.MessagePackObject> dic, System.Action <bool, string> f)
    {
        MsgPack.MessagePackObject tmp;
        dic.TryGetValue("status", out tmp);
        int status = tmp.AsInt32();

        if (status == 0)
        {
            dic.TryGetValue("ip", out tmp);
            string ip = tmp.AsString();
            dic.TryGetValue("port", out tmp);
            int port = tmp.AsInt32();
            NetWork.ConnectNode(ip, port);
            dic.TryGetValue("token", out tmp);
            string token = tmp.AsString();
            NetWork.token = token;
            NetWork.StartPing();
            f.Invoke(true, "");
        }
        else
        {
            dic.TryGetValue("error", out tmp);
            string error = tmp.AsString();
            f.Invoke(false, error);
        }
    }