Пример #1
0
    private void SetToggleSound()
    {
        Toggle[] toggles = GetComponentsInChildren <Toggle>();
        for (int i = 0; i < toggles.Length; i++)
        {
            Toggle          toggle     = toggles[i];
            ButtonPlaySound ChildSound = toggle.gameObject.GetComponent <ButtonPlaySound>();
            if (ChildSound != null)
            {
                if (ChildSound.SoundSource != null)
                {
                    continue;
                }
            }

            for (int j = 0; j < toggle.onValueChanged.GetPersistentEventCount(); j++)
            {
                toggle.onValueChanged.SetPersistentListenerState(j, UnityEngine.Events.UnityEventCallState.RuntimeOnly);
            }

            toggle.onValueChanged.AddListener(delegate(bool isOn)
            {
                if (isOn)
                {
                    PlaySound();
                }
            });
        }
    }
Пример #2
0
    private void SetButtonSound()
    {
        Button[] btns = GetComponentsInChildren <Button>();
        for (int i = 0; i < btns.Length; i++)
        {
            Button          btnChild   = btns[i];
            ButtonPlaySound ChildSound = btnChild.gameObject.GetComponent <ButtonPlaySound>();
            if (ChildSound != null)
            {
                if (ChildSound.SoundSource != null)
                {
                    continue;
                }
            }

            for (int j = 0; j < btnChild.onClick.GetPersistentEventCount(); j++)
            {
                btnChild.onClick.SetPersistentListenerState(j, UnityEngine.Events.UnityEventCallState.RuntimeOnly);
            }

            btnChild.onClick.AddListener(PlaySound);
        }
    }
Пример #3
0
        void ReleaseDesignerOutlets()
        {
            if (ActivityLog != null)
            {
                ActivityLog.Dispose();
                ActivityLog = null;
            }

            if (ButtonPlaySound != null)
            {
                ButtonPlaySound.Dispose();
                ButtonPlaySound = null;
            }

            if (ButtonSaveSound != null)
            {
                ButtonSaveSound.Dispose();
                ButtonSaveSound = null;
            }

            if (LabelDefinitions != null)
            {
                LabelDefinitions.Dispose();
                LabelDefinitions = null;
            }

            if (LabelEndings != null)
            {
                LabelEndings.Dispose();
                LabelEndings = null;
            }

            if (LabelExamples != null)
            {
                LabelExamples.Dispose();
                LabelExamples = null;
            }

            if (LabelPronunciation != null)
            {
                LabelPronunciation.Dispose();
                LabelPronunciation = null;
            }

            if (LabelTranslation != null)
            {
                LabelTranslation.Dispose();
                LabelTranslation = null;
            }

            if (LabelWord != null)
            {
                LabelWord.Dispose();
                LabelWord = null;
            }

            if (txtLookUp != null)
            {
                txtLookUp.Dispose();
                txtLookUp = null;
            }

            if (StackViewOpslagsords != null)
            {
                StackViewOpslagsords.Dispose();
                StackViewOpslagsords = null;
            }

            if (ButtonOpslagsord != null)
            {
                ButtonOpslagsord.Dispose();
                ButtonOpslagsord = null;
            }
        }