Search in sources :

Example 1 with DummyHelpElement

use of buildcraft.lib.gui.help.DummyHelpElement in project BuildCraft by BuildCraft.

the class GuiEngineStone_BC8 method initGui.

@Override
public void initGui() {
    super.initGui();
    mainGui.shownElements.add(new DummyHelpElement(flameRect.expand(2), helpFlame));
    mainGui.shownElements.add(new DummyHelpElement(fuelSlotRect, helpFuel));
}
Also used : DummyHelpElement(buildcraft.lib.gui.help.DummyHelpElement)

Example 2 with DummyHelpElement

use of buildcraft.lib.gui.help.DummyHelpElement in project BuildCraft by BuildCraft.

the class ElementTypeHelp method deserialize0.

// Args:
// - pos[0], pos[1]: the area for help (where it will be drawn, relative to the root of the gui). Defaults
// to 0,0
// - size[0], size[1]: the size of the help area
// - area[0-3]: mapping for pos[0], pos[1], size[0], size[1]
// - colour: The colour for the help element (overlay)
// - title: The name of the help element
@Override
public IGuiElement deserialize0(BuildCraftJsonGui gui, IGuiPosition parent, JsonGuiInfo info, JsonGuiElement json) {
    FunctionContext ctx = createContext(json);
    String title = json.properties.get("title");
    List<String> text = new ArrayList<>();
    if (json.properties.containsKey("text[0]")) {
        int i = 0;
        while (true) {
            String prop = json.properties.get("text[" + i + "]");
            if (prop == null) {
                break;
            }
            text.add(prop);
            i++;
        }
    } else {
        text.add(json.properties.getOrDefault("text", "ERROR: Help not given!"));
    }
    int colour = resolveEquationInt(json, "colour", ctx);
    ElementHelpInfo help = new ElementHelpInfo(title, colour, text.toArray(new String[0]));
    inheritProperty(json, "pos[0]", "area[0]");
    inheritProperty(json, "pos[1]", "area[1]");
    inheritProperty(json, "size[0]", "area[2]");
    inheritProperty(json, "size[1]", "area[3]");
    IGuiArea area = resolveArea(json, "area", parent, ctx);
    return new DummyHelpElement(area, help);
}
Also used : IGuiArea(buildcraft.lib.gui.pos.IGuiArea) DummyHelpElement(buildcraft.lib.gui.help.DummyHelpElement) ArrayList(java.util.ArrayList) ElementHelpInfo(buildcraft.lib.gui.help.ElementHelpInfo) FunctionContext(buildcraft.lib.expression.FunctionContext)

Aggregations

DummyHelpElement (buildcraft.lib.gui.help.DummyHelpElement)2 FunctionContext (buildcraft.lib.expression.FunctionContext)1 ElementHelpInfo (buildcraft.lib.gui.help.ElementHelpInfo)1 IGuiArea (buildcraft.lib.gui.pos.IGuiArea)1 ArrayList (java.util.ArrayList)1