WIP map notification instruction
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.1 KiB |
@@ -1709,6 +1709,7 @@ lst.setblock = Set tile data at any location.
|
|||||||
lst.spawnunit = Spawn unit at a location.
|
lst.spawnunit = Spawn unit at a location.
|
||||||
lst.packcolor = Pack [0, 1] RGBA components into a single number for drawing or rule-setting.
|
lst.packcolor = Pack [0, 1] RGBA components into a single number for drawing or rule-setting.
|
||||||
lst.setrule = Set a game rule.
|
lst.setrule = Set a game rule.
|
||||||
|
lst.flushnotification = Display a notification at the top of the screen from the text buffer.\nWill wait until the previous message finishes.
|
||||||
|
|
||||||
logic.nounitbuild = [red]Unit building logic is not allowed here.
|
logic.nounitbuild = [red]Unit building logic is not allowed here.
|
||||||
|
|
||||||
|
|||||||
@@ -2988,7 +2988,7 @@ public class UnitTypes{
|
|||||||
abilities.add(new SuppressionFieldAbility(){{
|
abilities.add(new SuppressionFieldAbility(){{
|
||||||
orbRadius = orbRad;
|
orbRadius = orbRad;
|
||||||
particleSize = partRad;
|
particleSize = partRad;
|
||||||
y = -33f / 4f;
|
y = -32f / 4f;
|
||||||
x = 43f * i / 4f;
|
x = 43f * i / 4f;
|
||||||
particles = parts;
|
particles = parts;
|
||||||
//visual only, the middle one does the actual suppressing
|
//visual only, the middle one does the actual suppressing
|
||||||
|
|||||||
@@ -325,6 +325,7 @@ public class UI implements ApplicationListener, Loadable{
|
|||||||
Core.scene.add(table);
|
Core.scene.add(table);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** Shows a label at some position on the screen. Does not fade. */
|
/** Shows a label at some position on the screen. Does not fade. */
|
||||||
public void showInfoPopup(String info, float duration, int align, int top, int left, int bottom, int right){
|
public void showInfoPopup(String info, float duration, int align, int top, int left, int bottom, int right){
|
||||||
Table table = new Table();
|
Table table = new Table();
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ public class ShapePart extends DrawPart{
|
|||||||
public int sides = 3;
|
public int sides = 3;
|
||||||
public float radius = 3f, radiusTo = -1f;
|
public float radius = 3f, radiusTo = -1f;
|
||||||
public float x, y, rotation;
|
public float x, y, rotation;
|
||||||
public float moveX, moveY, rotMove;
|
public float moveX, moveY, moveRot;
|
||||||
public Color color = Color.white;
|
public Color color = Color.white;
|
||||||
public @Nullable Color colorTo;
|
public @Nullable Color colorTo;
|
||||||
public boolean mirror = false;
|
public boolean mirror = false;
|
||||||
@@ -47,7 +47,7 @@ public class ShapePart extends DrawPart{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(!circle){
|
if(!circle){
|
||||||
Fill.poly(rx, ry, sides, rad, rotMove * prog * sign + params.rotation - 90);
|
Fill.poly(rx, ry, sides, rad, moveRot * prog * sign + params.rotation - 90);
|
||||||
}else{
|
}else{
|
||||||
Fill.circle(rx, ry, rad);
|
Fill.circle(rx, ry, rad);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1252,5 +1252,20 @@ public class LExecutor{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class FlushNotificationI implements LInstruction{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run(LExecutor exec){
|
||||||
|
//skip back to self until possible
|
||||||
|
if(ui.hudfrag.hasToast()){
|
||||||
|
exec.var(varCounter).numval --;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ui.hudfrag.showToast(Icon.info, exec.textBuffer.toString());
|
||||||
|
exec.textBuffer.setLength(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//endregion
|
//endregion
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1271,4 +1271,27 @@ public class LStatements{
|
|||||||
return new SetRuleI(rule, builder.var(value));
|
return new SetRuleI(rule, builder.var(value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RegisterStatement("notification")
|
||||||
|
public static class FlushNotificationStatement extends LStatement{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void build(Table table){
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean privileged(){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Color color(){
|
||||||
|
return Pal.logicWorld;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LInstruction build(LAssembler builder){
|
||||||
|
return new FlushNotificationI();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -419,6 +419,10 @@ public class HudFragment extends Fragment{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean hasToast(){
|
||||||
|
return Time.timeSinceMillis(lastToast) < 3.5f * 1000f;
|
||||||
|
}
|
||||||
|
|
||||||
public void showToast(String text){
|
public void showToast(String text){
|
||||||
showToast(Icon.ok, text);
|
showToast(Icon.ok, text);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user