override public void undo() { //music if (musicClipName != SoundManager.nullSoundName) { SoundManager.Get().playMusic(musicClipName, musicClipVolume); } //characters (visible, pos, attire, expression) int count = myPlayer.sequencerData.targets.Count; for (int i = 0; i < count; i++) { if (myPlayer.sequencerData.targets [i].target == null) { continue; } SequencerTargetModel model = myPlayer.sequencerData.targets [i]; VN_CharBase hasCharComp = model.target.GetComponent <VN_CharBase>(); model.target.transform.position = positions [i]; if (hasCharComp != null) { model.target.SetActive(visibilitys [i]); hasCharComp.setAttire(attires [i]); hasCharComp.setExpression(expressions [i], true); } } //future: vars }
override public void drawCustomUi() { string[] nicks = sequencerData.getTargetNickNames(); GUILayout.Label("modify who?:"); targetIndexList = EditorGUILayout.Popup(targetIndexList, nicks, GUILayout.Width(100)); if (sequencerData.targets [targetIndexList] != null) { VN_CharBase charcomp = sequencerData.targets [targetIndexList].target.GetComponent <VN_CharBase>(); if (charcomp != null) { string[] attires = charcomp.getAttireNames(); GUILayout.Label("attire:"); attireListIndex = EditorGUILayout.Popup(attireListIndex, attires, GUILayout.Width(100)); string[] expressions = charcomp.getExpressionNames(); GUILayout.Label("expression:"); expressionListIndex = EditorGUILayout.Popup(expressionListIndex, expressions, GUILayout.Width(100)); if (expressionListIndex < expressions.Length) { expressionName = expressions [expressionListIndex]; } else { Debug.LogWarning("Error here"); expressionName = expressions [0]; } } } }
override public void undo() { GameObject target = sequencerData.targets [targetIndexList].target; VN_CharBase charcomp = target.GetComponent <VN_CharBase>(); charcomp.setAttire(prevAttireIndex); charcomp.setExpression(prevExpressionName, true); }
override public void execute(SequencePlayer player) { myPlayer = player; if (player.inRewindMode) { undo(); } else { GameObject target = sequencerData.targets [targetIndexList].target; VN_CharBase charcomp = target.GetComponent <VN_CharBase>(); prevAttireIndex = charcomp.getCurrentAttire(); prevExpressionName = charcomp.getCurrentExpressionName(); charcomp.setAttire(attireListIndex); charcomp.setExpression(expressionName, false); } myPlayer.callBackFromCommand(); }
override public void execute(SequencePlayer player) { myPlayer = player; if (player.inRewindMode) { undo(); } else { //clear previous positions = new List <Vector3>(); visibilitys = new List <bool>(); attires = new List <int>(); expressions = new List <string>(); //attempt save state: //music musicClipName = SoundManager.Get().getCurrentMusicClipName(); musicClipVolume = SoundManager.Get().getCurrentMusicClipVolume(); SoundManager.Get().stopMusic(); //characters (visible, pos, attire, expression) foreach (SequencerTargetModel model in myPlayer.sequencerData.targets) { if (model.target == null) { positions.Add(Vector3.zero); visibilitys.Add(false); attires.Add(0); expressions.Add("none"); continue; } positions.Add(model.target.transform.position); visibilitys.Add(model.target.activeInHierarchy); VN_CharBase hasCharComp = model.target.GetComponent <VN_CharBase>(); if (hasCharComp != null) { attires.Add(hasCharComp.getCurrentAttire()); expressions.Add(hasCharComp.getCurrentExpressionName()); } else { attires.Add(-1); expressions.Add(""); } //TODO: in future use type instead? backgrounds are characters too ? if (hasCharComp != null) { model.target.SetActive(false); } } //future: vars } myPlayer.callBackFromCommand(); }