Esempio n. 1
0
        private static void DrawItem(Rect position, int i)
        {
            var item = lastEvent._actionList[i];

            leftStyle.alignment = TextAnchor.MiddleLeft;
            if (item == audioEventAction)
            {
                DrawBackground(position);
            }

            Rect fullArea = position;
            Rect typePos  = position;

            typePos.width = 110;
            if (item != null)
            {
                if (GUI.Button(typePos, EventActionExtension.GetList().Find(p => p.Value == (int)item._eventActionType).Name))
                {
                    ShowChangeContext(lastEvent, item);
                    Event.current.UseEvent();
                }
            }
            else
            {
                GUI.Label(position, "Missing data", leftStyle);
            }


            typePos.x += 130;
            if (item != null && item._eventActionType != EventActionTypes.StopAll && item._eventActionType != EventActionTypes.StopAllMusic)
            {
                Rect area = typePos;
                area.width = position.width - 200;
                GUI.Label(area, item.ObjectName);
            }
            HandleDragging(item, typePos);

            position.x     = position.x + position.width - 75;
            position.width = 45;

            if (item != null && item._eventActionType != EventActionTypes.StopAll && item._eventActionType != EventActionTypes.StopAllMusic)
            {
                if (GUI.Button(position, "Find"))
                {
                    SearchHelper.SearchForActionTarget(item);
                }
            }

            position.x    += 50;
            position.width = 20;

            if (audioEventAction == item)
            {
                DrawBackground(position);
            }

            if (GUI.Button(position, "X"))
            {
                toRemove = item;
            }

            if (Event.current.ClickedWithin(fullArea))
            {
                audioEventAction = item;
                Event.current.UseEvent();
            }
        }