public MainForm() { InitializeComponent(); player = (PlayerBean)Data.Get("player"); world = (WorldBean)Data.Get("world"); account = (BankAccountBean)Data.Get("account"); }
private void ButtonEnterWorld_Click(object sender, System.EventArgs e) { PlayerBean player = (PlayerBean)comboBoxSelectPlayer.SelectedItem; WorldBean world = (WorldBean)comboBoxSelectWorld.SelectedItem; BankAccountBean account = bankAccountDAO.GetByPlayerIdAndWorldId(player.Id, world.Id); if (player == null) { MessageBox.Show("请选择玩家"); return; } if (world == null) { MessageBox.Show("请选择世界"); return; } if (account == null) { account = new BankAccountBean() { PlayerId = player.Id, WorldId = world.Id }; bankAccountDAO.Insert(account); } Data.Set("player", player); Data.Set("world", world); Data.Set("account", account); Data.Set("system_account", bankAccountDAO.GetById(0)); Data.Set("form", new MainForm()); Dispose(); }