Exemplo n.º 1
0
        public void Initialize(AppBar newParentToolBar, AppBar.ButtonTemplate newTemplate, ButtonIconProfile newCustomProfile)
        {
            // TODO move this into the tag manager
            VisibleFilterTag     = new FilterTag();
            VisibleFilterTag.Tag = "Default";
            HiddenFilterTag      = new FilterTag();
            HiddenFilterTag.Tag  = "Hidden";

            template          = newTemplate;
            customIconProfile = newCustomProfile;
            parentToolBar     = newParentToolBar;

            cButton = GetComponent <CompoundButton>();
            cButton.MainRenderer.enabled = false;
            text      = GetComponent <CompoundButtonText>();
            text.Text = template.Text;
            icon      = GetComponent <CompoundButtonIcon>();
            if (customIconProfile != null)
            {
                icon.IconProfile = customIconProfile;
                icon.IconName    = string.Empty;
            }
            icon.IconName = template.Icon;
            initialized   = true;
            Hide();
        }
Exemplo n.º 2
0
        /// <summary>
        /// On Start spawn in the active bounding box and app bar for manipulation
        /// </summary>
        protected void Start()
        {
            // Spawn in the bounding box and assign internally
            GameObject boundBoxGO = Instantiate(BoundingBoxPrefab) as GameObject;

            m_boundingBox = boundBoxGO.GetComponent <BoundingBoxManipulate>();

            // Spawn in the app bar and assign internally
            GameObject appBarGO = Instantiate(AppBarPrefab) as GameObject;

            m_appBar = appBarGO.GetComponent <AppBar>();
        }
Exemplo n.º 3
0
        public void Tapped()
        {
            // If we've already got a bounding box and it's pointing to us, do nothing
            if (boundingBox != null && boundingBox.Target == this.gameObject)
            {
                return;
            }

            // Try to find our bounding box
            if (boundingBox == null)
            {
                boundingBox = GameObject.FindObjectOfType <BoundingBoxManipulate>();
                if (boundingBox == null)
                {
                    Debug.LogError("Couldn't find bounding box for object " + name);
                    return;
                }
            }

            // Try to find our toolbar
            if (toolbar == null)
            {
                toolbar = GameObject.FindObjectOfType <AppBar>();
                if (toolbar == null)
                {
                    // This is only a problem if we want to display one
                    if (ShowAppBar)
                    {
                        Debug.LogError("Couldn't find toolbar for object " + name);
                        return;
                    }
                }
            }

            // Set the bounding box's target and permitted operations
            boundingBox.PermittedOperations = PermittedOperations;
            boundingBox.Target = gameObject;

            if (ShowAppBar)
            {
                // Show it and set its bounding box object
                toolbar.BoundingBox = boundingBox;
                toolbar.Reset();
            }
            else if (toolbar != null)
            {
                // Set its bounding box to null to hide it
                toolbar.BoundingBox = null;
                // Set to accept input immediately
                boundingBox.AcceptInput = true;
            }
        }
Exemplo n.º 4
0
        public void Tapped()
        {
            // Return if there isn't a Manipulation Manager
            if (ManipulationManager.Instance == null)
            {
                Debug.LogError("No manipulation manager for " + name);
                return;
            }

            // Try to find our bounding box
            if (boundingBox == null)
            {
                boundingBox = ManipulationManager.Instance.ActiveBoundingBox;
            }

            // Try to find our toolbar
            if (toolbar == null)
            {
                toolbar = ManipulationManager.Instance.ActiveAppBar;
            }

            // If we've already got a bounding box and it's pointing to us, do nothing
            if (boundingBox != null && boundingBox.gameObject.activeSelf && boundingBox.Target == this.gameObject)
            {
                return;
            }

            // Set the bounding box's target and permitted operations
            boundingBox.PermittedOperations = PermittedOperations;
            boundingBox.FlattenPreference   = FlattenPreference;
            boundingBox.Target = gameObject;
            boundingBox.BoundsMethodOverride = BoundsCalculationMethod;
            boundingBox.gameObject.SetActive(true);

            if (ShowAppBar)
            {
                // Show it and set its bounding box object
                toolbar.BoundingBox = boundingBox;
                toolbar.Reset();
                toolbar.gameObject.SetActive(true);
            }
            else if (toolbar != null)
            {
                // Set its bounding box to null to hide it
                toolbar.BoundingBox = null;
                // Set to accept input immediately
                boundingBox.AcceptInput = true;
            }
        }
Exemplo n.º 5
0
        public void Initialize(AppBar newParentToolBar, AppBar.ButtonTemplate newTemplate, ButtonIconProfile newCustomProfile)
        {
            // TODO move this into the tag manager
            VisibleFilterTag     = new FilterTag();
            VisibleFilterTag.Tag = "Default";
            HiddenFilterTag      = new FilterTag();
            HiddenFilterTag.Tag  = "Hidden";

            template          = newTemplate;
            customIconProfile = newCustomProfile;
            parentToolBar     = newParentToolBar;

            cButton = GetComponent <CompoundButton>();
            cButton.MainRenderer.enabled = false;
            text      = GetComponent <CompoundButtonText>();
            text.Text = template.Text;
            icon      = GetComponent <CompoundButtonIcon>();
            if (customIconProfile != null)
            {
                icon.Profile  = customIconProfile;
                icon.IconName = string.Empty;
            }
            icon.IconName = template.Icon;
            initialized   = true;
            Hide();

            if (newTemplate.EventTarget != null)
            {
                // Register the button with its target interactable
                newTemplate.EventTarget.RegisterInteractible(gameObject);
            }
            else
            {
                // Register the button with the parent app bar
                newParentToolBar.RegisterInteractible(gameObject);
            }
        }