This commit is contained in:
Anuken
2019-04-07 11:25:08 -04:00
parent 7c81a807ea
commit 08a2872527
11 changed files with 58 additions and 53 deletions

View File

@@ -818,7 +818,7 @@ public class Blocks implements ContentList{
size = 1;
reload = 200f;
range = 40f;
healPercent = 5f;
healPercent = 4f;
phaseBoost = 4f;
phaseRangeBoost = 20f;
health = 80;
@@ -1088,11 +1088,11 @@ public class Blocks implements ContentList{
requirements(Category.power, ItemStack.with(Items.lead, 1000, Items.silicon, 600, Items.graphite, 800, Items.thorium, 200, Items.surgealloy, 500, Items.metaglass, 500));
size = 4;
health = 900;
powerProduction = 100f;
powerProduction = 110f;
itemDuration = 40f;
consumes.power(25f);
consumes.item(Items.blastCompound);
consumes.liquid(Liquids.cryofluid, 0.8f);
consumes.liquid(Liquids.cryofluid, 0.3f);
}};
//endregion power

View File

@@ -694,6 +694,8 @@ public class Bullets implements ContentList{
bulletWidth = 9f;
bulletHeight = 13f;
hitEffect = Fx.flakExplosion;
shootEffect = Fx.none;
smokeEffect = Fx.none;
}};
bombIncendiary = new BombBulletType(7f, 10f, "shell"){{

View File

@@ -82,7 +82,6 @@ public class Mechs implements ContentList{
roundrobin = true;
shots = 3;
inaccuracy = 0f;
velocityRnd = 0.2f;
ejectEffect = Fx.none;
bullet = Bullets.lightning;
}};

View File

@@ -352,7 +352,8 @@ public class NetClient implements ApplicationListener{
player.pointerX, player.pointerY, player.rotation, player.baseRotation,
player.velocity().x, player.velocity().y,
player.getMineTile(),
player.isBoosting, player.isShooting, requests,
player.isBoosting, player.isShooting, ui.chatfrag.chatOpen(),
requests,
Core.camera.position.x, Core.camera.position.y,
Core.camera.width * viewScale, Core.camera.height * viewScale);
}

View File

@@ -269,7 +269,7 @@ public class NetServer implements ApplicationListener{
float rotation, float baseRotation,
float xVelocity, float yVelocity,
Tile mining,
boolean boosting, boolean shooting,
boolean boosting, boolean shooting, boolean chatting,
BuildRequest[] requests,
float viewX, float viewY, float viewWidth, float viewHeight
){
@@ -293,6 +293,7 @@ public class NetServer implements ApplicationListener{
player.pointerX = pointerX;
player.pointerY = pointerY;
player.setMineTile(mining);
player.isTyping = chatting;
player.isBoosting = boosting;
player.isShooting = shooting;
player.getPlaceQueue().clear();

View File

@@ -305,6 +305,9 @@ public class MapGenerateDialog extends FloatingDialog{
}
Core.app.post(() -> {
if(pixmap == null || texture == null){
return;
}
texture.draw(pixmap, 0, 0);
generating = false;
});

View File

@@ -39,7 +39,7 @@ public class Predict{
Vector2 ts = quad(a, b, c);
// Find smallest positive solution
Vector2 sol = vresult.set(0, 0);
Vector2 sol = vresult.set(dstx, dsty);
if(ts != null){
float t0 = ts.x, t1 = ts.y;
float t = Math.min(t0, t1);

View File

@@ -58,7 +58,7 @@ public class Player extends Unit implements BuilderTrait, ShooterTrait{
public float pointerX, pointerY;
public String name = "name";
public String uuid, usid;
public boolean isAdmin, isTransferring, isShooting, isBoosting, isMobile;
public boolean isAdmin, isTransferring, isShooting, isBoosting, isMobile, isTyping;
public float boostHeat, shootHeat, destructTime;
public boolean achievedFlight;
public Color color = new Color();
@@ -850,7 +850,7 @@ public class Player extends Unit implements BuilderTrait, ShooterTrait{
public void write(DataOutput buffer) throws IOException{
super.writeSave(buffer, !isLocal);
TypeIO.writeStringData(buffer, name); //TODO writing strings is very inefficient
buffer.writeByte(Pack.byteValue(isAdmin) | (Pack.byteValue(dead) << 1) | (Pack.byteValue(isBoosting) << 2));
buffer.writeByte(Pack.byteValue(isAdmin) | (Pack.byteValue(dead) << 1) | (Pack.byteValue(isBoosting) << 2) | (Pack.byteValue(isTyping) << 3));
buffer.writeInt(Color.rgba8888(color));
buffer.writeByte(mech.id);
buffer.writeInt(mining == null ? noSpawner : mining.pos());
@@ -869,6 +869,7 @@ public class Player extends Unit implements BuilderTrait, ShooterTrait{
isAdmin = (bools & 1) != 0;
dead = (bools & 2) != 0;
boolean boosting = (bools & 4) != 0;
isTyping = (bools & 8) != 0;
color.set(buffer.readInt());
mech = content.getByID(ContentType.mech, buffer.readByte());
int mine = buffer.readInt();

View File

@@ -1,16 +1,12 @@
package io.anuke.mindustry.ui.fragments;
import io.anuke.arc.Core;
import io.anuke.arc.Input.TextInput;
import io.anuke.arc.collection.Array;
import io.anuke.arc.graphics.Color;
import io.anuke.arc.graphics.g2d.BitmapFont;
import io.anuke.arc.graphics.g2d.Draw;
import io.anuke.arc.graphics.g2d.Fill;
import io.anuke.arc.graphics.g2d.GlyphLayout;
import io.anuke.arc.input.KeyCode;
import io.anuke.arc.graphics.g2d.*;
import io.anuke.arc.math.Mathf;
import io.anuke.arc.scene.Group;
import io.anuke.arc.scene.ui.Dialog;
import io.anuke.arc.scene.ui.Label;
import io.anuke.arc.scene.ui.Label.LabelStyle;
import io.anuke.arc.scene.ui.TextField;
@@ -115,35 +111,6 @@ public class ChatFragment extends Table{
chatfield.getStyle().fontColor = Color.WHITE;
chatfield.setStyle(chatfield.getStyle());
if(mobile){
chatfield.tapped(() -> {
Dialog dialog = new Dialog("", "dialog");
dialog.setFillParent(true);
dialog.cont.top();
dialog.cont.defaults().height(65f);
TextField to = dialog.cont.addField("", t-> {}).pad(15).width(250f).get();
to.setMaxLength(maxTextLength);
to.keyDown(KeyCode.ENTER, () -> {
dialog.cont.find("okb").fireClick();
});
dialog.cont.addButton("$ok", () -> {
chatfield.clearText();
chatfield.appendText(to.getText());
chatfield.change();
dialog.hide();
Core.input.setOnscreenKeyboardVisible(false);
toggle();
}).width(90f).name("okb");
dialog.show();
Time.runTask(1f, () -> {
to.setCursorPosition(to.getText().length());
Core.scene.setKeyboardFocus(to);
Core.input.setOnscreenKeyboardVisible(true);
});
});
}
bottom().left().marginBottom(offsety).marginLeft(offsetx * 2).add(fieldlabel).padBottom(6f);
add(chatfield).padBottom(offsety).padLeft(offsetx).growX().padRight(offsetx).height(28);
@@ -214,8 +181,21 @@ public class ChatFragment extends Table{
if(!chatOpen){
scene.setKeyboardFocus(chatfield);
chatfield.fireClick();
chatOpen = !chatOpen;
if(mobile){
TextInput input = new TextInput();
input.maxLength = maxTextLength;
input.accepted = text -> {
chatfield.setText(text);
sendMessage();
hide();
Core.input.setOnscreenKeyboardVisible(false);
};
input.canceled = this::hide;
Core.input.getTextInput(input);
}else{
chatfield.fireClick();
}
}else{
scene.setKeyboardFocus(null);
chatOpen = !chatOpen;

View File

@@ -202,6 +202,7 @@ public class HudFragment extends Fragment{
//'core is under attack' table
parent.fill(t -> {
t.touchable(Touchable.disabled);
float notifDuration = 240f;
Events.on(StateChangeEvent.class, event -> {
@@ -236,7 +237,7 @@ public class HudFragment extends Fragment{
return coreAttackOpacity > 0;
});
t.table("button", top -> top.add("$coreattack").pad(2)
.update(label -> label.getColor().set(Color.ORANGE).lerp(Color.SCARLET, Mathf.absin(Time.time(), 2f, 1f))));
.update(label -> label.getColor().set(Color.ORANGE).lerp(Color.SCARLET, Mathf.absin(Time.time(), 2f, 1f)))).touchable(Touchable.disabled);
});
//launch button