LongField() public static method

Make a text field for entering long integers.

public static LongField ( GUIContent label, long value ) : long
label UnityEngine.GUIContent Optional label to display in front of the long field.
value long The value to edit.
return long
コード例 #1
0
        private void RenderNetworkVariableValueType <T>(int index) where T : struct
        {
            var    networkVariable = (NetworkVariable <T>)m_NetworkVariableFields[m_NetworkVariableNames[index]].GetValue(target);
            var    type            = typeof(T);
            object val             = networkVariable.Value;
            string name            = m_NetworkVariableNames[index];

            if (NetworkManager.Singleton != null && NetworkManager.Singleton.IsListening)
            {
                if (type == typeof(int))
                {
                    val = EditorGUILayout.IntField(name, (int)val);
                }
                else if (type == typeof(uint))
                {
                    val = (uint)EditorGUILayout.LongField(name, (long)((uint)val));
                }
                else if (type == typeof(short))
                {
                    val = (short)EditorGUILayout.IntField(name, (int)((short)val));
                }
                else if (type == typeof(ushort))
                {
                    val = (ushort)EditorGUILayout.IntField(name, (int)((ushort)val));
                }
                else if (type == typeof(sbyte))
                {
                    val = (sbyte)EditorGUILayout.IntField(name, (int)((sbyte)val));
                }
                else if (type == typeof(byte))
                {
                    val = (byte)EditorGUILayout.IntField(name, (int)((byte)val));
                }
                else if (type == typeof(long))
                {
                    val = EditorGUILayout.LongField(name, (long)val);
                }
                else if (type == typeof(ulong))
                {
                    val = (ulong)EditorGUILayout.LongField(name, (long)((ulong)val));
                }
                else if (type == typeof(bool))
                {
                    val = EditorGUILayout.Toggle(name, (bool)val);
                }
                else if (type == typeof(string))
                {
                    val = EditorGUILayout.TextField(name, (string)val);
                }
                else if (type.IsEnum)
                {
                    val = EditorGUILayout.EnumPopup(name, (Enum)val);
                }
                else
                {
                    EditorGUILayout.LabelField("Type not renderable");
                }

                networkVariable.Value = (T)val;
            }
            else
            {
                EditorGUILayout.LabelField(name, EditorStyles.wordWrappedLabel);
                EditorGUILayout.SelectableLabel(val.ToString(), EditorStyles.wordWrappedLabel);
            }
        }