void Start() { instance = this; }
private void Start() { instance = this; MainCamera = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <Camera>(); Music = GameObject.Find("Music Source").GetComponent <AudioSource>(); Sounds = gameObject.GetComponent <AudioSource>(); CursorTrail = GameObject.Find("Cursor Trail"); comboText = GameObject.Find("Canvas/Combo").GetComponent <Text>(); scoreText = GameObject.Find("Canvas/Score").GetComponent <Number>(); percentageText = GameObject.Find("Canvas/Percentage").GetComponent <Text>(); WorldCanvas = GameObject.Find("Canvas World").GetComponent <Transform>(); DontDestroyOnLoad(playStat.gameObject); switch (Userpref.data.skinType) { default: case 0: Debug.Log("USING SKIN" + Userpref.data.skinType); Circle = Resources.Load <GameObject>("Skin0/Circle"); HitSound = Resources.Load <AudioClip>("Skin0/player_knocked"); break; case 1: Circle = Resources.Load <GameObject>("Skin1/CircleBhe"); HitSound = Resources.Load <AudioClip>("Skin1/ㄅtrim"); break; case 2: Circle = Resources.Load <GameObject>("Skin2/Circle"); HitSound = Resources.Load <AudioClip>("Skin2/jc_hentai!"); break; } if (GameObject.Find("GameValue")) { Debug.Log("找到GameValue。正在套用"); ToGameValue v = GameObject.Find("GameValue").GetComponent <ToGameValue>(); playStat.playing = v.FinalOsu; if (v.FinalOsu.isFromAsset) { TextAsset txt = Resources.Load <TextAsset>(v.FinalOsu.path.Replace("RESOURCES/", "")); string p = $"{Application.temporaryCachePath}/{Path.GetRandomFileName()}"; File.WriteAllText(p, txt.text); Debug.Log("Song is from Resources! TempSheetPath=" + p); ReadCircles(p); } else { ReadCircles(v.FinalOsu.path); } MainMusic = v.FinalMusic; if (!string.IsNullOrEmpty(v.FinalOsu.BGmovieFileName)) { BGMovie.url = Path.Combine(v.FinalOsu.dirPath, v.FinalOsu.BGmovieFileName); } else { BG.texture = v.FinalBG; } Destroy(v.gameObject); } else { #if UNITY_EDITOR ReadCircles(Application.dataPath + "/" + TestMapPath); MainMusic = TestMusic; BG.texture = TestImage; #else Debug.LogError("未找到GameValue! 這不該發生!"); UnityEngine.SceneManagement.SceneManager.LoadScene("Menu"); #endif } playStat.mods = Userpref.data.mods.ToArray(); if (!playStat.HasMod(PlayStat.Mods.AutoMove)) { autoMoveCursor.SetActive(false); } Music.clip = MainMusic; pSounds = Sounds; pHitSound = HitSound; GameStart(); }