static void UseDOOR(Oni.InstanceDescriptor ides) { Round2.DOOR des = DeserializeAs <Round2.DOOR>(ides.AsXmlStream()); Debug.Log(des.id); }
static void UseONCC(Oni.InstanceDescriptor ides) { DateTime l_n = DateTime.Now; ides.AsXmlStream(); /* * Round2.ONCC l_chr = DeserializeAs<Round2.ONCC>(ides.AsXmlStream()); * l_chr.SetName(ides.Name); * Debug.Log(l_chr.BodySet.TRBS.id); * Oni.Game.CharacterClass l_oncc = Oni.Game.CharacterClass.Read(ides); * * foreach (Oni.InstanceDescriptor animdes in l_oncc.Animations) * { * Oni.Totoro.Animation l_tram = Oni.Totoro.AnimationDatReader.Read(animdes); * l_chr.AddAnimInfo(animdes.Name, l_tram); * string l_clipname = animdes.Name; * * if (l_tram.FrameSize != 6)//TODO: fix? * { * continue; * } * * AnimationClipHolder.Hold(animdes.Name, controller => * { * bool frameSize = l_tram.FrameSize == 6; * AnimationClip l_clip = new AnimationClip(); * l_clip.name = l_clipname; * * for (int i = 0; i < l_tram.Rotations.Count; i++) * { * Keyframe[] l_kFrx = new Keyframe[l_tram.Rotations[i].Count]; * Keyframe[] l_kFry = new Keyframe[l_tram.Rotations[i].Count]; * Keyframe[] l_kFrz = new Keyframe[l_tram.Rotations[i].Count]; * Keyframe[] l_kFrw = new Keyframe[l_tram.Rotations[i].Count]; * int l_duration = 0; * * for (int j = 0; j < l_tram.Rotations[i].Count; j++) * { * UnityEngine.Quaternion _l_q; * * if (!frameSize) * { * Oni.Quaternion l_q = new Oni.Quaternion(l_tram.Rotations[i][j].Rotation); * _l_q = Quaternion.Euler(Oni.MathHelper.ToDegrees(l_q.ToEulerXYZ().X), Oni.MathHelper.ToDegrees(l_q.ToEulerXYZ().Y), Oni.MathHelper.ToDegrees(l_q.ToEulerXYZ().Z)); * } * else * { * Oni.Quaternion qq = Oni.Quaternion.CreateFromEulerXYZ(l_tram.Rotations[i][j].Rotation.X, -l_tram.Rotations[i][j].Rotation.Y, -l_tram.Rotations[i][j].Rotation.Z); * _l_q = new Quaternion(qq.X, qq.Y, qq.Z, qq.W); * } * * l_kFrx[j] = new Keyframe(l_duration * 0.0166666675f, _l_q.x); * l_kFry[j] = new Keyframe(l_duration * 0.0166666675f, _l_q.y); * l_kFrz[j] = new Keyframe(l_duration * 0.0166666675f, _l_q.z); * l_kFrw[j] = new Keyframe(l_duration * 0.0166666675f, _l_q.w); * * l_duration = l_duration + l_tram.Rotations[i][j].Duration; * } * * System.Text.StringBuilder sb = new System.Text.StringBuilder(); * string l_path = ""; * l_path = ""; * sb.Remove(0, sb.Length); * sb.Append(i == 0 ? "" : ((Round2.ONCC.Bodyparts)i).ToString()); * l_path = ""; * * for (int _i = l_chr.BodySet.TRBS.Elements[0].TRCM.Hierarchy.TRIA.Elements[i].Parent; _i != l_chr.BodySet.TRBS.Elements[0].TRCM.Hierarchy.TRIA.Elements[_i].Parent; _i = l_chr.BodySet.TRBS.Elements[0].TRCM.Hierarchy.TRIA.Elements[_i].Parent) * { * sb.Insert(0, '/'); * sb.Insert(0, ((Round2.ONCC.Bodyparts)_i).ToString()); * } * * l_path = sb.ToString(); * l_clip.SetCurve(l_path, typeof(Transform), "m_LocalRotation.x", new AnimationCurve(l_kFrx)); * l_clip.SetCurve(l_path, typeof(Transform), "m_LocalRotation.y", new AnimationCurve(l_kFry)); * l_clip.SetCurve(l_path, typeof(Transform), "m_LocalRotation.z", new AnimationCurve(l_kFrz)); * l_clip.SetCurve(l_path, typeof(Transform), "m_LocalRotation.w", new AnimationCurve(l_kFrw)); * } * * l_clip.AddEvent(new AnimationEvent() { objectReferenceParameter = controller, functionName = "OnActionFrame", time = (0.0166666675f * l_tram.Velocities.Count) - 1 / 60f, stringParameter = l_clipname }); * l_clip.EnsureQuaternionContinuity(); * l_clip.wrapMode = WrapMode.ClampForever; * //l_chr.m_clips.Add(l_clip); * return l_clip; * }); * * } * */ Debug.Log("finished in " + (DateTime.Now - l_n).TotalSeconds); }
static void UseAKEV(Oni.InstanceDescriptor ides) { ides.AsXmlStream(); }