Ejemplo n.º 1
0
        /// <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);
        }
Ejemplo n.º 2
0
        private AKSwitchAtom RegisterGetSwitch(int switchId)
        {
            AKSwitchAtom atom;

            if (!switchDict.TryGetValue(switchId, out atom))
            {
                atom = new AKSwitchAtom(switchId);
                switchDict[switchId] = atom;
            }

            return(atom);
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
 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);
 }
Ejemplo n.º 5
0
        private void SetSwitch(GameObject target, int grpId, int index)
        {
            AKSwitchAtom switchAtom = typesController.RegisterGetSwitch(target, grpId, index);

            switchAtom.SetSwitch(index, target);
        }
Ejemplo n.º 6
0
        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);
        }