Exemple #1
0
 void _MnuAddParameter_Click(object sender, System.EventArgs e)
 {
     UI.MenuItem mnu = sender as UI.MenuItem;
     if (mnu != null)
     {
         AddNewParameter((AnimationTreeParameterType)mnu.UserData);
     }
 }
Exemple #2
0
 private void FindSceneMatinees()
 {
     if (_Frame == null)
     {
         return;
     }
     _ItmSceneMatinee.Clear();
     Matinee[] matinees = GameObject.FindObjectsOfType <Matinee>();
     if (matinees != null && matinees.Length > 0)
     {
         for (int i = 0; i < matinees.Length; i++)
         {
             Skill.Editor.UI.MenuItem item = new UI.MenuItem(matinees[i].gameObject.name);
             item.UserData = matinees[i];
             item.Click   += MatineeItem_Click;
             _ItmSceneMatinee.Add(item);
         }
     }
 }
Exemple #3
0
            private EventTrackBarContextMenu()
            {
                // find all event class
                List <EventInfo> events = new List <EventInfo>();

                Type baseType = typeof(EventKey);

                foreach (System.Reflection.Assembly assembly in AppDomain.CurrentDomain.GetAssemblies())
                {
                    foreach (Type objType in assembly.GetTypes())
                    {
                        if ((objType.IsPublic && ((objType.Attributes & System.Reflection.TypeAttributes.Abstract) != System.Reflection.TypeAttributes.Abstract)) &&
                            objType.IsSubclassOf(baseType))
                        {
                            object[] customEventAttributes = objType.GetCustomAttributes(typeof(CustomEventAttribute), true);
                            if (customEventAttributes != null && customEventAttributes.Length > 0)
                            {
                                CustomEventAttribute att = (CustomEventAttribute)customEventAttributes[0];

                                EventInfo info = new EventInfo();
                                info.DisplayName = att.DisplayName;
                                info.Path        = string.IsNullOrEmpty(att.Path) ? "Custom" : att.Path.Trim(' ', '/', '\\', ',', '.').Replace('\\', '/');
                                info.Type        = objType;
                                info.Assembly    = assembly;

                                events.Add(info);
                            }
                        }
                    }
                }

                List <MenuItemData> itemList = new List <MenuItemData>();

                foreach (var e in events)
                {
                    Skill.Editor.UI.MenuItem pathItem = FindItem(itemList, e.Path);
                    if (pathItem == null)
                    {
                        string[] pathParts = e.Path.Split('/');
                        if (pathParts == null || pathParts.Length == 0)
                        {
                            pathParts = new string[] { "Custom" }
                        }
                        ;

                        string path = string.Empty;
                        Skill.Editor.UI.MenuItemBase parentItem = this;
                        for (int i = 0; i < pathParts.Length; i++)
                        {
                            path    += pathParts[i];
                            pathItem = FindItem(itemList, path);

                            if (pathItem == null)
                            {
                                pathItem = new UI.MenuItem(pathParts[i]);
                                itemList.Add(new MenuItemData()
                                {
                                    Path = path, Item = pathItem
                                });
                                parentItem.Add(pathItem);
                            }

                            parentItem = pathItem;
                            path      += "/";
                        }
                    }

                    if (pathItem != null)
                    {
                        Skill.Editor.UI.MenuItem addItem = new UI.MenuItem(e.DisplayName)
                        {
                            UserData = e
                        };
                        addItem.Click += addItem_Click;
                        pathItem.Add(addItem);
                    }
                }
            }