public void Add(BoardItem item, bool sort)
 {
     lock (board.ParentControl)
     {
         if (item is TileInstance || item is ObjectInstance)
         {
             TileObjs.Add((LayeredItem)item);
             if (sort)
             {
                 Sort();
             }
         }
         else if (item is BackgroundInstance instance)
         {
             if (instance.front)
             {
                 FrontBackgrounds.Add(instance);
             }
             else
             {
                 BackBackgrounds.Add(instance);
             }
             if (sort)
             {
                 Sort();
             }
         }
         else if (item.Type == ItemTypes.Misc)
         {
             if (item is VRDot || item is MinimapDot)
             {
                 SpecialDots.Add((MapleDot)item);
             }
             else
             {
                 MiscItems.Add(item);
             }
         }
         else
         {
             Type itemType = item.GetType();
             foreach (IMapleList itemList in AllItemLists)
             {
                 Type listType = itemList.GetType().GetGenericArguments()[0];
                 if (listType.FullName == itemType.FullName)
                 {
                     itemList.Add(item);
                     return;
                 }
             }
             throw new Exception("unknown type at boarditems.add");
         }
     }
 }
예제 #2
0
        public static string CreateItemDescription(BoardItem item, string lineBreak)
        {
            switch (item.GetType().Name)
            {
            case "TileInstance":
                return("Tile:" + lineBreak + ((TileInfo)item.BaseInfo).tS + @"\" + ((TileInfo)item.BaseInfo).u + @"\" + ((TileInfo)item.BaseInfo).no);

            case "ObjectInstance":
                return("Object:" + lineBreak + ((ObjectInfo)item.BaseInfo).oS + @"\" + ((ObjectInfo)item.BaseInfo).l0 + @"\" + ((ObjectInfo)item.BaseInfo).l1 + @"\" + ((ObjectInfo)item.BaseInfo).l2);

            case "BackgroundInstance":
                return("Background:" + lineBreak + ((BackgroundInfo)item.BaseInfo).bS + @"\" + (((BackgroundInfo)item.BaseInfo).ani ? "ani" : "back") + @"\" + ((BackgroundInfo)item.BaseInfo).no);

            case "PortalInstance":
                return("Portal:" + lineBreak + "Name: " + ((PortalInstance)item).pn + lineBreak + "Type: " + Tables.PortalTypeNames[(int)((PortalInstance)item).pt]);

            case "LifeInstance":
                if (((LifeInstance)item).Type == ItemTypes.Mobs)
                {
                    return("Mob:" + lineBreak + "Name: " + ((MobInfo)item.BaseInfo).Name + lineBreak + "ID: " + ((MobInfo)item.BaseInfo).ID);
                }
                else
                {
                    return("Npc:" + lineBreak + "Name: " + ((NpcInfo)item.BaseInfo).Name + lineBreak + "ID: " + ((NpcInfo)item.BaseInfo).ID);
                }

            case "ReactorInstance":
                return("Reactor:" + lineBreak + "ID: " + ((ReactorInfo)item.BaseInfo).ID);

            case "FootholdAnchor":
                return("Foothold");

            case "RopeAnchor":
                return(((RopeAnchor)item).ParentRope.ladder ? "Ladder" : "Rope");

            case "Chair":
                return("Chair");

            case "ToolTipDot":
            case "ToolTip":
            case "ToolTipChar":
                return("Tooltip");

            default:
                return("");
            }
        }
예제 #3
0
        private void multiBoard_OnEditInstanceClicked(BoardItem item)
        {
            InputHandler.ClearBoundItems(multiBoard.SelectedBoard);
            switch (item.GetType().Name)
            {
            case "ObjectInstance":
                new InstanceEditor.ObjectInstanceEditor((ObjectInstance)item).ShowDialog();
                multiBoard.RenderFrame();
                break;

            case "TileInstance":
            case "Chair":
                new InstanceEditor.GeneralInstanceEditor(item).ShowDialog();
                multiBoard.RenderFrame();
                break;

            case "FootholdAnchor":
                FootholdLine[] selectedFootholds = FootholdLine.GetSelectedFootholds(item.Board);
                if (selectedFootholds.Length > 0)
                {
                    new InstanceEditor.FootholdEditor(selectedFootholds).ShowDialog();
                }
                else
                {
                    new InstanceEditor.GeneralInstanceEditor(item).ShowDialog();
                }
                multiBoard.RenderFrame();
                break;

            case "RopeAnchor":
                new InstanceEditor.RopeInstanceEditor((RopeAnchor)item).ShowDialog();
                multiBoard.RenderFrame();
                break;

            case "LifeInstance":
                new InstanceEditor.LifeInstanceEditor((LifeInstance)item).ShowDialog();
                multiBoard.RenderFrame();
                break;

            case "ReactorInstance":
                new InstanceEditor.ReactorInstanceEditor((ReactorInstance)item).ShowDialog();
                multiBoard.RenderFrame();
                break;

            case "BackgroundInstance":
                multiBoard.RenderFrame();
                break;

            case "PortalInstance":
                new InstanceEditor.PortalInstanceEditor((PortalInstance)item).ShowDialog();
                multiBoard.RenderFrame();
                break;

            case "ToolTip":

                break;

            default:
                break;
            }
        }