예제 #1
0
        private void Awake()
        {
            WidgetInputHandler.RegisterInput(this.m_KeyCode, this);
            m_RectTransform = GetComponent <RectTransform> ();
            m_CanvasGroup   = GetComponent <CanvasGroup> ();
            if (!IsVisible)
            {
                m_RectTransform.localScale = Vector3.zero;
            }
            if (this.m_AlphaTweenRunner == null)
            {
                this.m_AlphaTweenRunner = new TweenRunner <FloatTween> ();
            }
            this.m_AlphaTweenRunner.Init(this);

            if (this.m_ScaleTweenRunner == null)
            {
                this.m_ScaleTweenRunner = new TweenRunner <Vector3Tween> ();
            }
            this.m_ScaleTweenRunner.Init(this);

            onShow.AddListener(delegate {
                Execute("OnShow", new CallbackEventData());
            });
            onClose.AddListener(delegate {
                Execute("OnClose", new CallbackEventData());
            });
            m_IsShowing = IsVisible;
            OnAwake();
        }
예제 #2
0
        private void Awake()
        {
            //Register the KeyCode to show or close the widget.
            WidgetInputHandler.RegisterInput(this.m_KeyCode, this);
            m_RectTransform         = GetComponent <RectTransform> ();
            m_CanvasGroup           = GetComponent <CanvasGroup> ();
            this.m_Scrollbars       = GetComponentsInChildren <Scrollbar>();
            this.m_CameraTransform  = Camera.main.transform;
            this.m_CameraController = this.m_CameraTransform.GetComponent("ThirdPersonCamera") as MonoBehaviour;

            if (!IsVisible)
            {
                //Set local scale to zero, when widget is not visible. Used to correctly animate the widget.
                m_RectTransform.localScale = Vector3.zero;
            }
            if (this.m_AlphaTweenRunner == null)
            {
                this.m_AlphaTweenRunner = new TweenRunner <FloatTween> ();
            }
            this.m_AlphaTweenRunner.Init(this);

            if (this.m_ScaleTweenRunner == null)
            {
                this.m_ScaleTweenRunner = new TweenRunner <Vector3Tween> ();
            }
            this.m_ScaleTweenRunner.Init(this);
            m_IsShowing = IsVisible;

            OnAwake();
        }