Exemplo n.º 1
0
    public AudioBGMLoader CreateBGMLoader(string name, AudioClip clip)
    {
        AudioBGMLoader loader = GameObjectUtility.AddChild <AudioBGMLoader>(name, gameObject);

        loader.clip = clip;
        return(loader);
    }
Exemplo n.º 2
0
    private void LoadStageUI(int fromStage, int toStage)
    {
        if (areaLockGO != null)
        {
            areaLockGO.SetActive(false);
        }
        if (toStage == 10)
        {
            UpdateMissionText();
        }
        for (int i = fromStage - 1; i < toStage; i++)
        {
            int        col     = i % 5;
            int        row     = i / 5;
            GameObject stageGO = GameObjectUtility.AddChild("Stage_" + (i + 1), stageParentGO, stagePrb);
            stageList.Add(stageGO);
            Transform stageTrans = stageGO.transform;

            Vector3 localPosition = new Vector3(-310 + col * 155, 235 - row * 100, 0);
            stageTrans.localPosition = localPosition;
            Stage stage    = stageGO.GetComponent <Stage>();
            int   stageNum = (areaNum - 1) * 10 + (i + 1);
            stage.SetStage(this, areaNum, stageNum);
        }
    }
Exemplo n.º 3
0
    void Awake()
    {
        DontDestroyOnLoad(gameObject);
        audioSources   = GameObjectUtility.AddChild("Audio Sources", gameObject);
        BGMsource      = GameObjectUtility.AddChild <AudioSource>("BGM", audioSources);
        BGMsource.loop = true;

        volume.BGM   = PlayerPrefs.GetFloat("bgm_value", 1f);
        volume.SE    = PlayerPrefs.GetFloat("se_value", 1f);
        volume.VOICE = PlayerPrefs.GetFloat("voice_value", 1f);

        enabledSEsources = new LinkedList <AudioSE>();
        cachedSEsources  = new Queue <AudioSE>();

        enabledENVsources = new LinkedList <AudioSource>();
        cachedENVsources  = new Queue <AudioSource>();

        for (int i = 0, il = BGM.Length; i < il; i++)
        {
            BGM_list.Add(BGM[i].name);
        }
        for (int i = 0, il = SE.Length; i < il; i++)
        {
            SE_list.Add(SE[i].name);
        }
        for (int i = 0, il = ENV.Length; i < il; i++)
        {
            ENV_list.Add(ENV[i].name);
        }
    }
Exemplo n.º 4
0
    public void PlayENV(AudioClip clip)
    {
        AudioSource source;

        if (enabledENVsources.Count >= numberOfConcurrentENV)
        {
            source = enabledENVsources.First.Value;
            source.Stop();
            enabledENVsources.RemoveFirst();
        }
        else
        {
            if (cachedENVsources.Count > 0)
            {
                source = cachedENVsources.Dequeue();
            }
            else
            {
                source      = GameObjectUtility.AddChild <AudioSE>("ENV", audioSources).GetComponent <AudioSource>();
                source.loop = true;
            }
            source.mute   = this.volume.Mute;
            source.volume = this.volume.ENV;
        }
        enabledENVsources.AddLast(source);
        source.clip = clip;
        source.Play();
    }
Exemplo n.º 5
0
    public AudioSE PlaySE(AudioClip clip, float volume = 1f)
    {
        AudioSE se;

        if (enabledSEsources.Count >= numberOfConcurrentSE)
        {
            se = enabledSEsources.First.Value;
            enabledSEsources.RemoveFirst();
        }
        else
        {
            if (cachedSEsources.Count > 0)
            {
                se         = cachedSEsources.Dequeue();
                se.enabled = true;
            }
            else
            {
                se             = GameObjectUtility.AddChild <AudioSE>("SE", audioSources);
                se.EnableCache = true;
            }
        }
        enabledSEsources.AddLast(se);
        se.Init(clip, volume);
        se.Play(this.volume.Mute, this.volume.SE, this.volume.VOICE);
        return(se);
    }
Exemplo n.º 6
0
    public AudioBGMLoader CreateBGMLoader(string name)
    {
        AudioClip      clip   = Resources.Load <AudioClip>("Audio/BGM/" + name);
        AudioBGMLoader loader = GameObjectUtility.AddChild <AudioBGMLoader>(name, gameObject);

        loader.clip = clip;
        return(loader);
    }
Exemplo n.º 7
0
    public AudioSELoader CreateSELoader(string name, AudioClip clip, float vol)
    {
        AudioSELoader loader = GameObjectUtility.AddChild <AudioSELoader>(name, gameObject);

        loader.clip   = clip;
        loader.volume = vol;
        return(loader);
    }
Exemplo n.º 8
0
    public AudioSELoader CreateSELoader(string name, float vol)
    {
        AudioClip     clip   = Resources.Load <AudioClip>("Audio/SE/" + name);
        AudioSELoader loader = GameObjectUtility.AddChild <AudioSELoader>(name, gameObject);

        loader.clip   = clip;
        loader.volume = vol;
        return(loader);
    }
Exemplo n.º 9
0
 // Use this for initialization
 void Awake()
 {
     if (Application.systemLanguage == SystemLanguage.Japanese)
     {
         GameObject nendIconGO = GameObjectUtility.AddChild(gameObject, nendAdIconPrb);
         nendAdIcon                    = nendIconGO.GetComponent <NendAdIcon>();
         nendAdIcon.AdLoaded          += OnFinishLoadIconAd;
         nendAdIcon.AdReceived        += OnReceiveIconAd;
         nendAdIcon.AdFailedToReceive += OnFailToReceiveIconAd;
         nendAdIcon.AdClicked         += OnClickIconAd;
     }
 }
Exemplo n.º 10
0
 private void AddLockArea()
 {
     if (areaLockGO == null)
     {
         GameObject lockPrb = Resources.Load("Common/AreaLock") as GameObject;
         GameObject panelGO = GameObject.Find("Panel");
         areaLockGO = GameObjectUtility.AddChild(panelGO, lockPrb);
         areaLockGO.transform.localScale    = Vector3.one * 2.0f;
         areaLockGO.transform.localPosition = Vector3.zero;
     }
     else
     {
         areaLockGO.SetActive(true);
     }
     noticeText.gameObject.SetActive(false);
 }
Exemplo n.º 11
0
    public void LoadStage(string areaNum, string stageNum)
    {
        currentArea = areaNum;
        currenStage = stageNum;
        string     stagePrbName = "Stage" + areaNum + "_" + stageNum;
        GameObject stagePrb     = Resources.Load("Views/Stages/" + stagePrbName) as GameObject;

        stageGO = GameObjectUtility.AddChild(stagePrbName, gameViewGO, stagePrb);
        stageGO.transform.localScale = Vector3.one;
        questText.text = Language.Get("STAGE" + areaNum + "_" + stageNum);
        if (isTrackScreen)
        {
#if !UNITY_EDITOR
            GoogleAnalytics.instance.LogScreen(stagePrbName);
#endif
            isTrackScreen = false;
        }
    }
Exemplo n.º 12
0
    void Awake()
    {
        if (!enablePositionEffect)
        {
            return;
        }

        se = GameObjectUtility.AddChild <AudioSE>("SE", target);
        if (type == InstanceType.Sibiling)
        {
            se.transform.parent = target.transform.parent;
        }

        se.EnableCache = false;
        se.Init(clip, volume);
        se.GetComponent <AudioSource>().rolloffMode = AudioRolloffMode.Linear;
        se.isVoice = isVoice;
    }