public ActionResult CreateGame(InitViewModel inputData) { if (GameSettings.Instance.InitializeGame(inputData)) { return(RedirectToAction("New", "Draft")); } return(RedirectToAction("Index")); }
public void SetViewModel(InitViewModel viewModel) { __InitViewModel = viewModel; __InitViewModel.PropertyChanged += (sender, e) => { DidChangeValue("viewModel_" + e.PropertyName); }; __InitViewModel.PropertyWillChange += (sender, e) => { WillChangeValue("viewModel_" + e.PropertyName); }; }
public ActionResult NewGame(InitViewModel initViewModel) { if (initViewModel == null) { return(RedirectToAction("NewGame")); } Player playerOne = new Player(PlayerTypes.X, initViewModel.NameOne); Player playerTwo = new Player(PlayerTypes.O, initViewModel.NameTwo); var result = _gameSevice.StartNew(playerOne, playerTwo); return(View(result)); }
// GET: Init public ActionResult Index() { IConfigService confService = new ConfigService(); string baseUrl = confService.ReadProperty("BaseURL"); string ui5Src = confService.ReadProperty("UI5SrcPath"); string uiResourceRoots = confService.ReadProperty("data-sap-ui-resourceroots"); var model = new InitViewModel() { BaseURL = baseUrl, Ui5Src = ui5Src, UiResourceRoots = uiResourceRoots, }; return(View(model)); }
public ActionResult Index() { InitViewModel model = new InitViewModel(); return(View(model)); }
public bool InitializeGame(InitViewModel inputData) { Player1 = new User(); if (inputData.PlayerOne != null) { Player1.Name = inputData.PlayerOne; } else { return(false); } if (inputData.FormationP1 != null) { Player1.Formation = inputData.FormationsDictionary[inputData.FormationP1]; } else { return(false); } Player2 = new User(); if (inputData.PlayerTwo != null) { Player2.Name = inputData.PlayerTwo; } else { return(false); } if (inputData.FormationP2 != null) { Player2.Formation = inputData.FormationsDictionary[inputData.FormationP2]; } else { return(false); } if (inputData.ChosenDivisions != null) { divisionList = inputData.ChosenDivisions; } else { return(false); } if (inputData.Budget != 0) { Budget = inputData.Budget; } else { return(false); } valuta = ValutaFactory.GetValuta(inputData.Valuta); if (valuta == null) { return(false); } SetPlayerPool(); if (drafter.GetCount() < 22) { return(false); } return(true); }