public Form1() { InitializeComponent(); this.ShowInTaskbar = false; ToolStripMenuItem v = new ToolStripMenuItem("退出", null, this.onExit); m_notifyMenu.Items.Add(v); // 关联快捷菜单 m_notify.ContextMenuStrip = m_notifyMenu; CheckForIllegalCrossThreadCalls = false; m_lblCurState.ForeColor = Color.Green; XmlConfig cfg = ResMgr.getInstance().getRes("dbserver.xml"); this.Text = "数据统计--" + cfg.getString("title", ""); m_notify.Text = this.Text; StatService sys = ServiceMgr.getInstance().getSys <StatService>(ServiceType.serviceTypeStat); if (sys != null) { sys.setForm(this); } }
// 退出应用程序 private void onExit(object sender, EventArgs e) { DialogResult result = MessageBox.Show("确定退出?", "确认", MessageBoxButtons.OKCancel); if (result == DialogResult.OK) { ServiceMgr.getInstance().exitService(); Application.Exit(); } }
static void Main() { LogMgr.init(); ResMgr.getInstance().reload(); ServiceMgr.getInstance().init(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); }
// 完成一个订单 public int completeOrder(OrderInfo info) { string cmd = string.Format(SQL_SEARCH_GM, TableName.GM_ACCOUNT, info.m_gmAcc); Dictionary <string, object> data = m_sqlDb.queryOne(cmd, CMySqlDbName.DB_XIANXIA); if (data == null) { return(RetCode.RET_NO_SUP_ACC); } string createCode = Convert.ToString(data["createCode"]); int depth = Convert.ToInt32(data["depth"]); long remainMoney = Convert.ToInt64(data["money"]); bool res = addOrderToMySql(info, createCode, remainMoney); if (!res) { return(RetCode.RET_DB_ERROR); } if (info.m_isApi) // 若是API发出的,需要回调 { string devKey = Convert.ToString(data["devSecretKey"]); ApiCallBackService sys = ServiceMgr.getInstance().getSys <ApiCallBackService>(ServiceType.serviceTypeApiCallBack); sys.addApiOrder(info, devKey); } forPlayerOrder(info); // 插入mysql成功,从mongodb里面删除 MongodbPlayer.Instance.ExecuteRemoveBykey(TableName.PLAYER_ORDER_REQ, "key", info.m_key); returnMoneyToGM(info); // 修改player_account的money临时字段,可以在后台随时查看分数 if (info.m_orderState == PlayerReqOrderState.STATE_FINISH) { // scoreLog(info, depth, createCode); // 上下分成功后,才会写日志 string upSql = string.Format(SQL_UPDATE_ONLINE_MONEY, TableName.PLAYER_ACCOUNT_XIANXIA, info.m_playerRemainMoney, info.m_playerAcc); m_sqlDb.executeOp(upSql, CMySqlDbName.DB_XIANXIA); } return(RetCode.RET_SUCCESS); }
// 退出应用程序 private void onExit(object sender, EventArgs e) { bool busy = ServiceMgr.getInstance().isBusy(); if (busy) { MessageBox.Show("当前系统忙碌,请稍候退出!", "确认", MessageBoxButtons.OK); return; } DialogResult result = MessageBox.Show("确定退出?", "确认", MessageBoxButtons.OKCancel); if (result == DialogResult.OK) { ServiceMgr.getInstance().exitService(); Application.Exit(); } }
static void Main() { LogMgr.init(); XmlConfig xml = ResMgr.getInstance().getRes("dbserver.xml"); int port = xml.getInt("exportPort", 60002); TcpServerChannel tcpChannel = new TcpServerChannel(port); RemotingConfiguration.RegisterWellKnownServiceType(typeof(ServersEngine), "ServersEngine", WellKnownObjectMode.Singleton); ChannelServices.RegisterChannel(tcpChannel, false); ServiceMgr.getInstance().init(); ServersEngine.s_callService = ServiceMgr.getInstance().doService; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); }
public Form1() { InitializeComponent(); this.ShowInTaskbar = false; ToolStripMenuItem v = new ToolStripMenuItem("退出", null, this.onExit); m_notifyMenu.Items.Add(v); // 关联快捷菜单 m_notify.ContextMenuStrip = m_notifyMenu; CheckForIllegalCrossThreadCalls = false; StatWinLoseService sys = ServiceMgr.getInstance().getSys <StatWinLoseService>(ServiceType.serviceTypeWinLose); sys.setForm(this); m_lblCurState.ForeColor = Color.Green; }
// 开始检测收支平衡 private void btnCheck_Click(object sender, EventArgs e) { StatService stat = ServiceMgr.getInstance().getSys <StatService>(ServiceType.serviceTypeStat); if (stat.isBusy()) { MessageBox.Show("忙碌中,请稍候"); return; } int playerId = 0; if (!int.TryParse(txtPlayerId.Text, out playerId)) { MessageBox.Show("玩家ID非法"); return; } DateTime mint = DateTime.Now, maxt = DateTime.Now; bool res = Tool.splitTimeStr(txtGameTime.Text, ref mint, ref maxt); if (!res || mint.AddDays(1) != maxt) { MessageBox.Show("游戏时间非法"); return; } ParamCheck param = new ParamCheck(); param.m_gameId = StrName.s_onlineGameIdList[m_gameList.SelectedIndex]; param.m_playerId = playerId; param.m_startTime = mint; param.m_endTime = maxt; param.m_itemId = s_itemId[m_moneyType.SelectedIndex]; param.m_from = this; stat.startCheck(param); }