feat: implement audio object definitions and refactor audio system

- Add AudioObjectDefinitions.cs with name-to-ID mappings and ambiguity detection
- Update AudioSystem.cs to support Play(uint) and deprecated Play(string) with warnings
- Rename PitchStepManager to PitchStepResolver and update all references
- Refactor generated code to use 'this.' prefix and foreach loops
- Remove TestEnum from audio enums and IDs
- Update SampleScene.unity to use new AudioSystem namespace and rain sound parameter
- Optimize binary serialization in generated audio classes
This commit is contained in:
2026-04-02 14:31:46 +08:00
parent 03b06fd83e
commit 89c024e781
18 changed files with 208 additions and 32 deletions
@@ -0,0 +1,145 @@
/* auto generated, do not modify */
using System.Collections.Generic;
namespace OCES.Audio
{
public static class AudioObjectDefinitions
{
public static readonly Dictionary<string, uint> NameToId = new()
{
{ "AnimCollision", 1 },
{ "AnimToWeapon", 2 },
{ "ArrowFire", 3 },
{ "BoxBeSelected", 4 },
{ "BoxCollision", 5 },
{ "BoxMove", 6 },
{ "BoxTouch", 7 },
{ "BoxToWeapon", 8 },
{ "ChangeColor", 9 },
{ "ClickButton", 10 },
{ "CoinFly", 11 },
{ "DamageByArrow", 12 },
{ "DamageByBullet", 13 },
{ "DamageByCannonBall", 14 },
{ "Defeat", 15 },
{ "DestroyBox", 16 },
{ "DevilAttackShield", 17 },
{ "DevilBeHit_01", 18 },
{ "DevilBeHit_02", 18 },
{ "DevilBeHit_03", 18 },
{ "DevilDie", 19 },
{ "DevilFire", 20 },
{ "DevilResurrection", 21 },
{ "DragonAttackShield", 22 },
{ "DragonBeHit", 23 },
{ "DragonDie", 24 },
{ "DragonFire", 25 },
{ "DragonResurrection", 26 },
{ "GhostAttackShield", 27 },
{ "GhostBeHit", 28 },
{ "GhostDie", 29 },
{ "GhostFire", 30 },
{ "GhostResurrection", 31 },
{ "GunFire", 32 },
{ "HorseMove", 33 },
{ "LevelBegins", 34 },
{ "PrincessDown", 35 },
{ "PrincessFear", 36 },
{ "ShieldBroken", 37 },
{ "ShieldUnderAttack", 38 },
{ "Spin", 39 },
{ "TigerMove", 40 },
{ "UnlockProp", 41 },
{ "UnlockTurret", 42 },
{ "Victory", 43 },
{ "WeaponExhausted", 44 },
{ "WeaponFire", 45 },
{ "au_stream", 46 },
{ "rain", 46 },
{ "Chinese Number 01", 48 },
{ "Chinese Number 02", 48 },
{ "Chinese Number 03", 48 },
{ "Chinese Number 04", 48 },
{ "Chinese Number 05", 48 },
{ "Chinese Number 06", 49 },
{ "Chinese Number 07", 49 },
{ "Chinese Number 08", 49 },
{ "Chinese Number 09", 49 },
{ "Chinese Number 10", 49 },
{ "sfx_amb_desert", 2000 },
{ "sfx_amb_forest", 2001 },
{ "sfx_anim_common_item_fly", 3000 },
{ "sfx_anim_corePlay_character_footstep_grass", 3001 },
{ "sfx_anim_corePlay_character_footstep_sand", 3002 },
{ "sfx_anim_corePlay_character_footstep_stone", 3003 },
{ "sfx_anim_corePlay_fireBall", 3004 },
{ "sfx_anim_corePlay_freeze", 3005 },
{ "sfx_anim_corePlay_getIn_devil", 3006 },
{ "sfx_anim_corePlay_getIn_dragon", 3007 },
{ "sfx_anim_corePlay_getIn_ghost", 3008 },
{ "sfx_anim_corePlay_newBoxFromStorage", 3009 },
{ "sfx_anim_corePlay_shield_broke_wood", 3010 },
{ "sfx_anim_corePlay_shield_broke_crystal", 3011 },
{ "sfx_anim_corePlay_shield_broke_eggRoll", 3012 },
{ "sfx_anim_corePlay_shield_show_crystal", 3013 },
{ "sfx_anim_corePlay_shield_show_eggRoll", 3014 },
{ "sfx_anim_corePlay_shield_show_wood", 3015 },
{ "sfx_anim_corePlay_shield_underAttack_wood", 3016 },
{ "sfx_anim_corePlay_shield_underAttack_crystal", 3017 },
{ "sfx_anim_corePlay_shield_underAttack_eggRoll", 3018 },
{ "sfx_anim_corePlay_slow", 3019 },
{ "sfx_anim_corePlay_speedUp", 3020 },
{ "sfx_anim_corePlay_useProp_", 3021 },
{ "sfx_anim_cutScene_in", 3022 },
{ "sfx_anim_cutScene_out", 3023 },
{ "sfx_notice_common_negative", 4000 },
{ "sfx_notice_corePlay_losing", 4001 },
{ "sfx_notice_corePlay_restart", 4002 },
{ "sfx_notice_corePlay_warning", 4003 },
{ "sfx_notice_guide", 4004 },
{ "sfx_notice_spinWheel_click", 4005 },
{ "sfx_notice_spinWheel_getReward", 4006 },
{ "sfx_notice_corePlay_levelStart_hard", 4007 },
{ "sfx_ui_labelSwitch_home", 5000 },
{ "sfx_ui_panel_common_close", 5001 },
{ "sfx_ui_panel_common_open", 5002 },
{ "sfx_ui_panel_continue_open", 5003 },
{ "sfx_ui_panel_corePlay_guide_open", 5004 },
{ "sfx_ui_panel_initPack_open", 5005 },
{ "sfx_ui_panel_piggyBank_close", 5006 },
{ "sfx_ui_panel_piggyBank_open", 5007 },
{ "sfx_ui_panel_removeAds_open", 5008 },
{ "0", 5009 },
{ "sfx_ui_panel_summerPack_open", 5010 },
{ "sfx_ui_panel_unlockItem_open", 5011 },
{ "voice_princess_fear", 9000 },
};
public static readonly HashSet<string> AmbiguousNames = new()
{
"DevilBeHit_01",
"DevilBeHit_02",
"DevilBeHit_03",
"Chinese Number 01",
};
public static readonly HashSet<string> SharedIdNames = new()
{
"DevilBeHit_01",
"DevilBeHit_02",
"DevilBeHit_03",
"au_stream",
"rain",
"Chinese Number 01",
"Chinese Number 02",
"Chinese Number 03",
"Chinese Number 04",
"Chinese Number 05",
"Chinese Number 06",
"Chinese Number 07",
"Chinese Number 08",
"Chinese Number 09",
"Chinese Number 10",
};
}
}