示例#1
0
    public static void PlaySoundClip(string preMake)
    {
#if IN_GAME
        ISoundMan soundMan = EntryPoint.Instance.SoundMan;
        if (soundMan != null)
        {
            soundMan.Play2DAudio(preMake);
        }
#else
        /*
         * if (Application.isPlaying)
         * {
         *  GameObject g = GameObject.Find("AudioSources");
         *  if (g == null) g = new GameObject("AudioSources");
         *
         *  AudioSource audioSource = g.GetComponent<AudioSource>();
         *  if (audioSource == null)
         *  {
         *      audioSource = g.AddComponent<AudioSource>();
         *  }
         *
         *  AudioClip clip = AssetDatabase.LoadAssetAtPath(preMake, typeof(AudioClip)) as AudioClip;
         *  audioSource.clip = clip;
         *  audioSource.volume = 1f;
         *  audioSource.spatialBlend = 0f;
         *  audioSource.Play();
         * }
         */
#endif
    }
示例#2
0
        public XleGameControl(
            IXleScreen screen,
            IStatsDisplay statsDisplay,
            IXleWaiter waiter,
            IXleInput input,
            ISoundMan soundMan,
            ITextArea textArea,
            GameState gameState,
            XleSystemState systemState)
        {
            this.screen       = screen;
            this.statsDisplay = statsDisplay;
            this.waiter       = waiter;
            this.input        = input;
            this.soundMan     = soundMan;
            this.textArea     = textArea;
            this.gameState    = gameState;
            this.systemState  = systemState;

            soundMan.ErrorMessage += message =>
            {
                textArea.PrintLine();
                textArea.PrintLine(message);
            };

            textArea.Waiter += WaitAsync;
        }
示例#3
0
        public CommandExecutor(
            GameState state,
            ICommandList commands,
            IXleGameControl gameControl,
            IXleInput input,
            ISoundMan soundMan,
            IPlayerDeathHandler deathHandler,
            IPlayerAnimator characterAnimator,
            ITextArea textArea)
        {
            gameState           = state;
            this.commands       = commands;
            this.gameControl    = gameControl;
            this.input          = input;
            this.textArea       = textArea;
            this.soundMan       = soundMan;
            this.playerAnimator = characterAnimator;
            this.deathHandler   = deathHandler;

            input.DoCommand += (sender, args) =>
            {
                DoCommand(args.Command, args.KeyString);
            };

            mDirectionMap[Keys.Right] = Direction.East;
            mDirectionMap[Keys.Up]    = Direction.North;
            mDirectionMap[Keys.Left]  = Direction.West;
            mDirectionMap[Keys.Down]  = Direction.South;

            mDirectionMap[Keys.OemOpenBrackets] = Direction.North;
            mDirectionMap[Keys.OemSemicolon]    = Direction.West;
            mDirectionMap[Keys.OemQuotes]       = Direction.East;
            mDirectionMap[Keys.OemQuestion]     = Direction.South;
        }
示例#4
0
 public LotaTitleScreen(
     IXleRenderer renderer,
     ISoundMan soundMan,
     IContentProvider content,
     ILotaTitleScreenFactory factory)
 {
     this.renderer = renderer;
     this.soundMan = soundMan;
     this.content  = content;
     State         = factory.CreateSplash();
 }
示例#5
0
    void ftdunk()
    {
        ISoundMan soundMan = EntryPoint.Instance.SoundMan;

        if (soundMan != null && soundMan.CanPlayEffect)
        {
            int    footStepId = GetFootStepId();
            string sound      = EntryPoint.Instance.WwiseSoundConfigParams.GetdunkFootStepAudio(footStepId);

            if (!string.IsNullOrEmpty(sound))
            {
                soundMan.PlayFootStepAudio(sound, gameObject.transform.position);
            }
        }
    }
示例#6
0
    void ftHoofed()
    {
        //Debug.Log("FootOnGround,stepSoundOn!");
        ISoundMan soundMan = EntryPoint.Instance.SoundMan;

        if (soundMan != null && soundMan.CanPlayEffect)
        {
            int    footStepId = GetFootStepId();
            string sound      = EntryPoint.Instance.WwiseSoundConfigParams.GetHoofedFootStepAudio(footStepId);
            if (!string.IsNullOrEmpty(sound))
            {
                soundMan.PlayFootStepAudio(sound, gameObject.transform.position);
            }
        }
    }
示例#7
0
        //        private void _PlayFx(Transform hook, Transform anchor, string fx_path, float life_time, bool is_ui)
        //        {
        //            if (!is_ui)
        //            {
        //                if (hook == null) hook = _CachedT;
        //#if ART_USE && UNITY_EDITOR
        //                GameObject obj = UnityEditor.AssetDatabase.LoadAssetAtPath(fx_path, typeof(GameObject)) as GameObject;
        //                if (obj != null)
        //                {
        //                    obj = Instantiate<GameObject>(obj);
        //                    Transform t = obj.transform;
        //                    t.SetParent(hook, false);
        //                    obj.SetActive(true);
        //                    Util.SetLayerRecursively(obj, LayerMask.NameToLayer("UIScene"));

        //                    //re-position
        //                    if (anchor != null && anchor != hook)
        //                    {
        //                        t.position = anchor.position;
        //                    }

        //                    if (life_time < 0.0001f)
        //                    {
        //                        FxDuration fxd = obj.GetComponent<FxDuration>();
        //                        if (fxd != null) life_time = fxd.duration;
        //                    }

        //                    Destroy(obj, life_time > 0.0001f ? life_time : 5);

        //                    Debug.Log("PlayFx " + hook.name + ", " + fx_path + ", " + life_time);
        //                }

        //#else
        //                //Debug.Log("TODO: PlayFx");
        //#if IN_Game
        //                 int fxId = 0;
        //                 CFxOne fx_one = CFxCacheMan.Instance.RequestFxOne(fx_path, -1, ref fxId);
        //                 if (fx_one != null)
        //                 {
        //                     Transform t_fx=fx_one.transform;
        //                     GameObject g_fx = fx_one.gameObject;
        //                     t_fx.SetParent(hook, false);

        //                     //re-position
        //                    if (anchor != null && anchor != hook)
        //                     {
        //                         t_fx.position = anchor.position;
        //                     }

        //                     //g_fx.SetActive(true);
        //                     Util.SetLayerRecursively(g_fx, LayerMask.NameToLayer("UIScene"));

        //                     fx_one.Play(life_time > 0.0001f ? life_time : 5);
        //                 }
        //#endif
        //#endif
        //            }
        //            else
        //            {
        //                UISfxBehaviour.Play(fx_path, anchor.gameObject, hook.gameObject, null, life_time > 0.0001f ? life_time : 5);
        //            }
        //        }

        private void _PlaySound(GameObject go, string snd_path, float life_time, bool is_2D)
        {
            if (go == null)
            {
                return;
            }
#if ART_USE && UNITY_EDITOR
            AudioClip clip = UnityEditor.AssetDatabase.LoadAssetAtPath(snd_path, typeof(AudioClip)) as AudioClip;
            if (clip != null)
            {
                AudioSource source = go.AddComponent <AudioSource>();
                source.clip         = clip;
                source.spatialBlend = is_2D ? 0 : 1;
                source.Play();

                Destroy(source, life_time > 0.0001f ? life_time : clip.length);
            }

            Debug.Log("PlaySound " + go.name + ", " + snd_path);
#elif IN_GAME
            //Debug.Log("TODO: PlaySound");

            ISoundMan soundMan = EntryPoint.Instance.SoundMan;
            if (soundMan != null)
            {
                if (is_2D)
                {
                    soundMan.Play2DAudio(snd_path);
                }
                else
                {
                    soundMan.PlayAttached3DAudio(snd_path, go.transform);
                }
            }
#endif
        }
示例#8
0
        public void ExcEvent(TLEvent evt)
        {
            if (evt.EvtType == UEEventType.PlayAnim)
            {
                UEvtAnim block = evt as UEvtAnim;
                if (block != null && block.Anim != null)
                {
                    block.Anim.Play(block.Path);
                }
            }
            else if (evt.EvtType == UEEventType.PlayDotween)
            {
                UEvtDot block = evt as UEvtDot;
                if (block != null && block.DotPlayer != null)
                {
                    block.DotPlayer.Restart(block.Id);
                }
            }
            else if (evt.EvtType == UEEventType.UIFx)
            {
                UEvtUIFx block = evt as UEvtUIFx;
                if (block != null)
                {
                    GNewUITools.PlayFx(block.Holder, block.Target, block.Clipper, block.Path, block.LifeTime, true, block.OrderOffset);
                }
            }
            else if (evt.EvtType == UEEventType.SetActive)
            {
                UEvtActive block = evt as UEvtActive;
                if (block != null && block.Go != null)
                {
                    block.Go.SetActive(block.ActiveState);
                }
            }
            else if (evt.EvtType == UEEventType.ShakeScreen)
            {
                UEvtShake block = evt as UEvtShake;
                if (block != null)
                {
                    CameraShaker cs = Main.PanelRoot.GetComponent <CameraShaker>();
                    if (cs != null)
                    {
                        cs.ShakeOnce(block.Mag, 10, 0.15f, 0.15f, block.LifeTime, "ui");
                    }
                }
            }
            else if (evt.EvtType == UEEventType.Lua)
            {
                UEvtLua block = evt as UEvtLua;
                if (block != null && block.LuaFunc != null)
                {
                    block.LuaFunc.Call();
                }
            }
            else if (evt.EvtType == UEEventType.UISound)
            {
                UEvtUISound block = evt as UEvtUISound;
                if (block != null)
                {
#if IN_GAME
                    ISoundMan soundMan = EntryPoint.Instance.SoundMan;
                    if (soundMan != null)
                    {
                        soundMan.Play2DAudio(block.Path);
                    }
#endif
                }
            }
        }