private bool makeAnmFile(String[] ss) { List <BoneDataA> bda = new List <BoneDataA>(); byte[] header = new byte[15]; bool isFirst = true; //読み込み foreach (String s in ss) { using (BinaryReader r = new BinaryReader(File.OpenRead(getPoseDataPath(true) + s))) { try { if (isFirst) { isFirst = false; //最初のファイルでヘッダー部分を決定 for (int i = 0; i < 15; i++) { header[i] = r.ReadByte(); } byte t = r.ReadByte(); while (true) { if (t == 1) { BoneDataA a = new BoneDataA(); //A先頭部分 t = r.ReadByte(); byte c = 0; c = r.ReadByte(); if (c == 1) { a.isB = true; a.name = ""; } else { a.isB = false; a.name = "" + (char)c; t--; } for (int i = 0; i < t; i++) { c = r.ReadByte(); a.name += (char)c; } a.b = new List <BoneDataB>(); //B部分 while (true) { t = r.ReadByte(); if (t >= 64) { BoneDataB b = new BoneDataB(); b.index = t; int tmpf = r.ReadByte(); r.ReadByte(); r.ReadByte(); r.ReadByte(); //C部分 bool firstFrame = true; for (int i = 0; i < tmpf; i++) { if (firstFrame) { firstFrame = false; b.c = new List <BoneDataC>(); BoneDataC bc = new BoneDataC(); bc.time = 0; //time r.ReadBytes(4); //raw bc.raw = r.ReadBytes(12); b.c.Add(bc); } else { r.ReadBytes(16); } } a.b.Add(b); } else { break; } } bda.Add(a); } else { break; } } } else { int time = get00000000byInt(s); //最初以外はヘッダー部分を読み飛ばす r.ReadBytes(15); byte t = r.ReadByte(); while (true) { if (t == 1) { //A先頭部分 t = r.ReadByte(); byte c = 0; String name; bool isB = false; c = r.ReadByte(); if (c == 1) { isB = true; name = ""; } else { isB = false; name = "" + (char)c; t--; } for (int i = 0; i < t; i++) { c = r.ReadByte(); name += (char)c; } BoneDataA a = null; foreach (BoneDataA tmp in bda) { if (tmp.name.Equals(name)) { a = tmp; break; } } if (a == null) { a = new BoneDataA(); a.name = name; a.isB = isB; a.b = new List <BoneDataB>(); //B部分 while (true) { t = r.ReadByte(); if (t >= 64) { BoneDataB b = new BoneDataB(); b.index = t; int tmpf = r.ReadByte(); r.ReadByte(); r.ReadByte(); r.ReadByte(); //C部分 bool firstFrame = true; for (int i = 0; i < tmpf; i++) { if (firstFrame) { firstFrame = false; b.c = new List <BoneDataC>(); BoneDataC bc = new BoneDataC(); bc.time = 0; //time r.ReadBytes(4); //raw bc.raw = r.ReadBytes(12); b.c.Add(bc); } else { BoneDataC bc = new BoneDataC(); bc.time = time; //time r.ReadBytes(4); //raw bc.raw = r.ReadBytes(12); b.c.Add(bc); } } a.b.Add(b); } else { break; } } bda.Add(a); } else { //B部分 while (true) { t = r.ReadByte(); if (t >= 64) { BoneDataB b = null; foreach (BoneDataB tmpb in a.b) { if (t == tmpb.index) { b = tmpb; break; } } if (b == null) { b = new BoneDataB(); b.index = t; int tmpf = r.ReadByte(); r.ReadByte(); r.ReadByte(); r.ReadByte(); //C部分 bool firstFrame = true; for (int i = 0; i < tmpf; i++) { if (firstFrame) { firstFrame = false; b.c = new List <BoneDataC>(); BoneDataC bc = new BoneDataC(); bc.time = 0; //time r.ReadBytes(4); //raw bc.raw = r.ReadBytes(12); b.c.Add(bc); } else { BoneDataC bc = new BoneDataC(); bc.time = time; //time r.ReadBytes(4); //raw bc.raw = r.ReadBytes(12); b.c.Add(bc); } } a.b.Add(b); } else { int tmpf = r.ReadByte(); r.ReadByte(); r.ReadByte(); r.ReadByte(); //C部分 bool firstFrame = true; for (int i = 0; i < tmpf; i++) { if (firstFrame) { firstFrame = false; BoneDataC bc = new BoneDataC(); bc.time = time; //time r.ReadBytes(4); //raw bc.raw = r.ReadBytes(12); b.c.Add(bc); } else { r.ReadBytes(16); } } } } else { break; } } } } else { break; } } } } catch (Exception) { errorFile = "ポーズ「" + s + "」の読み込み中にエラーが発生しました"; return(false); } } } //結合 bool isExist = File.Exists(getPoseDataPath(true) + anmName + ".anm"); using (BinaryWriter w = new BinaryWriter(File.Create(getPoseDataPath(true) + anmName + ".anm"))) { try { w.Write(header); foreach (BoneDataA a in bda) { w.Write(a.outputABinary()); } w.Write((byte)0); w.Write((byte)0); w.Write((byte)0); } catch (Exception) { errorFile = "モーション「" + anmName + ".anm」の書き出し中にエラーが発生しました"; return(false); } } if (!isExist) { MotionWindow mw = GameObject.FindObjectOfType <MotionWindow>(); if (mw != null) { PopupAndTabList patl = mw.PopupAndTabList; try { mw.AddMyPose(getPoseDataPath(true) + anmName + @".anm"); } catch (Exception e) { Debug.LogError(e.ToString()); } } } return(true); }
public Room this[MotionWindow window] { get { return(_rooms[window.Start.Uid]); } }
/// <summary> /// Handle move inside a room /// </summary> /// <param name="point"></param> private Task HandleMove(MotionWindow point) => _roomService[point].MarkMotion(point.Start.TimeStamp);
private void HandleMove(MotionWindow point) { _rooms?[point.Start.Uid]?.MarkMotion(point.Start.TimeStamp).GetAwaiter().GetResult(); }
private void HandleMove(MotionWindow point) { _rooms?[point.Start.Uid]?.MarkMotion(point.Start.TimeStamp); }