// 默认方式创建给定模块 static T BC <T>() where T : Component, new() { var c = new T(); srv.Add(typeof(T).Name, c); return(c); }
public static void BuildBussinessLoggers(GameServer srv) { ServerBusinessLoggerConfig.Config("scm_log", "127.0.0.1", "root", "123456"); srv.Add("LoginLog", new ServerBusinessLogger <LoginInfo>()); // 登录日志 srv.Add("BattleLog", new ServerBusinessLogger <BattleInfo>()); // 战斗日志 }
public static void BuildQuestionnaire(GameServer srv) { BC <QuestionnaireMgr>(); // 问卷调查 BC <QuestionnaireResultMgr>(); // 问卷调查 var qrc = new QuestionnaireResultContainer(new MySqlDbPersistence <QuestionnaireResult, string>( "scm_qr", "127.0.0.1", "root", "123456", @"Qa", "CREATE TABLE Qa(ID VARCHAR(100) BINARY, Data MediumBlob," + "PRIMARY KEY(ID ASC));", null, (da) => { var buff = new WriteBuffer(); da.Serialize(buff); return(buff.Data); }, (data) => { var rb = new RingBuffer(data); var qr = new QuestionnaireResult(); qr.Deserialize(rb); return(qr); }, null)); srv.Add("QuestionnaireResultContainer", qrc); }