private void onEditButtonClicked(string name) { var dialog = new UIConfirmDialog(gameSystem, "confirm", "edit game world?"); dialog.okButtonClicked = () => { dialog.Close(); uiEditGameWorldDialog.Close(); gameSystem.sceneToWaiting(); Task.Run(async() => { try { var gw = await GameWorldHelper.loadGameWorldData <GameWorldSystem>(name); gw.camera = new Camera(gameSystem.option.screenWidth, gameSystem.option.screenHeight); gameSystem.dispatchSceneToEditGame(gw); } catch (Exception e) { Debug.WriteLine(e); throw; } }); }; dialog.ShowDialog(formMain); }
private void onRemoveButtonClicked(string code) { var name = gameSystem.currentPlayer.servers.SingleOrDefault(o => o.code == code).name; var dialog = new UIConfirmDialog(gameSystem, "confirm", $"remove {name} ?"); dialog.okButtonClicked = () => { gameSystem.currentPlayer.servers.RemoveAll(o => o.code == code); PlayerHelper.savePlayer(gameSystem.players); loadGameServerList(); dialog.Close(); }; dialog.ShowDialog(formMain); }
private void onRemoveButtonClicked(string name) { if (string.IsNullOrWhiteSpace(name)) { return; } var dialog = new UIConfirmDialog(gameSystem, "confirm", $"remove player {name} ?"); dialog.okButtonClicked = () => { gameSystem.players.RemoveAll(o => o.name == name); PlayerHelper.savePlayer(gameSystem.players); uiPlayerDialog.setData(gameSystem.players.Select(o => o.name).ToList()); dialog.Close(); }; dialog.ShowDialog(formMain); }
private void onRemoveButtonClicked(string name) { var dialog = new UIConfirmDialog(gameSystem, "confirm", "delete?"); dialog.okButtonClicked = () => { dialog.Close(); try { GameWorldHelper.delete(name); } catch (Exception e) { MessageBox.Show("create_failed:" + e.Message); return; } _ = loadGameWorldMapList(); }; dialog.ShowDialog(formMain); }