Example #1
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);


#if Debug
        blackRect= Content.Load<Texture2D>(@"Textures\darkBackground");
#endif
            goldPlusEffect10 = Content.Load<Texture2D>(@"ui\goldPlus10");
            goldPlusEffect15 = Content.Load<Texture2D>(@"ui\goldPlus15");

            lifePlusEffect10 = Content.Load<Texture2D>(@"ui\lifePlus10");
            lifePlusEffect15 = Content.Load<Texture2D>(@"ui\lifePlus15");

            darkBackgroundImage = Content.Load<Texture2D>(@"Textures\darkBackground");
            go_back = Content.Load<Texture2D>(@"ui\go_back");
            go_front = Content.Load<Texture2D>(@"ui\go_front");

            //이거 없으면 STARTNOTE TEXTURE가 NULL이라 위치값을 잘못 줄때가 있다.
            spriteSheet = Content.Load<Texture2D>(@"ui\SpriteSheet8");
     
            backJesture = Content.Load<Texture2D>(@"game1\backJesture");
            backJestureManager = new BackJestureManager(backJesture, new Rectangle(0, 0, 204, 204), 10, new Vector2(800, 500));

       
           //타이틀화면
            menuScene = new MenuScene();
            menuScene.LoadContent(Content);

            uiEnergyBackground = Content.Load<Texture2D>(@"ui\uiEnergyBackground");
            energyDarkBack = Content.Load<Texture2D>(@"ui\energyDarkBack");

            processBar = Content.Load<Texture2D>(@"ui\processBar");
            processMark = Content.Load<Texture2D>(@"ui\processMark");

            //아이템관리
            //startnotemanager 생성보다 앞에 있어야 한다.
            itemManager = new ItemManager();
            itemManager.LoadContent(Content);
            itemManager.Init();

            loadingScene = new LoadingScene();
            //loadingScene.LoadContent(Content);


            //게임중 점수관리
            scoreManager = new ScoreManager();

            //상점 대문2
            shopDoor = new ShopDoor(scoreManager);
            shopDoor.LoadContent(Content);
            
            //점수 기록 (TO FILE)
            reportManager = new ReportManager(scoreManager);


            /////아이템 상점 -START
            rightItemShop = new RightItemShop(itemManager,  scoreManager, reportManager);
            rightItemShop.LoadContent(Content);

            leftItemShop = new LeftItemShop(itemManager, scoreManager, reportManager);
            leftItemShop.LoadContent(Content);

            effectItemShop = new EffectItemShop(itemManager, scoreManager, reportManager);
            effectItemShop.LoadContent(Content);
            
            noteItemShop = new NoteItemShop(itemManager, scoreManager, reportManager);
            noteItemShop.LoadContent(Content);

            backgroundItemShop = new BackgroundItemShop(itemManager, scoreManager, reportManager);
            backgroundItemShop.LoadContent(Content);
            /////아이템 상점 -START

            //연주자
            memberManager = new MemberManager(scoreManager);
            memberManager.LoadContent(Content);
            memberManager.init();

            /////텍스쳐 로드 -START
            //배경
            //playBackgroud1 = Content.Load<Texture2D>(@"background\ConcertHall_3");
            //playBackgroud2 = Content.Load<Texture2D>(@"background\crosswalk3");
            
            
            //노트,마커
           // spriteSheet = Content.Load<Texture2D>(@"Textures\SpriteSheet8");
            
            //드래그 노트
           // heart = Content.Load<Texture2D>(@"Textures\heart");
           
            //진행상황
            //uiBackground = Content.Load<Texture2D>(@"ui\background");
            energy = Content.Load<Texture2D>(@"ui\energy");

            //골드 업어
            getGold = Content.Load<Texture2D>(@"gold\getGold");
            //폰트
            georgia = Content.Load<SpriteFont>(@"Fonts\Georgia");

            
            //perfect,good,bad,miss 판정 배너 
            perfectBanner = Content.Load<Texture2D>(@"judgement\perfect");

            goodBanner = Content.Load<Texture2D>(@"judgement\good");

            badBanner = Content.Load<Texture2D>(@"judgement\bad");

            missBanner = Content.Load<Texture2D>(@"judgement\miss");


            noPerson = Content.Load<Texture2D>(@"game1\noperson");



            rightHandTextures = itemManager.GetRightHandTexture();
            leftHandTextures = itemManager.GetLeftHandTexture();
            
            
            //드래그 노트 셀떄

            one = Content.Load<Texture2D>(@"ui\one");
            two = Content.Load<Texture2D>(@"ui\two");
            three = Content.Load<Texture2D>(@"ui\three");


            previousButton = Content.Load<Texture2D>(@"game1\previousButton");
            hoverPreviousButton = Content.Load<Texture2D>(@"game1\hoverPrevious");
            

            nextButton = Content.Load<Texture2D>(@"game1\nextButton");
            hoverNextButton = Content.Load<Texture2D>(@"game1\hoverNextButton");

            loadingForAngle = Content.Load<Texture2D>(@"ui\LoadingKinect");
            //   charisma1 = Content.Load<Texture2D>(@"shopdoor\nogold");
            /////텍스쳐 로드 -END

         

            /////////////////드래그 라인 관련
            

            //드래그 라인
         //   drawLineNote1 = Content.Load<Texture2D>(@"DrawLine\drawLineNote1");

            //드래그 라인 마커점
            drawLineMarker = Content.Load<Texture2D>(@"DrawLine\drawLineMark");
            

            gold = Content.Load<Texture2D>(@"gold\gold");
            menuGold = Content.Load<Texture2D>(@"game1\menuGold");
           
            levelTexture = Content.Load<Texture2D>(@"game1\level");


            //로드하고, 기본적으로 넣어줌
            itemManager.LoadFileItem();

                   
            //현재 장착한 이펙트의 인덱스를 전체 베이스에 찾음
            int effectIndex = itemManager.getEffectIndex();

     
            //콤보 숫자
            comboNumberManager = new ComboNumberManager();
            comboNumberManager.LoadContent(Content);

            //***결과화면 숫자
            //resultNumberManager = new ResultNumberManager();
           // resultNumberManager.LoadContent(Content);

            tutorialScene = new TutorialScene();
            tutorialScene.Load(Content);
              

            //드래그 라인 렌더링
            dragLineRenderer = new LineRenderer();


            //드래그 라인 안의 마커점의 렌더링 
            dragLineMarkerRenderer = new LineRenderer();

            //드래그라인 
            curveManager = new CurveManager(dragLineRenderer, dragLineMarkerRenderer,dragNoteManager,itemManager);

            //가이드 라인 렌더링

            guideLineRenderer = new LineRenderer();

            //가이드 라인 
            guideLineManager = new GuideLineManager(guideLineRenderer);

            //텍스쳐 크기
            ///////이펙트 생성 -START
            

            //폭발 효과
            perfectManager = new PerfectExplosionManager();
            perfectManager.ExplosionInit(itemManager.GetEffectTexture()[effectIndex], itemManager.GetEffectInitFrame()[effectIndex], itemManager.GetEffectFrameCount()[effectIndex], itemManager.GetEffectScale()[effectIndex], itemManager.GetEffectDulation()[effectIndex]);

            goodManager = new GoodExplosionManager();
            goodManager.ExplosionInit(itemManager.GetGoodEffectTexture()[effectIndex], itemManager.GetEffectInitFrame()[effectIndex], itemManager.GetEffectFrameCount()[effectIndex], itemManager.GetEffectScale()[effectIndex], itemManager.GetEffectDulation()[effectIndex]);

            badManager = new BadExplosionManager();
            badManager.ExplosionInit(itemManager.GetBadEffectTexture()[effectIndex], itemManager.GetEffectInitFrame()[effectIndex], itemManager.GetEffectFrameCount()[effectIndex], itemManager.GetEffectScale()[effectIndex], itemManager.GetEffectDulation()[effectIndex]);


            //판정 글씨 나타내기 
            perfectBannerManager = new PerfectBannerManager();
            perfectBannerManager.BannerInit(perfectBanner,new Rectangle(0,0,1380,428),/*sprite로 바꾸면 frameCount바꾸기*/1,0.5f,30);


            goodBannerManager = new GoodBannerManager();
            goodBannerManager.BannerInit(goodBanner, new Rectangle(0, 0, 1020, 368),/*sprite로 바꾸면 frameCount바꾸기*/1, 0.5f, 30);


            badBannerManager = new BadBannerManager();
            badBannerManager.BannerInit(badBanner, new Rectangle(0, 0, 782, 400),/*sprite로 바꾸면 frameCount바꾸기*/1, 0.7f, 30);

            missBannerManager = new MissBannerManager();
            missBannerManager.BannerInit(missBanner, new Rectangle(0, 0, 975, 412),/*sprite로 바꾸면 frameCount바꾸기*/1, 0.5f,30);


      

            //일단은 miss effect로
            goldGetManager = new ExplosionManager();
            goldGetManager.ExplosionInit(getGold,new Rectangle(0,0,200,200), 5, 1.0f, 40);

            ///////이펙트 생성 -END
       
            //시작 노트 관리 생성    
            //여기에 들어가는 텍스쳐가 노트의 텍스쳐가 된다.
            //상점의 텍스쳐가 들어가야 한다. 


            startNoteManager = new StartNoteManager(
                spriteSheet,
                new Rectangle(0, 200, 52, 55),
                1);


            //첫 마커 위치   
            //마커 위치 처음 시작은 일단 마커매니저의 제일 0번째 것으로 시작
            Vector2[] initMarkLocation = MarkManager.GetPattern(0);

        //    removeAreaRec = MarkManager.GetRemoveArea(0);

            //마크 관리 초기화 (STATIC)
            //***시작시 마커 위치에 관한 사항 결정 못함.  
            MarkManager.initialize(
                spriteSheet,
                new Rectangle(0, 200, 50, 55),
                1,
                initMarkLocation[0],
                initMarkLocation[1],
                initMarkLocation[2],
                initMarkLocation[3],
                initMarkLocation[4],
                initMarkLocation[5],
                startNoteManager
                
                );

            //카리스마 매니저
            charismaManager = new CharismaManager();
            charismaManager.LoadContent(Content);

          

            //드래그노트 초기화
            //이것은 노트 안에서 움직이는 마커점
            dragNoteManager = new DragNoteManager(
                 drawLineMarker,
                 itemManager.GetDragNoteBackground()[itemManager.getNoteIndex()],
                 new Rectangle(0, 0, 100, 100),
                 1,
                 15,
                 0,
                 missBannerManager,
                 scoreManager);



            //충돌관리 생성
            collisionManager = new CollisionManager(perfectManager, goodManager, badManager, goldGetManager, scoreManager, memberManager,/*effect크기*/itemManager,perfectBannerManager,goodBannerManager,badBannerManager,missBannerManager,new Vector2(this.Window.ClientBounds.Width,this.Window.ClientBounds.Height),comboNumberManager,charismaManager,dragNoteManager);
            
            //노트정보 관리 생성
            noteFileManager = new NoteFileManager();
            //드래그 라인 렌더링
            dragLineRenderer = new LineRenderer();

            dragLineMarkerRenderer = new LineRenderer();
            //드래그라인 
            curveManager = new CurveManager(dragLineRenderer, dragLineMarkerRenderer, dragNoteManager,itemManager);

          

        //    photoManager = new PhotoManager();
        //    photoManager.LoadContent(Content);


            //노트파일 읽기 관리 생성
            file = new File(startNoteManager, noteFileManager, collisionManager, scoreManager, itemManager, curveManager, guideLineManager, charismaManager);

            SoundFmod.initialize(file);
            //곡선택화면 곡 불러오는 폴더 
          
            //노래폴더 만들기 위해서 테스트
           // String songFile = System.Environment.CurrentDirectory+"\\beethovenSong\\song.txt";
            String dir = System.Environment.CurrentDirectory + "\\beethovenSong";

            DirectoryInfo di = new DirectoryInfo(dir);
            if (di.Exists == false)
            {
                di.Create();
            }
            
           
            //기록 만들기 위해서 테스트
          //  String songRecordFile = System.Environment.CurrentDirectory + "\\beethovenRecord\\song.txt";
            String songRecorddir = System.Environment.CurrentDirectory + "\\beethovenRecord";

            DirectoryInfo diRecord = new DirectoryInfo(songRecorddir);
            if (diRecord.Exists == false)
            {
                diRecord.Create();
            }
            


            
            //사진 폴더  위해서 테스트
            //String picFile = System.Environment.CurrentDirectory + "\\beethovenRecord\\userPicture\\song.txt";
            String picddir = System.Environment.CurrentDirectory + "\\beethovenRecord\\userPicture";
            String defaultPicture = System.Environment.CurrentDirectory + "\\No_Image.png";


            DirectoryInfo diPic = new DirectoryInfo(picddir);
            if (diPic.Exists == false)
            {
                diPic.Create();
                FileInfo fileInfo = new FileInfo(defaultPicture);
                fileInfo.CopyTo(System.Environment.CurrentDirectory + "\\beethovenRecord\\UserPicture\\No_Image.png");
            
            }
            
            
                      

            //곡을 불러오기
            file.FileLoading(dir, "*.mnf");
            
            ////드래그노트 초기화
            ////이것은 노트 안에서 움직이는 마커점
            //dragNoteManager = new DragNoteManager(
            //     drawLineMarker,
            //     new Rectangle(0, 0, 100, 100),
            //     1,
            //     15,
            //     0,
            //     missBannerManager,
            //     scoreManager);

            //골드 초기화
            //크기 0.3
            GoldManager.initialize(
                gold,
                new Rectangle(0, 0, 200, 200),
                1,
                70,
                0,
                0.3f);
            
            
            //***
           

            
            resultManager = new ResultManager(scoreManager);
            resultManager.LoadContent(Content);



            //점수기록판 화면
            recordBoard = new RecordBoard();
            recordBoard.LoadContent(Content);

#if Kinect
            settingBoard = new SettingBoard(this);
            settingBoard.LoadContent(Content);
#endif

            showPictureScene = new ShowPictureScene();
            showPictureScene.LoadContent(Content);

            

            songMenu = new SongMenu(noteFileManager, reportManager);
            songMenu.Load(Content, graphics.GraphicsDevice);




            //LOAD REPORT SCORE FILE
            //점수기록판을 로드해서 게임에 올린다. 

            reportManager.LoadReport();

            //골드를 로드해서 게임에 올린다. 
            reportManager.LoadGoldFromFile();

            currentSongName = "";
           
           // itemManager.LoadFileItem();
#if Kinect
          
        //    messageFont = Content.Load<SpriteFont>("MessageFont");
            setupKinect();

            /*제스쳐 인식인데 
             전체 구간에서 계속 실행 된다. 
             *이것이 다른것에 영향을 줄 수도 있다. 
             */
            activeRecognizer = CreateRecognizer();

            //!!! 페이스 인식, 디버깅 시에 잠시 

#if StartDetact
            settingBoard.LoadCheckFile();
            if(settingBoard.CheckFaceDetact)
            {
                //0 각도 재야함 // 1 각도 잴필요없음 //2 끝남 
                loadingTime = 0;

                ts4 = new ThreadStart(FaceDetect);
                th4 = new Thread(ts4);
                th4.Start();
            }

#endif


#endif
            playingPictures = new Queue();
            showPictureTextures = new Texture2D[5];

            metronomes = new Texture2D[8];
            metronomes[0] = Content.Load<Texture2D>(@"metronome\metronome0");
            metronomes[1] = Content.Load<Texture2D>(@"metronome\metronome1");
            metronomes[2] = Content.Load<Texture2D>(@"metronome\metronome2");
            metronomes[3] = Content.Load<Texture2D>(@"metronome\metronome3");
            metronomes[4] = Content.Load<Texture2D>(@"metronome\metronome4");
            metronomes[5] = Content.Load<Texture2D>(@"metronome\metronome5");
            metronomes[6] = Content.Load<Texture2D>(@"metronome\metronome6");
            metronomes[7] = Content.Load<Texture2D>(@"metronome\metronome7");
        }
Example #2
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        /// 


        //카리스마 타임이맞는지 확인한다.
//        public void JudgeCharisma()
//        {

//#if Kinect
//            if(charismaManager.IsCharismaTime == 1 && !charismaManager.IsJudgeCheck) 
//            {
//                if(!kinectMessage.Contains("__UNKNOWN"))
//                {

//                }
//                //나중에는 타입마다 이렇게 설정
//                //else if(charismaManager.Type == 0 && kinectMessage.Contains("@xxxxxx");
//                else
//                {
//                    //perfectBannerManager.AddBanners(new Vector2(this.Window.ClientBounds.Width / 2 - 1380 / 4, this.Window.ClientBounds.Height / 2 - 428 / 4));
//                    //scoreManager.Perfomance = scoreManager.Perfomance + 1;
//                    charismaManager.IsJudgeCheck = true;
//                }
            
//            }
//#endif
//        }
            
        protected override void Update(GameTime gameTime)
        {
            // Allows the game to exit
             // Update
            _elapsed_time += (float)gameTime.ElapsedGameTime.TotalMilliseconds;
 
            // 1 Second has passed
            if (_elapsed_time >= 1000.0f)
            {
                _fps = _total_frames;
                _total_frames = 0;
                _elapsed_time = 0;
            }
            //Trace.WriteLine(_fps);

            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
                this.Exit();
      
            mouseStateCurrent = Mouse.GetState();

#if Kinect
            Rectangle rightHandPosition = new Rectangle((int)j1r.Position.X, (int)j1r.Position.Y, 5, 5);

#else
            Rectangle rightHandPosition = new Rectangle(0, 0, 1, 1);

#endif


            
           switch (gameState)
           {
               #region 타이틀
               //타이틀 화면
                case GameStates.Menu:


                    menuScene.Update(gameTime, rightHandPosition);

                break;
               #endregion

               #region 상점대문
                //상점대문
               case GameStates.ShopDoor:

                    //타이틀화면으로 돌아가는 키보드처리
                    //HandleKeyboardInputGoToMenu(Keyboard.GetState());
                    shopDoor.Update(gameTime, rightHandPosition);
                   // pastClick = finalClick;

                break;

                #endregion

               #region 아이템상점들


               #region 오른쪽상점
               case GameStates.RightItemShop:
                   //상점대문으로 돌아가는 키보드처리

                 
                   //HandleKeyboardInputinItemShop(Keyboard.GetState());
                   rightItemShop.Update(gameTime, rightHandPosition);
                   
             
                   break;

               #endregion

               #region 왼쪽상점

               case GameStates.LeftItemShop:
                   //상점대문으로 돌아가는 키보드처리
                    //HandleKeyboardInputinItemShop(Keyboard.GetState());
                    leftItemShop.Update(gameTime, rightHandPosition);


                   break;

               #endregion 

               #region 노트상점
               case GameStates.NoteItemShop:
                    //HandleKeyboardInputinItemShop(Keyboard.GetState());
                    noteItemShop.Update(gameTime, rightHandPosition);
             
                   break;
               #endregion
               #region 이펙트상점


               case GameStates.EffectItemShop:


                   //HandleKeyboardInputinItemShop(Keyboard.GetState());
                   effectItemShop.Update(gameTime, rightHandPosition);
                  
                
                   break;
               #endregion



               #region 배경상점
               case GameStates.BackgroundItemShop:
                   //상점대문으로 돌아가는 키보드처리
                   //HandleKeyboardInputinItemShop(Keyboard.GetState());
                   backgroundItemShop.Update(gameTime, rightHandPosition);

                break;

               #endregion
               #endregion

               #region 플레이화면
               case GameStates.Playing:
                   //if (scoreManager.Gage < 1)
                   //{//$$$게이지
                   //    file.SetEndFile(true);
                   //    resultManager.FailGame = true;
                   //}

                   //곡이 끝내게 되면 결과 화면으로
                   //go to result scene right after finishing a piece
                   if (file.GetEndFile())
                   {
                      
                       
                       //노래 총 시간으로 끝을 바꾸자
                       gameState = GameStates.ResultManager;
                       //점수기록판에 기재
                      
                       //reportManager의 scoreInfoManager에 곡명과 자기사진 추가
                       //여기에 현재 자신의 사진 이름이 들어가야 함.(날짜시간 포함해서 독립적으로)
                       if(ScorePic == null)
                       {
                           ScorePic = "No_Image.png";
                       }


                       reportManager.AddSongInfoManager(scoreManager.SongName, scoreManager.TotalScore, ScorePic);


                       isScorePic = false;
                       //현재 노래 제목
                       currentSongName = scoreManager.SongName;

                       if (scoreManager.Combo > scoreManager.Max)
                       {
                           scoreManager.Max = scoreManager.Combo;
                       }
                       //scoreManager.Combo = 0;

                       
                       //점수 기록 파일로 저장
                       //save recored scores in the file
                       reportManager.SaveReport();

                       //photoManager.PhotoFrams.Clear();
                       //gold 파일에  저장
                       int indexGoldPlusItem = 3;

                       double goldEffect = 1;

                     //  int goldPlus = 0;
                       if (itemManager.getRightHandIndex() == indexGoldPlusItem)
                       {
                           goldEffect *= 1.1;
                       }
                       if(itemManager.getLeftHandIndex() == indexGoldPlusItem)
                       {
                        
                             goldEffect *= 1.1;
                       }

                       if(   itemManager.getNoteIndex() == indexGoldPlusItem)
                       {
                           goldEffect *= 1.1;
                          
                       }

                       if (itemManager.getBackgroundIndex() == indexGoldPlusItem)
                       {
                             goldEffect *= 1.15;
                       }
                       if (itemManager.getEffectIndex() == indexGoldPlusItem)
                       {
                            goldEffect *= 1.15;
                       }

                         
                       // goldPlus = 1;
                       scoreManager.Gold = (int)(scoreManager.Gold * goldEffect); 
                           
                       ////골드추가 아이템을 장착 했으면 추가 점수 
                       //if (goldPlus == 1)
                       //{
                           

                       //}
                       //else if (goldPlus == 2)
                       //{

                         

                       //}


                



                       scoreManager.TotalGold += scoreManager.Gold;
                       reportManager.SaveGoldToFile();

                       //도중에 꺼져도 모든 드래그모양 지우기 

                       curveManager.DeleteAllCurve();

                       //도중에 꺼져도 두번째 가이드라인 지우기 
                       
                       guideLineManager.DeleteAllSecondGuideLine();

                       //기록판에 보여줄 유저 사진 찾기
                       //Fine user pictures which will be seen in score board
                       reportManager.MakePictures(currentSongName, GraphicsDevice);

                       playPicturesCount = 0;
                       showPictureTextures = new Texture2D[5];
                       //Texture2D texture = null; 
                       //Stream str = System.IO.File.OpenWrite("gesture.jpg");
                       //texture.SaveAsJpeg(str, 1200, 900);

                       //
                       resultManager.FailGame = false;

                       bool isPlay = false;
                       SoundFmod.sndChannel.isPlaying(ref isPlay);
                       if (isPlay)
                       {
                           SoundFmod.StopSound();
                       }
                      
                       SoundFmod.PlaySound(resultMusic);
                      // resultNumberManager.AddResultNumbers(new Vector2(200, 300), scoreManager.Perfect);
               
                   }



                   double playTime = 0;

                   if (isPlayingSong)
                   {

                       
                       SoundFmod.sndChannel.getPosition(ref songLength, TIMEUNIT.MS);
          //             Trace.WriteLine("Time" + (songLength / 1000 / 60) + ":" + (songLength / 1000 % 60) + ":" + (songLength / 10 % 100));
                       playTime = (songLength / 1000 / 60) * 60 + (songLength / 1000 % 60) + ((songLength / 10 % 100) * 0.01 );
                       //Trace.WriteLine(playTime);
                   }

                   





                   //마크 업데이트
                    MarkManager.Update(gameTime);
                    startNoteManager.Update(gameTime);
                    HandleKeyboardInput(Keyboard.GetState());
                    HandleMouseInput(Mouse.GetState());
                    file.Update(spriteBatch, playTime, SoundFmod.changedTempo, SoundFmod.optionalTime);
                    //*** 어떻게 돼는건지 모르겠음 
                    dragNoteManager.Update(gameTime);
                   ////
                    GoldManager.Update(gameTime);
                    perfectManager.Update(gameTime);
                    goodManager.Update(gameTime);
                    badManager.Update(gameTime);
                    goldGetManager.Update(gameTime);
                    scoreManager.Update(gameTime);
                    memberManager.Update(gameTime);
                    
                    

                    SoundFmod.StartChangedTime(gameTime);
                    //photoManager.Update(gameTime);


                    perfectBannerManager.Update(gameTime);
                    goodBannerManager.Update(gameTime);
                    badBannerManager.Update(gameTime);
                    missBannerManager.Update(gameTime);

                    comboNumberManager.Update(gameTime);
                 //   collisionManager.DeleteMarks();
#if Kinect
                    HandleInput();
#endif
                    collisionManager.CheckRightNoteInCenterArea();
                    collisionManager.CheckLeftNoteInCenterArea();

                  //JudgeCharisma();


                    //3초만에 원상복귀
                    //       AutoRetrunChangeTempo(gameTime);

                break;

               #endregion

               #region Setting
               case GameStates.SettingBoard:

                //HandleKeyboardInputGoToMenu(Keyboard.GetState());
#if Kinect
                settingBoard.Update(gameTime, rightHandPosition);
#endif


                pastClick = finalClick;

                break;

               
               
               #endregion

               #region 결과 결산
               //결과 창
                case GameStates.ResultManager:

                   //resultNumberManager.Update(gameTime);

                    Rectangle rectMouse = new Rectangle(mouseStateCurrent.X, mouseStateCurrent.Y, 5, 5);
                 
                    
                    //nextButton 위에 마우스를 올려놨을 때
                    //mousecursor on nextButton item section
                    if (rectMouse.Intersects(resultManager.getRectNextButton()) || rightHandPosition.Intersects(resultManager.getRectNextButton()))
                    {
                        nearButton = true;
                        GetCenterOfButton(resultManager.getRectNextButton());



                        resultManager.setClickNextButton(true);
                        //click the right hand item section
                        if ((mouseStateCurrent.LeftButton == ButtonState.Pressed && mouseStatePrevious.LeftButton == ButtonState.Released )|| (finalClick &&!pastClick))
                        {
                            gameState = GameStates.ShowPictures;
                            nearButton = false;
                           
                            //현재 마커 위치 저장
                            //Vector2 mark1Location = MarkManager.Marks[0].MarkSprite.Location;
                            //Vector2 mark2Location = MarkManager.Marks[1].MarkSprite.Location;
                            //Vector2 mark3Location = MarkManager.Marks[2].MarkSprite.Location;
                            //Vector2 mark4Location = MarkManager.Marks[3].MarkSprite.Location;
                            //Vector2 mark5Location = MarkManager.Marks[4].MarkSprite.Location;
                            //Vector2 mark6Location = MarkManager.Marks[5].MarkSprite.Location;

                            //현재 위치 말고, 기본은 0으로 해놓고


                            Vector2 markerSize = MarkManager.GetMarkerSize();


                            Vector2[] zeroIndexMarkers = MarkManager.GetPattern(0);
                         //   removeAreaRec = MarkManager.GetRemoveArea(0);
                            //두번째꺼 재실행시 이상한거 생기는것 방지
                            startNoteManager.DeleateAllNote();
                            //StartNoteManager.rightNoteManager.DeleteAllNote();
                            //StartNoteManager.leftNoteManager.DeleteAllNote();
                            //StartNoteManager.longNoteManager.DeleteAllNote();
                            
                            //@@@이걸 지워서 무제가 될수도 있다. 패턴이 바뀌었는데도 다음번에 안바뀌어서 이걸 넣음
                            //startNoteManager = new StartNoteManager(
                            //    spriteSheet,
                            //    new Rectangle(0, 200, 52, 55),
                            //    1);

                            //드로우 라인
                            file.SetDrawLine(false);
                            
                            //골드 초기화 
                            GoldManager.DeleteAll();
                            //카리스마
                          //  charismaManager.IsCharismaTime = 0;

                            //froze 방지
                            MarkManager.initialize(
                                // markManager = new MarkManager(
                                spriteSheet,
                                new Rectangle(0, 200, 50, 55),
                                1,
                                zeroIndexMarkers[0],
                                zeroIndexMarkers[1],
                                zeroIndexMarkers[2],
                                zeroIndexMarkers[3],
                                zeroIndexMarkers[4],
                                zeroIndexMarkers[5],
                                startNoteManager
                               

                                );


                            //파일을 다시 만들 필요는 없고 초기화만 시켜주면 된다.
                            //여러개 파일 다시 생성되서

                            //파일 저장
                            //file = new File(startNoteManager, noteFileManager, collisionManager, scoreManager, itemManager, curveManager, guideLineManager);

                            file.SetEndFile(false);
                            file.SetTime(TimeSpan.Zero);

                            //if (!System.IO.File.Exists(songsDir))
                            //{
                            //    System.IO.Directory.CreateDirectory(songsDir);
                            //}

                            //file.FileLoading(songsDir, "*.mnf");
                           
                            scoreManager.init();

                          }
                    }
                    else
                    {
                        nearButton = false;
                        resultManager.setClickNextButton(false);
                    }

                    pastClick = finalClick;
                break;
                #endregion
                   
                #region 사진들
                case GameStates.ShowPictures:
                //Rectangle rectMouseShowPictures = new Rectangle(mouseStateCurrent.X, mouseStateCurrent.Y, 5, 5);

                showPictureScene.Update(gameTime, rightHandPosition);

                break;
                #endregion 
                #region 순위판
                case GameStates.RecordBoard:

                    recordBoard.Update(gameTime, rightHandPosition);

                break;

                
                #endregion
               
               #region 곡선택메뉴
                case GameStates.SongMenu:


                resultSongMenu = songMenu.Update(rightHandPosition);


                
                   
#if Kinect

                //제스쳐//좌우 만 있음
             //   activeRecognizer = CreateRecognizer();
#endif


                //뒤로가기
                if (resultSongMenu == -1)
                    {
                        gameState = GameStates.Menu;
                        bool isPlay = false;
                        SoundFmod.sndChannel.isPlaying(ref isPlay);
                        if (isPlay)
                        {
                            SoundFmod.StopSound();
                        }
                       
                        SoundFmod.PlaySound(title_Music);

                    }
                // 선택 되었음
                else if (resultSongMenu != -2)
                    {

                        //*** 롱노트와 왼손노트에도 다른 텍스쳐를 입혀야 함.
                        ////각 아이템에 따른 텍스쳐 변경

                        Texture2D[] rightNoteTextures = itemManager.GetRightNoteTexture();

                        ////왼손 노트 // 일단은 오른손노트랑 같이 함.
                        Texture2D[] leftNoteTextures = itemManager.GetLeftNoteTexture();

                        ////롱노트 // 일단은 오른손노트랑 같이 함.
                        Texture2D[] longNoteTextures = itemManager.GetLongNoteTexture();


                            
                        ////노트 - 달라야 될때도 있어서 나누어 놨다.
                        ////오른손노트


                    //프로세스 타임 초기화
                        uiProcessTime = 0;

                        lifePlusEffect = 1;

                        //노트 맞는 scale 
                        float[] rightNoteScale = itemManager.GetRightNoteScale();
                        float[] leftNoteScale = itemManager.GetRightNoteScale();
                        float[] longNoteScale = itemManager.GetRightNoteScale();
                       
                      

                      Texture2D[] backgroudTextures  =itemManager.GetBackgroundTexture();

                      ScorePic = null;
                       
                         //배경 바꾸기
                        playBackgroud = backgroudTextures[itemManager.getBackgroundIndex()];
                        
                        ////롱노트 //*** 임시로 오른손노트랑 똑같은걸로 해놓음
                        startNoteManager.changeLongNoteImage(longNoteTextures[itemManager.getNoteIndex()], new Rectangle(0, 0, longNoteTextures[itemManager.getNoteIndex()].Width, longNoteTextures[itemManager.getNoteIndex()].Height), longNoteScale[0]);

                        ////왼손노트

                        //고스톱이 아니면
                        if (itemManager.getNoteIndex() != 3)
                        {
                            startNoteManager.changeLeftNoteImage(leftNoteTextures[itemManager.getNoteIndex()], new Rectangle(0, 0, leftNoteTextures[itemManager.getNoteIndex()].Width, leftNoteTextures[itemManager.getNoteIndex()].Height), leftNoteScale[0]);
                        }
                    // 고스톱이면 스프라이트 적용
                        else if (itemManager.getNoteIndex() == 3)
                        {
                            startNoteManager.changeLeftNoteImage(leftNoteTextures[itemManager.getNoteIndex()], new Rectangle(0, 0, 100, leftNoteTextures[itemManager.getNoteIndex()].Height), leftNoteScale[0],15, 10);

                        }





                        //오른손 노트 이미지 바꾸기

                        //고스톱이 아니면
                        if (itemManager.getNoteIndex() != 3)
                        {
                            startNoteManager.changeRightNoteImage(rightNoteTextures[itemManager.getNoteIndex()], new Rectangle(0, 0, rightNoteTextures[itemManager.getNoteIndex()].Width, rightNoteTextures[itemManager.getNoteIndex()].Height), rightNoteScale[0]);
                        }


                        // 고스톱이면 스프라이트 적용
                        //
                        else if (itemManager.getNoteIndex() == 3)
                        {
                            startNoteManager.changeRightNoteImage(rightNoteTextures[itemManager.getNoteIndex()], new Rectangle(0, 0, 100, rightNoteTextures[itemManager.getNoteIndex()].Height), rightNoteScale[0],15 ,10);
                 
                        }

                        //curveManager.DeleteAllCurve();

                        Texture2D[] dragTextures = itemManager.GetDragNoteTexture();
                        Texture2D[] dragTextureBackgrounds = itemManager.GetDragNoteBackground();
                        
                        int noteIndex = itemManager.getNoteIndex();

                        //드래그노트 이미지 바꾸기
                        dragNoteManager.Texture = dragTextures[noteIndex];

                        //드래그노트 가 무엇인지 인덱스
                        dragNoteManager.Index = noteIndex;

                        //드래그노트 크기 설정
                     //   dragNoteManager.InitialFrame = itemManager.GetDragNoteInitFrame()[noteIndex];

                        //드래그노트 백그라운드 이마지 바꾸기
                        dragNoteManager.Background = dragTextureBackgrounds[noteIndex];

                        

                        //마커리스트 텍스쳐 가져오기
                        Texture2D[] markersTextures = itemManager.GetMarkerTexture();
                        
                        //*** 마커리스트에 맞는 rect, 바로width와 height 를 가져와서 넣기 때문에 필요 없을 수 도 있다.
                        //Rectangle[] markersRectangle = new Rectangle[5];
                        //markersRectangle[0] = new Rectangle(0,0,265,240);

                        //***마커리스트에 맞는 =>>itemManager로 옮김
                        float[] markersScale = itemManager.GetMarkersScale();

                    //배너문구 초기화
                        perfectBannerManager.Clear();
                        goodBannerManager.Clear();
                        badBannerManager.Clear();
                        missBannerManager.Clear();
                    //콤보숫자 초기화
                        comboNumberManager.Clear();


                    //템포 초기화 
                        SoundFmod.isChangedTempo = 0;
                        SoundFmod.changedTempo = 0;
                        for (int q = 0; q < 6; q++)
                        {
                            memberManager.SetMemberState(q, 0);
                        }
                    //속도초기화 
                        memberManager.SetMembersFrameTime(0.1f);
                        //현재 장착한 마커로 설정//(마커,마커의 rect크기. scale)
                        //개별 마커및 전체 마커에도 설정함
                        MarkManager.chageMarksImages(markersTextures[itemManager.getNoteIndex()], new Rectangle(0,0,markersTextures[itemManager.getNoteIndex()].Width,markersTextures[itemManager.getNoteIndex()].Height), markersScale[0]);
                        
                        //노트 사라지는 영역 지정을 위해 사용
                        Vector2 markerSize = MarkManager.GetMarkerSize();

                        //일단 처음은 항상 0 부터 시작
                      //  MarkManager.GetPattern(0, (int)markerSize.X, (int)markerSize.Y);
                        MarkManager.SetRemoveArea(0, (int)markerSize.X, (int)markerSize.Y);
                     

                      //  Vector2[] zeroIndexMarkers = MarkManager.GetPattern(0, (int)markerSize.X, (int)markerSize.Y);
                        //   removeAreaRec = MarkManager.GetRemoveArea(0);
                  

 
                        //MarkManager.initialize(
                        //    // markManager = new MarkManager(
                        //    markersTextures[itemManager.getNoteIndex()],
                        //   new Rectangle(0, 0, markersTextures[itemManager.getNoteIndex()].Width, markersTextures[itemManager.getNoteIndex()].Height),
                        //    1,
                        //    zeroIndexMarkers[0],
                        //    zeroIndexMarkers[1],
                        //    zeroIndexMarkers[2],
                        //    zeroIndexMarkers[3],
                        //    zeroIndexMarkers[4],
                        //    zeroIndexMarkers[5],
                        //    startNoteManager,
                        //    markersScale[0]


                        //    );


                        /////이펙트 생성 -START
                        Texture2D[] explosionTexture = itemManager.GetEffectTexture();
                        
                        //특성 로드
                        Rectangle[] effectInitFrame = itemManager.GetEffectInitFrame();
                        int[] effectFramCount = itemManager.GetEffectFrameCount();
                        float[] effecScale = itemManager.GetEffectScale();

        
                        //이펙트 
                        int effectIndex = itemManager.getEffectIndex();

                        perfectManager = new PerfectExplosionManager();
                        perfectManager.ExplosionInit(itemManager.GetEffectTexture()[effectIndex], itemManager.GetEffectInitFrame()[effectIndex], itemManager.GetEffectFrameCount()[effectIndex], itemManager.GetEffectScale()[effectIndex], itemManager.GetEffectDulation()[effectIndex]);

                        goodManager = new GoodExplosionManager();
                        goodManager.ExplosionInit(itemManager.GetGoodEffectTexture()[effectIndex], itemManager.GetEffectInitFrame()[effectIndex], itemManager.GetEffectFrameCount()[effectIndex], itemManager.GetEffectScale()[effectIndex], itemManager.GetEffectDulation()[effectIndex]);

                        badManager = new BadExplosionManager();
                        badManager.ExplosionInit(itemManager.GetBadEffectTexture()[effectIndex], itemManager.GetEffectInitFrame()[effectIndex], itemManager.GetEffectFrameCount()[effectIndex], itemManager.GetEffectScale()[effectIndex], itemManager.GetEffectDulation()[effectIndex]);

                        //미스도 투입되면
                        //missManager = new ExplosionManager();
                        //missManager.ExplosionInit(missEffectTextures[effectIndex], new Rectangle(0, 0, 166, 162), 9, 1f, 45);

                        goldGetManager = new ExplosionManager();
                        goldGetManager.ExplosionInit(getGold, new Rectangle(0, 0, 200, 200), 5, 0.7f, 30);

                     

                        ////일단은 miss effect로
                        //goldGetManager = new ExplosionManager();
                        //goldGetManager.ExplosionInit(itemManager.GetMissEffectTexture()[effectIndex], itemManager.GetEffectInitFrame()[effectIndex], itemManager.GetEffectFrameCount()[effectIndex], itemManager.GetEffectScale()[effectIndex], itemManager.GetEffectDulation()[effectIndex]);

                        collisionManager = new CollisionManager(perfectManager, goodManager, badManager, goldGetManager, scoreManager, memberManager, itemManager, perfectBannerManager, goodBannerManager, badBannerManager, missBannerManager, new Vector2(this.Window.ClientBounds.Width, this.Window.ClientBounds.Height), comboNumberManager, charismaManager,dragNoteManager);
            

                        /////이펙트 생성 -END

                        //lifeplus 아이템 장착
                        int indexLifePlusItem = 2;
                        //라이프아이템의 인덱스

                        if (itemManager.getRightHandIndex() == indexLifePlusItem)
                        {
                            lifePlusEffect*=1.1f;
                        }
                        if(itemManager.getLeftHandIndex() == indexLifePlusItem)
                        {
                            lifePlusEffect*=1.1f;
                        }
                        if (itemManager.getNoteIndex() == indexLifePlusItem)
                        {
                            lifePlusEffect*=1.1f;
                        }
                        if(itemManager.getBackgroundIndex() == indexLifePlusItem)
                        {
                            lifePlusEffect*=1.15f;
                        }
                        if(itemManager.getEffectIndex() == indexLifePlusItem)
                        {
                            lifePlusEffect*=1.15f;
                        }
                         

                        gameState = GameStates.Playing;
                        
                        file.Loading(resultSongMenu);

                        uiEndTime = file.EndTime;

                        bool isPlay = false;
                        SoundFmod.sndChannel.isPlaying(ref isPlay);
                        if (isPlay)
                        {
                            SoundFmod.StopSound();
                        }
                      
                        SoundFmod.PlaySound(songsDir + noteFileManager.noteFiles[resultSongMenu].Mp3);
                        isPlayingSong = true;
                    }

                    break;
               #endregion

               #region 튜토리얼씬

                case GameStates.TutorialScene:

                    int resultTutorialScene = tutorialScene.Update();


                    
                    if (resultTutorialScene == -1)
                    {
                        gameState = GameStates.Menu;
                       

                    }




                    break;

               #endregion


           }
           mouseStatePrevious = mouseStateCurrent;
           pastClick = finalClick;

           backJestureManager.Update(gameTime);
           base.Update(gameTime);
        }