Beispiel #1
0
    // Token: 0x06005536 RID: 21814 RVA: 0x001D5BB4 File Offset: 0x001D3FB4
    public void RefreshComponentPositions()
    {
        this.Tether.SetActive(!this.IsFloatingLabel);
        this.Icon.transform.localPosition          = new Vector3(this._iconInitialOffsetX, this.Icon.transform.localPosition.y, this.Icon.transform.localPosition.z);
        this.Text.transform.localPosition          = new Vector3(this._textInitialOffsetX, this.Text.transform.localPosition.y, this.Text.transform.localPosition.z);
        this.IconSecondary.transform.localPosition = new Vector3(this._iconInitialOffsetX, this.IconSecondary.transform.localPosition.y, this.IconSecondary.transform.localPosition.z);
        this.TextSecondary.transform.localPosition = new Vector3(this._textInitialOffsetX, this.TextSecondary.transform.localPosition.y, this.TextSecondary.transform.localPosition.z);
        bool enabled  = this.Icon.GetComponent <Renderer>().enabled;
        bool enabled2 = this.IconSecondary.GetComponent <Renderer>().enabled;

        if (!enabled)
        {
            this.Text.transform.localPosition = new Vector3(this._iconInitialOffsetX + this.Icon.transform.localScale.x / 2f, this.Text.transform.localPosition.y, this.Text.transform.localPosition.z);
        }
        if (!enabled2)
        {
            this.TextSecondary.transform.localPosition = new Vector3(this._iconInitialOffsetX + this.IconSecondary.transform.localScale.x / 2f, this.TextSecondary.transform.localPosition.y, this.TextSecondary.transform.localPosition.z);
        }
        float a   = ((!enabled) ? 0f : this.Icon.transform.localScale.x) + this.GetTextMeshWidth(this.Text.GetComponent <TextMesh>());
        float b   = ((!enabled2) ? 0f : this.IconSecondary.transform.localScale.x) + this.GetTextMeshWidth(this.TextSecondary.GetComponent <TextMesh>());
        float num = Mathf.Max(a, b);

        if (this.IsFloatingLabel)
        {
            Vector3 position = TutorialLabel.CalculateFloatingLabelPosition();
            base.transform.position = position;
            float num2 = num / 2f;
            this.Icon.transform.localPosition          = new Vector3(this.Icon.transform.localPosition.x + num2, this.Icon.transform.localPosition.y, this.Icon.transform.localPosition.z);
            this.Text.transform.localPosition          = new Vector3(this.Text.transform.localPosition.x + num2, this.Text.transform.localPosition.y, this.Text.transform.localPosition.z);
            this.IconSecondary.transform.localPosition = new Vector3(this.IconSecondary.transform.localPosition.x + num2, this.IconSecondary.transform.localPosition.y, this.IconSecondary.transform.localPosition.z);
            this.TextSecondary.transform.localPosition = new Vector3(this.TextSecondary.transform.localPosition.x + num2, this.TextSecondary.transform.localPosition.y, this.TextSecondary.transform.localPosition.z);
        }
        else if (this.InvertLabelAlignment)
        {
            this.Icon.transform.localPosition          = new Vector3(this.Icon.transform.localPosition.x + num, this.Icon.transform.localPosition.y, this.Icon.transform.localPosition.z);
            this.Text.transform.localPosition          = new Vector3(this.Text.transform.localPosition.x + num, this.Text.transform.localPosition.y, this.Text.transform.localPosition.z);
            this.IconSecondary.transform.localPosition = new Vector3(this.IconSecondary.transform.localPosition.x + num, this.IconSecondary.transform.localPosition.y, this.IconSecondary.transform.localPosition.z);
            this.TextSecondary.transform.localPosition = new Vector3(this.TextSecondary.transform.localPosition.x + num, this.TextSecondary.transform.localPosition.y, this.TextSecondary.transform.localPosition.z);
        }
        base.GetComponentInChildren <FaceCamera>().ForceUpdate();
    }
Beispiel #2
0
    // Token: 0x06005577 RID: 21879 RVA: 0x001D7BF8 File Offset: 0x001D5FF8
    private bool ActivateLabel(Transform targetObj, string id, TutorialLabelType type, ControllerHand hand, ControllerInputUI controllerPart, string text, ControllerActionUI action, string textSecondary, ControllerActionUI actionSecondary, float duration, int priority, Vector3?tetherPos, Vector3?labelPos, AttachMode attachMode, bool showOffscreen, float scale)
    {
        if (!this.AreLabelsEnabled)
        {
            return(false);
        }
        if (this.TutorialLabelPrefab == null)
        {
            return(false);
        }
        bool flag = targetObj == null || type == TutorialLabelType.Popup || type == TutorialLabelType.PopupAttached;

        if (targetObj == null)
        {
            targetObj = this.FloatingLabelTransform;
        }
        TutorialManager.ActiveLabel activeLabel = this.FindActiveLabel(targetObj.GetInstanceID());
        if (activeLabel == null)
        {
            if (flag)
            {
                Vector3 value = TutorialLabel.CalculateFloatingLabelPosition();
                tetherPos = new Vector3?(value);
                labelPos  = new Vector3?(value);
            }
            else if (tetherPos == null || labelPos == null)
            {
                Vector3 value2;
                Vector3 value3;
                TutorialLabel.FindLabelAttachPoints(targetObj, out value2, out value3);
                if (tetherPos == null)
                {
                    tetherPos = new Vector3?(value2);
                }
                if (labelPos == null)
                {
                    labelPos = new Vector3?(value3);
                }
            }
            if (!showOffscreen && !VRCTrackingManager.IsPointWithinHMDView(labelPos.Value))
            {
                return(false);
            }
            activeLabel = new TutorialManager.ActiveLabel();
            activeLabel.TargetObject = targetObj;
            GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(this.TutorialLabelPrefab);
            activeLabel.Label = gameObject.GetComponent <TutorialLabel>();
            activeLabel.Label.Init();
            this._activeLabels.Add(activeLabel.TargetObject.GetInstanceID(), activeLabel);
            activeLabel.Label.SetTargetObject(targetObj, attachMode, tetherPos.Value, labelPos.Value, flag);
        }
        else if (activeLabel.Label.IsActive && activeLabel.Priority > priority)
        {
            VRC.Core.Logger.LogOnceEvery(10f, this, string.Concat(new object[]
            {
                "TutorialManager: Existing label (",
                activeLabel.ID,
                ", ",
                activeLabel.TargetObject.name,
                ") \"",
                activeLabel.Label.TextString,
                "\" has higher priority ",
                activeLabel.Priority,
                " > ",
                priority,
                ", discarding new one"
            }));
            return(false);
        }
        activeLabel.ID   = id;
        activeLabel.Type = type;
        activeLabel.SetController(hand, controllerPart);
        activeLabel.ShowOffscreen = showOffscreen;
        activeLabel.Priority      = priority;
        activeLabel.Label.SetText(text, textSecondary);
        activeLabel.Label.SetIcon(action, actionSecondary);
        activeLabel.Label.SetTextScaleOverride(scale);
        bool invertLabelAlignment = type == TutorialLabelType.Controller && hand == ControllerHand.Right && VRCInputManager.LastInputMethod == VRCInputManager.InputMethod.Oculus;

        activeLabel.Label.IsFloatingLabel      = flag;
        activeLabel.Label.InvertLabelAlignment = invertLabelAlignment;
        activeLabel.Label.IsAttachedToView     = (type == TutorialLabelType.PopupAttached);
        activeLabel.Label.RefreshComponentPositions();
        activeLabel.TimeToLive = duration;
        activeLabel.Label.Activate();
        return(true);
    }