private void mouseChk() { MouseState state = Mouse.GetState(); pos.X = state.X; pos.Y = state.Y; if (state.X >= 0 && state.X <= 800 && state .Y >=0 && state .Y <=600) { switch (sceneFlg) { case 0: statupscreen.MouseHoverChk(state.X, state.Y); break; case 1: stageselect.MouseHoverChk(state.X, state.Y); break; } if (state.LeftButton == ButtonState.Pressed) { if (mouseFlg) { switch (sceneFlg) { case 0: sceneFlg = statupscreen.MousePressChk(state.X, state.Y); if (sceneFlg == 3) { hp = 5; co = 0; kazu = 0; kazu2 = 0; kazuuni1 = 0; enemys = enemydata.getEnemykazu(0); enemys2 = enemydata.getEnemyNo(0); second = enemydata.getSecond(enemys2[0]); Money = mapMoney[0]; } break; case 1: stageNo = stageselect.MousePressChk(state.X, state.Y); if (stageNo >= 0) { talkevent.setEvent(stageNo); sceneFlg = 2; } bgm.setBGM(6); break; case 2: if (talkevent.MousePressChk()) { if (staCliFlg) { talkevent = new Event(sprite, Gm.GraphicsDevice, font); //enemy = new Enemy(sprite, Gm.GraphicsDevice, 0, 0, 0, 80); //listenemy.Add(enemy ); hp = 5; co = 0; kazu = 0; kazu2 = 0; kazuuni1 = 0; map = new CreateMap(sprite, Gm.GraphicsDevice); enemys = enemydata.getEnemykazu(stageNo); enemys2 = enemydata.getEnemyNo(stageNo); second = enemydata.getSecond(enemys2[0]); Money = mapMoney[stageNo]; sceneFlg = 3; int[] aaa = {3,3,5,5,4,4,2,2}; bgm.setBGM(aaa[stageNo]); } else { talkevent = new Event(sprite, Gm.GraphicsDevice, font); staCliFlg = true; bgm.setBGM(1); sceneFlg = 1; } } break; case 3: if (state.X > 600) { unitno = map.MousePressChk(state.X, state.Y); } else { if (unitno != -1) { int ch = map.mapCheck(state.X, state.Y); if (ch == 1) { unit = new Unit(sprite, Gm.GraphicsDevice, unitno, state.X, state.Y); if (Money >= unit.getCost(unitno)) { Money = Money - unit.getCost(unitno); listunit.Add(unit); kazuuni1++; } } else if (ch == 2) { for (int i = 0; i < listunit.Count; i++) { if (listunit[i].getX() <= state.X && state.X < listunit[i].getX() + 40) { if (listunit[i].getY() <= state.Y && state.Y < listunit[i].getY() + 40) { if (Money >= listunit[i].getLVUPCost()) { Money = Money - listunit[i].getLVUPCost(); listunit[i].getLvUP(); } } } } } } } break; case 4: bgm.setBGM(1); sceneFlg = 1; break; } mouseFlg = false; } } if (state.LeftButton == ButtonState.Released) { mouseFlg = true; switch (sceneFlg) { case 2: talkevent.MouseReleasChk(); break; } } } }
protected override void LoadContent() { font = Content.Load<SpriteFont>("Content/SpriteFont1"); sprite = new SpriteBatch(GraphicsDevice); statupscreen = new StartupScreen(sprite, Gm.GraphicsDevice); stageselect = new StageSelect(sprite, Gm.GraphicsDevice); talkevent = new Event(sprite, Gm.GraphicsDevice, font); map = new CreateMap(sprite, Gm.GraphicsDevice); hitbox = new HitBox(); enemydata = new GetEnemyDate(); // 秒 (Second) を取得する iSecond = dtNow.Second; }