当前位置: 首页>>代码示例>>Java>>正文


Java LControl类代码示例

本文整理汇总了Java中net.nickac.lithium.backend.controls.LControl的典型用法代码示例。如果您正苦于以下问题:Java LControl类的具体用法?Java LControl怎么用?Java LControl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


LControl类属于net.nickac.lithium.backend.controls包,在下文中一共展示了LControl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: removeControl

import net.nickac.lithium.backend.controls.LControl; //导入依赖的package包/类
@SuppressWarnings("WeakerAccess")
@Override
public void removeControl(UUID c) {
    LControl toRemove = child.getOrDefault(c, null);
    child.remove(c);
    refresh();
    if (toRemove != null) {
        try {
            if (LithiumConstants.onControlRuntime != null && getViewer() != null) {
                LithiumConstants.onControlRuntime.removeControl(toRemove, this, getViewer());
            }
        } catch (NullPointerException ex) {
            //Sorry! I had to do this....
        }
    }
}
 
开发者ID:NickAcPT,项目名称:Lithium-Backend,代码行数:17,代码来源:LWindow.java

示例2: execute

import net.nickac.lithium.backend.controls.LControl; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
@Override
public void execute(List<String> data) {
    UUID containerUUID = UUID.fromString(data.get(0));
    UUID controlUUID = UUID.fromString(data.get(1));


    LControl container = LithiumMod.getWindowManager().getControlById(containerUUID);
    if (container != null) {
        if (container instanceof LContainer && LithiumMod.getCurrentLithium() != null) {
            LControl toRemove = LithiumMod.getWindowManager().getControlById(controlUUID);
            if (toRemove != null) {
                LithiumMod.getCurrentLithium().removeControl(toRemove);
            }
        }
    }
}
 
开发者ID:NickAcPT,项目名称:Lithium-Forge,代码行数:18,代码来源:RemoveFromContainer.java

示例3: replaceControl

import net.nickac.lithium.backend.controls.LControl; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
public static void replaceControl(LContainer cc, UUID u, LControl c) {
	for (LControl control : cc.getControls()) {
		if (control instanceof LContainer) {
			replaceControl(((LContainer) control), u, c);
		} else if (control.getUUID().equals(u)) {
			if (currentLithium != null) {
				//Try to check if it is a window
				currentLithium.removeControl(control);
				currentLithium.addControlToGUI(c);
			} else if (currentLithiumOverlay != null) {
				//It might be the overlay
				currentLithiumOverlay.addControl(c);
			}
		}
	}
}
 
开发者ID:NickAcPT,项目名称:Lithium-Forge,代码行数:18,代码来源:LithiumMod.java

示例4: addControl

import net.nickac.lithium.backend.controls.LControl; //导入依赖的package包/类
@Override
public void addControl(LControl c) {
    //We can't allow stuff that needs user input.
    //It's an overlay, not a GUI!
    if (c.canReceiveUserInput()) {
        return;
    }
    controls.put(c.getUUID(), c);
    internalAddControl(c);
}
 
开发者ID:NickAcPT,项目名称:Lithium-Backend,代码行数:11,代码来源:LOverlay.java

示例5: addControl

import net.nickac.lithium.backend.controls.LControl; //导入依赖的package包/类
@Override
public void addControl(LControl c) {
    if (c.getParent() == null) {
        c.setParent(this);
    }
    child.put(c.getUUID(), c);
    refresh();
    try {
        if (LithiumConstants.onControlRuntime != null && getViewer() != null) {
            LithiumConstants.onControlRuntime.addControl(c, this, getViewer());
        }
    } catch (NullPointerException ex) {
        //Sorry! I had to do this....
    }
}
 
开发者ID:NickAcPT,项目名称:Lithium-Backend,代码行数:16,代码来源:LWindow.java

示例6: addControl

import net.nickac.lithium.backend.controls.LControl; //导入依赖的package包/类
@Override
public void addControl(LControl c) {
    c.setParent(this);
    child.put(c.getUUID(), c);
    refresh();
    try {
        if (LithiumConstants.onControlRuntime != null && getViewer() != null) {
            LithiumConstants.onControlRuntime.addControl(c, this, getViewer());
        }
    } catch (NullPointerException ex) {
        //Sorry! I had to do this....
    }
}
 
开发者ID:NickAcPT,项目名称:Lithium-Backend,代码行数:14,代码来源:LPanel.java

示例7: getTotalWidth

import net.nickac.lithium.backend.controls.LControl; //导入依赖的package包/类
public int getTotalWidth() {
    int width = 0;
    for (LControl control : child.values()) {
        width = Math.max(width, control.getRight());
    }
    return width;
}
 
开发者ID:NickAcPT,项目名称:Lithium-Backend,代码行数:8,代码来源:LPanel.java

示例8: getTotalHeight

import net.nickac.lithium.backend.controls.LControl; //导入依赖的package包/类
public int getTotalHeight() {
    int height = 0;
    for (LControl control : child.values()) {
        height = Math.max(height, control.getBottom());
    }
    return height;
}
 
开发者ID:NickAcPT,项目名称:Lithium-Backend,代码行数:8,代码来源:LPanel.java

示例9: execute

import net.nickac.lithium.backend.controls.LControl; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
@Override
public void execute(List<String> data) {
    String c = data.get(0);
    LControl newC = SerializationUtils.stringToObject(c, LControl.class);

    if (newC.getParent() != null) {
        Minecraft.getMinecraft().addScheduledTask(() -> LithiumMod.replaceControl(newC.getParent(), newC.getUUID(), newC));
    }
}
 
开发者ID:NickAcPT,项目名称:Lithium-Forge,代码行数:11,代码来源:ControlChanged.java

示例10: execute

import net.nickac.lithium.backend.controls.LControl; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
@Override
public void execute(List<String> data) {
    try {
        //Deserialize the control
        LControl newC = SerializationUtils.stringToObject(data.get(1), LControl.class);

        UUID uuid = UUID.fromString(data.get(0));
        LControl l = LithiumMod.getWindowManager().getControlById(uuid);
        if (l != null) {
            //Check if it is a container
            if (l instanceof LContainer) {
                ((LContainer) l).addControl(newC);
                if (LithiumMod.getCurrentLithium() != null) {
                    //Lets try adding this control.
                    //It might work...
                    LithiumMod.getCurrentLithium().addControlToGUI(newC);
                }
            }
        } else {
            //It might be a window....
            LWindow window = LithiumMod.getWindowManager().getWindowById(uuid);
            if (window != null) {
                window.addControl(newC);
                if (LithiumMod.getCurrentLithium() != null &&
                        LithiumMod.getCurrentLithium().getBaseWindow().getUUID().equals(uuid)) {
                    LithiumMod.getCurrentLithium().addControlToGUI(newC);
                }
            }

        }

    } catch (ArrayIndexOutOfBoundsException | IllegalArgumentException ex) {
        LithiumMod.log("Received malformed packet from server. Ignoring!");
    }
}
 
开发者ID:NickAcPT,项目名称:Lithium-Forge,代码行数:37,代码来源:AddToContainer.java

示例11: removeControl

import net.nickac.lithium.backend.controls.LControl; //导入依赖的package包/类
public void removeControl(LControl c) {
	controls.remove(c.getUUID());
	if (c instanceof LContainer) {
		((LContainer) c).getControls().forEach(this::removeControl);
	}
	nativeControls.remove(c.getUUID());
}
 
开发者ID:NickAcPT,项目名称:Lithium-Forge,代码行数:8,代码来源:LithiumWindowManager.java

示例12: centerControl

import net.nickac.lithium.backend.controls.LControl; //导入依赖的package包/类
public static Point centerControl(LControl c) {
    Point parentLoc = (c.getParent() != null)
            && (c.getParent() instanceof LControl)
            && !(c.getParent() instanceof LWindow) ? centerControl((LControl) c.getParent()) : Point.EMPTY;

    if (c.getCentered() == LControl.CenterOptions.NONE) {
        return new Point(parentLoc.getX() + c.getLocation().getX(), parentLoc.getY() + c.getLocation().getY());
    }
    ScaledResolution sr = ModCoderPackUtils.getScaledResolution();
    int parentWidth = sr.getScaledWidth();
    int parentHeight = sr.getScaledHeight();

    int newX = parentLoc.getX()+c.getLocation().getX();
    int newY = parentLoc.getY() + c.getLocation().getY();

    int sizeW = c instanceof LPanel ? ((LPanel) c).getTotalWidth() : c.getSize().getWidth();
    int sizeH = c instanceof LPanel ? ((LPanel) c).getTotalHeight() : c.getSize().getHeight();

    if (c instanceof LTextLabel) {
        sizeW = ModCoderPackUtils.getFontRenderer().getStringWidth(c.getText());
        sizeH = ModCoderPackUtils.getFontRenderer().FONT_HEIGHT;
    }

    boolean centeredX = c.getCentered() != LControl.CenterOptions.NONE && c.getCentered() != LControl.CenterOptions.VERTICAL;
    boolean centeredY = c.getCentered() != LControl.CenterOptions.NONE && c.getCentered() != LControl.CenterOptions.HORIZONTAL;
    if (centeredX) {
        newX = ((parentWidth / 2) - (sizeW / 2));
    }
    if (centeredY) {
        newY = parentLoc.getY() + ((parentHeight / 2) - (sizeH / 2));
    }
    return new Point(newX, newY);
}
 
开发者ID:NickAcPT,项目名称:Lithium-Forge,代码行数:34,代码来源:NewLithiumGUI.java

示例13: renderOverlay

import net.nickac.lithium.backend.controls.LControl; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void renderOverlay(RenderGameOverlayEvent event) {
	if (event.getType() == RenderGameOverlayEvent.ElementType.TEXT) {
		if (LithiumMod.getCurrentLithiumOverlay() != null) {
			LOverlay o = LithiumMod.getCurrentLithiumOverlay();
			if (o.getControls() != null) {
				for (LControl lControl : o.getControls()) {
					ILithiumControlRenderer renderer = null;
					if (lControl.getClass().equals(LImage.class)) {
						renderer = new ImageRenderer();
						if (!ImageManager.isImageHandled((LImage) lControl)) {
							ImageManager.handleImage((LImage) lControl);
						}
					} else if (lControl.getClass().equals(LProgressBar.class)) {
						renderer = new ProgressBarRenderer();
					} else if (lControl.getClass().equals(LTextLabel.class)) {
						renderer = new TextLabelRenderer();
					}


					if (renderer != null) {
						renderer.renderLithiumControl(lControl, this);
					}
				}
			}
		}
	}
}
 
开发者ID:NickAcPT,项目名称:Lithium-Forge,代码行数:30,代码来源:LithiumOverlay.java

示例14: execute

import net.nickac.lithium.backend.controls.LControl; //导入依赖的package包/类
@Override
public void execute(LithiumPlayer player, List<String> data) {
    LControl w = player.getControlById(UUID.fromString(data.get(0)));
    if (w != null && w instanceof LTextBox) {
        LTextBox txt = (LTextBox) w;
        txt.setInternalText(SerializationUtils.stringToObject(data.get(1), String.class));
        txt.invokeTextChanged(player.getUniqueId());
    }
}
 
开发者ID:NickAcPT,项目名称:Lithium-Spigot,代码行数:10,代码来源:TextboxTextChanged.java

示例15: execute

import net.nickac.lithium.backend.controls.LControl; //导入依赖的package包/类
@Override
public void execute(LithiumPlayer player, List<String> data) {
    LControl w = player.getControlById(UUID.fromString(data.get(0)));
    if (w instanceof IToggleable) {
        IToggleable t = (IToggleable) w;
        t.setChecked(!t.isChecked());
        if (w.getClass().equals(LCheckBox.class)) {
            ((LCheckBox) w).invokeToggled(player.getUniqueId());
        }
    }
}
 
开发者ID:NickAcPT,项目名称:Lithium-Spigot,代码行数:12,代码来源:ToggleAction.java


注:本文中的net.nickac.lithium.backend.controls.LControl类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。