Пример #1
0
/*AUTO SCRIPT*/
/*AUTO SCRIPT*/ public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
/*AUTO SCRIPT*/ {
/*AUTO SCRIPT*/ if (list == null)
/*AUTO SCRIPT*/ {
/*AUTO SCRIPT*/ list  = EditorUtility.GetPropertyObject <Texture2DList>(property);
/*AUTO SCRIPT*/ rList = new ReorderableList(list, typeof(Texture2D), true, false, true, true);
/*AUTO SCRIPT*/                         // rList.onAddCallback += data => { list.Add(defaultVal); };
/*AUTO SCRIPT*/                         // rList.onChangedCallback += data=> {
/*AUTO SCRIPT*/                         // };
/*AUTO SCRIPT*/ }
/*AUTO SCRIPT*/
/*AUTO SCRIPT*/ numLines = 3 + list.Count;
/*AUTO SCRIPT*/ var title  = new GUIContent($" {label.text}");
/*AUTO SCRIPT*/ var height = base.GetPropertyHeight(property, label);
/*AUTO SCRIPT*/ var rect   = new Rect(position.x, position.y, position.width, height);

/*AUTO SCRIPT*/ EditorGUI.BeginChangeCheck();
/*AUTO SCRIPT*/ rList.DoList(rect);
/*AUTO SCRIPT*/ EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), title);
/*AUTO SCRIPT*/
/*AUTO SCRIPT*/ if (EditorGUI.EndChangeCheck())
            {
/*AUTO SCRIPT*/ property.serializedObject.ApplyModifiedProperties();
            }
/*AUTO SCRIPT*/
/*AUTO SCRIPT*/ }
Пример #2
0
        public AnimatedCursor(
            string name,
            Vector2 hotspot,
            IList <Texture2D> images,
            float framePerSecond = 30) : base(name, hotspot)
        {
            Assert.IsNotNull(images, "images != null");
            Assert.IsTrue(images.Any(), "images.Any()");

            Assert.IsTrue(framePerSecond > 0, "framePerSecond > 0");

            _images = new Texture2DList(images.Count);
            _images.CopyTo(images.ToArray(), 0);

            _framesPerSecond = framePerSecond;
        }