message block preview

This commit is contained in:
sharlottes
2022-12-01 05:36:48 +09:00
parent e2e7d5053a
commit cad9c28e84
6 changed files with 72 additions and 1 deletions

View File

@@ -33,6 +33,8 @@ setting.baropacity.description = Sets the opacity of the unit health bar.
setting.blockBar.name = enable Block Bar
setting.blockBar.description = display block health bar
setting.memoView.name = preview message block
setting.memoView.description = preview message blocks' text at once
setting.powerNode.name = enable Power Node
setting.powerNode.description = display power node link lines

View File

@@ -33,6 +33,8 @@ setting.baropacity.description = 유닛 바의 투명도를 조절합니다.
setting.blockBar.name = 블록 바 표시
setting.blockBar.description = 블록 체력바를 표시합니다.
setting.memoView.name = 메시지 블록 내용 미리보기
setting.memoView.description = 메시지 블록에 기록된 내용물을 한눈에 볼 수 있습니다.
setting.powerNode.name = 노드 연결선 표시
setting.powerNode.description = 선택한 블록과 전기적으로 연결된 블록들을 선으로 이어서 표시합니다.

View File

@@ -0,0 +1,43 @@
package informatis.draws;
import arc.Events;
import arc.graphics.g2d.Lines;
import arc.math.Mathf;
import arc.util.Time;
import arc.util.Tmp;
import mindustry.entities.Effect;
import mindustry.game.EventType;
import mindustry.graphics.Drawf;
import mindustry.graphics.Pal;
import static arc.Core.camera;
import static mindustry.Vars.player;
import static mindustry.Vars.spawner;
public class InfoRingDraw extends OverDraw {
public InfoRingDraw() {
super("infoRing", OverDrawCategory.Util);
Events.on(EventType.UnitCreateEvent.class, ev -> {
});
}
@Override
public void draw() {
super.draw();
float sin = Mathf.absin(Time.time, 6f, 1f);
float leng = (player.unit() != null && player.unit().hitSize > 4 * 8f ? player.unit().hitSize * 1.5f : 4 * 8f) + sin;
Tmp.v1.set(camera.position);
Lines.stroke(1f + sin / 2, Pal.accent);
Lines.circle(Tmp.v1.x, Tmp.v1.y, leng - 4f);
spawner.getSpawns().each(t ->
Drawf.arrow(
Tmp.v1.x, Tmp.v1.y,
t.worldx(), t.worldy(),
leng,
(Math.min(200 * 8f, Mathf.dst(Tmp.v1.x, Tmp.v1.y, t.worldx(), t.worldy())) / (200 * 8f)) * (5f + sin)
)
);
}
}

View File

@@ -0,0 +1,19 @@
package informatis.draws;
import mindustry.world.Tile;
import mindustry.world.blocks.logic.MessageBlock;
import static mindustry.Vars.tilesize;
public class MemoViewDraw extends OverDraw {
public MemoViewDraw() {
super("memoView", OverDrawCategory.Block);
}
@Override
public void onTile(Tile tile) {
if(tile.build instanceof MessageBlock.MessageBuild message) {
message.drawSelect();
}
}
}

View File

@@ -45,6 +45,9 @@ public class OverDraw {
*/
public void draw() {}
/**
* 매 프레임에 대한 업데이트를 처리합니다.
*/
public void update() {}
}

View File

@@ -25,6 +25,7 @@ public class OverDraws {
unitCargoLink = new UnitCargoLinkDraw(),
massLink = new MassLinkDraw(),
blockRange = new BlockRangeDraw(),
memoView = new MemoViewDraw(),
unitRange = new UnitRangeDraw(),
playerRange = new PlayerRangeDraw(),
pathLine = new PathLineDraw(),
@@ -34,7 +35,8 @@ public class OverDraws {
unitItem = new UnitItemDraw(),
unitBar = new UnitBarDraw(),
magicCursor = new MagicCursorDraw(),
autoShoot = new AutoShootDraw();
autoShoot = new AutoShootDraw(),
infoRing = new InfoRingDraw();
static ObjectMap<OverDrawCategory, Seq<OverDraw>> draws;
static FrameBuffer effectBuffer = new FrameBuffer();