public void restart() { // 배경 영상 정지 RSC.GetVideo(Global.modeVideoName[(int)Global.currentSelectMode]).GetComponent <MediaPlayerCtrl>().Stop(); SceneManager.LoadScene("Ready"); }
// Update is called once per frame void Update() { if (loadFlag) { absoluteTime += Time.deltaTime; if (absoluteTime >= 0.5f) { loadFlag = false; // 리소스 로드 //Global.loadResource(); // XML, JAM 로드 XML_LoadJudgeData(); XML_LoadSelectedMusic(); // 오디오, 배경 비디오 파일 로드 RSC.LoadAudio(Global.songPath + "/" + Global.mp3Path + "/" + Global.musicInfo[Global.currentSelectMusic].mp3Name); RSC.LoadVideoCache(Global.musicInfo[Global.currentSelectMusic].bgaName); // 인게임 설정 로드 loadIngameSetting(); // 씬 전환 SceneManager.LoadScene("InGame"); } } }
public void selectMode(ref GameObject currentObject) { for (int i = 0; i < selectTarget.Length; ++i) { if (selectTarget[i] == currentObject) { Global.currentSelectMode = (SelectMode)i; Debug.Log(Global.currentSelectMode.ToString() + " Selected."); if (Global.currentSelectMode != SelectMode.Setting) { loadingToast.SetActive(true); changeScene(); for (int j = 0; j < Global.modeVideoName.Length; ++j) { MediaPlayerCtrl videoCache = RSC.GetVideo(Global.modeVideoName[j]).GetComponent <MediaPlayerCtrl>(); videoCache.Stop(); } } else { denyMessage(); return; } } } }
public void startIngame() { loadIngameLoadingData(); // 배경 영상 정지 RSC.GetVideo(Global.modeVideoName[(int)Global.currentSelectMode]).GetComponent <MediaPlayerCtrl>().Stop(); SceneManager.LoadScene("IngameLoading"); }
public void exit() { if (Global.musicInfo != null) { RSC.RemoveAudio(Global.musicInfo[Global.currentSelectMusic].prevName); RSC.RemoveSprite(Global.musicInfo[Global.currentSelectMusic].pngName); } SceneManager.LoadScene("MusicSelect"); }
void nextScene() { if (Global.musicInfo != null) { RSC.RemoveVideo(Global.musicInfo[Global.currentSelectMusic].bgaName); RSC.RemoveAudio(Global.musicInfo[Global.currentSelectMusic].mp3Name); } Global.noteManager.Clear(); Global.currentModeInfo.noteInfo.Clear(); SceneManager.LoadScene("Result"); }
public void back() { // 미리듣기, 타이틀 파일 제거 RSC.RemoveSprite(Global.musicInfo[Global.currentSelectMusic].pngName); RSC.RemoveAudio(Global.musicInfo[Global.currentSelectMusic].prevName); // 배경 영상 정지 RSC.GetVideo(Global.modeVideoName[(int)Global.currentSelectMode]).GetComponent <MediaPlayerCtrl>().Stop(); // BGM 재생 (중복으로 임시제외) //Global.outGameBGM.GetComponent<AudioSource>().Play(); SceneManager.LoadScene("MusicSelect"); }
public void back() { if (Global.musicInfo != null) { RSC.RemoveVideo(Global.musicInfo[Global.currentSelectMusic].bgaName); RSC.RemoveAudio(Global.musicInfo[Global.currentSelectMusic].prevName); RSC.RemoveAudio(Global.musicInfo[Global.currentSelectMusic].mp3Name); RSC.RemoveSprite(Global.musicInfo[Global.currentSelectMusic].pngName); } Global.noteManager.Clear(); Global.currentModeInfo.noteInfo.Clear(); SceneManager.LoadScene("MusicSelect"); }
// Use this for initialization void Start() { // 배경 비디오 로드 if (Global.modeVideoName != null) { MediaPlayerCtrl videoCache; GameObject tmpGO = RSC.GetVideo(Global.modeVideoName[(int)Global.currentSelectMode]) as GameObject; if (tmpGO != null) { videoCache = tmpGO.GetComponent <MediaPlayerCtrl>(); if (videoCache != null) { videoCache.m_TargetMaterial[0] = bgObject; videoCache.Play(); } else { Debug.Log("Cannot load videocache."); } } else { Debug.Log("Object not Found"); } } else { Debug.Log("Cannot load videocache."); } // 타이틀 이미지 로드 if (Global.musicInfo != null) { Sprite tmpSpr = RSC.GetSprite(Global.musicInfo[Global.currentSelectMusic].pngName); if (tmpSpr != null) { titleObject.GetComponent <UI2DSprite>().sprite2D = tmpSpr; } else { Debug.Log("Cannot Load title image."); } } // 타이틀, 아티스트 라벨 로드 titleLabel.GetComponent <UILabel>().text = Global.musicInfo[Global.currentSelectMusic].titleName; artistLabel.GetComponent <UILabel>().text = Global.musicInfo[Global.currentSelectMusic].makerName; }
// Use this for initialization void Start() { GameObject tmpObj = new GameObject(); DontDestroyOnLoad(tmpObj); Global.outGameBGM = tmpObj.AddComponent <AudioSource>(); RSC.LoadAudio("Sound/bgm1"); Global.outGameBGM.playOnAwake = false; Global.outGameBGM.loop = true; Global.outGameBGM.clip = RSC.GetAudio("bgm1"); Global.outGameBGM.Play(); // TST 스프라이트 받아오기 spr_TST = obj_TouchToStart.GetComponent <UI2DSprite>(); }
// Use this for initialization void Start() { // 타이틀 이미지 로드 if (Global.musicInfo != null) { Sprite tmpSpr = RSC.GetSprite(Global.musicInfo[Global.currentSelectMusic].pngName); if (tmpSpr != null) { titleObject.GetComponent <UI2DSprite>().sprite2D = tmpSpr; } else { Debug.Log("Cannot Load title image."); } } }
void load() { // 리소스 로드 //Global.loadResource(); // XML, JAM 로드 XML_LoadJudgeData(); XML_LoadSelectedMusic(); // 오디오, 배경 비디오 파일 로드 RSC.LoadAudio(Global.songPath + "/" + Global.mp3Path + "/" + Global.musicInfo[Global.currentSelectMusic].mp3Name); RSC.LoadVideoCache(Global.musicInfo[Global.currentSelectMusic].bgaName); // 인게임 설정 로드 loadIngameSetting(); // 씬 전환 SceneManager.LoadScene("InGame"); }
void Start () { for (int i = 0; i < Global.modeVideoName.Length; ++i) { GameObject tmpGO = RSC.Get(Global.modeVideoName[i]) as GameObject; if (tmpGO == null) { Debug.Log("Object not Found"); return; } videoCache = tmpGO.GetComponent<MediaPlayerCtrl>(); if (videoCache != null) { videoCache.m_bLoop = true; videoCache.m_bFullScreen = true; Array.Resize(ref videoCache.m_TargetMaterial, 1); videoCache.m_TargetMaterial[0] = gameObject; videoCache.Play(); } else { Debug.Log("Cannot load videocache."); } } }
// Use this for initialization void Start() { // 백그라운드 영상 로드 if (Global.titleFlag) { Global.titleFlag = false; for (int i = 0; i < Global.modeVideoName.Length; ++i) { RSC.LoadVideoCache(Global.modeVideoName[i]); } } MediaPlayerCtrl videoCache; for (int i = 0; i < Global.modeVideoName.Length; ++i) { GameObject tmpGO = RSC.GetVideo(Global.modeVideoName[i]) as GameObject; if (tmpGO == null) { Debug.Log("Object not Found"); return; } videoCache = tmpGO.GetComponent <MediaPlayerCtrl>(); if (videoCache != null) { videoCache.m_bLoop = true; videoCache.m_bFullScreen = true; videoCache.m_bAutoPlay = true; Array.Resize(ref videoCache.m_TargetMaterial, 1); videoCache.m_TargetMaterial[0] = selectTarget[i]; videoCache.Play(); } else { Debug.Log("Cannot load videocache."); } } }
public void selectMusic() { Collider2D col = Physics2D.OverlapPoint( new Vector2(selectObject.transform.localPosition.x * selectObject.transform.root.localScale.x, selectObject.transform.localPosition.y * selectObject.transform.root.localScale.y)); if (col != null) { Global.currentSelectMusic = Int32.Parse(col.name); if (Global.musicInfo.ContainsKey(Global.currentSelectMusic)) { Debug.Log(Global.musicInfo[Global.currentSelectMusic].titleName + " Selected."); // 미리듣기, 타이틀 파일 로드 RSC.LoadSprite(Global.songPath + "/" + Global.pngPath + "/" + Global.musicInfo[Global.currentSelectMusic].pngName); RSC.LoadAudio(Global.songPath + "/" + Global.prevPath + "/" + Global.musicInfo[Global.currentSelectMusic].prevName); // 배경 영상 정지 RSC.GetVideo(Global.modeVideoName[(int)Global.currentSelectMode]).GetComponent <MediaPlayerCtrl>().Stop(); SceneManager.LoadScene("Ready"); } } }
void loadMusicInfo() { string readingNode; string readingAttr; do { TextAsset txt = Resources.Load(Global.musicInfoPath) as TextAsset; XmlDocument xmldoc = new XmlDocument(); xmldoc.LoadXml(txt.text); readingNode = "MusicData"; XmlNodeList tmpNodeList = xmldoc.SelectNodes(readingNode); if (tmpNodeList == null || tmpNodeList.Count <= 0) { Debug.Log("Node not found : " + readingNode); break; } tmpNodeList = tmpNodeList[0].ChildNodes; Global.musicInfo = new Dictionary <int, MusicInfo>(); for (int i = 0; i < tmpNodeList.Count; ++i) { MusicInfo tmpMusicInfo = new MusicInfo(); readingAttr = "id"; if (tmpNodeList[i].Attributes[readingAttr] == null) { Debug.Log("Attribute not found : " + readingAttr); break; } tmpMusicInfo.id = XmlConvert.ToInt32(tmpNodeList[i].Attributes[readingAttr].Value); readingAttr = "title"; if (tmpNodeList[i].Attributes[readingAttr] == null) { Debug.Log("Attribute not found : " + readingAttr); break; } tmpMusicInfo.titleName = tmpNodeList[i].Attributes[readingAttr].Value; readingAttr = "maker"; if (tmpNodeList[i].Attributes[readingAttr] == null) { Debug.Log("Attribute not found : " + readingAttr); break; } tmpMusicInfo.makerName = tmpNodeList[i].Attributes[readingAttr].Value; readingAttr = "bpm"; if (tmpNodeList[i].Attributes[readingAttr] == null) { Debug.Log("Attribute not found : " + readingAttr); break; } tmpMusicInfo.bpm = XmlConvert.ToSingle(tmpNodeList[i].Attributes[readingAttr].Value); readingAttr = "ez"; if (tmpNodeList[i].Attributes[readingAttr] == null) { Debug.Log("Attribute not found : " + readingAttr); break; } tmpMusicInfo.easyDiff = XmlConvert.ToInt32(tmpNodeList[i].Attributes[readingAttr].Value); readingAttr = "nm"; if (tmpNodeList[i].Attributes[readingAttr] == null) { Debug.Log("Attribute not found : " + readingAttr); break; } tmpMusicInfo.normalDiff = XmlConvert.ToInt32(tmpNodeList[i].Attributes[readingAttr].Value); readingAttr = "hd"; if (tmpNodeList[i].Attributes[readingAttr] == null) { Debug.Log("Attribute not found : " + readingAttr); break; } tmpMusicInfo.hardDiff = XmlConvert.ToInt32(tmpNodeList[i].Attributes[readingAttr].Value); readingAttr = "omp"; if (tmpNodeList[i].Attributes[readingAttr] == null) { Debug.Log("Attribute not found : " + readingAttr); break; } tmpMusicInfo.ompName = tmpNodeList[i].Attributes[readingAttr].Value; readingAttr = "mp3"; if (tmpNodeList[i].Attributes[readingAttr] == null) { Debug.Log("Attribute not found : " + readingAttr); break; } tmpMusicInfo.mp3Name = tmpNodeList[i].Attributes[readingAttr].Value; readingAttr = "png"; if (tmpNodeList[i].Attributes[readingAttr] == null) { Debug.Log("Attribute not found : " + readingAttr); break; } tmpMusicInfo.pngName = tmpNodeList[i].Attributes[readingAttr].Value; readingAttr = "mpng"; if (tmpNodeList[i].Attributes[readingAttr] == null) { Debug.Log("Attribute not found : " + readingAttr); break; } tmpMusicInfo.mpngName = tmpNodeList[i].Attributes[readingAttr].Value; readingAttr = "bga"; if (tmpNodeList[i].Attributes[readingAttr] == null) { Debug.Log("Attribute not found : " + readingAttr); break; } tmpMusicInfo.bgaName = tmpNodeList[i].Attributes[readingAttr].Value + ".mp4"; readingAttr = "jam"; if (tmpNodeList[i].Attributes[readingAttr] == null) { Debug.Log("Attribute not found : " + readingAttr); break; } tmpMusicInfo.jamName = tmpNodeList[i].Attributes[readingAttr].Value; readingAttr = "prev"; if (tmpNodeList[i].Attributes[readingAttr] == null) { Debug.Log("Attribute not found : " + readingAttr); break; } tmpMusicInfo.prevName = tmpNodeList[i].Attributes[readingAttr].Value; readingAttr = "sort"; if (tmpNodeList[i].Attributes[readingAttr] == null) { Debug.Log("Attribute not found : " + readingAttr); break; } tmpMusicInfo.sort = XmlConvert.ToInt32(tmpNodeList[i].Attributes[readingAttr].Value); readingAttr = "pay"; if (tmpNodeList[i].Attributes[readingAttr] == null) { Debug.Log("Attribute not found : " + readingAttr); break; } tmpMusicInfo.pay = (PaymentType)XmlConvert.ToInt32(tmpNodeList[i].Attributes[readingAttr].Value); readingAttr = "cost"; if (tmpNodeList[i].Attributes[readingAttr] == null) { Debug.Log("Attribute not found : " + readingAttr); break; } tmpMusicInfo.cost = XmlConvert.ToInt32(tmpNodeList[i].Attributes[readingAttr].Value); readingAttr = "lock"; if (tmpNodeList[i].Attributes[readingAttr] == null) { Debug.Log("Attribute not found : " + readingAttr); break; } tmpMusicInfo.isLocked = XmlConvert.ToInt32(tmpNodeList[i].Attributes[readingAttr].Value); Global.musicInfo[tmpMusicInfo.id] = tmpMusicInfo; } readingNode = null; } while (false); if (readingNode != null) { Debug.Log("Failed to reading XML Node : " + readingNode); return; } // 썸네일, 타이틀 로드 List <MusicInfo> tmpMusicInfoList = Global.musicInfo.Values.ToList(); for (int i = 0; i < tmpMusicInfoList.Count; ++i) { RSC.LoadSprite(Global.songPath + "/" + Global.mpngPath + "/" + tmpMusicInfoList[i].mpngName); RSC.LoadSprite(Global.songPath + "/" + Global.pngPath + "/" + tmpMusicInfoList[i].pngName); } }
public void back() { RSC.GetVideo(Global.modeVideoName[(int)Global.currentSelectMode]).GetComponent <MediaPlayerCtrl>().Stop(); SceneManager.LoadScene("ModeSelect"); }
// Use this for initialization void Start() { // 배경 비디오 로드 if (Global.modeVideoName != null) { MediaPlayerCtrl videoCache; GameObject tmpGO = RSC.GetVideo(Global.modeVideoName[(int)Global.currentSelectMode]) as GameObject; if (tmpGO != null) { videoCache = tmpGO.GetComponent <MediaPlayerCtrl>(); if (videoCache != null) { videoCache.m_TargetMaterial[0] = bgObject; videoCache.Play(); } else { Debug.Log("Cannot load videocache."); } } else { Debug.Log("Object not Found"); } } else { Debug.Log("Cannot load videocache."); } // 수록곡 정보 로드 if (Global.musicInfo != null) { List <MusicInfo> tmpInfoList = Global.musicInfo.Values.ToList(); for (int i = 0; i < tmpInfoList.Count; ++i) { MusicInfo tmpInfo = tmpInfoList[i]; GameObject tmpObject = Instantiate(dummyTitle) as GameObject; tmpObject.transform.SetParent(titleGrid.transform); tmpObject.transform.localScale = new Vector3(1, 1, 1); tmpObject.name = tmpInfo.id.ToString(); tmpObject.transform.FindChild("Title_Thumb").GetComponent <UI2DSprite>().sprite2D = RSC.GetSprite(tmpInfoList[i].mpngName); if (tmpInfo.isLocked != 0) { tmpObject.transform.FindChild("Title_Thumb").GetComponent <UI2DSprite>().color = new Color(1, 1, 1, 0.5f); tmpObject.transform.FindChild("Title_Lock").gameObject.SetActive(true); } // tmpObject.transform.FindChild("ID Label").GetComponent<UILabel>().text = ""; tmpObject.transform.FindChild("Title Label").GetComponent <UILabel>().text = tmpInfo.titleName; tmpObject.transform.FindChild("Maker Label").GetComponent <UILabel>().text = tmpInfo.makerName; } } titleGrid.GetComponent <UIGrid>().Reposition(); /* * if (Global.musicInfo.Count % 2 == 0) * { * Vector3 tmpVec = titleGrid.transform.parent.localPosition; * tmpVec.y = 0f; * titleGrid.transform.parent.localPosition = tmpVec; * }*/ }
// Use this for initialization void Start() { resetGlobalVariable(); float secondPerMeasure = 240f / Global.currentModeInfo.bpm; // 판정 오브젝트 judgeAnimation = judgeObject.GetComponent <JudgementAnimation>() as JudgementAnimation; //judgeObject.SetActive(false); if (Global.musicInfo != null) { // 오디오 로드 mp3Audio = GetComponent <AudioSource>(); mp3Audio.clip = RSC.GetAudio(Global.musicInfo[Global.currentSelectMusic].mp3Name); if (mp3Audio.clip == null) { Debug.Log("Cannot load audio file."); } // 배경 비디오 로드 GameObject tmpGO = RSC.GetVideo(Global.musicInfo[Global.currentSelectMusic].bgaName) as GameObject; if (tmpGO != null) { videoCache = tmpGO.GetComponent <MediaPlayerCtrl>(); if (videoCache != null) { videoCache.m_bLoop = false; videoCache.m_bFullScreen = true; videoCache.m_bAutoPlay = false; Array.Resize(ref videoCache.m_TargetMaterial, 1); videoCache.m_TargetMaterial[0] = bgObject; videoCache.Stop(); } else { Debug.Log("Cannot load videocache."); } } else { Debug.Log("Object not Found"); } } else { Debug.Log("Cannot load videocache."); } // 노트 오브젝트 로드 if (Global.currentModeInfo.noteInfo != null) { Global.noteManager = new Dictionary <int, List <NoteManager> >(); for (int i = 0; i < Global.currentModeInfo.noteInfo.Count; ++i) { List <NoteManager> tmpNoteManagerList = new List <NoteManager>(); for (int j = 0; j < Global.currentModeInfo.noteInfo[i].Count; ++j) { GameObject noteObject = Instantiate(dummyNote) as GameObject; NoteManager tmpNoteManager = noteObject.GetComponent <NoteManager>() as NoteManager; tmpNoteManager.noteInfo = Global.currentModeInfo.noteInfo[i][j]; noteObject.transform.SetParent(dummyNote.transform.parent); noteObject.transform.localScale = new Vector3(1, 1, 1); switch (tmpNoteManager.noteInfo.type) { case NoteType.Normal: { switch (tmpNoteManager.noteInfo.drag) { case DragType.Normal: break; case DragType.DragBody1: case DragType.DragHead1: case DragType.DragTail1: case DragType.DragBody2: case DragType.DragHead2: case DragType.DragTail2: { noteObject.GetComponent <UI2DSprite>().sprite2D = dummySprites[1]; } break; default: break; } } break; case NoteType.LongHead: case NoteType.LongBody: case NoteType.LongTail: { noteObject.GetComponent <UI2DSprite>().sprite2D = dummySprites[2]; } break; default: break; } tmpNoteManager.absoluteTime = Global.firstNoteDelayTime + (secondPerMeasure * tmpNoteManager.noteInfo.measure) + (secondPerMeasure * tmpNoteManager.noteInfo.grid); Vector3 tmpVector = new Vector3(); tmpVector.x = Global.sequencePosition[i].x; tmpVector.y = Global.sequencePosition[i].y; tmpVector.z = (float)(tmpNoteManager.absoluteTime * Global.z_PerMeasure); noteObject.transform.localPosition = tmpNoteManager.absolutePosition = tmpVector; //noteObject.SetActive(true); noteObject.GetComponent <UIWidget>().depth = 10000 - j; tmpNoteManagerList.Add(tmpNoteManager); } Global.noteManager[i] = tmpNoteManagerList; } } }
// Use this for initialization void Start() { // 배경 비디오 로드 if (Global.modeVideoName != null) { MediaPlayerCtrl videoCache; GameObject tmpGO = RSC.GetVideo(Global.modeVideoName[(int)Global.currentSelectMode]) as GameObject; if (tmpGO != null) { videoCache = tmpGO.GetComponent <MediaPlayerCtrl>(); if (videoCache != null) { videoCache.m_TargetMaterial[0] = bgObject; videoCache.Play(); } else { Debug.Log("Cannot load videocache."); } } else { Debug.Log("Object not Found"); } } else { Debug.Log("Cannot load videocache."); } // 미리듣기 로드 AudioClip tmpAudio = RSC.GetAudio(Global.musicInfo[Global.currentSelectMusic].prevName); if (tmpAudio != null) { titleObject.GetComponent <AudioSource>().clip = tmpAudio; titleObject.GetComponent <AudioSource>().Play(); } else { Debug.Log("Cannot Load audio."); } // 난이도 스프라이트 로드 easyButtonIdle = easyButton.GetComponent <UI2DSprite>().sprite2D; normalButtonIdle = normalButton.GetComponent <UI2DSprite>().sprite2D; hardButtonIdle = hardButton.GetComponent <UI2DSprite>().sprite2D; Global.currentSelectDifficulty = Difficulty.Easy; changeDifficulty(Global.currentSelectDifficulty); // 타이틀 이미지 로드 if (Global.musicInfo != null) { Sprite tmpSpr = RSC.GetSprite(Global.musicInfo[Global.currentSelectMusic].pngName); if (tmpSpr != null) { titleObject.GetComponent <UI2DSprite>().sprite2D = tmpSpr; // 곡 락 여부 if (Global.musicInfo[Global.currentSelectMusic].isLocked != 0) { titleObject.GetComponent <UI2DSprite>().color = new Color(1, 1, 1, 0.5f); obj_TitleLock.SetActive(true); obj_UnlockTooltip.SetActive(true); } } else { Debug.Log("Cannot Load title image."); } } // 스타트 버튼, 아이템 버튼 활성화 조정 if (Global.musicInfo[Global.currentSelectMusic].isLocked != 0) { startButton.SetActive(false); itemButtons.SetActive(false); } // 타이틀, 아티스트 라벨 로드 titleLabel.GetComponent <UILabel>().text = Global.musicInfo[Global.currentSelectMusic].titleName; artistLabel.GetComponent <UILabel>().text = Global.musicInfo[Global.currentSelectMusic].makerName; // BGM 페이드아웃 준비 Global.bgmVolume = Global.outGameBGM.volume = 1f; alpha_Tooltip = 0f; alpha_UnlockTooltip = 5f; }