WIP map notification instruction

This commit is contained in:
Anuken
2022-02-10 11:49:55 -05:00
parent a80e1d86a1
commit 414d07a843
8 changed files with 47 additions and 3 deletions

View File

@@ -2988,7 +2988,7 @@ public class UnitTypes{
abilities.add(new SuppressionFieldAbility(){{
orbRadius = orbRad;
particleSize = partRad;
y = -33f / 4f;
y = -32f / 4f;
x = 43f * i / 4f;
particles = parts;
//visual only, the middle one does the actual suppressing

View File

@@ -325,6 +325,7 @@ public class UI implements ApplicationListener, Loadable{
Core.scene.add(table);
}
/** 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){
Table table = new Table();

View File

@@ -10,7 +10,7 @@ public class ShapePart extends DrawPart{
public int sides = 3;
public float radius = 3f, radiusTo = -1f;
public float x, y, rotation;
public float moveX, moveY, rotMove;
public float moveX, moveY, moveRot;
public Color color = Color.white;
public @Nullable Color colorTo;
public boolean mirror = false;
@@ -47,7 +47,7 @@ public class ShapePart extends DrawPart{
}
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{
Fill.circle(rx, ry, rad);
}

View File

@@ -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
}

View File

@@ -1271,4 +1271,27 @@ public class LStatements{
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();
}
}
}

View File

@@ -419,6 +419,10 @@ public class HudFragment extends Fragment{
}
}
public boolean hasToast(){
return Time.timeSinceMillis(lastToast) < 3.5f * 1000f;
}
public void showToast(String text){
showToast(Icon.ok, text);
}