public void Initialize(AppBar newParentToolBar, AppBar.ButtonTemplate newTemplate, ButtonIconProfile newCustomProfile)
        {
            template          = newTemplate;
            customIconProfile = newCustomProfile;
            parentToolBar     = newParentToolBar;

            cButton = GetComponent <CompoundButton>();
            cButton.MainRenderer.enabled = false;
            text                  = GetComponent <CompoundButtonText>();
            text.Text             = template.Text;
            icon                  = GetComponent <CompoundButtonIcon>();
            highlightMeshRenderer = cButton.GetComponent <CompoundButtonMesh>().Renderer;

            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.Registerinteractable(gameObject);
            }
            else
            {
                // Register the button with the parent app bar
                newParentToolBar.Registerinteractable(gameObject);
            }
        }
예제 #2
0
        private void Start()
        {
            objectToBound = this.gameObject;

            boxInstance                   = Instantiate(BoundingBoxPrefab) as BoundingBox;
            boxInstance.Target            = objectToBound;
            boxInstance.FlattenPreference = flattenedAxis;

            BuildRig();

            appBarInstance             = Instantiate(appBarPrefab) as AppBar;
            appBarInstance.BoundingBox = boxInstance;
            boxInstance.IsVisible      = false;
            appBarInstance.IsVisible   = false;
        }
예제 #3
0
        private void Start()
        {
            objectToBound = this.gameObject;

            boxInstance                   = Instantiate(BoundingBoxPrefab) as BoundingBox;
            boxInstance.Target            = objectToBound;
            boxInstance.FlattenPreference = flattenedAxis;
            //boxInstance.transform.parent = this.gameObject.transform;

            BuildRig();

            appBarInstance              = Instantiate(appBarPrefab) as AppBar;
            appBarInstance.BoundingBox  = boxInstance;
            appBarInstance.HoverOffsetZ = appBarHoverOffsetZ;

            boxInstance.IsVisible = false;
        }
예제 #4
0
        private void Start()
        {
            objectToBound = this.gameObject;

            boxInstance                   = Instantiate(BoundingBoxPrefab) as BoundingBox;
            boxInstance.Target            = objectToBound;
            boxInstance.FlattenPreference = flattenedAxis;

            BuildRig();

            appBarInstance             = Instantiate(appBarPrefab) as AppBar;
            appBarInstance.BoundingBox = boxInstance;

            boxInstance.IsVisible = false;

            // Activate(); //daniel
            // Deactivate(); //daniel

            //kliment
            appBarInstance.name = objectToBound.name + "AppBar";
        }
예제 #5
0
        private void Start()
        {
            objectToBound = this.gameObject;

            boxInstance                         = Instantiate(BoundingBoxPrefab) as BoundingBox;
            boxInstance.Target                  = objectToBound;
            boxInstance.FlattenPreference       = flattenedAxis;
            boxInstance.BoundsCalculationMethod = PresetBoundsCalculationMethod;

            BuildRig();

            if (appBarPrefab != null)
            {
                appBarInstance              = Instantiate(appBarPrefab) as AppBar;
                appBarInstance.BoundingBox  = boxInstance;
                appBarInstance.HoverOffsetZ = appBarHoverOffsetZ;
            }

            boxInstance.IsVisible = false;

            //创建完成后取消激活
            boxInstance.gameObject.Active(false);
        }