예제 #1
0
    // 添加背景音乐播放
    public override void play(System.String clipName, callback method = null)
    {
        if (audioPlayers.Count <= 0 || clips.Count <= 0)
        {
            return;
        }
        float       maxTime = -1;
        AudioSource player  = _atom;

        switch (clipName)
        {
        case "":
            player.clip = null;
            return;
        }

        AudioPlayObj obj = new AudioPlayObj(selectClip(clipName), this, player, maxTime);

        AudioPlayCtrl.getInstance().addBackgroundObj(obj);

        if (method != null)
        {
            AudioPlayCtrl.getInstance().addCallbackToBackgroundClip(clipName, method);
        }
    }
예제 #2
0
    public override void play(String clipName, callback method = null)
    {
        if (audioPlayers.Count <= 0 || clips.Count <= 0)
        {
            return;
        }
        float       maxTime = -1;
        AudioSource player  = _center;

        // specific clip data. switch 的传入判断值必须在运行时就已经是既定值,即 const 不能作为判断对象。
        switch (clipName)
        {
        case PlayerAudioData.SWITCH_OBSTACLE_CLIP:
            player = _switch;
            break;

        default: break;
        }

        AudioPlayObj obj = new AudioPlayObj(selectClip(clipName), this, player, maxTime);

        AudioPlayCtrl.getInstance().addEffectObj(obj);
        if (method != null)
        {
            AudioPlayCtrl.getInstance().addCallbackToEffectClip(clipName, method);
        }
    }
예제 #3
0
    private void init()
    {
        _curTime = 0;
        // 动态加载资源
        if (!ResourcesSaveUtils.getInstance().isLoaded)
        {
            // 开启协程,异步执行数据内容(并不是异步)
            StartCoroutine(ResourcesSaveUtils.getInstance().loadSpriteResources());
        }

        // init audio
        AudioPlayCtrl.init(audioManager);
        StartSceneAudioCtrl.init(audioManager);
        // repeat play audio
        GestureCtrl.getInstance().toLeftGesture   = playSystemAudio;
        GestureCtrl.getInstance().toCenterGesture = makeSure;
        GestureCtrl.getInstance().toRightGesture  = null;
        GestureCtrl.getInstance().toBackGesture   = () => {
            changeChoice(false);
        };
        GestureCtrl.getInstance().toFrontGesture = () => {
            changeChoice(true);
        };
        bindingUIFeature();
        GameManagerGlobalData.resetGameGlobalData();
    }
예제 #4
0
 private void switchGestureToPlot()
 {
     GestureCtrl.getInstance().toCenterGesture = AudioPlayCtrl.getInstance().stopEffect;
     GestureCtrl.getInstance().toLeftGesture   = null;
     GestureCtrl.getInstance().toRightGesture  = null;
     GestureCtrl.getInstance().toFrontGesture  = null;
     GestureCtrl.getInstance().toBackGesture   = null;
 }
예제 #5
0
    // Use this for initialization
    void Start()
    {
        CanvasCtrl.adjustCanvasScale(canvas);
        LoadingSceneAudioCtrl.init(audioManager);
        AudioPlayCtrl.init(audioManager);
        LoadingSceneAudioCtrl.getInstance().play(LOADING_TIPS);
        GestureCtrl.removeInstance();

        fillBar.fillAmount  = 0;
        fillEyes.fillAmount = 0;
        StartCoroutine(LoadMainScene());
    }
예제 #6
0
    // init audio
    private void initAudioCtrl()
    {
        AudioPlayCtrl.init(audioManager);
        PlayerAudioCtrl.init(audioManager);
        BackgroundAudioCtrl.init(audioManager);
        ObstacleAudioCtrl.init(audioManager);

        // close contain feature when in the runtime.
        if (PlatformUtils.isTouchUser())
        {
            isDevelop = false;
        }
    }
예제 #7
0
    // 这个功能是有可复用性的,只是针对 playeAudioCtrl 并不有效
    public virtual void play(String clipName, callback method = null)
    {
        if (audioPlayers.Count > 0 && clips.Count > 0)
        {
            AudioPlayObj obj = new AudioPlayObj(selectClip(clipName), this, audioPlayers[0], 3.5f);
            AudioPlayCtrl.getInstance().addEffectObj(obj);

            if (method != null)
            {
                AudioPlayCtrl.getInstance().addCallbackToEffectClip(clipName, method);
            }
        }
    }
예제 #8
0
    public override void play(System.String clipName, callback method = null)
    {
        if (clips.Count <= 0)
        {
            return;
        }
        float       maxTime = -1;
        AudioSource player  = manager;

        AudioPlayObj obj = new AudioPlayObj(selectClip(clipName), this, player, maxTime);

        AudioPlayCtrl.getInstance().addEffectObj(obj);

        if (method != null)
        {
            AudioPlayCtrl.getInstance().addCallbackToEffectClip(clipName, method);
        }
    }
예제 #9
0
    public void playAudio(ArrowDir dir)
    {
        String name = selectedDir(dir);

        System.String clipName = "";
        AudioPlayObj  obj      = null;

        if (dir == ArrowDir.FRONT)
        {
            clipName = "frontSword";
            obj      = new AudioPlayObj(selectClip(clipName), this, selectSource(name));
        }
        else
        {
            clipName = "bow";
            obj      = new AudioPlayObj(selectClip(clipName), this, selectSource(name));
        }

        AudioPlayCtrl.getInstance().addEffectObj(obj);

        // 教学音频设计需要
        if (GameManagerGlobalData.isFirstMeetObstacle)
        {
            PlayerAudioCtrl.getInstance().play(PlayerAudioData.PARRY_TO_FRONT_TIPS, () => {
                Parry.getInstance().setParry(true);
                GameManagerGlobalData.isFirstMeetObstacle = false;
            });
        }
        else if (GameManagerGlobalData.isSecondMeetObstacle)
        {
            PlayerAudioCtrl.getInstance().play(PlayerAudioData.PARRY_TO_LEFT_TIPS, () => {
                Parry.getInstance().setParry(true);
                GameManagerGlobalData.isSecondMeetObstacle = false;
            });
        }
    }
예제 #10
0
 public static void init(GameObject manager)
 {
     _instance = manager.GetComponent <AudioPlayCtrl>();
 }