// Start is called before the first frame update void Start() { currentLevelGameObject = GameObject.Find("Level"); if (currentLevelGameObject == null) { currentLevelGameObject = Instantiate(levels[currentLevel]) as GameObject; } SetupLevel(currentLevelGameObject.GetComponent <Level>()); //levelCurrentTimestamp = 0.0f; ////levelDuration = 64.0f; //levelDuration = 8.0f; //pixelToSecondsRate = levelDuration * 4.0f; //levelBeatsCount = levelDuration * pixelToSecondsRate / tileSize; //currentBeat = 0; //currentBeatTotal = 0; //loopDuration = 4; initialBarPosition = bar.transform.position; currentInstrument = buffered1 = buffered2 = buffered3 = buffered4 = Note.NoteType.NotSet; // Coins coins = new int[levels.Length]; }
//创建已输入音符,要自动贴合到最近的节拍上(最小刻度 16分音符) public Note AddInputNote(Note.NoteType inputType, float beat) { Note note = new Note { type = inputType, beatInBar = beat, }; if (inputType == Note.NoteType.inputBassdrum) { SoundController.Instance.PlayAudioEffect("Bassdrum"); //SoundController.Instance.PlayOneShot("event:/instruments/bassdrum"); note.note = Instantiate((GameObject)Resources.Load("Prefab/UI/Bar/UI_Bar_Note_Bassdrum", typeof(GameObject)), transform); } else { //SoundController.Instance.PlayOneShot("event:/instruments/snare"); SoundController.Instance.PlayAudioEffect("Snare"); note.note = Instantiate((GameObject)Resources.Load("Prefab/UI/Bar/UI_Bar_Note_Snare", typeof(GameObject)), transform); } float beatmodpos = (beat % 0.5f < 0.25f) ? beat - beat % 0.5f : beat - beat % 0.5f + 0.5f; note.note.transform.localPosition = startPos + (oneBeatSpace * beatmodpos) + new Vector3(0, -10, 0); noteList_main.Add(note); return(note); }
NoteQueue CreateNoteData(int startTime, int endTime, Note.NoteType noteType) { NoteQueue notedata; notedata = new NoteQueue(startTime, endTime, noteType); return(notedata); }
Material[] GetMaterials(Material colorMat, Note.NoteType visualNoteType) { Material[] materials; const int STANDARD_COLOUR_MAT_POS = 1; const int SP_COLOR_MAT_POS = 3; bool isStarpower = specialType == Note.SpecialType.StarPower; int colorMatIndex = isStarpower ? SP_COLOR_MAT_POS : STANDARD_COLOUR_MAT_POS; switch (visualNoteType) { case Note.NoteType.Hopo: materials = isStarpower ? resourceSharedMatsSpHopo : resourceSharedMatsHopo; break; case Note.NoteType.Tap: materials = isStarpower ? resourceSharedMatsSpTap : resourceSharedMatsTap; break; case Note.NoteType.Cymbal: materials = isStarpower ? resourceSharedMatsSpCymbal : resourceSharedMatsCymbal; break; default: materials = isStarpower ? resourceSharedMatsSpStrum : resourceSharedMatsStrum; break; } materials[colorMatIndex] = colorMat; return(materials); }
bool CheckTextureInSkin() { Skin customSkin = SkinManager.Instance.currentSkin; Note note = nCon.note; Note.NoteType noteType = NoteVisualsManager.GetVisualNoteType(note); Note.SpecialType specialType = NoteVisualsManager.IsStarpower(note); int arrayPos = NoteVisuals2DManager.GetNoteArrayPos(note); Note.NoteType visualNoteType = noteType; if (!Globals.ghLiveMode) { if (noteType == Note.NoteType.Hopo && Globals.drumMode) { visualNoteType = Note.NoteType.Strum; } } string noteKey = NoteVisuals2DManager.GetSkinKey(arrayPos, noteType, specialType, Globals.ghLiveMode); Sprite[] sprites = SkinManager.Instance.currentSkin.GetSprites(noteKey); return(sprites != null && sprites.Length > 0); }
public void UltiInput(Note.NoteType inputtype) { //锁定状态直接RETURN if (RhythmController.Instance.badTime >= 0) { return; } if (RhythmController.InputComment(UIBarController.Instance.currentQTENotes) < 2) { if (inputtype == UIBarController.Instance.currentQTENotes[0].type) { Debug.Log(UIBarController.Instance.currentQTENotes[0].SuccessSkill); UIBarController.Instance.currentQTENotes[0].note.GetComponent <VFX>().StartCoroutine("FadeOutLarger"); Player.Instance.UltiAction(UIBarController.Instance.currentQTENotes[0].SuccessSkill); } else { Debug.Log(UIBarController.Instance.currentQTENotes[0].SuccessSkill); UIBarController.Instance.currentQTENotes[0].note.GetComponent <VFX>().StartCoroutine("NoteInputBad"); Player.Instance.UltiAction(UIBarController.Instance.currentQTENotes[0].BadSkill); } UIBarController.Instance.currentQTENotes.RemoveAt(0); } else { // RhythmController.Instance.LockPin(); } }
private void HandleNote(Note.NoteType note) { if (note == Note.NoteType.Stop) { player.Stop(); } if (note == Note.NoteType.Run) { player.Run(); } if (note == Note.NoteType.Walk) { player.Walk(); } if (note == Note.NoteType.Jump) { jumpSfx.Play(); player.Jump(); } if (note == Note.NoteType.Reverse) { player.Reverse(); } }
public void ActivateWindow(int _noteType) { if (_noteType == 0) { noteType = Note.NoteType.LeftHanded; SetColor(Track.LeftHandColor); } else if (_noteType == 1) { noteType = Note.NoteType.RightHanded; SetColor(Track.RightHandColor); } else if (_noteType == 2) { noteType = Note.NoteType.OneHandSpecial; SetColor(Track.OneHandColor); } else if (_noteType == 3) { noteType = Note.NoteType.BothHandsSpecial; SetColor(Track.TwoHandColor); } active = true; Track.ColorPickerWindowOpen = true; m_ColorPickerWindowAnimator.Play("Panel In"); }
public void SetNoteType(Note.NoteType type) { List <ActionHistory.Action> actions = new List <ActionHistory.Action>(); foreach (ChartObject chartObject in editor.currentSelectedObjects) { if (chartObject.classID == (int)SongObject.ID.Note) { Note note = chartObject as Note; // Need to record the whole chord Note unmodified = (Note)note.Clone(); Note[] chord = note.GetChord(); ActionHistory.Action[] deleteRecord = new ActionHistory.Action[chord.Length]; for (int i = 0; i < deleteRecord.Length; ++i) { deleteRecord[i] = new ActionHistory.Delete(chord[i]); } note.SetType(type); //SetNoteType(note as Note, type); chord = note.GetChord(); ActionHistory.Action[] addRecord = new ActionHistory.Action[chord.Length]; for (int i = 0; i < addRecord.Length; ++i) { addRecord[i] = new ActionHistory.Add(chord[i]); } if (note.flags != unmodified.flags) { actions.AddRange(deleteRecord); actions.AddRange(addRecord); } foreach (Note chordNote in note.chord) { if (chordNote.controller) { chordNote.controller.SetDirty(); } } } if (chartObject.controller) { chartObject.controller.SetDirty(); } } if (actions.Count > 0) { editor.actionHistory.Insert(actions.ToArray()); } ChartEditor.isDirty = true; }
// Update is called once per frame public override void UpdateVisuals() { base.UpdateVisuals(); currentAnimationData = null; Note note = nCon.note; Vector3 scale = new Vector3(1, 1, 1); if (note != null) { if (Globals.ghLiveMode && !note.IsOpenNote()) { transform.localPosition = new Vector3(0, ghlSpriteOffset, 0); } else { transform.localPosition = Vector3.zero; } if (!Globals.ghLiveMode) { // This is based on GH3 sprites. // For some reason the open note sprite sheets sourced from Exilelord's GH3+ mod don't fit compared to the rest of the sprites. // It's possible there's some weird GH3 code that are scaling them in a strage way. // We're simply correcting for that and making them fit. if (note.guitarFret == Note.GuitarFret.Open) { scale = new Vector3(1.2f, 1, 1); } else if (specialType == Note.SpecialType.StarPower) { scale = new Vector3(1.2f, 1.2f, 1); } } // We have a note. Here we're figuring out which set of sprites will be used to display that sprite and assigning them to currentAnimationData. // The actual setting of the sprite in the renderer will happen later on in the Animate() function { int noteArrayPos = GetNoteArrayPos(note, ChartEditor.Instance.laneInfo); Note.NoteType visualNoteType = noteType; if (!Globals.ghLiveMode) { if (noteType == Note.NoteType.Hopo && Globals.drumMode) { visualNoteType = Note.NoteType.Strum; } } Skin skin = SkinManager.Instance.currentSkin; string noteKey = GetSkinKey(noteArrayPos, noteType, specialType, Globals.ghLiveMode); currentAnimationData = skin.GetSprites(noteKey); } } transform.localScale = scale; }
public static void SetType(this Note note, Note.NoteType type) { note.flags = Note.Flags.None; switch (type) { case (Note.NoteType.Strum): if (note.isChord) { note.flags &= ~Note.Flags.Forced; } else { if (note.isNaturalHopo) { note.flags |= Note.Flags.Forced; } else { note.flags &= ~Note.Flags.Forced; } } break; case (Note.NoteType.Hopo): if (!note.cannotBeForced) { if (note.isChord) { note.flags |= Note.Flags.Forced; } else { if (!note.isNaturalHopo) { note.flags |= Note.Flags.Forced; } else { note.flags &= ~Note.Flags.Forced; } } } break; case (Note.NoteType.Tap): if (!note.IsOpenNote()) { note.flags |= Note.Flags.Tap; } break; default: break; } note.ApplyFlagsToChord(); }
public static Note.Flags GetFlagsToSetType(this Note note, Note.NoteType type) { Note.Flags flags = Note.Flags.None; switch (type) { case (Note.NoteType.Strum): if (note.isChord) { flags &= ~Note.Flags.Forced; } else { if (note.isNaturalHopo) { flags |= Note.Flags.Forced; } else { flags &= ~Note.Flags.Forced; } } break; case (Note.NoteType.Hopo): if (!note.cannotBeForced) { if (note.isChord) { flags |= Note.Flags.Forced; } else { if (!note.isNaturalHopo) { flags |= Note.Flags.Forced; } else { flags &= ~Note.Flags.Forced; } } } break; case (Note.NoteType.Tap): if (!note.IsOpenNote()) { flags |= Note.Flags.Tap; } break; default: break; } return(flags); }
private void playAll() { foreach (string s in listBox1.Items) { Note.NoteCode noteName = (Note.NoteCode)Enum.Parse(typeof(Note.NoteCode), s.Split('-')[0]); Note.NoteType noteType = (Note.NoteType)Enum.Parse(typeof(Note.NoteType), s.Split('-')[1]); Note.Play(noteName, noteType); } }
public HistoryChange(History.HistoryObjectType _type, bool _added, Note.NoteType _subType, float _beat, float[] _pos, float[,] _segments) { Type = _type; // Note, segment, slider, etc. Added = _added; // True if this event is describing a post state object; false if describing original state SubType = _subType; // Note type, slider type, etc. Beat = _beat; Position = _pos; Segments = _segments; //Debug.Log("New HistoryChange"); }
public static Note.NoteType GetVisualNoteType(Note note) { Note.NoteType noteType = note.type; if (ChartEditor.Instance.currentGameMode == Chart.GameMode.Drums && GameSettings.drumsModeOptions == GameSettings.DrumModeOptions.Standard) { noteType = Note.NoteType.Strum; } return(noteType); }
public static int GetSkinKeyHash(int notePos, Note.NoteType noteType, Note.SpecialType specialType, bool isGhl) { int result = 4; int salt = 1231; result = unchecked (result * salt + notePos); result = unchecked (result * salt + (int)noteType); result = unchecked (result * salt + (int)specialType); result = unchecked (result * salt + (isGhl ? 1 : -1)); return(result); }
public static string GetSkinKey(int notePos, Note.NoteType noteType, Note.SpecialType specialType, bool isGhl) { skinKeySb.Clear(); // Reuse the same builder to reduce GC allocs StringBuilder sb = skinKeySb; sb.AppendFormat("{0}_", notePos); if (specialType == Note.SpecialType.StarPower) { sb.AppendFormat("sp_"); } else { sb.AppendFormat("reg_"); } switch (noteType) { case Note.NoteType.Strum: { sb.AppendFormat("strum"); break; } case Note.NoteType.Hopo: { sb.AppendFormat("hopo"); break; } case Note.NoteType.Tap: { sb.AppendFormat("tap"); break; } case Note.NoteType.Cymbal: { sb.AppendFormat("cymbal"); break; } default: break; } if (isGhl) { sb.AppendFormat("_ghl"); } return(sb.ToString()); }
bool ObjectCanClap(SongObject songObject) { SongObject.ID id = (SongObject.ID)songObject.classID; GameSettings.ClapToggle toggleValue; // Must have some kind of visual representation on screen if (songObject.controller == null || !songObject.controller.isActiveAndEnabled) { return(false); } bool playClap = false; if (SongObjectHelper.songObjectIdToClapOption.TryGetValue(id, out toggleValue)) { if ((GameSettings.clapProperties & toggleValue) != 0) { playClap = true; } } else if (id == SongObject.ID.Note) { Note note = songObject as Note; Note.NoteType noteType = NoteVisualsManager.GetVisualNoteType(note); switch (noteType) { case Note.NoteType.Strum: case Note.NoteType.Cymbal: playClap = (GameSettings.clapProperties & GameSettings.ClapToggle.STRUM) != 0; break; case Note.NoteType.Hopo: playClap = (GameSettings.clapProperties & GameSettings.ClapToggle.HOPO) != 0; break; case Note.NoteType.Tap: playClap = (GameSettings.clapProperties & GameSettings.ClapToggle.TAP) != 0; break; default: break; } } return(playClap); }
public void QTEInput(Note.NoteType inputtype) { //锁定状态直接RETURN if (RhythmController.Instance.badTime >= 0) { return; } if (RhythmController.InputComment(UIBarController.Instance.currentQTENotes) < 2) { if (inputtype == UIBarController.Instance.currentQTENotes[0].type) { Debug.Log(UIBarController.Instance.currentQTENotes[0].SuccessSkill); UIBarController.Instance.currentQTENotes[0].note.GetComponent <VFX>().StartCoroutine("FadeOutLarger"); SuperController.Instance.ShowInputTip("NICE", 1); Player.Instance.enemyList[0].GetComponent <AI>().QTEAction(UIBarController.Instance.currentQTENotes[0].SuccessSkill); if (inputtype == Note.NoteType.QTEHihat) { SoundController.Instance.PlayAudioEffect("Hihat"); } if (inputtype == Note.NoteType.QTESnare) { SoundController.Instance.PlayAudioEffect("Snare"); } if (inputtype == Note.NoteType.QTEBassdrum) { SoundController.Instance.PlayAudioEffect("Bassdrum"); } } //else //{ // Debug.Log(UIBarController.Instance.currentQTENotes[0].BadSkill); // UIBarController.Instance.currentQTENotes[0].note.GetComponent<VFX>().StartCoroutine("NoteInputBad"); // SuperController.Instance.ShowInputTip("BAD"); // Player.Instance.enemyList[0].GetComponent<AI>().QTEAction(UIBarController.Instance.currentQTENotes[0].BadSkill); //} UIBarController.Instance.currentQTENotes.RemoveAt(0); } else { RhythmController.Instance.LockPin(); } }
public void CalcSkillInput(Note.NoteType inputType) { // Debug.Log("UIBarController.Instance.playingBarPosInBeats!" + UIBarController.Instance.playingBarPosInBeats); // Debug.Log("RhythmController.Instance.commentGoodTime!" + RhythmController.Instance.commentGoodTime); //锁定状态直接RETURN if (RhythmController.Instance.badTime >= 0) { return; } //自动状态直接RETURN if (Player.Instance.automode) { return; } //第三拍之后,改为不处理,仅处理下一小节第一拍之前的一小段时间 if ((UIBarController.Instance.playingBarPosInBeats > -RhythmController.Instance.commentGoodTime + 4f)) { //return; judgeBeat = UIBarController.Instance.preBarPosInBeats; // Debug.Log("early beat!!!"); InsertInputNote(inputType, judgeBeat, UIBarController.Instance.preBar); } //第三拍之前 if ((UIBarController.Instance.playingBarPosInBeats < 2 - RhythmController.Instance.commentGoodTime)) { judgeBeat = UIBarController.Instance.playingBarPosInBeats; // Debug.Log("normal beat!!!"); InsertInputNote(inputType, judgeBeat, UIBarController.Instance.playingBar); } //第三拍 if ((UIBarController.Instance.playingBarPosInBeats < RhythmController.Instance.commentGoodTime + 2) && (UIBarController.Instance.playingBarPosInBeats > 2 - RhythmController.Instance.commentGoodTime)) { judgeBeat = UIBarController.Instance.playingBarPosInBeats; // Debug.Log("third beat!!!"); InsertInputNote(inputType, judgeBeat, UIBarController.Instance.playingBar); } }
public static Note.NoteType GetVisualNoteType(Note note) { Note.NoteType noteType = note.type; if (ChartEditor.Instance.currentGameMode == Chart.GameMode.Drums) { if (Globals.gameSettings.drumsModeOptions == GameSettings.DrumModeOptions.Standard) { noteType = Note.NoteType.Strum; } if (note.ShouldBeCulledFromLanes(ChartEditor.Instance.laneInfo)) { noteType = Note.NoteType.Tap; // Gives the user some kind of clue that this note has come from the 5th lane } } return(noteType); }
public void SetNoteType(Note.NoteType type) { List <SongEditCommand> songEditCommands = new List <SongEditCommand>(); foreach (ChartObject chartObject in editor.currentSelectedObjects) { if (chartObject.classID == (int)SongObject.ID.Note) { Note note = chartObject as Note; Note newNote = new Note(note); newNote.flags = note.GetFlagsToSetType(type); songEditCommands.Add(new SongEditModify <Note>(note, newNote)); } } if (songEditCommands.Count > 0) { editor.commandStack.Push(new BatchedSongEditCommand(songEditCommands)); } }
public void SpawnNote() { var totalWeights = Note.noteSpawnWeights .Where(a => CurrentStage.AvailableNotes.Contains(a.Key)) .Sum(a => a.Value); var idx = random.Next(0, totalWeights); int i = 0; Note.NoteType selectedType = Note.NoteType.None; while (idx > 0) { idx -= Note.noteSpawnWeights[CurrentStage.AvailableNotes[i]]; selectedType = CurrentStage.AvailableNotes[i]; i++; } notes.Add(new Note(this, selectedType)); }
protected override void Animate() { base.Animate(); Note note = nCon.note; if (note != null) { int noteArrayPos = GetNoteArrayPos(note); Note.NoteType visualNoteType = noteType; if (!Globals.ghLiveMode) { if (noteType == Note.NoteType.Hopo && Globals.drumMode) { visualNoteType = Note.NoteType.Strum; } } Skin skin = SkinManager.Instance.currentSkin; string noteKey = GetSkinKey(noteArrayPos, noteType, specialType, Globals.ghLiveMode); Sprite[] sprites = skin.GetSprites(noteKey); if (sprites != null && sprites.Length > 0) { UpdateGlobalAnimationFrame(); // Get anim index float animSpeed = 1.0f; int alteredGlobalAnimationFrame = (int)(globalAnimationFrame * animSpeed); int frame = alteredGlobalAnimationFrame - ((int)(alteredGlobalAnimationFrame / sprites.Length) * sprites.Length); // Set the final sprites ren.sprite = sprites.Length > 0 ? sprites[frame] : null; } else { // Todo, show error sprite } } }
bool CheckTextureInSkin() { Skin customSkin = SkinManager.Instance.currentSkin; Note note = nCon.note; Note.NoteType noteType = NoteVisualsManager.GetVisualNoteType(note); Note.SpecialType specialType = NoteVisualsManager.IsStarpower(note); int arrayPos = NoteVisuals2DManager.GetNoteArrayPos(note, ChartEditor.Instance.laneInfo); Note.NoteType visualNoteType = noteType; if (!Globals.ghLiveMode) { if (noteType == Note.NoteType.Hopo && Globals.drumMode) { visualNoteType = Note.NoteType.Strum; } } bool isInSkin; bool isGhl = Globals.ghLiveMode; int hash = NoteVisuals2DManager.GetSkinKeyHash(arrayPos, noteType, specialType, isGhl); if (textureInSkinCache.TryGetValue(hash, out isInSkin)) { return(isInSkin); } else { string noteKey = NoteVisuals2DManager.GetSkinKey(arrayPos, noteType, specialType, isGhl); Sprite[] sprites = SkinManager.Instance.currentSkin.GetSprites(noteKey); isInSkin = sprites != null && sprites.Length > 0; textureInSkinCache[hash] = isInSkin; return(isInSkin); } }
public void BufferNote(Note n) { if (buffered1 == Note.NoteType.NotSet) { buffered1 = n.noteType; return; } if (buffered2 == Note.NoteType.NotSet) { buffered2 = n.noteType; return; } if (buffered3 == Note.NoteType.NotSet) { buffered3 = n.noteType; return; } if (buffered4 == Note.NoteType.NotSet) { buffered4 = n.noteType; return; } }
public virtual void UpdateVisuals() { Note note = nCon.note; if (note != null) { noteType = note.type; // Star power? specialType = IsStarpower(note); // Update note visuals if (!noteRenderer) { noteRenderer = GetComponent <Renderer>(); } noteRenderer.sortingOrder = -(int)note.tick; if (Globals.drumMode && note.guitarFret == Note.GuitarFret.Open) { noteRenderer.sortingOrder -= 1; } } }
bool CheckTextureInSkin() { Texture2D textureInSkin = null; Skin customSkin = SkinManager.Instance.currentSkin; Note note = nCon.note; Note.NoteType noteType = note.type; Note.SpecialType specialType = NoteVisualsManager.IsStarpower(note); int arrayPos = GetSpriteArrayPos(note); if (Globals.ghLiveMode) { if (noteType == Note.NoteType.Strum) { if (specialType == Note.SpecialType.StarPower) { textureInSkin = customSkin.sp_strum_ghl[arrayPos]; } else { textureInSkin = customSkin.reg_strum_ghl[arrayPos]; } } else if (noteType == Note.NoteType.Hopo) { if (specialType == Note.SpecialType.StarPower) { textureInSkin = customSkin.sp_hopo_ghl[arrayPos]; } else { textureInSkin = customSkin.reg_hopo_ghl[arrayPos]; } } // Tap notes else { if (!note.IsOpenNote()) { if (specialType == Note.SpecialType.StarPower) { textureInSkin = customSkin.sp_tap_ghl[arrayPos]; } else { textureInSkin = customSkin.reg_tap_ghl[arrayPos]; } } } } else { if (noteType == Note.NoteType.Strum) { if (specialType == Note.SpecialType.StarPower) { textureInSkin = customSkin.sp_strum[arrayPos]; } else { textureInSkin = customSkin.reg_strum[arrayPos]; } } else if (noteType == Note.NoteType.Hopo) { if (specialType == Note.SpecialType.StarPower) { textureInSkin = customSkin.sp_hopo[arrayPos]; } else { textureInSkin = customSkin.reg_hopo[arrayPos]; } } // Tap notes else { if (note.guitarFret != Note.GuitarFret.Open) { if (specialType == Note.SpecialType.StarPower) { textureInSkin = customSkin.sp_tap[arrayPos]; } else { textureInSkin = customSkin.reg_tap[arrayPos]; } } } } return(textureInSkin); }
public static void SetType(this Note note, Note.NoteType type) { note.flags = note.GetFlagsToSetType(type); note.ApplyFlagsToChord(); }
public static string GetSkinKey(int notePos, Note.NoteType noteType, Note.SpecialType specialType, bool isGhl) { int hash = GetSkinKeyHash(notePos, noteType, specialType, isGhl); string stringKey; if (skinKeySkinCache.TryGetValue(hash, out stringKey)) { return(stringKey); } skinKeySb.Clear(); // Reuse the same builder to reduce GC allocs StringBuilder sb = skinKeySb; sb.AppendFormat("{0}_", notePos); if (specialType == Note.SpecialType.StarPower) { sb.AppendFormat("sp_"); } else { sb.AppendFormat("reg_"); } switch (noteType) { case Note.NoteType.Strum: { sb.AppendFormat("strum"); break; } case Note.NoteType.Hopo: { sb.AppendFormat("hopo"); break; } case Note.NoteType.Tap: { sb.AppendFormat("tap"); break; } case Note.NoteType.Cymbal: { sb.AppendFormat("cymbal"); break; } default: break; } if (isGhl) { sb.AppendFormat("_ghl"); } stringKey = sb.ToString(); skinKeySkinCache[hash] = stringKey; return(stringKey); }