//--------------------------------------------------

    #region Methods


    void OnEnable()
    {
        if (window == null)
        {
            window = this;
        }
        window.minSize = minWindowSize;
        window.maxSize = maxWindowSize;

        SelectedGroup = null;
        initializeOrderableLists();


        titleStyle           = new GUIStyle();
        titleStyle.alignment = TextAnchor.MiddleCenter;
        titleStyle.fontSize  = 16;
        // titleStyle.stretchHeight = true;
        // titleStyle.stretchWidth = true;
        titleStyle.normal.textColor = new Color(224 / 255f, 185 / 255f, 121 / 255f);
        titleStyle.richText         = true;

        DirectoryInfo di    = new DirectoryInfo(Application.dataPath);
        var           files = di.GetFiles("flame.jpg", SearchOption.AllDirectories);

        if (files.Length > 0)
        {
            WWW w       = new WWW(@"file:///" + files[0].FullName.Replace("\\", "/"));
            var texture = w.texture;
            texture.wrapMode = TextureWrapMode.Repeat;
            // TextureScale.Bilinear(texture, (int) (position.width/20), (int)position.height*20);
            titleStyle.normal.background = texture; // new Texture2D(1024, 1024, TextureFormat.DXT1, false);
        }
    }
    public EventMethodModifier(EventMethodsGroup containingGroup, EventMethodInfo method)
    {
        if (containingGroup == null || method == null)
        {
            throw new ArgumentException("arguments cannot be null!");
        }

        if (!containingGroup.ContainsMethod(method))
        {
            throw new ArgumentException("the method must be contained in the group in order!");
        }

        _containingGroup = containingGroup;
        _method          = method;
    }
    void initializeOrderableLists()
    {
        groupsList = new ReorderableList(EventsManager.Instance.GroupsContainer.GroupNames, typeof(string));

        groupsList.drawHeaderCallback  = (rect) => EditorGUI.LabelField(rect, "Groups");
        groupsList.drawElementCallback = (rect, index, active, focused) =>
        {
            Rect r = rect;
            r.width = rect.width - ButtonWidth;
            EditorGUI.LabelField(r, groupsList.list[index] as string);

            r.x     += r.width;
            r.width  = ButtonWidth;
            r.height = rect.height * .75f;
            if (GUI.Button(r, "Rename"))
            {
                var win = GetWindow <RenameGroupWindow>(true, "Rename Group", true);
                win.SetGroup((groupsList.list[index] as string));
            }
        };
        groupsList.onSelectCallback = list =>
        {
            selectedGroupName = list.list[list.index] as string;
            CreateEventOrderableList();
        };

        groupsList.onAddCallback = list =>
        {
            GetWindow <CreateGroupWindow>(true, "Create Group", true);
        };
        groupsList.onReorderCallback = list => UpdateGroupListOrder(list.list);


        groupsList.onRemoveCallback = list =>
        {
            SelectedGroup = null;
            EventsManager.Instance.GroupsContainer.RemoveGroup(list.list[list.index] as string);
            list.index = -1;
            NotifyGroupDatasetChanged();
            groupsList.ReleaseKeyboardFocus();
        };
    }
Exemplo n.º 4
0
 public ReadOnlyEventMethodsGroup(EventMethodsGroup other) : base(other)
 {
 }