protected override void OnLoadStart() { gameSchedule = new GameSchedule(); listAlongGameSchedule = new List <AloneGameSchedule>(); dicSchedule = new Dictionary <int, AloneGameSchedule>(); playerStatus = new PlayerStatus(); playerInventory = new PlayerInventory(); holostarSetting = new HoloStarSetting(); calanderEvent = new CalanderEvent(); scheduleModel = Model.First <ScheduleModel>(); playerStatusModel = Model.First <PlayerStatusModel>(); playerInventoryModel = Model.First <PlayerInventoryModel>(); settingModel = Model.First <SettingModel>(); holostarSettingModel = Model.First <HolostarSettingModel>(); calendarModel = Model.First <CalendarModel>(); CheckFile("PlayerInventory"); CheckFile("HoloStarSetting"); CheckFile("Calendar"); SetLoadComplete(); }
protected override void OnLoadStart() { gameSchedule = new GameSchedule(); listAlongGameSchedule = new List <AloneGameSchedule>(); dicSchedule = new Dictionary <int, AloneGameSchedule>(); playerStatus = new PlayerStatus(); playerInventory = new PlayerInventory(); holostarSetting = new HoloStarSetting(); mobileOption = new MobileOption(); scheduleModel = Model.First <ScheduleModel>(); playerStatusModel = Model.First <PlayerStatusModel>(); playerInventoryModel = Model.First <PlayerInventoryModel>(); settingModel = Model.First <SettingModel>(); holostarSettingModel = Model.First <HolostarSettingModel>(); mobileOptionModel = Model.First <MobileOptionModel>(); CheckFile("Schedule"); CheckFile("PlayerStatus"); CheckFile("PlayerInventory"); CheckFile("HoloStarSetting"); CheckFile("MobileOption"); SetLoadComplete(); }
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, "")); } }
void CheckFile(string fileName) { string path = Application.dataPath + "/Resources/Json/" + fileName + ".json"; #if (UNITY_EDITOR) path = Application.dataPath + "/Resources/Json/" + fileName + ".json"; #elif (UNITY_STANDALONE_WIN) path = Application.dataPath + "/StreamingAssets/Json/" + fileName + ".json"; #elif (UNITY_ANDROID) string sDirPath; sDirPath = Application.persistentDataPath + "/Json"; DirectoryInfo di = new DirectoryInfo(sDirPath); if (di.Exists == false) { di.Create(); } path = Application.persistentDataPath + "/Json/" + fileName + ".json"; #endif FileInfo fi = new FileInfo(path); if (fi.Exists) { if (fileName == "PlayerStatus") { playerStatus = LoadJsonFile <PlayerStatus>("PlayerStatus"); playerStatusModel.CharacterStatus = playerStatus; } else if (fileName == "Schedule") { gameSchedule = LoadJsonFile <GameSchedule>("Schedule"); for (int i = 0; i < gameSchedule.alonGameShedule.Length; i++) { listAlongGameSchedule.Add(gameSchedule.alonGameShedule[i]); dicSchedule.Add(i, gameSchedule.alonGameShedule[i]); } scheduleModel.DicSchedule = dicSchedule; } else if (fileName == "PlayerInventory") { playerInventory = LoadJsonFile <PlayerInventory>("PlayerInventory"); playerInventoryModel.PlayerInventory = playerInventory; } else if (fileName == "HoloStarSetting") { holostarSetting = LoadJsonFile <HoloStarSetting>("HoloStarSetting"); holostarSettingModel.HoloStarSetting = holostarSetting; } else if (fileName == "Calendar") { calanderEvent = LoadJsonFile <CalanderEvent>("Calendar"); calendarModel.AlarmEvents = calanderEvent.alarmEvents.ToList(); } } else { if (fileName == "PlayerStatus") { CreatePlayerStatus(); playerStatusModel.CharacterStatus = playerStatus; } else if (fileName == "Schedule") { CreateScheduleJson(); for (int i = 0; i < listAlongGameSchedule.Count; i++) { dicSchedule.Add(i, listAlongGameSchedule[i]); } scheduleModel.DicSchedule = dicSchedule; } else if (fileName == "PlayerInventory") { CreatePlayerInventoryJson(); playerInventoryModel.PlayerInventory = playerInventory; } else if (fileName == "HoloStarSetting") { CreateSettingJson(); holostarSettingModel.HoloStarSetting = holostarSetting; } } }
void CheckFile(string fileName) { #if (UNITY_EDITOR) string path = Application.dataPath + "/Resources/Json/" + fileName + ".json"; #elif (UNITY_ANDROID) string sDirPath; sDirPath = Application.persistentDataPath + "/Json"; DirectoryInfo di = new DirectoryInfo(sDirPath); if (di.Exists == false) { di.Create(); } string path = Application.persistentDataPath + "/Json/" + fileName + ".json"; #endif FileInfo fi = new FileInfo(path); if (fi.Exists) { if (fileName == "PlayerStatus") { playerStatus = LoadJsonFile <PlayerStatus>("PlayerStatus"); playerStatusModel.CharacterStatus = playerStatus; } else if (fileName == "Schedule") { gameSchedule = LoadJsonFile <GameSchedule>("Schedule"); for (int i = 0; i < gameSchedule.alonGameShedule.Length; i++) { listAlongGameSchedule.Add(gameSchedule.alonGameShedule[i]); dicSchedule.Add(i, gameSchedule.alonGameShedule[i]); } scheduleModel.DicSchedule = dicSchedule; } else if (fileName == "PlayerInventory") { playerInventory = LoadJsonFile <PlayerInventory>("PlayerInventory"); playerInventoryModel.PlayerInventory = playerInventory; playerInventoryModel.ArrayBuyCharacter = playerInventory.buyCharacter; playerInventoryModel.ArrayBuySkinNum = playerInventory.buySkinNum; } else if (fileName == "HoloStarSetting") { holostarSetting = LoadJsonFile <HoloStarSetting>("HoloStarSetting"); holostarSettingModel.HoloStarSetting = holostarSetting; } else if (fileName == "MobileOption") { mobileOption = LoadJsonFile <MobileOption>("MobileOption"); mobileOptionModel.MobileOption = mobileOption; } } else { if (fileName == "PlayerStatus") { CreatePlayerStatus(); playerStatusModel.CharacterStatus = playerStatus; } else if (fileName == "Schedule") { CreateScheduleJson(); for (int i = 0; i < listAlongGameSchedule.Count; i++) { dicSchedule.Add(i, listAlongGameSchedule[i]); } scheduleModel.DicSchedule = dicSchedule; } else if (fileName == "PlayerInventory") { CreatePlayerInventoryJson(); playerInventoryModel.PlayerInventory = playerInventory; playerInventoryModel.ArrayBuyCharacter = playerInventory.buyCharacter; playerInventoryModel.ArrayBuySkinNum = playerInventory.buySkinNum; } else if (fileName == "HoloStarSetting") { CreateSettingJson(); holostarSettingModel.HoloStarSetting = holostarSetting; } else if (fileName == "MobileOption") { CreateMobileOptionJson(); mobileOptionModel.MobileOption = mobileOption; } } }