public MovieMaidAnimationTrack(Maid maid, int animationId)
 {
     this.maid            = maid;
     this.animationTarget = maid.body0.m_Bones.GetComponent <Animation>();
     this.animation       = PhotoMotionData.data.Where(d => d.id == animationId).First();
     this.animationName   = LoadAnimation(this.animation, this.maid);
 }
 public MovieMaidAnimationTrack(Maid maid, PhotoMotionData data) : base()
 {
     this.maid            = maid;
     this.animationTarget = maid.body0.m_Bones.GetComponent <Animation>();
     this.animation       = data;
     this.animationName   = LoadAnimation(this.animation, this.maid);
 }
Exemple #3
0
        // add data from *phot_motion_list*.nei files to PhotoMotionData.motion_data_
        public static void PhotMotExt()
        {
            string[] PhotoMotNei = null;

            PhotoMotNei = GameUty.FileSystemMod.GetList("PhotMot_NEI", AFileSystemBase.ListType.AllFile);


            //   if (PhotoMotNei == null || PhotoMotNei.Length == 0)
            //   { return; }

            foreach (string str in PhotoMotNei)
            {
                string nei_filename = Path.GetFileName(str);

                if (Path.GetExtension(nei_filename) == ".nei" && nei_filename != "phot_motion_list.nei")
                {
                    using (AFileBase aFileBase = GameUty.FileSystem.FileOpen(nei_filename))
                    {
                        using (CsvParser csvParser = new CsvParser())
                        {
                            if (csvParser.Open(aFileBase))
                            {
                                for (int i = 1; i < csvParser.max_cell_y; i++)
                                {
                                    int             num             = 0;
                                    PhotoMotionData photoMotionData = new PhotoMotionData(); // this requires prepatched assembly to compile
                                    photoMotionData.id                = (long)csvParser.GetCellAsInteger(num++, i);
                                    photoMotionData.category          = csvParser.GetCellAsString(num++, i);
                                    photoMotionData.name              = csvParser.GetCellAsString(num++, i);
                                    photoMotionData.direct_file       = csvParser.GetCellAsString(num++, i);
                                    photoMotionData.is_loop           = (csvParser.GetCellAsString(num++, i) == "○");
                                    photoMotionData.call_script_fil   = csvParser.GetCellAsString(num++, i);
                                    photoMotionData.call_script_label = csvParser.GetCellAsString(num++, i);
                                    photoMotionData.is_mod            = false;
                                    string cellAsString = csvParser.GetCellAsString(num++, i);
                                    bool   flag         = csvParser.GetCellAsString(num++, i) == "○";
                                    photoMotionData.use_animekey_mune_l = (photoMotionData.use_animekey_mune_r = flag);
                                    photoMotionData.is_man_pose         = (csvParser.GetCellAsString(num++, i) == "○");
                                    PhotoMotionData.motion_data_.Add(photoMotionData);
                                }
                            }
                            else
                            {
                                Debug.Log($"Skipping invalid file: Mod/{str}");
                            }
                        }
                    }
                }
            }
        }
 private static string LoadAnimation(PhotoMotionData data, Maid maid)
 {
     if (!string.IsNullOrEmpty(data.direct_file))
     {
         maid.IKTargetToBone("左手", (Maid)null, "無し", Vector3.zero);
         maid.IKTargetToBone("右手", (Maid)null, "無し", Vector3.zero);
         if (!data.is_mod && !data.is_mypose)
         {
             maid.body0.LoadAnime(data.direct_file.ToLower(), data.direct_file, false, data.is_loop);
             return(data.direct_file.ToLower());
         }
         else
         {
             byte[] numArray = new byte[0];
             try
             {
                 using (FileStream fileStream = new FileStream(data.direct_file, FileMode.Open, FileAccess.Read))
                 {
                     numArray = new byte[fileStream.Length];
                     fileStream.Read(numArray, 0, numArray.Length);
                 }
             }
             catch
             {
             }
             if (0 >= numArray.Length)
             {
                 return("");
             }
             maid.body0.LoadAnime(data.id.ToString(), numArray, false, data.is_loop);
             return(data.id.ToString());
             // Maid.AutoTwist[] autoTwistArray = new Maid.AutoTwist[6]
             //     {
             //         Maid.AutoTwist.ShoulderL,
             //         Maid.AutoTwist.ShoulderR,
             //         Maid.AutoTwist.WristL,
             //         Maid.AutoTwist.WristR,
             //         Maid.AutoTwist.ThighL,
             //         Maid.AutoTwist.ThighR
             //     };
             // foreach (Maid.AutoTwist f_eType in autoTwistArray)
             //     maid.SetAutoTwist(f_eType, true);
         }
     }
     else
     {
         if (string.IsNullOrEmpty(data.call_script_fil) || string.IsNullOrEmpty(data.call_script_label))
         {
             return("");
         }
         CharacterMgr characterMgr = GameMain.Instance.CharacterMgr;
         int          sloat        = 0;
         for (int nMaidNo = 0; nMaidNo < characterMgr.GetMaidCount(); ++nMaidNo)
         {
             if ((UnityEngine.Object)maid == (UnityEngine.Object)characterMgr.GetMaid(nMaidNo))
             {
                 sloat = nMaidNo;
                 break;
             }
         }
         GameMain.Instance.ScriptMgr.LoadMotionScript(sloat, false, data.call_script_fil, data.call_script_label, maid.Param.status.guid, true, true);
     }
     return("");
 }