/// <summary> /// 新switch注册获取 /// </summary> /// <param name="target"></param> /// <param name="grpId"></param> /// <param name="stateIndex"></param> /// <returns></returns> public AKSwitchAtom RegisterGetSwitch(GameObject target, int grpId, int stateIndex = -1) { AssertUtility.Assert(target != null); HashSet <AKSwitchAtom> switchAtoms; AKSwitchAtom ret; if (gameobjectSwitchGrps.TryGetValue(target, out switchAtoms)) { foreach (var atom in switchAtoms) { if (atom.config.Id == grpId) { return(atom); } } ret = new AKSwitchAtom(grpId, stateIndex, target); switchAtoms.Add(ret); } else { ret = new AKSwitchAtom(grpId, stateIndex, target); switchAtoms = new HashSet <AKSwitchAtom>() { ret }; gameobjectSwitchGrps.Add(target, switchAtoms); } return(ret); }
private AKSwitchAtom RegisterGetSwitch(int switchId) { AKSwitchAtom atom; if (!switchDict.TryGetValue(switchId, out atom)) { atom = new AKSwitchAtom(switchId); switchDict[switchId] = atom; } return(atom); }
internal void PostEvent(AudioEventItem eventItem, bool skipSwitchSetting) { if (!skipSwitchSetting && eventItem.SwitchGroup != null && eventItem.SwitchGroup.Count > 0) { eventItem.SwitchGroup.ForEach( (id) => { AKSwitchAtom atom = RegisterGetSwitch(id); atom.InitSwitch(target.gameObject); }); } var playerId = AkSoundEngine.PostEvent(eventItem.GetConvertedId(), target.gameObject, (uint)AkCallbackType.AK_EndOfEvent, GameAudioMedia.OnEventCallback, target); AudioUtil.LogPostEventResult(playerId, eventItem.Event); }
private void SwitchStateFinalHandler(AKSwitchAtom atom, GameObject target) { AKRESULT result = AkSoundEngine.SetSwitch(atom.config.Group, atom.currState, target); // DebugUtil.MyLog( "Real set switch {1} {0}", atom.currState,target.name); }
private void SetSwitch(GameObject target, int grpId, int index) { AKSwitchAtom switchAtom = typesController.RegisterGetSwitch(target, grpId, index); switchAtom.SetSwitch(index, target); }
private void SwitchStateFinalHandler(AKSwitchAtom atom, GameObject target) { AKRESULT result = AkSoundEngine.SetSwitch(atom.config.Group, atom.currState, target); AudioUtil.AssertProcessResult(result, "set switch {1} {0}", atom.currState, target.name); }