public void Init(string file) { fmcFile = file; frames = FMCLoader.Instance.Load(fmcFile); pose = FMCPose.LoadPose(fmcFile); state = 1; //ChangePose(0, 0); }
public void Init(string file, FMCFile f = null) { fmcFile = file; frames = f != null ? f : FMCLoader.Ins.Load(fmcFile); pose = FMCPoseLoader.Ins.LoadPose(fmcFile); state = 1; //ChangePose(0, 0); }
public void Init(TextAsset asset) { int i = asset.name.IndexOf('.'); fmcFile = asset.name.Substring(0, i); frames = FMCLoader.Ins.Load(asset); pose = FMCPoseLoader.Ins.LoadPose(fmcFile); state = 1; }
public static FMCPose LoadPose(string file) { file += ".pos"; if (fmcPose.ContainsKey(file)) { return(fmcPose[file]); } FMCPose pose = new FMCPose(); TextAsset asset = Resources.Load <TextAsset>(file); if (asset == null) { return(null); } string text = System.Text.Encoding.ASCII.GetString(asset.bytes); string[] pos = text.Split(new char[] { '\r', '\n' }, System.StringSplitOptions.RemoveEmptyEntries); int idx = 0; MiniPose po = null; for (int i = 0; i < pos.Length; i++) { string[] eachobj = pos[i].Split(new char[] { ' ', '\t' }, System.StringSplitOptions.RemoveEmptyEntries); if (eachobj[0] == "pose") { po = new MiniPose(); po.idx = idx; pose.pos.Add(po); idx++; } if (eachobj[0] == "start") { if (po != null) { po.start = int.Parse(eachobj[1]); } } if (eachobj[0] == "end") { if (po != null) { po.end = int.Parse(eachobj[1]); } } } fmcPose.Add(file, pose); return(pose); }
public FMCPose LoadPose(string file) { string file_no_ext = file; file += ".pos"; if (fmcPose.ContainsKey(file)) { return(fmcPose[file]); } byte[] body = null; if (CombatData.Ins.Chapter != null) { string path = CombatData.Ins.Chapter.GetResPath(FileExt.Pos, file_no_ext); if (!string.IsNullOrEmpty(path)) { if (File.Exists(path)) { body = File.ReadAllBytes(path); } } } if (body == null) { TextAsset asset = Resources.Load <TextAsset>(file); if (asset == null) { return(null); } body = asset.bytes; } FMCPose pose = new FMCPose(); string text = System.Text.Encoding.ASCII.GetString(body); string[] pos = text.Split(new char[] { '\r', '\n' }, System.StringSplitOptions.RemoveEmptyEntries); int idx = 0; MiniPose po = null; for (int i = 0; i < pos.Length; i++) { string[] eachobj = pos[i].Split(new char[] { ' ', '\t' }, System.StringSplitOptions.RemoveEmptyEntries); if (eachobj[0] == "pose") { po = new MiniPose(); po.idx = idx; pose.pos.Add(po); idx++; } if (eachobj[0] == "start") { if (po != null) { po.start = int.Parse(eachobj[1]); } } if (eachobj[0] == "end") { if (po != null) { po.end = int.Parse(eachobj[1]); } } } fmcPose.Add(file, pose); return(pose); }