private void Start_Click(object sender, RoutedEventArgs e) { Core core = null; if (Nexon.IsChecked.Value) { core = new Nexon(webControl); } else if (Naver.IsChecked.Value) { core = new Naver(webControl); } else if (Daum.IsChecked.Value) { core = new Daum(webControl); } else if (MGame.IsChecked.Value) { core = new MGame(webControl); } else if (HanGame.IsChecked.Value) { core = new HanGame(webControl); } core.StartGame(); }
private void SaveSalesDets(TSales sales, IList <DetailMessage> listDet) { var agentComms = (from agentComm in sales.AgentId.AgentComms select agentComm).ToList(); decimal?comm = null; IDictionary <string, MGame> dictGame = GetDictGame(); MGame game = null; foreach (DetailMessage detailMessage in listDet) { dictGame.TryGetValue(detailMessage.GameId, out game); if (agentComms.Count > 0) { comm = (from agentComm in agentComms where agentComm.GameId == game select agentComm.CommValue).First(); } if (detailMessage.IsBB) { SaveDetsForBB(sales, detailMessage.SalesNumber, detailMessage.SalesValue, game, comm, detailMessage.SalesNumber.Length); } else { SaveSalesDet(sales, detailMessage.SalesNumber, detailMessage.SalesValue, game, comm, null); } } }
public MGame(MInGamePage page) { instance = this; this.page = page; this.container = page; _players.Add(new MPlayer(0, true,"YOU",MColor.Green)); _players.Add(new MPlayer(1, false,"RED",MColor.Red)); _players.Add(new MPlayer(2, false,"BLUE",MColor.Blue)); _ais.Add (new MPlayerAI(_players[1], _players)); _ais.Add (new MPlayerAI(_players[2], _players)); _human = _players[0]; _beasts = new MBeast[_players.Count * (_human.maxBeasts + 20)]; CreateTowers(); container.AddChild(_beastContainer = new FContainer()); container.AddChild(_beastContainerSpecial = new FContainer()); container.AddChild(effectLayer = new MEffectLayer()); container.AddChild(hudLayer = new FContainer()); CreateUI(); Futile.instance.SignalUpdate += HandleUpdate; Futile.touchManager.AddMultiTouchTarget(this); ShowNote("CLICK TO MOVE THE GREEN GUYS!\nDESTROY THE ENEMY CELLS!\nEVOLVE BY USING DNA!",10.0f); }
public static void PrintGameBoard() { MGame Game = MGame.Instance; int score = Game.getScore(); int lifes = Game.Snake.Nblife; VGame.Print(GameBoard, Game.Map.Height, Game.Map.Width, score, lifes); }
private void SaveDetsForBB(TSales sales, string detNumber, decimal detValue, MGame gameId, decimal?comm, int leng) { var result = detNumber.AllPermutations().Where(x => x.Length == leng); foreach (var res in result) { SaveSalesDet(sales, res, detValue, gameId, comm, string.Format("BB : {0}", detNumber)); } }
private void SaveSalesDets(TSales sales, FormCollection formCollection) { TSalesDet det = null; string detNumber, gameId; decimal detValue = 0; IDictionary <string, MGame> dictGame = GetDictGame(); MGame game = null; var agentComms = (from agentComm in sales.AgentId.AgentComms select agentComm).ToList(); decimal?comm = null; for (int i = 0; i < 40; i++) { detNumber = formCollection[string.Format("txtSalesDetNumber_{0}", i)]; if (!string.IsNullOrEmpty(detNumber)) { detValue = decimal.Parse(formCollection[string.Format("txtSalesDetValue_{0}", i)].Replace(",", "")); gameId = formCollection[string.Format("gameId_{0}", i)]; if (!string.IsNullOrEmpty(gameId)) { if (gameId.Equals("D4.BB")) { dictGame.TryGetValue("D4", out game); } else if (gameId.Equals("D3.BB")) { dictGame.TryGetValue("D3", out game); } else { dictGame.TryGetValue(gameId, out game); } if (agentComms.Count > 0) { comm = (from agentComm in agentComms where agentComm.GameId == game select agentComm.CommValue).First(); } } //recursive and calculate for BB if (gameId.Equals("D4.BB")) { SaveDetsForBB(sales, detNumber, detValue, game, comm, 4); } else if (gameId.Equals("D3.BB")) { SaveDetsForBB(sales, detNumber, detValue, game, comm, 3); } else { SaveSalesDet(sales, detNumber, detValue, game, comm, null); } } } }
public ActionResult Commission(AgentCommViewModel viewModel, FormCollection formCollection, string agentId) { _mAgentCommRepository.DbContext.BeginTransaction(); //delete agent commission first _mAgentCommRepository.DeleteByAgent(agentId); IList <MGame> listGame = _mGameRepository.GetAll(); MGame game = null; MAgentComm comm = null; MAgent agent = _mAgentRepository.Get(agentId); string gameComm; for (int i = 0; i < listGame.Count; i++) { game = listGame[i]; comm = new MAgentComm(agent); comm.SetAssignedIdTo(Guid.NewGuid().ToString()); gameComm = formCollection[string.Format("txtComm_{0}", game.Id)]; //set comm value if comm value is not empty if (!string.IsNullOrEmpty(gameComm)) { comm.CommValue = decimal.Parse(gameComm); } comm.GameId = game; comm.DataStatus = EnumDataStatus.New.ToString(); comm.CreatedBy = User.Identity.Name; comm.CreatedDate = DateTime.Now; _mAgentCommRepository.Save(comm); } bool Success = true; string Message = string.Empty; try { _mAgentCommRepository.DbContext.CommitTransaction(); TempData[EnumCommonViewData.SaveState.ToString()] = EnumSaveState.Success; Success = true; Message = "Komisi Agen berhasil disimpan."; } catch (Exception ex) { _mAgentCommRepository.DbContext.RollbackTransaction(); TempData[EnumCommonViewData.SaveState.ToString()] = EnumSaveState.Failed; Success = false; Message = ex.GetBaseException().Message; } var e = new { Success, Message }; return(Json(e, JsonRequestBehavior.AllowGet)); }
private void DeleteClick(object sender, RoutedEventArgs e) { MGame m = new MGame(); m.Id = int.Parse(txtId.Text); NGame n = new NGame(); n.Delete(m); SelectClick(sender, e); }
private void grid_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (grid.SelectedItem != null) { MGame c = grid.SelectedItem as MGame; txtId.Text = c.Id.ToString(); txtNome.Text = c.Nome; txtFabricante.Text = c.Fabricante; txtNasc.Text = c.DataCompra.ToString("dd/MM/yyyy"); txtEstrelas.Text = c.Estrelas.ToString(); } }
private void Login() { Core core = null; if (Nexon.IsChecked.Value) { core = new Nexon(webControl); } else if (Naver.IsChecked.Value) { core = new Naver(webControl); } else if (Daum.IsChecked.Value) { core = new Daum(webControl); } else if (MGame.IsChecked.Value) { core = new MGame(webControl); } else if (HanGame.IsChecked.Value) { core = new HanGame(webControl); } if (core == null) { MessageBox.Show("로스트사가 서버를 선택해주세요.", "알림", MessageBoxButton.OK, MessageBoxImage.Information); return; } if (Favorite.IsChecked.Value) { SetFavorite(core.GetServer()); } core.LogIn(ID.Text, PW.Password, () => { LoGin.IsEnabled = false; Naver.IsEnabled = false; Daum.IsEnabled = false; Nexon.IsEnabled = false; MGame.IsEnabled = false; HanGame.IsEnabled = false; Start.IsEnabled = true; Favorite.IsEnabled = false; MessageBox.Show("로그인에 성공하였습니다.", "알림", MessageBoxButton.OK, MessageBoxImage.Information); }); }
private void SaveSalesDet(TSales sales, string detNumber, decimal detValue, MGame gameId, decimal?comm, string desc) { TSalesDet det = new TSalesDet(sales); det.SetAssignedIdTo(Guid.NewGuid().ToString()); det.SalesDetNumber = detNumber; det.SalesDetValue = detValue; det.GameId = gameId; det.SalesDetComm = comm; det.SalesDetDesc = desc; det.CreatedDate = DateTime.Now; det.CreatedBy = User.Identity.Name; det.DataStatus = EnumDataStatus.New.ToString(); _tSalesDetRepository.Save(det); }
public void Delete(MGame c) { PGame p = new PGame(); List <MGame> cs = p.Open(); for (int i = 0; i < cs.Count; i++) { if (cs[i].Id == c.Id) { cs.RemoveAt(i); break; } } p.Save(cs); }
public static void NewGame() { MGame game = MGame.Instance; EventManager mgr = Snake.EventManager; //Key events mgr.RegisterEvent(Event.KeyPressedDown, new KeyboardDown()); mgr.RegisterEvent(Event.KeyPressedUp, new KeyboardUP()); mgr.RegisterEvent(Event.KeyPressedLeft, new KeyboardLeft()); mgr.RegisterEvent(Event.KeyPressedRight, new KeyboardRight()); mgr.RegisterEvent(Event.KeyPressedPause, new KeyboardPaused()); //Register to clock ticks mgr.RegisterEvent(Event.ClockTick, new EClockTick()); }
private void UpdateClick(object sender, RoutedEventArgs e) { MGame m = new MGame(); m.Id = int.Parse(txtId.Text); m.Nome = txtNome.Text; m.Fabricante = txtFabricante.Text; m.DataCompra = DateTime.Parse(txtNasc.Text); m.Estrelas = int.Parse(txtEstrelas.Text); NGame n = new NGame(); n.Update(m); SelectClick(sender, e); }
public void Insert(MGame c) { PGame p = new PGame(); List <MGame> cs = p.Open(); int m = 0; foreach (MGame x in cs) { if (x.Id > m) { m = x.Id; } } c.Id = m + 1; cs.Add(c); p.Save(cs); }
public override void Start() { _background = new FSprite("Background.png"); AddChild(_background); _backButton = new FButton("CircleButtonBG_normal.png", "CircleButtonBG_over.png", "Click"); _backButton.AddLabel("Cubano","BACK!",Color.white); AddChild (_backButton); _backButton.x = -Futile.screen.halfWidth+100; _backButton.y = Futile.screen.halfHeight-100; _backButton.SignalRelease += HandleStartButtonRelease; _game = new MGame(this); this.alpha = 0; Go.to (this, 0.5f, new TweenConfig().floatProp("alpha",1.0f)); }
public static AgentCommViewModel Create(IMGameRepository mGameRepository, string agentId) { AgentCommViewModel viewModel = new AgentCommViewModel(); IList <MGame> listGame = mGameRepository.GetAll(); CommissionViewModel comm = null; IList <CommissionViewModel> list = new List <CommissionViewModel>(); MGame game = null; for (int i = 0; i < listGame.Count; i++) { comm = new CommissionViewModel(); game = listGame[i]; comm.GameId = game.Id; comm.GameName = game.GameName; comm.Commission = mGameRepository.GetCommissionByGameAndAgent(agentId, game.Id); list.Add(comm); } viewModel.ListComms = list; return(viewModel); }
public static ReportParamViewModel Create(IMAgentRepository mAgentRepository, IMGameRepository mGameRepository) { ReportParamViewModel viewModel = new ReportParamViewModel(); IList <MAgent> list = mAgentRepository.GetAll(); MAgent costCenter = new MAgent(); costCenter.AgentName = "-Semua Agen-"; list.Insert(0, costCenter); viewModel.AgentList = new SelectList(list, "Id", "AgentName"); IList <MGame> listGame = mGameRepository.GetAll(); MGame game = new MGame(); game.GameName = "-Semua Game-"; listGame.Insert(0, game); viewModel.GameList = new SelectList(listGame, "Id", "GameName"); viewModel.DateFrom = DateTime.Today; viewModel.DateTo = DateTime.Today; return(viewModel); }
private void SaveSalesDets(TSales sales, IList <DetailMessage> listDet) { var agentComms = (from agentComm in sales.AgentId.AgentComms select agentComm).ToList(); decimal?comm = null; IDictionary <string, MGame> dictGame = GetDictGame(); MGame game = null; string desc = string.Empty; foreach (DetailMessage detailMessage in listDet) { dictGame.TryGetValue(detailMessage.GameId, out game); desc = string.Empty; if (detailMessage.IsHBR && detailMessage.GameId.Equals(EnumGame.D4.ToString())) { desc = string.Format("HBR : {0}", detailMessage.SalesNumber); } if (agentComms.Count > 0) { var getComms = (from agentComm in agentComms where agentComm.GameId == game select agentComm.CommValue); if (getComms.Count() > 0) { comm = getComms.First(); } } if (detailMessage.IsBB) { SaveDetsForBB(sales, detailMessage.SalesNumber, detailMessage.SalesValue, game, comm, detailMessage.SalesNumber.Length, desc); } else { SaveSalesDet(sales, detailMessage.SalesNumber, detailMessage.SalesValue, game, comm, desc); } } }
public Scene(MGame game) { Content = new ContentManager(game.Services, "Content"); }
public static void Move() { MGame Game = MGame.Instance; MSnake Snake = Game.Snake; //Get the orientation of the snake SnakeOrientation orientation = Snake.Orientation; Tuple <int, int> PreviousPosition = Snake.snakebody.First(); int newX = PreviousPosition.Item1; int newY = PreviousPosition.Item2; //New position depending on the orientation switch (orientation) { case SnakeOrientation.Bottom: newY = newY + 1; break; case SnakeOrientation.Up: newY = newY - 1; break; case SnakeOrientation.Right: newX = newX + 1; break; case SnakeOrientation.Left: newX = newX - 1; break; } Tuple <int, int> NewPosition = new Tuple <int, int>(newX, newY); //Check for the intern events (Collisions, GameOver, etc...) if (newX < 0 || newY < 0 || newX >= Game.Map.Width || newY >= Game.Map.Height) { GameContext.Instance.IsOver = true; GameContext.Instance.HasHitTheWall = true; return; } //Check for collision with itself if (Snake.snakebody.Contains(new Tuple <int, int>(newX, newY))) { Snake.Nblife--; //Check for remaining number of lifes if (Snake.Nblife.Equals(0)) { GameContext.Instance.IsOver = true; return; } //Remove half of snake while (!Snake.snakebody.Last.Value.Equals(new Tuple <int, int>(newX, newY))) { Snake.snakebody.RemoveLast(); } } //We are OK => Go forward Snake.snakebody.AddFirst(new Tuple <int, int>(newX, newY)); //Check if we are in the position of the fruit Tuple <int, int> positionFruit = MGame.Instance.Fruit.Position; bool FruitInCase = (newX == positionFruit.Item1 && newY == positionFruit.Item2); //If there is no fruit, we remove the last part of the snake if (FruitInCase) { Game.Fruit.GetTypeFruit.Effect(); Game.GenerateFruit(); } else { Snake.snakebody.RemoveLast(); } }
public MainScene(MGame game) : base(game) { }
public static void BuildGameboard() { MGame Game = MGame.Instance; GameBoard = new CellTypes[Game.Map.Width, Game.Map.Height]; int score = Game.getScore(); int lifes = Game.Snake.Nblife; //Print the fruit int fruitX = Game.Fruit.Position.Item1; int fruitY = Game.Fruit.Position.Item2; if (Game.Fruit.GetTypeFruit is FruitLifeUp) { GameBoard[fruitX, fruitY] = CellTypes.FruitLifeUp; } else if (Game.Fruit.GetTypeFruit is FruitSpeedUp) { GameBoard[fruitX, fruitY] = CellTypes.FruitSpeedUp; } else if (Game.Fruit.GetTypeFruit is FruitSpeedDown) { GameBoard[fruitX, fruitY] = CellTypes.FruitSpeedDown; } else { GameBoard[fruitX, fruitY] = CellTypes.Fruit; } //GameBoard[fruitX, fruitY] = CellTypes.Fruit; bool first = true; //Print the snake in the gameboard foreach (var bodypart in Game.Snake.snakebody) { int bodypartX = bodypart.Item1; int bodypartY = bodypart.Item2; // The 1st is the head if (first) { switch (Game.Snake.Orientation) { case SnakeOrientation.Bottom: GameBoard[bodypartX, bodypartY] = CellTypes.SnakeHeadDown; break; case SnakeOrientation.Up: GameBoard[bodypartX, bodypartY] = CellTypes.SnakeHeadUp; break; case SnakeOrientation.Left: GameBoard[bodypartX, bodypartY] = CellTypes.SnakeHeadLeft; break; case SnakeOrientation.Right: GameBoard[bodypartX, bodypartY] = CellTypes.SnakeHeadRight; break; } first = false; } else { GameBoard[bodypartX, bodypartY] = CellTypes.SnakeBody; } } }