Exemplo n.º 1
0
        protected virtual void Awake()
        {
            if (m_instance != null)
            {
                Debug.LogWarning("Another instance of RTE exists");
                return;
            }
            if (m_useBuiltinUndo)
            {
                m_undo = new RuntimeUndo(this);
            }
            else
            {
                m_undo = new DisabledUndo();
            }

            if (m_raycaster == null)
            {
                m_raycaster = GetComponent <GraphicRaycaster>();
            }

            IsVR            = UnityEngine.XR.XRDevice.isPresent && m_enableVRIfAvailable;
            m_selection     = new RuntimeSelection(this);
            m_dragDrop      = new DragDrop(this);
            m_object        = gameObject.GetComponent <RuntimeObjects>();
            m_disabledInput = new DisabledInput();
            m_activeInput   = m_disabledInput;

            m_instance = this;

            bool isOpened = m_isOpened;

            m_isOpened = !isOpened;
            IsOpened   = isOpened;
        }
Exemplo n.º 2
0
 private static IRTE RegisterRTE()
 {
     if (Instance == null)
     {
         GameObject editor   = new GameObject("RTE");
         RTEBase    instance = editor.AddComponent <RTEBase>();
         instance.BuildUp(editor);
     }
     return(Instance);
 }
 private void InstantiateRuntimeEditor()
 {
     m_editor                  = Instantiate(m_editorPrefab);
     m_editor.name             = "RuntimeEditor";
     m_editor.IsOpenedChanged += OnIsOpenedChanged;
     m_editor.transform.SetAsFirstSibling();
     if (Created != null)
     {
         Created(m_editor);
     }
     gameObject.SetActive(false);
 }
 private void Awake()
 {
     IOC.RegisterFallback <IRTEState>(this);
     m_editor = (RTEBase)FindObjectOfType(m_editorPrefab.GetType());
     if (m_editor != null)
     {
         if (m_editor.IsOpened)
         {
             m_editor.IsOpenedChanged += OnIsOpenedChanged;
             gameObject.SetActive(false);
         }
     }
     m_createEditorButton.onClick.AddListener(OnOpen);
 }
Exemplo n.º 5
0
        public ExposeToEditorEvents(RTEBase rte)
        {
            m_rte = rte;

            ExposeToEditor._Awaked                 += OnAwaked;
            ExposeToEditor._Enabled                += OnEnabled;
            ExposeToEditor._Started                += OnStarted;
            ExposeToEditor._Disabled               += OnDisabled;
            ExposeToEditor._Destroying             += OnDestroying;
            ExposeToEditor._Destroyed              += OnDestroyed;
            ExposeToEditor._MarkAsDestroyedChanged += OnMarkAsDestroyedChanged;

            ExposeToEditor._TransformChanged += OnTransformChanged;
            ExposeToEditor._NameChanged      += OnNameChanged;
            ExposeToEditor._ParentChanged    += OnParentChanged;
        }
Exemplo n.º 6
0
        protected virtual void OnDestroy()
        {
            if (m_object != null)
            {
                m_object.Reset();
                m_object = null;
            }

            if (m_dragDrop != null)
            {
                m_dragDrop.Reset();
            }
            if (m_instance == this)
            {
                m_instance = null;
            }
        }
Exemplo n.º 7
0
 private static void OnSceneUnloaded(Scene arg0)
 {
     m_instance = null;
 }