Пример #1
0
        public int AddPlaySound(string s_key, float f_time, string s_path)
        {
            TLEvent tl = new UEvtUISound()
            {
                StartTime = f_time, KeyName = s_key, Path = s_path
            };

            return(AddEvent(tl));
        }
Пример #2
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
                }
            }
        }