// Constructor 1#: Used for Hall setting public XIVisi(ushort uid, string name, int teamCode, Base.VW.IVI vi, string server, int room, bool record, bool logmsg, bool watcher, AoDisplay ad) { this.auid = uid; this.name = name; this.VI = vi as VW.Cyvi; hopeTeam = teamCode; this.server = server; this.Room = room; this.port = Base.NetworkCode.HALL_PORT + room; this.ad = ad; VW.Bywi bywi = new VW.Bywi(server, port, name, avatar, hopeTeam, uid, this); Log = new ClLog(); Log.Start(auid, record, logmsg, 0); bywi.Log = Log; CommonConstruct(); //if (VI is VW.Ayvi) // (VI as VW.Ayvi).Log = Log; WI = bywi; if (!bywi.StartConnect(watcher)) (vi as VW.Cyvi).ReportFlashQuitError(); if (watcher) Uid = bywi.Uid; VI.Cout(uid, watcher ? "您开始旁观~" : "游戏开始咯~"); isReplay = false; }
// Constructor 4#: Used for ResumeHall // passCode is the password for a settled room private XIVisi(ushort newUid, ushort oldUid, string name, Base.VW.IVI vi, string server, int room, string passCode, bool record, bool msglog, AoDisplay ad) { this.auid = newUid; this.name = name; this.VI = vi as VW.Cyvi; this.server = server; this.Room = room; this.port = Base.NetworkCode.HALL_PORT + room; this.ad = ad; VW.Bywi bywi = new VW.Bywi(server, port, name, avatar, hopeTeam = 0, newUid, this); Log = new ClLog(); Log.Start(auid, record, msglog, 0); bywi.Log = Log; VI.Log = Log; WI = bywi; CommonConstruct(); bywi.StartConnectResume(oldUid, passCode); // After that, Uid get updated. this.Uid = bywi.Uid; VI.Cout(Uid, "游戏继续啦~"); isReplay = false; }
// Constructor 2#: Used for Direct Connection private XIVisi(string server, int port, string name, int avatar, int hopeTeam, bool record, bool watcher, bool msglog, AoDisplay ad) { this.server = server; this.port = port; this.name = name; this.avatar = avatar; this.hopeTeam = hopeTeam; VI = new VW.Cyvi(ad); VI.Init(); VI.SetInGame(true); VW.Bywi bywi = new VW.Bywi(server, port, name, avatar, hopeTeam, 0, this); WI = bywi; this.ad = ad; Log = new ClLog(); Log.Start(Uid, record, msglog, 0); CommonConstruct(); if (!bywi.StartConnectDirect(watcher, VI)) { VI.Cout(Uid, "咦,您是不是掉线或者连错人了:-("); auid = 0; return; } VI.Cout(Uid, watcher ? "您开始旁观~" : "游戏开始咯~"); this.auid = bywi.Uid; if (watcher) Uid = bywi.Uid; bywi.Log = Log; VI.Log = Log; WI.Send("C2ST," + Uid, Uid, 0); isReplay = false; }