예제 #1
0
 public void Alert(string Alert)
 {
     _Error.DisplayedString = Alert;
     _Error.Position        = new Vector2f(0, _AvailableUnits.Size.Y + _AvailableUnits.Position.Y + 16);
     _Pane.Remove(_Error);
     _Pane.Add(_Error);
 }
예제 #2
0
 public void destroyGui(Plugin plugin, GuiContainer container, string name = null)
 {
     if (container == null)
     {
         return;
     }
     if (name == null)
     {
         List <GuiContainer> garbage = new List <GuiContainer>();
         destroyGuiContainer(plugin, container, garbage);
         foreach (GuiContainer cont in garbage)
         {
             activeGuiContainers.Remove(cont);
         }
     }
     else
     {
         name = removeWhiteSpaces(name);
         name = PluginInstance.prependContainerName(container, name);
         List <GuiElement> eGarbage = new List <GuiElement>();
         destroyGuiElement(plugin, container, name, eGarbage);
         foreach (GuiElement element in eGarbage)
         {
             container.Remove(element);
         }
     }
 }
예제 #3
0
 public void destroyGui(Plugin plugin, GuiContainer container, string name = null)
 {
     if (container == null)
     {
         return;
     }
     if (name == null)
     {
         List <GuiContainer> garbage = new List <GuiContainer>();
         destroyGuiContainer(plugin, container, garbage);
         foreach (GuiContainer cont in garbage)
         {
             activeGuiContainers.Remove(cont);
         }
     }
     else
     {
         name = safeName(name);
         List <CuiElement> eGarbage = new List <CuiElement>();
         destroyGuiElement(plugin, container, name, eGarbage);
         foreach (CuiElement element in eGarbage)
         {
             container.Remove(element);
         }
     }
 }
예제 #4
0
            private void destroyGuiContainer(Plugin plugin, GuiContainer container, List <GuiContainer> garbage)
            {
#if DEBUG
                player.ChatMessage($"destroyGuiContainer: start {plugin.Name} {container.name}");
#endif
                if (activeGuiContainers.Contains(container))
                {
                    foreach (GuiContainer cont in activeGuiContainers)
                    {
                        if (cont.plugin != container.plugin)
                        {
                            continue;
                        }
                        if (cont.parent == container.name)
                        {
                            destroyGuiContainer(cont.plugin, cont, garbage);
                        }
                    }
                    container.closeCallback?.Invoke(player);
                    List <GuiElement> eGarbage = new List <GuiElement>();
                    foreach (GuiElement element in container)
                    {
                        destroyGuiElement(plugin, container, element.Name, eGarbage);
                    }
                    foreach (GuiElement element in eGarbage)
                    {
                        container.Remove(element);
                    }
                    foreach (Timer timer in container.timers)
                    {
                        timer.Destroy();
                    }
                    garbage.Add(container);
                }
                else
                {
                    PluginInstance.Puts($"destroyGui(container.name: {container.name}): no GUI containers found");
                }
            }