public IEnumerator Process(LanotaliumContext context) { if (!context.IsProjectLoaded) { yield break; } var request = new Request <AskForLinear>(); yield return(context.UserRequest.Request(request, "Linear Motion Creation")); if (!request.Succeed) { yield break; } var result = request.Object; var polar = CoordMath.ToPolar(new Vector2(result.X, result.Y)); //8 cir 11 linear //0 deg 1 radius var camera = new LanotaCameraXZ() { Time = context.TunerManager.ChartTime, Type = 11, ctp = polar.y, ctp1 = polar.x }; context.OperationManager.AddHorizontal(camera); yield return(null); }
public void InstantiateSingleHorizontal(LanotaCameraXZ Hor) { if (Hor.TimeLineGameObject != null) { Destroy(Hor.TimeLineGameObject); } Hor.TimeLineGameObject = Instantiate(TimeLineObject, HorTransform); Hor.TimeLineGameObject.GetComponent <RectTransform>().anchoredPosition = new Vector2(Hor.Time * Scale, 0); Hor.TimeLineGameObject.GetComponent <RectTransform>().sizeDelta = new Vector2(Hor.Duration * Scale, 30); Hor.TimeLineGameObject.GetComponent <Image>().color = Hor.Type == 8 ? Tp8 : Tp11; Hor.TimeLineGameObject.GetComponent <Button>().onClick.AddListener(OperationManager.OnTimeLineClick); Hor.InstanceId = Hor.TimeLineGameObject.GetInstanceID(); }
private void CreateHorizontalMotion(int type, float timing, float length = -1.0f, float ctp0 = 0.0f, float ctp1 = 0.0f, int ease = 0) { var camera = new LanotaCameraXZ() { Time = timing, Duration = length, Type = type, ctp = ctp0, ctp1 = ctp1, cfmi = ease }; _Operation.AddHorizontal(camera, length <= 0.0f); }
public LanotaCameraXZ DeepCopy() { LanotaCameraXZ New = new LanotaCameraXZ { Type = Type, Time = Time, Duration = Duration, ctp = ctp, ctp1 = ctp1, ctp2 = ctp2, cfmi = cfmi, cflg = cflg }; return(New); }
public ChartData(string Text) { Json.LnmReadJson MidJson; MidJson = JsonConvert.DeserializeObject <Json.LnmReadJson>(Text); if (MidJson == null) { MidJson = JsonConvert.DeserializeObject <Json.LnmReadJson>("{\"events\":null,\"eos\":0,\"bpm\":null,\"scroll\":null}"); } LanotaCameraRot = new List <LanotaCameraRot>(); LanotaCameraXZ = new List <LanotaCameraXZ>(); LanotaCameraY = new List <LanotaCameraY>(); LanotaChangeBpm = new List <LanotaChangeBpm>(); LanotaDefault = new LanotaDefault(); LanotaHoldNote = new List <LanotaHoldNote>(); LanotaScroll = new List <LanotaScroll>(); LanotaTapNote = new List <LanotaTapNote>(); //Events if (MidJson.events != null) { for (int i = 0; i < MidJson.events.Count; ++i) { int Type = MidJson.events[i].Type; if (Type == 0 || Type == 2 || Type == 3 || Type == 4) { LanotaTapNote TmpTap = new LanotaTapNote(); TmpTap.Type = Type; TmpTap.Time = MidJson.events[i].Timing; TmpTap.Duration = MidJson.events[i].Duration; TmpTap.Degree = MidJson.events[i].Degree; TmpTap.Size = MidJson.events[i].Size; TmpTap.Critical = MidJson.events[i].Critical; TmpTap.Combination = MidJson.events[i].Combination; TmpTap.Bpm = MidJson.events[i].Bpm; TmpTap.Sizef = MidJson.events[i].Sizef; LanotaTapNote.Add(TmpTap); } else if (Type == 5) { LanotaHoldNote TmpHold = new LanotaHoldNote(); TmpHold.Type = Type; TmpHold.Time = MidJson.events[i].Timing; TmpHold.Duration = MidJson.events[i].Duration; TmpHold.Jcount = MidJson.events[i].joints.j_count; TmpHold.Degree = MidJson.events[i].Degree; TmpHold.Combination = MidJson.events[i].Combination; TmpHold.Sizef = MidJson.events[i].Sizef; if (TmpHold.Jcount != 0) { TmpHold.Joints = new List <LanotaJoints>(); for (int j = 0; j < MidJson.events[i].joints.j.Count; ++j) { LanotaJoints JTmpHold = new LanotaJoints(); JTmpHold.dDegree = MidJson.events[i].joints.j[j].d_deg; JTmpHold.dTime = MidJson.events[i].joints.j[j].d_time; float TmpDegree = TmpHold.Degree + JTmpHold.dDegree; float TmpTime = TmpHold.Time + JTmpHold.dTime; for (int k = 0; k < j; ++k) { TmpDegree += TmpHold.Joints[k].dDegree; TmpTime += TmpHold.Joints[k].dTime; } JTmpHold.aDegree = TmpDegree; JTmpHold.aTime = TmpTime; JTmpHold.Cfmi = MidJson.events[i].joints.j[j].d_e; TmpHold.Joints.Add(JTmpHold); } } TmpHold.Size = MidJson.events[i].Size; TmpHold.Critical = MidJson.events[i].Critical; TmpHold.Bpm = MidJson.events[i].Bpm; LanotaHoldNote.Add(TmpHold); } else if (Type == 8 || Type == 11) { LanotaCameraXZ TmpCam = new LanotaCameraXZ(); TmpCam.Type = Type; TmpCam.Time = MidJson.events[i].Timing; TmpCam.Duration = MidJson.events[i].Duration; TmpCam.ctp = MidJson.events[i].ctp; TmpCam.ctp1 = MidJson.events[i].ctp1; TmpCam.ctp2 = MidJson.events[i].ctp2; TmpCam.cfmi = MidJson.events[i].cfmi; TmpCam.cflg = MidJson.events[i].cflg; LanotaCameraXZ.Add(TmpCam); } else if (Type == 10) { LanotaCameraY TmpCam = new LanotaCameraY(); TmpCam.Type = Type; TmpCam.Time = MidJson.events[i].Timing; TmpCam.Duration = MidJson.events[i].Duration; TmpCam.ctp = MidJson.events[i].ctp; TmpCam.ctp1 = MidJson.events[i].ctp1; TmpCam.ctp2 = MidJson.events[i].ctp2; TmpCam.cfmi = MidJson.events[i].cfmi; TmpCam.cflg = MidJson.events[i].cflg; LanotaCameraY.Add(TmpCam); } else if (Type == 12) { LanotaDefault.CamRou = MidJson.events[i].ctp; LanotaDefault.CamTheta = MidJson.events[i].ctp1; LanotaDefault.CamHeight = MidJson.events[i].ctp2; LanotaDefault.Degree = MidJson.events[i].Degree; } else if (Type == 13) { LanotaCameraRot TmpCam = new LanotaCameraRot(); TmpCam.Type = Type; TmpCam.Time = MidJson.events[i].Timing; TmpCam.Duration = MidJson.events[i].Duration; TmpCam.ctp = MidJson.events[i].ctp * -1; TmpCam.ctp1 = MidJson.events[i].ctp1; TmpCam.ctp2 = MidJson.events[i].ctp2; TmpCam.cfmi = MidJson.events[i].cfmi; TmpCam.cflg = MidJson.events[i].cflg; LanotaCameraRot.Add(TmpCam); } } } //Bpm if (MidJson.bpm != null) { if (MidJson.bpm.Count != 0) { LanotaChangeBpm FirstTmpBpm = new LanotaChangeBpm(); FirstTmpBpm.Type = MidJson.bpm[0].Type; FirstTmpBpm.Time = -3; FirstTmpBpm.Duration = MidJson.bpm[0].Duration; FirstTmpBpm.Degree = MidJson.bpm[0].Degree; FirstTmpBpm.Size = MidJson.bpm[0].Size; FirstTmpBpm.Critical = MidJson.bpm[0].Critical; FirstTmpBpm.Combination = MidJson.bpm[0].Combination; FirstTmpBpm.Bpm = MidJson.bpm[0].Bpm; LanotaChangeBpm.Add(FirstTmpBpm); for (int i = 1; i < MidJson.bpm.Count; ++i) { LanotaChangeBpm TmpBpm = new LanotaChangeBpm(); TmpBpm.Type = MidJson.bpm[i].Type; TmpBpm.Time = MidJson.bpm[i].Timing; TmpBpm.Duration = MidJson.bpm[i].Duration; TmpBpm.Degree = MidJson.bpm[i].Degree; TmpBpm.Size = MidJson.bpm[i].Size; TmpBpm.Critical = MidJson.bpm[i].Critical; TmpBpm.Combination = MidJson.bpm[i].Combination; TmpBpm.Bpm = MidJson.bpm[i].Bpm; LanotaChangeBpm.Add(TmpBpm); } } else { LanotaChangeBpm FirstTmpBpm = new LanotaChangeBpm(); FirstTmpBpm.Type = 6; FirstTmpBpm.Time = -3; FirstTmpBpm.Bpm = 100; LanotaChangeBpm.Add(FirstTmpBpm); } } else { LanotaChangeBpm FirstTmpBpm = new LanotaChangeBpm(); FirstTmpBpm.Type = 6; FirstTmpBpm.Time = -3; FirstTmpBpm.Bpm = 100; LanotaChangeBpm.Add(FirstTmpBpm); } //Scroll if (MidJson.scroll != null) { if (MidJson.scroll.Count != 0) { LanotaScroll TmpScrollFirst = new LanotaScroll(); TmpScrollFirst.Speed = MidJson.scroll[0].speed; TmpScrollFirst.Time = -10; LanotaScroll.Add(TmpScrollFirst); for (int i = 1; i < MidJson.scroll.Count; ++i) { LanotaScroll TmpScroll = new LanotaScroll(); TmpScroll.Speed = MidJson.scroll[i].speed; TmpScroll.Time = MidJson.scroll[i].timing; LanotaScroll.Add(TmpScroll); } } else { LanotaScroll TmpScrollFirst = new LanotaScroll(); TmpScrollFirst.Speed = 1; TmpScrollFirst.Time = -10; LanotaScroll.Add(TmpScrollFirst); } } else { LanotaScroll TmpScrollFirst = new LanotaScroll(); TmpScrollFirst.Speed = 1; TmpScrollFirst.Time = -10; LanotaScroll.Add(TmpScrollFirst); } SongLength = MidJson.eos; }
public IEnumerator Process(LanotaliumContext context) { if (!context.IsProjectLoaded) { yield break; } var request = new Request <AskForCircular>(); yield return(context.UserRequest.Request(request, "Circular Motion Creation")); if (!request.Succeed) { yield break; } var result = request.Object; var newPolar = CoordMath.ToPolar(new Vector2(result.X, result.Y)); var camManager = context.TunerManager.CameraManager; var currentPolar = new Vector2(camManager.CurrentRou, camManager.CurrentTheta); var deltaPolar = Vector2.zero; //invert roh if (currentPolar.x < 0.0f) { currentPolar.x *= -1.0f; currentPolar.y = (currentPolar.y + 180.0f) % 360.0f; } deltaPolar.x = newPolar.x - currentPolar.x; deltaPolar.y = newPolar.y - currentPolar.y; //theta is negative (clockwise) //and it's anti-clockwise if (deltaPolar.y < 0.0f && !result.Clockwise) { deltaPolar.y = 360.0f + deltaPolar.y; } //theta is positive (anti-clockwise) //and it's clockwise else if (deltaPolar.y >= 0.0f && result.Clockwise) { deltaPolar.y = -(360.0f - deltaPolar.y); } //add revolution if (result.Revolution > 0) { if (result.Clockwise) { deltaPolar.y -= 360.0f * result.Revolution; } else { deltaPolar.y += 360.0f * result.Revolution; } } //8 cir 11 linear //0 deg 1 radius var camera = new LanotaCameraXZ() { Time = context.TunerManager.ChartTime, Type = 8, ctp = deltaPolar.y, ctp1 = deltaPolar.x }; context.OperationManager.AddHorizontal(camera); yield return(null); }