static void Set(FSNScriptSequence.Parser.ICommandGenerateProtocol protocol) { var newCtrlSeg = new ScriptSegment(); newCtrlSeg.command = Segments.Object.CommandType.SetKey; _setupSegment(newCtrlSeg, protocol); // 셋업 protocol.PushSegment(new FSNScriptSequence.Parser.GeneratedSegmentInfo() { newSeg = newCtrlSeg, usePrevPeriod = true, selfPeriod = false }); }
static void _setupSegment(ScriptSegment seg, FSNScriptSequence.Parser.ICommandGenerateProtocol protocol, bool useObjName = true) { seg.layerID = FSNLibSequentiaModule.c_layerID; seg.objectName = c_ctrlObjName; // int settingCount = (protocol.parameters.Length) / 2; // 세팅 pair 갯수 for (int i = 0; i < settingCount; i++) { var pName = protocol.parameters[i * 2]; var pParam = protocol.parameters[i * 2 + 1]; seg.SetPropertyFromScriptParams(pName, pParam); // 파라미터 하나씩 세팅 } }
/// <summary> /// 스크립트 안에서 사용하기 전에 호출해야함. /// 실제로는 레이어에 LibSequentia를 컨트롤할 오브젝트를 생성하는 역할을 한다. /// </summary> /// <param name="protocol"></param> static void Ready(FSNScriptSequence.Parser.ICommandGenerateProtocol protocol) { var newCtrlSeg = new ScriptSegment(); newCtrlSeg.command = Segments.Object.CommandType.Create; _setupSegment(newCtrlSeg, protocol); // 셋업 // 현재 LibSequentia 엔진의 상태를 가져와 세팅해준다 newCtrlSeg.tension = LibSequentiaMain.instance.tension; newCtrlSeg.songTrans = LibSequentiaMain.instance.songTransition; protocol.PushSegment(new FSNScriptSequence.Parser.GeneratedSegmentInfo() { newSeg = newCtrlSeg, usePrevPeriod = true, selfPeriod = false }); }