コード例 #1
0
        private void Start()
        {
#if UDONCONSOLE
            InitializeUConsoleIfNeeded();
#endif
            DebugLog($"Started `{_appname} {_version}`.");

            _player1 = (VRCUnityVideoPlayer)GetComponent(typeof(VRCUnityVideoPlayer));
            _player2 = (VRCAVProVideoPlayer)GetComponent(typeof(VRCAVProVideoPlayer));

            _panel1           = transform.Find("Control/Panel").gameObject;
            _lock1            = transform.Find("Control/Panel/Lock").gameObject;
            _lock1Button      = transform.Find("Control/Panel/Lock/Button").GetComponent <Button>();
            _lock1Image       = transform.Find("Control/Panel/Lock/Button/Image").GetComponent <Image>();
            _lock2            = transform.Find("Control/Panel/UnLock").gameObject;
            _lock2Button      = transform.Find("Control/Panel/UnLock/Button").GetComponent <Button>();
            _lock2Image       = transform.Find("Control/Panel/UnLock/Button/Image").GetComponent <Image>();
            _versionText      = transform.Find("Control/Panel/Text").GetComponent <Text>();
            _versionText.text = $"{_appname} {_version}";
            _video            = transform.Find("Control/Panel/Video").gameObject;
            _videoButton      = transform.Find("Control/Panel/Video/Button").GetComponent <Button>();
            _videoText        = transform.Find("Control/Panel/Video/Button/Text").GetComponent <Text>();
            _live             = transform.Find("Control/Panel/Live").gameObject;
            _liveButton       = transform.Find("Control/Panel/Live/Button").GetComponent <Button>();
            _liveText         = transform.Find("Control/Panel/Live/Button/Text").GetComponent <Text>();

            _panel2         = transform.Find("Control/Panel (1)").gameObject;
            _pause          = transform.Find("Control/Panel (1)/Pause").gameObject;
            _pauseButton    = transform.Find("Control/Panel (1)/Pause/Button").GetComponent <Button>();
            _pauseImage     = transform.Find("Control/Panel (1)/Pause/Button/Image").GetComponent <Image>();
            _play           = transform.Find("Control/Panel (1)/Play").gameObject;
            _playButton     = transform.Find("Control/Panel (1)/Play/Button").GetComponent <Button>();
            _playImage      = transform.Find("Control/Panel (1)/Play/Button/Image").GetComponent <Image>();
            _message        = transform.Find("Control/Panel (1)/Message").gameObject;
            _messageText    = transform.Find("Control/Panel (1)/Message/Text").GetComponent <Text>();
            _progress       = transform.Find("Control/Panel (1)/Message/Progress").gameObject;
            _progressSlider = transform.Find("Control/Panel (1)/Message/Progress").GetComponent <Slider>();
            _address        = transform.Find("Control/Panel (1)/Address").gameObject;
            _addressInput   = (VRCUrlInputField)transform.Find("Control/Panel (1)/Address").GetComponent(typeof(VRCUrlInputField));
            _sync           = transform.Find("Control/Panel (1)/Sync").gameObject;
            _off            = transform.Find("Control/Panel (1)/PowerOff").gameObject;
            _offButton      = transform.Find("Control/Panel (1)/PowerOff/Button").GetComponentInChildren <Button>();
            _offText        = transform.Find("Control/Panel (1)/PowerOff/Button/Text").GetComponentInChildren <Text>();

            _quad         = transform.Find("Screen/Quad").gameObject;
            _screen1      = transform.Find("Screen/Video").gameObject;
            _screen1Quad1 = transform.Find("Screen/Video/Quad").gameObject;
            if (mirrorReflection)
            {
                _screen1Quad1.layer = 4;
            }
            _screen1Quad1.transform.position   = _screen1Quad1.transform.localPosition + _quad.transform.position;
            _screen1Quad1.transform.rotation   = _quad.transform.rotation;
            _screen1Quad1.transform.localScale = _quad.transform.localScale;
            _screen1Quad2 = transform.Find("Screen/Video/Quad (1)").gameObject;
            _screen1Quad2.SetActive(mirrorReflection);
            if (mirrorReflection)
            {
                _screen1Quad2.layer = 18;
            }
            _screen1Quad2.transform.position   = _quad.transform.position;
            _screen1Quad2.transform.rotation   = _quad.transform.rotation;
            _screen1Quad2.transform.localScale = Vector3.Scale(_quad.transform.localScale, new Vector3(-1f, 1f, 1f));
            _screen2      = transform.Find("Screen/Live").gameObject;
            _screen2Quad1 = transform.Find("Screen/Live/Quad").gameObject;
            if (mirrorReflection)
            {
                _screen2Quad1.layer = 4;
            }
            _screen2Quad1.transform.position   = _screen2Quad1.transform.localPosition + _quad.transform.position;
            _screen2Quad1.transform.rotation   = _quad.transform.rotation;
            _screen2Quad1.transform.localScale = _quad.transform.localScale;
            _screen2Quad2 = transform.Find("Screen/Live/Quad (1)").gameObject;
            _screen2Quad2.SetActive(mirrorReflection);
            if (mirrorReflection)
            {
                _screen2Quad2.layer = 18;
            }
            _screen2Quad2.transform.position   = _quad.transform.position;
            _screen2Quad2.transform.rotation   = _quad.transform.rotation;
            _screen2Quad2.transform.localScale = Vector3.Scale(_quad.transform.localScale, new Vector3(-1f, 1f, 1f));

            _dummyScreen   = _quad.activeSelf;
            _normalColor   = _addressInput.selectionColor;
            _disabledColor = _addressInput.colors.disabledColor;

            OnPowerOff();
        }