Esempio n. 1
0
 private void Event_ID_Search_B_Click(object sender, RoutedEventArgs e)
 {
     if (Event_ID_Search_T.Text == "" || IsClosing || IsBusy)
     {
         return;
     }
     try
     {
         uint Get_Short_ID = WwiseHash.HashString(Event_ID_Search_T.Text);
         int  ID_Number    = -1;
         for (int Number = 0; Number < Event_Type_L.Items.Count; Number++)
         {
             string Name     = Event_Type_L.Items[Number].ToString();
             uint   Event_ID = uint.Parse(Name.Substring(Name.IndexOf(':') + 1));
             if (Event_ID == Get_Short_ID)
             {
                 ID_Number = Number;
             }
         }
         if (ID_Number == -1)
         {
             Message_Feed_Out("ShortID : " + WwiseHash.HashString(Event_ID_Search_T.Text) + "\n取得したIDは、イベント内に含まれていませんでした。");
         }
         else
         {
             Message_Feed_Out("ShortID : " + WwiseHash.HashString(Event_ID_Search_T.Text) + "\nイベント番号 : " + (ID_Number + 1));
         }
     }
     catch
     {
         Message_Feed_Out("文字列をShortIDに変換できませんでした。");
     }
 }
 //以下の文字を指定した行に追加
 //GUIDやSourceIDはどんな数でも問題ないっぽいのでランダムに作成させる
 bool List_Add_File(int Line_Number, string FileName, string Language)
 {
     try
     {
         FileName = FileName.Replace(".wav", "");
         string Sound_GUID           = Guid.NewGuid().ToString().ToUpper();
         string AudioFileSource_GUID = Guid.NewGuid().ToString().ToUpper();
         string Replace_Name         = FileName.Replace(".", "_");
         uint   Sound_ID             = WwiseHash.HashGUID(Sound_GUID);
         uint   AudioFileSource_ID   = WwiseHash.HashGUID(AudioFileSource_GUID);
         //BGMはあとから変更できるように500000000から始まるように設定
         if (FileName.Contains("battle_bgm_"))
         {
             AudioFileSource_ID = (uint)(500000000 + Battle_Number);
             Battle_Number++;
         }
         More_Class.List_Init(Line_Number);
         More_Class.List_Add(Actor_Mixer_Hierarchy, "<Sound Name=\"" + Replace_Name + "\" ID=\"{" + Sound_GUID + "}\" ShortID=\"" + Sound_ID + "\">");
         if (Language != "SFX")
         {
             More_Class.List_Add(Actor_Mixer_Hierarchy, "<PropertyList>");
             More_Class.List_Add(Actor_Mixer_Hierarchy, "<Property Name=\"IsVoice\" Type=\"bool\" Value=\"True\"/>");
             More_Class.List_Add(Actor_Mixer_Hierarchy, "</PropertyList>");
         }
         More_Class.List_Add(Actor_Mixer_Hierarchy, "<ReferenceList>");
         More_Class.List_Add(Actor_Mixer_Hierarchy, "<Reference Name=\"Conversion\">");
         More_Class.List_Add(Actor_Mixer_Hierarchy, "<ObjectRef Name=\"Vorbis Quality High\" ID=\"{" + Vorbis_Quality_High_ID + "}\" WorkUnitID=\"{" + Vorbis_Quality_High_WorkID + "}\"/>");
         More_Class.List_Add(Actor_Mixer_Hierarchy, "</Reference>");
         More_Class.List_Add(Actor_Mixer_Hierarchy, "<Reference Name=\"OutputBus\">");
         More_Class.List_Add(Actor_Mixer_Hierarchy, "<ObjectRef Name=\"Master Audio Bus\" ID=\"{" + Master_Audio_Bus_ID + "}\" WorkUnitID=\"{" + Master_Audio_Bus_WorkID + "}\"/>");
         More_Class.List_Add(Actor_Mixer_Hierarchy, "</Reference>");
         More_Class.List_Add(Actor_Mixer_Hierarchy, "</ReferenceList>");
         More_Class.List_Add(Actor_Mixer_Hierarchy, "<ChildrenList>");
         More_Class.List_Add(Actor_Mixer_Hierarchy, "<AudioFileSource Name=\"" + Replace_Name + "\" ID=\"{" + AudioFileSource_GUID + "}\">");
         More_Class.List_Add(Actor_Mixer_Hierarchy, "<Language>" + Language + "</Language>");
         More_Class.List_Add(Actor_Mixer_Hierarchy, "<AudioFile>" + FileName + ".wav</AudioFile>");
         More_Class.List_Add(Actor_Mixer_Hierarchy, "<MediaIDList>");
         More_Class.List_Add(Actor_Mixer_Hierarchy, "<MediaID ID=\"" + AudioFileSource_ID + "\"/>");
         More_Class.List_Add(Actor_Mixer_Hierarchy, "</MediaIDList>");
         More_Class.List_Add(Actor_Mixer_Hierarchy, "</AudioFileSource>");
         More_Class.List_Add(Actor_Mixer_Hierarchy, "</ChildrenList>");
         More_Class.List_Add(Actor_Mixer_Hierarchy, "<ActiveSourceList>");
         More_Class.List_Add(Actor_Mixer_Hierarchy, "<ActiveSource Name=\"" + Replace_Name + "\" ID=\"{" + AudioFileSource_GUID + "}\" Platform=\"Linked\"/>");
         More_Class.List_Add(Actor_Mixer_Hierarchy, "</ActiveSourceList>");
         More_Class.List_Add(Actor_Mixer_Hierarchy, "</Sound>");
         return(true);
     }
     catch (Exception e)
     {
         Sub_Code.Error_Log_Write(e.Message);
         return(false);
     }
 }
Esempio n. 3
0
 public static void Init()
 {
     if (BNK_Info.Read_All.Count == 0)
     {
         return;
     }
     for (int Number = 0; Number < BNK_Info.Read_All.Count; Number++)
     {
         if (BNK_Info.Read_All[Number].Contains("type=\"u8\" name=\"eHircType\""))
         {
             if (BNK_Info.Read_All[Number - 1].Contains("<object name=\"CAkAttenuation\""))
             {
                 string Name;
                 string GUID = System.Guid.NewGuid().ToString().ToUpper();
                 if (BNK_Info.Attenuation_Info.Count + 1 < 10)
                 {
                     Name = "Attenuation_0" + (BNK_Info.Attenuation_Info.Count + 1);
                 }
                 else
                 {
                     Name = "Attenuation_" + (BNK_Info.Attenuation_Info.Count + 1);
                 }
                 uint        ShortID          = WwiseHash.HashString(Name);
                 int         Curve_Start_Line = 0;
                 int         Curve_End_Line   = 0;
                 List <bool> curveToUse       = new List <bool>();
                 for (int Number_02 = 0; Number_02 < 7; Number_02++)
                 {
                     curveToUse.Add(false);
                 }
                 for (int Number_01 = Number + 1; Number_01 < BNK_Info.Read_All.Count; Number_01++)
                 {
                     if (BNK_Info.Read_All[Number_01].Contains("type=\"sid\" name=\"ulID\""))
                     {
                         ShortID = uint.Parse(Get_Config.Get_Property_Value(BNK_Info.Read_All[Number_01]));
                     }
                     if (BNK_Info.Read_All[Number_01].Contains("type=\"s8\" name=\"curveToUse[0]\""))
                     {
                         curveToUse[0] = true;
                         for (int Number_02 = 1; Number_02 < 7; Number_02++)
                         {
                             int Value = int.Parse(Get_Config.Get_Property_Value(BNK_Info.Read_All[Number_01 + Number_02]));
                             if (Value > 0)
                             {
                                 curveToUse[Number_02] = true;
                             }
                         }
                     }
                     if (BNK_Info.Read_All[Number_01].Contains("<list name=\"curves\""))
                     {
                         Curve_Start_Line = Number_01;
                     }
                     if (BNK_Info.Read_All[Number_01].Contains("<object name=\"InitialRTPC\">") || BNK_Info.Read_All[Number_01].Contains("type=\"u8\" name=\"eHircType\""))
                     {
                         Curve_End_Line = Number_01 - 1;
                         break;
                     }
                 }
                 BNK_Info.Attenuation_Info.Add(new Attenuation_Relation(Name, GUID, ShortID, Curve_Start_Line, Curve_End_Line, curveToUse));
             }
             else
             {
                 break;
             }
         }
     }
     IsInit = true;
 }
 //audio_mods.xmlからイベントIDを取得
 public bool Get_Event_ID_From_XML(string audio_mods_file)
 {
     if (!File.Exists(audio_mods_file))
     {
         return(false);
     }
     try
     {
         //大杉ィ
         string[] WoT_Events = { "vo_start_battle", "vo_vehicle_destroyed",                                           "vo_enemy_killed_by_player",                                  "vo_fire_started",                                                 "vo_fuel_tank_damaged",           "vo_target_captured",              "vo_driver_killed"
                                 ,                  "vo_ammo_bay_damaged",                                            "vo_engine_damaged",                                          "vo_enemy_hp_damaged_by_explosion_at_direct_hit_by_player",        "vo_armor_not_pierced_by_player", "vo_track_destroyed",              "vo_track_functional"
                                 ,                  "vo_track_damaged",                                               "vo_track_functional_can_move",                               "vo_target_lost",                                                  "minimap_attention",              "enemy_sighted_for_team",          "vo_fire_stopped",           "vo_gun_damaged", "vo_target_unlocked"
                                 ,                  "vo_surveying_devices_damaged",                                   "vo_turret_rotator_destroyed",                                "vo_radio_damaged",                                                "vo_engine_destroyed",            "vo_enemy_fire_started_by_player", "vo_ally_killed_by_player"
                                 ,                  "vo_surveying_devices_destroyed",                                 "vo_commander_killed",                                        "vo_gunner_killed",                                                "vo_loader_killed",               "vo_radioman_killed",              "vo_turret_rotator_damaged", "vo_gun_destroyed"
                                 ,                  "vo_armor_ricochet_by_player",                                    "vo_enemy_hp_damaged_by_projectile_by_player",                "vo_enemy_no_hp_damage_at_no_attempt_by_player",                   "vo_engine_functional",           "vo_gun_functional"
                                 ,                  "vo_surveying_devices_functional",                                "vo_turret_rotator_functional",                               "vo_enemy_hp_damaged_by_projectile_and_chassis_damaged_by_player", "vo_enemy_hp_damaged_by_projectile_and_gun_damaged_by_player"
                                 ,                  "vo_enemy_no_hp_damage_at_attempt_and_chassis_damaged_by_player", "vo_enemy_no_hp_damage_at_attempt_and_gun_damaged_by_player", "vo_enemy_no_hp_damage_at_no_attempt_and_chassis_damaged_by_player" };
         //上の各項目がどの音声タイプか(詳しくはVoice_Set.csを参照)
         int[]         WoT_Events_Number = { 23, 33,  9, 13, 15, 36,           7
                                             ,            1, 10,  3,  2, 28,           29
                                             ,           27, 29, 37, 39, 34, 14, 16, 37
                                             ,           24, 31, 21, 11,  8,           0
                                             ,           25,  6, 19, 20, 22, 30,           17
                                             ,            5,  3,  2, 12,           18
                                             ,           26, 32,  4,           4
                                             ,            4,  4, 4 };
         List <string> All_Lines = new List <string>();
         All_Lines.AddRange(File.ReadAllLines(audio_mods_file));
         //WoT_Event_IDの内容をクリア
         Wot_Event_IDs_Clear();
         List <bool> IsAdd_Event_Number = new List <bool>();
         for (int Number_Temp = 0; Number_Temp < 40; Number_Temp++)
         {
             IsAdd_Event_Number.Add(false);
         }
         //xmlファイルを1行ずつ参照
         for (int Line_Number = 0; Line_Number < All_Lines.Count; Line_Number++)
         {
             try
             {
                 //イベント名が書かれている行であれば続行
                 if (!All_Lines[Line_Number].Contains("<name>"))
                 {
                     continue;
                 }
                 //標準のイベント名を取得
                 string After_Event_Name_01 = All_Lines[Line_Number].Substring(All_Lines[Line_Number].IndexOf("<name>") + 6);
                 string After_Event_Name_02 = After_Event_Name_01.Substring(0, After_Event_Name_01.IndexOf("</name>"));
                 for (int Number = 0; Number < WoT_Events.Length; Number++)
                 {
                     //WoT_Eventsに一致するイベント名があれば続行
                     if (WoT_Events[Number] == After_Event_Name_02)
                     {
                         if (!IsAdd_Event_Number[WoT_Events_Number[Number]])
                         {
                             WoT_Event_ID[WoT_Events_Number[Number]].Clear();
                             IsAdd_Event_Number[WoT_Events_Number[Number]] = true;
                         }
                         //変IsAdd_Event_Number更後のイベント名を取得
                         string After_Mod_Event_Name_01 = All_Lines[Line_Number + 1].Substring(All_Lines[Line_Number + 1].IndexOf("<mod>") + 5);
                         string After_Mod_Event_Name_02 = After_Mod_Event_Name_01.Substring(0, After_Mod_Event_Name_01.IndexOf("</mod>"));
                         //そのままの名前ではイベント内に入っている音声を取得できないため、変更後のイベント名をハッシュ値に変更(uint)
                         uint Get_Mod_Event_ID = WwiseHash.HashString(After_Mod_Event_Name_02);
                         WoT_Event_ID[WoT_Events_Number[Number]].Add(Get_Mod_Event_ID);
                     }
                 }
             }
             catch
             {
                 //例外処理なし
             }
         }
         All_Lines.Clear();
         IsAdd_Event_Number.Clear();
         //イベントIDが含まれていたらtrueを返す
         int Voice_Event_Count = 0;
         for (int Number_IDs = 0; Number_IDs < WoT_Event_ID.Count; Number_IDs++)
         {
             Voice_Event_Count += WoT_Event_ID[Number_IDs].Count;
         }
         if (Voice_Event_Count > 0)
         {
             return(true);
         }
     }
     catch (Exception e)
     {
         Sub_Code.Error_Log_Write(e.Message);
     }
     Wot_Event_IDs_Clear();
     return(false);
 }