コード例 #1
0
ファイル: PopupInventory.cs プロジェクト: sknchan/LegacyRust
    public void Setup(float fSeconds, string strText)
    {
        Vector2 size      = base.transform.parent.GetComponent <dfPanel>().Size;
        dfPanel component = base.GetComponent <dfPanel>();
        Vector2 vector2   = this.labelText.Font.MeasureText(strText, this.labelText.FontSize, this.labelText.FontStyle);

        this.labelText.Width = vector2.x + 16f;
        Vector3 relativePosition = this.labelText.RelativePosition;

        component.Width = relativePosition.x + this.labelText.Width + 8f;
        Vector2 vector21 = new Vector2()
        {
            x = size.x + UnityEngine.Random.Range(-16f, 16f),
            y = size.y * 0.7f + UnityEngine.Random.Range(-16f, 16f)
        };

        vector21.y = vector21.y + ((float)PopupInventory.iYPos / 6f - 0.5f) * size.y * 0.2f;
        component.RelativePosition = vector21;
        PopupInventory.iYPos       = PopupInventory.iYPos + 1;
        if (PopupInventory.iYPos > 5)
        {
            PopupInventory.iYPos = 0;
        }
        Vector3 endValue = this.tweenOut.EndValue;

        endValue.y             = UnityEngine.Random.Range(-100f, 100f);
        this.tweenOut.EndValue = endValue;
        component.BringToFront();
        this.labelText.Text = strText;
        base.Invoke("PlayOut", fSeconds);
    }
コード例 #2
0
    /// <summary>
    /// Displays the drag cursor, which will follow the mouse until hidden
    /// </summary>
    /// <param name="sprite">The sprite to display in the drag cursor</param>
    /// <param name="position">The initial position of the drag cursor</param>
    /// <param name="offset">The mouse offset within the dragged object</param>
    public static void Show(SpellDefinition spell)
    {
        if (spell == null)
        {
            Hide();
            return;
        }

        // Assign label text, which will internally recalculate the label's Size
        _name.Text = spell.Name;
        _info.Text = spell.Description;

        // Resize this control to match the size of the contents
        var labelHeight = _info.RelativePosition.y + _info.Size.y;

        _panel.Height = labelHeight;

        // The tooltip should appear above the mouse
        _cursorOffset = new Vector2(0, labelHeight + 10);

        // Display the base panel
        _panel.Show();
        _panel.BringToFront();

        // Call the update function to position the tooltip
        _instance.Update();
    }
コード例 #3
0
    public void Setup(float fSeconds, string strText)
    {
        Vector2 vector3;
        Vector2 size      = base.transform.parent.GetComponent <dfPanel>().Size;
        dfPanel component = base.GetComponent <dfPanel>();
        Vector2 vector2   = this.labelText.Font.MeasureText(strText, this.labelText.FontSize, this.labelText.FontStyle);

        this.labelText.Width = vector2.x + 16f;
        component.Width      = (this.labelText.RelativePosition.x + this.labelText.Width) + 8f;
        vector3 = new Vector2 {
            x = size.x + UnityEngine.Random.Range((float)-16f, (float)16f),
            y = (size.y * 0.7f) + UnityEngine.Random.Range((float)-16f, (float)16f),
            y = vector3.y + ((((((float)iYPos) / 6f) - 0.5f) * size.y) * 0.2f)
        };
        component.RelativePosition = (Vector3)vector3;
        iYPos++;
        if (iYPos > 5)
        {
            iYPos = 0;
        }
        Vector3 endValue = this.tweenOut.EndValue;

        endValue.y             = UnityEngine.Random.Range((float)-100f, (float)100f);
        this.tweenOut.EndValue = endValue;
        component.BringToFront();
        this.labelText.Text = strText;
        base.Invoke("PlayOut", fSeconds);
    }
コード例 #4
0
ファイル: PopupNotice.cs プロジェクト: Virobeast2/RCLIENT
    public void Setup(float fSeconds, string strIcon, string strText)
    {
        Vector2 size      = base.transform.parent.GetComponent <dfPanel>().Size;
        dfPanel component = base.GetComponent <dfPanel>();
        Vector2 vector2   = this.labelText.Font.MeasureText(strText, this.labelText.FontSize, this.labelText.FontStyle);

        this.labelText.Width = vector2.x + 16f;
        component.Width      = (this.labelText.RelativePosition.x + this.labelText.Width) + 8f;
        Vector2 vector3 = new Vector2 {
            x = ((size.x - component.Width) / 2f) + UnityEngine.Random.Range((float)-32f, (float)32f),
            y = (component.Height * -1f) + UnityEngine.Random.Range((float)-32f, (float)32f)
        };

        component.RelativePosition = (Vector3)vector3;
        this.labelIcon.Text        = strIcon;
        this.labelText.Text        = strText;
        component.BringToFront();
        base.Invoke("PlayOut", fSeconds);
    }
コード例 #5
0
ファイル: LockEntry1.cs プロジェクト: sknchan/LegacyRust
    public void SetVisible(bool visible)
    {
        this.entryLabel.Text = (!this.changingEntry ? "Password:"******"New Password:");
        dfPanel component = base.GetComponent <dfPanel>();

        if (!visible)
        {
            component.Hide();
            this.passwordInput.Unfocus();
        }
        else
        {
            component.Show();
            component.BringToFront();
            this.passwordInput.Text = string.Empty;
            this.passwordInput.Focus();
        }
        base.gameObject.SetActive(visible);
    }