示例#1
0
        /// <summary>
        /// float 型の値を制御するコントローラをスライダ付きで描画します。
        /// </summary>
        /// <param name="title">
        /// コントローラのタイトル。null を指定するとき描画しません。
        /// </param>
        /// <param name="minValue">
        /// スライダの最小値。
        /// </param>
        /// <param name="maxValue">
        /// スライダの最大値。
        /// </param>
        /// <param name="textFieldWidth">
        /// テキストフィールドの幅。
        /// 0 以下の値を指定するとき、幅は最大になります。
        /// </param>
        /// <returns>
        /// コントローラによって変更された値。
        /// </returns>
        public float Controller
            (string title, float minValue, float maxValue, float textFieldWidth)
        {
            UnityEngine.GUILayout.BeginVertical();

            UnityEngine.GUILayout.BeginHorizontal();

            if (title != null)
            {
                UnityEngine.GUILayout.Label(title);
            }

            UnityEngine.GUILayoutOption layoutOption = null;

            if (textFieldWidth <= 0)
            {
                layoutOption = UnityEngine.GUILayout.ExpandWidth(true);
            }
            else
            {
                layoutOption = UnityEngine.GUILayout.Width(textFieldWidth);
            }

            this.Text = UnityEngine.GUILayout.TextField
                            (this.Text, GUILayout.NumericTextBoxStyle, layoutOption);

            UnityEngine.GUILayout.EndHorizontal();

            // 無効な数値が TextField に与えられているときは、
            // スライダの値が変更されたときのみ Value を更新する。

            float newValue = UnityEngine.GUILayout.HorizontalSlider(this.Value, minValue, maxValue);

            if (this.textIsValid)
            {
                this.Value = newValue;
            }
            else
            {
                if (newValue != this.Value)
                {
                    this.Value = newValue;
                }
            }

            UnityEngine.GUILayout.EndVertical();

            return(this.Value);
        }
        /// <summary>
        /// int 型の値を制御するコントローラを描画します。
        /// </summary>
        /// <param name="title">
        /// コントローラのタイトル。null を指定するとき描画しません。
        /// </param>
        /// <param name="textFieldWidth">
        /// テキストフィールドの幅。
        /// 0 以下の値を指定するとき、幅は最大になります。
        /// </param>
        /// <returns>
        /// コントローラによって変更された値。
        /// </returns>
        public int Controller(string title, float textFieldWidth)
        {
            UnityEngine.GUILayout.BeginHorizontal();

            if (title != null)
            {
                if (textFieldWidth <= 0)
                {
                    UnityEngine.GUILayout.Label
                        (title,
                        GUILayout.MiddleRightAlignedLabelStyle,
                        UnityEngine.GUILayout.ExpandWidth(false));
                }
                else
                {
                    UnityEngine.GUILayout.Label(title);
                }
            }

            UnityEngine.GUILayoutOption layoutOption = null;

            if (textFieldWidth <= 0)
            {
                layoutOption = UnityEngine.GUILayout.ExpandWidth(true);
            }
            else
            {
                layoutOption = UnityEngine.GUILayout.Width(textFieldWidth);
            }

            this.Text = UnityEngine.GUILayout.TextField
                            (this.Text, GUILayout.NumericTextBoxStyle, layoutOption);

            UnityEngine.GUILayout.EndHorizontal();

            return(this.Value);
        }
示例#3
0
 public static System.Boolean Button(System.String text, UnityEngine.GUILayoutOption option)
 {
     throw new NotImplementedException("This function was automatically generated by Mockery and has no real implementation yet.");
 }
示例#4
0
 public static void Label(System.String text, UnityEngine.GUILayoutOption option)
 {
 }