Beispiel #1
0
        // Constructor 1#: Used for Hall setting
        public XIClient(ushort uid, string name, int teamCode, Base.VW.IVI vi,
            string server, int room, bool record, bool msglog, bool watcher)
        {
            joined = false;
            this.auid = uid; this.name = name; this.VI = vi;
            hopeTeam = teamCode;
            this.server = server;
            this.Room = room;
            this.port = Base.NetworkCode.HALL_PORT + room;

            VW.Bywi bywi = new VW.Bywi(server, port, name, avatar, hopeTeam, uid);
            Log = new ClLog(); Log.Start(auid, record, msglog, 0);
            bywi.Log = Log;
            if (VI is VW.Ayvi)
                (VI as VW.Ayvi).Log = Log;
            WI = bywi;
            if (!bywi.StartConnect(watcher))
            {
                VI.Cout(Uid, "哦我的上帝,真不敢想象连接竟然失败了。");
                auid = 0; return;
            }
            VI.Cout(Uid, watcher ? "您开始旁观~" : "游戏开始咯~");
            CommonConstruct();
        }
Beispiel #2
0
        // Constructor 3#: Used for Direct Connection
        private XIClient(string server, int port, string name,
            int avatar, int hopeTeam, bool record, bool msglog, bool watcher)
        {
            joined = false;
            this.server = server; this.port = port;
            this.name = name; this.avatar = avatar;
            this.hopeTeam = hopeTeam;

            VW.Ayvi ayvi = new VW.Ayvi();
            VI = ayvi;
            VI.Init(); ayvi.SetInGame(true);
            VW.Bywi bywi = new VW.Bywi(server, port, name, avatar, hopeTeam, 0);
            WI = bywi;

            Log = new ClLog(); Log.Start(Uid, record, msglog, 0);
            if (!bywi.StartConnectDirect(watcher, VI))
            {
                VI.Cout(Uid, "咦,您是不是掉线或者连错人了:-(");
                auid = 0; return;
            }
            VI.Cout(Uid, watcher ? "您开始旁观~" : "游戏开始咯~");
            this.auid = bywi.Uid;
            bywi.Log = Log; ayvi.Log = Log;
            WI.Send("C2ST," + Uid, Uid, 0);
            CommonConstruct();
        }
Beispiel #3
0
        // Constructor 4#: Used for ResumeHall
        // passCode is the password for a settled room
        private XIClient(ushort newUid, ushort oldUid, string name, Base.VW.IVI vi,
            string server, int room, string passCode, bool record, bool msglog)
        {
            joined = false;
            this.auid = newUid;
            this.name = name; this.VI = vi;
            this.server = server;
            this.Room = room;
            this.port = Base.NetworkCode.HALL_PORT + room;

            VW.Bywi bywi = new VW.Bywi(server, port, name, avatar, hopeTeam = 0, newUid);
            Log = new ClLog(); Log.Start(auid, record, msglog, 0);
            bywi.Log = Log;
            if (VI is VW.Ayvi)
                (VI as VW.Ayvi).Log = Log;
            WI = bywi; bywi.StartConnectResume(oldUid, passCode);
            // After that, Uid get updated.
            this.Uid = bywi.Uid;
            VI.Cout(Uid, "游戏继续啦~");

            CommonConstruct();
        }