IEnumerator RhythmGameResultClose() { yield return(new WaitForSeconds(5.0f)); UI.IDialog.RequestDialogExit <UI.RhythmGameResultDialog>(); settingModel.IsPlayGame = false; rhythmGame_Controller.GameEnd(); BluetoothData data = new BluetoothData(); data.msg = ""; data.dataType = SENDMSGTYPE.MENU; data.musicInfo = MUSICINFO.None; string dataMsg; data.menu = Menu.Main; dataMsg = JsonUtility.ToJson(data); Message.Send <TabletMotionMsg>(new TabletMotionMsg(dataMsg)); Message.Send <RunMenuMsg>(new RunMenuMsg(Menu.None)); }
//립모션으로 메뉴 이동시 private void TabletMotion(TabletMotionMsg msg) { BluetoothData data = JsonUtility.FromJson <BluetoothData>(msg.msg); SENDMSGTYPE tempMsgType = data.dataType; IContent.RequestContentExit <TabletHolostarContent>(); IContent.RequestContentExit <TabletWatchContent>(); IContent.RequestContentExit <TabletMusicContent>(); IContent.RequestContentExit <TabletRhythmContent>(); if (tempMsgType == SENDMSGTYPE.MENU) { try { Menu tempMenu = data.menu; if (tempMenu == Menu.Main) { Debug.Log("메인 메뉴"); settingModel.NowMenu = Menu.Main; } else if (tempMenu == Menu.Watch) { Debug.Log("시계"); settingModel.NowMenu = Menu.Watch; IContent.RequestContentEnter <TabletWatchContent>(); } else if (tempMenu == Menu.Music) { Debug.Log("음악"); settingModel.NowMenu = Menu.Music; IContent.RequestContentEnter <TabletMusicContent>(); } else if (tempMenu == Menu.Game) { Debug.Log("게임"); settingModel.NowMenu = Menu.Game; } else if (tempMenu == Menu.HoloStar) { Debug.Log("홀로스타"); settingModel.NowMenu = Menu.HoloStar; IContent.RequestContentEnter <TabletHolostarContent>(); } else if (tempMenu == Menu.Option) { Debug.Log("옵션"); settingModel.NowMenu = Menu.Option; } WindowBluetooth.GetInstance().SendBluetoothMsg("", SENDMSGTYPE.MENU, MUSICINFO.None, tempMenu); Message.Send <RunMenuMsg>(new RunMenuMsg(tempMenu)); } catch (Exception e) { Debug.Log(e.ToString()); } } else if (tempMsgType == SENDMSGTYPE.GAME) { settingModel.NowMenu = Menu.Game; GameType gameType = (GameType)Enum.Parse(typeof(GameType), data.msg); if (gameType == GameType.AlongGame) { Debug.Log("방치형"); IContent.RequestContentEnter <TabletAloneContent>(); } else if (gameType == GameType.RhythmGame) { Debug.Log("리듬"); IContent.RequestContentEnter <TabletRhythmContent>(); Message.Send <RunMenuMsg>(new RunMenuMsg(Menu.Game)); Message.Send <RhythmGameStartMsg>(new RhythmGameStartMsg()); } } }
void ReceiveMsg(string msg) { if (msg == "DisConnect") { settingModel.IsBluetoothConnet = false; Message.Send <InfoMsg>(new InfoMsg("Bluetooth 연결이 끊어졌습니다.")); return; } BluetoothData data = JsonUtility.FromJson <BluetoothData>(msg); SENDMSGTYPE tempMsgType = data.dataType; WindowBluetooth.GetInstance().SendBluetoothMsg("", SENDMSGTYPE.RECEIVE); if (tempMsgType == SENDMSGTYPE.MENU) { try { Menu tempMenu = data.menu; IContent.RequestContentExit <TabletHolostarContent>(); IContent.RequestContentExit <TabletWatchContent>(); IContent.RequestContentExit <TabletMusicContent>(); IContent.RequestContentExit <TabletRhythmContent>(); if (tempMenu == Menu.Main) { Debug.Log("메인 메뉴"); settingModel.NowMenu = Menu.Main; } else if (tempMenu == Menu.Watch) { Debug.Log("시계"); settingModel.NowMenu = Menu.Watch; IContent.RequestContentEnter <TabletWatchContent>(); } else if (tempMenu == Menu.Music) { Debug.Log("음악"); settingModel.NowMenu = Menu.Music; IContent.RequestContentEnter <TabletMusicContent>(); } else if (tempMenu == Menu.Game) { Debug.Log("게임"); settingModel.NowMenu = Menu.Game; } else if (tempMenu == Menu.HoloStar) { Debug.Log("홀로스타"); settingModel.NowMenu = Menu.HoloStar; IContent.RequestContentEnter <TabletHolostarContent>(); } else if (tempMenu == Menu.Option) { Debug.Log("옵션"); settingModel.NowMenu = Menu.Option; } Message.Send <RunMenuMsg>(new RunMenuMsg(tempMenu)); if (holostarSettingModel.IsMusicPlay && tempMenu == Menu.Music) { } else { Message.Send <SetCharacterAnimationMsg>(new SetCharacterAnimationMsg(AnimationType.Idel1, false)); } } catch (Exception e) { Debug.Log(e.ToString()); } } else if (tempMsgType == SENDMSGTYPE.GAME) { IContent.RequestContentExit <TabletAloneContent>(); IContent.RequestContentExit <TabletRhythmContent>(); settingModel.NowMenu = Menu.Game; GameType gameType = (GameType)Enum.Parse(typeof(GameType), data.msg); if (gameType == GameType.AlongGame) { Debug.Log("방치형"); IContent.RequestContentEnter <TabletAloneContent>(); } else if (gameType == GameType.RhythmGame) { Debug.Log("리듬"); IContent.RequestContentEnter <TabletRhythmContent>(); } } else if (tempMsgType == SENDMSGTYPE.MSG) { if (holostarSettingModel.IsMMSReceive) { Message.Send <InfoMsg>(new InfoMsg(data.msg)); } if (holostarSettingModel.IsTTSReceive) { Message.Send <TTSSendMsg>(new TTSSendMsg(null, data.msg, playerInventoryModel.NowCharacter)); } } else if (tempMsgType == SENDMSGTYPE.MUSIC) { Message.Send <MusicRequestMsg>(new MusicRequestMsg(data.musicInfo, data.msg)); } else if (tempMsgType == SENDMSGTYPE.CHARINFO) { //블루트스 커넥터가 false인 상태에서 최초 정보 수신 연결 확인 알림 //모바일에 인벤토리 정보를 저장 PlayerInventory tempInven = JsonUtility.FromJson <PlayerInventory>(data.msg); playerInventoryModel.PlayerInventory = tempInven; //모델 정보로 케릭터 셋팅 Message.Send <SetCharacterDressMsg>(new SetCharacterDressMsg(playerInventoryModel.PlayerInventory.nowCharacter, playerInventoryModel.PlayerInventory.nowSkin)); string tempSetting = JsonUtility.ToJson(holostarSettingModel.HoloStarSetting); WindowBluetooth.GetInstance().SendBluetoothMsg(tempSetting, SENDMSGTYPE.SETTING); } else if (tempMsgType == SENDMSGTYPE.LOCATION) { string[] location = data.msg.Split('&'); Message.Send <LocationMsg>(new LocationMsg(location[0], location[1])); //위치 정보 저장 } else if (tempMsgType == SENDMSGTYPE.CALENDAR) { if (data.msg == "start") { calendarModel.AlarmEvents.Clear(); } else if (data.msg == "end") { } else { AlarmEvent alarmEvent = JsonUtility.FromJson <AlarmEvent>(data.msg); calendarModel.AlarmEvents.Add(alarmEvent); } //WindowBluetooth.GetInstance().SendBluetoothMsg("", SENDMSGTYPE.RECEIVE); // CalanderEvent alarmEvent = JsonUtility.FromJson<CalanderEvent>(data.msg); //calendarModel.AlarmEvents = alarmEvent.alarmEvents.ToList(); //calendarModel.AlarmEvents.Add //일정 저장 } else if (tempMsgType == SENDMSGTYPE.SETTING) { settingModel.NowMenu = Menu.Option; Message.Send <RunMenuMsg>(new RunMenuMsg(Menu.Option)); HoloStarSetting tempSetting = JsonUtility.FromJson <HoloStarSetting>(data.msg); holostarSettingModel.HoloStarSetting = tempSetting; } else if (tempMsgType == SENDMSGTYPE.ANIMATION) { //애니메이션 AnimationType aniType = (AnimationType)Enum.Parse(typeof(AnimationType), data.msg); Message.Send <SetCharacterAnimationMsg>(new SetCharacterAnimationMsg(aniType, true)); } else if (tempMsgType == SENDMSGTYPE.CONNECTION) { if (Convert.ToBoolean(data.msg)) { Debug.Log("접속 완료"); Message.Send <InfoMsg>(new InfoMsg("Bluetooth 연결되었습니다.")); settingModel.IsBluetoothConnet = true; //Debug.Log("메인"); BluetoothData bluetoothData = new BluetoothData(); bluetoothData.msg = ""; bluetoothData.dataType = SENDMSGTYPE.MENU; bluetoothData.musicInfo = MUSICINFO.None; bluetoothData.menu = Menu.Main; string dataMsg = JsonUtility.ToJson(bluetoothData); Message.Send <TabletMotionMsg>(new TabletMotionMsg(dataMsg)); Message.Send <RunMenuMsg>(new RunMenuMsg(Menu.Main)); WindowBluetooth.GetInstance().SendBluetoothMsg("", SENDMSGTYPE.CHARINFO); } else { Debug.Log("접속 종료"); Message.Send <InfoMsg>(new InfoMsg("Bluetooth 연결이 끊어졌습니다.")); settingModel.IsBluetoothConnet = false; } } else if (tempMsgType == SENDMSGTYPE.INTENT) { Message.Send <STTReceiveMsg>(new STTReceiveMsg(data.msg, "")); } }
//todo.. //음성 인식 처리 부분.. 추후 음성 추가에 따라 처리 private void STTReceive(STTReceiveMsg msg) { int index = 0; try { index = int.Parse(msg.intent); } catch (Exception E) { Debug.Log(E.ToString()); } BluetoothData data = new BluetoothData(); data.msg = ""; data.dataType = SENDMSGTYPE.MENU; data.musicInfo = MUSICINFO.None; string dataMsg; //홀로스타 if (index == 10000)//메인 메뉴 { Message.Send <InfoMsg>(new InfoMsg("메인 메뉴로 이동합니다.")); Debug.Log("메인"); data.menu = Menu.Main; dataMsg = JsonUtility.ToJson(data); Message.Send <TabletMotionMsg>(new TabletMotionMsg(dataMsg)); Message.Send <RunMenuMsg>(new RunMenuMsg(Menu.None)); MenuMoveResponse(); } else if (index == 10001)//메인 메뉴 { Message.Send <InfoMsg>(new InfoMsg("최상위 메뉴로 이동합니다.")); Debug.Log("메인"); data.menu = Menu.Main; dataMsg = JsonUtility.ToJson(data); Message.Send <TabletMotionMsg>(new TabletMotionMsg(dataMsg)); Message.Send <RunMenuMsg>(new RunMenuMsg(Menu.None)); MenuMoveResponse(); } else if (index == 11000)//시계 { Debug.Log("시계"); Message.Send <InfoMsg>(new InfoMsg("탁상시계 화면으로 이동합니다.")); data.menu = Menu.Watch; dataMsg = JsonUtility.ToJson(data); Message.Send <TabletMotionMsg>(new TabletMotionMsg(dataMsg)); Message.Send <RunMenuMsg>(new RunMenuMsg(Menu.Watch)); MenuMoveResponse(); } else if (index == 13200 || index == 13000)//게임 { Debug.Log("게임"); //Message.Send<InfoMsg>(new InfoMsg(" 이동합니다.")); data.dataType = SENDMSGTYPE.GAME; data.msg = GameType.RhythmGame.ToString();; dataMsg = JsonUtility.ToJson(data); Message.Send <TabletMotionMsg>(new TabletMotionMsg(dataMsg)); MenuMoveResponse(); } else if (index == 12000)//음악 { //검지 중지 음악재생 Message.Send <InfoMsg>(new InfoMsg("음악재생으로 이동합니다.")); Debug.Log("음악재생"); data.menu = Menu.Music; dataMsg = JsonUtility.ToJson(data); Message.Send <TabletMotionMsg>(new TabletMotionMsg(dataMsg)); Message.Send <RunMenuMsg>(new RunMenuMsg(Menu.Music)); MenuMoveResponse(); } else if (index == 14000)//홀로스타 { //검지 중지 약지 새끼 홀로스타 Message.Send <InfoMsg>(new InfoMsg("홀로스타 모드로 이동합니다.")); Debug.Log("홀로스타"); data.menu = Menu.HoloStar; dataMsg = JsonUtility.ToJson(data); Message.Send <TabletMotionMsg>(new TabletMotionMsg(dataMsg)); Message.Send <RunMenuMsg>(new RunMenuMsg(Menu.HoloStar)); MenuMoveResponse(); } else if (index == 15000)//옵션 { //엄지 검지 중지 약지 새끼 옵션 Message.Send <InfoMsg>(new InfoMsg("환경설정으로 이동합니다.")); Debug.Log("옵션"); data.menu = Menu.Option; dataMsg = JsonUtility.ToJson(data); Message.Send <TabletMotionMsg>(new TabletMotionMsg(dataMsg)); Message.Send <RunMenuMsg>(new RunMenuMsg(Menu.Option)); MenuMoveResponse(); } else if (index == 12100 || index == 12200)//음악재생 { Message.Send <InfoMsg>(new InfoMsg("음악재생으로 이동합니다.")); //검지 중지 음악재생 Debug.Log("음악재생"); data.menu = Menu.Music; dataMsg = JsonUtility.ToJson(data); Message.Send <TabletMotionMsg>(new TabletMotionMsg(dataMsg)); Message.Send <RunMenuMsg>(new RunMenuMsg(Menu.Music)); MenuMoveResponse(); } else if (index == 20003 && settingModel.NowMenu == Menu.Option)//음소거 { MenuMoveResponse(); Message.Send <InfoMsg>(new InfoMsg("음소거 되었습니다.")); holostarSettingModel.HoloOptionSetting.isMute = true; //사용 } else if (index == 20004 && settingModel.NowMenu == Menu.Option)//음소거 해제 { MenuMoveResponse(); Message.Send <InfoMsg>(new InfoMsg("음소거가 해제되었습니다.")); holostarSettingModel.HoloOptionSetting.isMute = false; } else if (index == 20005 && settingModel.NowMenu == Menu.Option)//볼륨 업 { holostarSettingModel.HoloOptionSetting.TabletVolume += 0.2f; if (holostarSettingModel.HoloOptionSetting.TabletVolume > 1) { holostarSettingModel.HoloOptionSetting.TabletVolume = 1f; } Message.Send <InfoMsg>(new InfoMsg("현재 볼륨은 " + holostarSettingModel.HoloOptionSetting.TabletVolume + " 입니다.")); } else if (index == 20006 && settingModel.NowMenu == Menu.Option)//볼륨 다운 { holostarSettingModel.HoloOptionSetting.TabletVolume -= 0.2f; if (holostarSettingModel.HoloOptionSetting.TabletVolume < 0) { holostarSettingModel.HoloOptionSetting.TabletVolume = 0; } Message.Send <InfoMsg>(new InfoMsg("현재 볼륨은 " + holostarSettingModel.HoloOptionSetting.TabletVolume + " 입니다.")); } else if (index == 31011) { //날씨 Message.Send <WeatherRequestMsg>(new WeatherRequestMsg(playerInventoryModel.NowCharacter)); } else if (index == 31021) { //시간 string time = string.Format("현재 시간은 {0}시 {1}분 입니다.", DateTime.Now.ToString("HH"), DateTime.Now.ToString("mm")); Message.Send <TTSSendMsg>(new TTSSendMsg("", time, playerInventoryModel.NowCharacter)); } else if (index == 31031) { string dateEvent = string.Format("오늘은 {0}개의 일정이 있습니다.", calendarModel.GetTodayEvent()); Message.Send <InfoMsg>(new InfoMsg(dateEvent)); Message.Send <TTSSendMsg>(new TTSSendMsg("", dateEvent, playerInventoryModel.NowCharacter)); //오늘 일정 } else if (index == 31032) { //내일 일정 string dateEvent = string.Format("내일은 {0}개의 일정이 있습니다.", calendarModel.GetTomorrowEvent()); Message.Send <InfoMsg>(new InfoMsg(dateEvent)); Message.Send <TTSSendMsg>(new TTSSendMsg("", dateEvent, playerInventoryModel.NowCharacter)); } else if (index == 0) { Message.Send <TTSSendMsg>(new TTSSendMsg("", "다시 말씀해 주시겠어요?", playerInventoryModel.NowCharacter)); } else { if (playerInventoryModel.NowCharacter == Character.Girl) { SoundManager.Instance.PlaySound(index); } else { index = index + 10000; SoundManager.Instance.PlaySound(index); } Message.Send <EmotionAniMationMsg>(new EmotionAniMationMsg(index)); } if (settingModel.UseWakeUp) { Message.Send <WakeUpMsg>(new WakeUpMsg(true)); } Message.Send <STTBtnSetMsg>(new STTBtnSetMsg(true)); string receive = string.Format("STT 수신 Intent : {0} text : {1}", msg.intent, msg.text); Log.Instance.log(receive); }
void LeapMotion(Menu menu) { //yield return null; BluetoothData data = new BluetoothData(); data.msg = ""; data.dataType = SENDMSGTYPE.MENU; data.musicInfo = MUSICINFO.None; string dataMsg; if (!tabletMainMenu.activeSelf && !settingModel.IsPlayGame) { if (menu == Menu.Main) { //엄지 상위 메뉴 Debug.Log("메인"); data.menu = Menu.Main; dataMsg = JsonUtility.ToJson(data); Message.Send <TabletMotionMsg>(new TabletMotionMsg(dataMsg)); RunMenu(new RunMenuMsg(Menu.None)); } else if (menu == Menu.Watch) { //검지 시계 Debug.Log("시계"); data.menu = Menu.Watch; dataMsg = JsonUtility.ToJson(data); Message.Send <TabletMotionMsg>(new TabletMotionMsg(dataMsg)); RunMenu(new RunMenuMsg(Menu.Watch)); } else if (menu == Menu.Game) { //검지 중지 약지 게임이동 Debug.Log("게임"); data.dataType = SENDMSGTYPE.GAME; data.msg = GameType.RhythmGame.ToString();; dataMsg = JsonUtility.ToJson(data); Message.Send <TabletMotionMsg>(new TabletMotionMsg(dataMsg)); } else if (menu == Menu.HoloStar) { //검지 중지 약지 새끼 홀로스타 Debug.Log("홀로스타"); data.menu = Menu.HoloStar; dataMsg = JsonUtility.ToJson(data); Message.Send <TabletMotionMsg>(new TabletMotionMsg(dataMsg)); RunMenu(new RunMenuMsg(Menu.HoloStar)); } else if (menu == Menu.Music) { //검지 중지 음악재생 Debug.Log("음악재생"); data.menu = Menu.Music; dataMsg = JsonUtility.ToJson(data); Message.Send <TabletMotionMsg>(new TabletMotionMsg(dataMsg)); RunMenu(new RunMenuMsg(Menu.Music)); } else if (menu == Menu.Option) { //엄지 검지 중지 약지 새끼 옵션 Debug.Log("옵션"); data.menu = Menu.Option; dataMsg = JsonUtility.ToJson(data); Message.Send <TabletMotionMsg>(new TabletMotionMsg(dataMsg)); RunMenu(new RunMenuMsg(Menu.Option)); } //tablet_Menu.MenuPosition(menu); } Debug.Log("제스쳐 인식"); }
void ReceiveMsg(string msg) { BluetoothData data = JsonUtility.FromJson <BluetoothData>(msg); SENDMSGTYPE tempMsgType = data.dataType; if (tempMsgType == SENDMSGTYPE.MENU) { try { IContent.RequestContentExit <WatchContent>(); IContent.RequestContentExit <AloneGameContent>(); IContent.RequestContentExit <RhythmGameContent>(); IContent.RequestContentExit <HolostarContent>(); IContent.RequestContentExit <SettingContnet>(); IContent.RequestContentExit <StoreContent>(); IContent.RequestContentExit <MusicContent>(); Menu tempMenu = data.menu; if (tempMenu == Menu.Watch) { IContent.RequestContentEnter <WatchContent>(); Message.Send <RunMenuMsg>(new RunMenuMsg(tempMenu)); } else if (tempMenu == Menu.Music) { IContent.RequestContentEnter <MusicContent>(); Message.Send <RunMenuMsg>(new RunMenuMsg(tempMenu)); } else if (tempMenu == Menu.Game) { if (data.msg == "rhythm") { IContent.RequestContentEnter <RhythmGameContent>(); Message.Send <RhythmGameBluetoothSelectMsg>(new RhythmGameBluetoothSelectMsg(true)); Message.Send <RunMenuMsg>(new RunMenuMsg(tempMenu)); } else { UI.IDialog.RequestDialogEnter <UI.GameSelectDialog>(); Message.Send <RunMenuMsg>(new RunMenuMsg(tempMenu)); } } else if (tempMenu == Menu.Store) { IContent.RequestContentEnter <StoreContent>(); Message.Send <RunMenuMsg>(new RunMenuMsg(tempMenu)); } else if (tempMenu == Menu.HoloStar) { IContent.RequestContentEnter <HolostarContent>(); Message.Send <RunMenuMsg>(new RunMenuMsg(tempMenu)); } else if (tempMenu == Menu.Option) { IContent.RequestContentEnter <SettingContnet>(); } else if (tempMenu == Menu.Main) { IContent.RequestContentEnter <MenuContent>(); } } catch (Exception e) { Debug.Log(e.ToString()); } } else if (tempMsgType == SENDMSGTYPE.MSG) { } else if (tempMsgType == SENDMSGTYPE.MUSIC) { if (data.musicInfo == MUSICINFO.MUSIC_PLAY) { holostarSettingModel.MusicSetting.isMusicPlay = true; } else if (data.musicInfo == MUSICINFO.MUSIC_PAUSE) { holostarSettingModel.MusicSetting.isMusicPlay = false; } Message.Send <BluetoothMusicCommandMsg>(new BluetoothMusicCommandMsg(data.musicInfo, data.msg)); } else if (tempMsgType == SENDMSGTYPE.CHARINFO) { AndroidTrasferMgr.Instance.BluetoothSendMsg(JsonUtility.ToJson(playerInventoryModel.PlayerInventory), SENDMSGTYPE.CHARINFO); } else if (tempMsgType == SENDMSGTYPE.LOCATION) { } else if (tempMsgType == SENDMSGTYPE.CALENDAR) { } else if (tempMsgType == SENDMSGTYPE.SETTING) { HoloStarSetting holoStarSetting; holoStarSetting = JsonUtility.FromJson <HoloStarSetting>(data.msg); holostarSettingModel.HoloStarSetting = holoStarSetting; Message.Send <MusicPlaySettingMsg>(new MusicPlaySettingMsg(holostarSettingModel.HoloStarSetting.musicSetting)); } else if (tempMsgType == SENDMSGTYPE.ANIMATION) { AnimationType aniType = (AnimationType)Enum.Parse(typeof(AnimationType), data.msg); Message.Send <SetCharacterAnimationMsg>(new SetCharacterAnimationMsg(aniType, true)); } else if (tempMsgType == SENDMSGTYPE.CONNECTION) { if (!Convert.ToBoolean(data.msg)) { Message.Send <MusicSettingResetMsg>(new MusicSettingResetMsg()); settingModel.IsBluetoothConnet = false; holostarSettingModel.MusicSetting.isMusicPlay = false; Message.Send <SetCharacterAnimationMsg>(new SetCharacterAnimationMsg(AnimationType.Idel1, false)); AndroidTrasferMgr.Instance.ShowToast("홀로스타 본체와 연결이 끊어졌습니다."); } } else if (tempMsgType == SENDMSGTYPE.RECEIVE) { if (AndroidTrasferMgr.Instance.corTimer != null) { StopCoroutine(AndroidTrasferMgr.Instance.corTimer); AndroidTrasferMgr.Instance.corTimer = null; } AndroidTrasferMgr.Instance.IsSendPossible = true; if (AndroidTrasferMgr.Instance.ListMsg.Count > 0) { Debug.Log("지워지는 데인터 :" + AndroidTrasferMgr.Instance.ListMsg[0]); AndroidTrasferMgr.Instance.ListMsg.RemoveAt(0); } } }