mirror of
https://github.com/collinsmith/riiablo.git
synced 2025-07-09 15:28:18 +07:00
Implemented HotkeyButton skill ids
Implemented HotkeyButton skill ids Changed GameScreen to cast active right hand skill on right click
This commit is contained in:
@ -67,14 +67,20 @@ public class ControlPanel extends Table implements Disposable {
|
|||||||
manaWidget = new ManaWidget(ctrlpnl.getTexture(numFrames - 2));
|
manaWidget = new ManaWidget(ctrlpnl.getTexture(numFrames - 2));
|
||||||
|
|
||||||
if (!DEBUG_MOBILE && Gdx.app.getType() == Application.ApplicationType.Desktop) {
|
if (!DEBUG_MOBILE && Gdx.app.getType() == Application.ApplicationType.Desktop) {
|
||||||
leftSkill = new HotkeyButton(Skillicon, 0);
|
leftSkill = new HotkeyButton(Skillicon, 0, -1);
|
||||||
leftSkill.addListener(new ClickListener() {
|
leftSkill.addListener(new ClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void clicked(InputEvent event, float x, float y) {
|
public void clicked(InputEvent event, float x, float y) {
|
||||||
gameScreen.spellsQuickPanelL.setVisible(!gameScreen.spellsQuickPanelL.isVisible());
|
gameScreen.spellsQuickPanelL.setVisible(!gameScreen.spellsQuickPanelL.isVisible());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
rightSkill = new HotkeyButton(Skillicon, 0);
|
|
||||||
|
int leftSkillId = gameScreen.player.actions[0][0];
|
||||||
|
if (leftSkillId > 0) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
rightSkill = new HotkeyButton(Skillicon, 0, -1);
|
||||||
rightSkill.addListener(new ClickListener() {
|
rightSkill.addListener(new ClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void clicked(InputEvent event, float x, float y) {
|
public void clicked(InputEvent event, float x, float y) {
|
||||||
@ -82,6 +88,11 @@ public class ControlPanel extends Table implements Disposable {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
int rightSkillId = gameScreen.player.actions[0][1];
|
||||||
|
if (rightSkillId > 0) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
int width = 0;
|
int width = 0;
|
||||||
int height = Integer.MIN_VALUE;
|
int height = Integer.MIN_VALUE;
|
||||||
for (int i = 1; i < numFrames - 2; i++) {
|
for (int i = 1; i < numFrames - 2; i++) {
|
||||||
|
@ -65,13 +65,13 @@ public class MobileControls extends WidgetGroup implements Disposable {
|
|||||||
});
|
});
|
||||||
|
|
||||||
skills = new HotkeyButton[3];
|
skills = new HotkeyButton[3];
|
||||||
skills[0] = new HotkeyButton(Skillicon, 0);
|
skills[0] = new HotkeyButton(Skillicon, 0, -1);
|
||||||
skills[0].setSize(SIZE, SIZE);
|
skills[0].setSize(SIZE, SIZE);
|
||||||
|
|
||||||
skills[1] = new HotkeyButton(Skillicon, 0);
|
skills[1] = new HotkeyButton(Skillicon, 0, -1);
|
||||||
skills[1].setSize(SIZE, SIZE);
|
skills[1].setSize(SIZE, SIZE);
|
||||||
|
|
||||||
skills[2] = new HotkeyButton(Skillicon, 0);
|
skills[2] = new HotkeyButton(Skillicon, 0, -1);
|
||||||
skills[2].setSize(SIZE, SIZE);
|
skills[2].setSize(SIZE, SIZE);
|
||||||
|
|
||||||
ActorGestureListener gestureListener = new ActorGestureListener() {
|
ActorGestureListener gestureListener = new ActorGestureListener() {
|
||||||
@ -96,6 +96,8 @@ public class MobileControls extends WidgetGroup implements Disposable {
|
|||||||
@Override
|
@Override
|
||||||
public void tap(InputEvent event, float x, float y, int count, int button) {
|
public void tap(InputEvent event, float x, float y, int count, int button) {
|
||||||
gameScreen.spellsQuickPanelR.setVisible(false);
|
gameScreen.spellsQuickPanelR.setVisible(false);
|
||||||
|
Button actor = (Button) event.getListenerActor();
|
||||||
|
// TODO: cast spell
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
gestureListener.getGestureDetector().setLongPressSeconds(0.5f);
|
gestureListener.getGestureDetector().setLongPressSeconds(0.5f);
|
||||||
|
@ -77,8 +77,8 @@ public class SpellsQuickPanel extends Table implements Disposable {
|
|||||||
CharacterClass charClass = player.charClass;
|
CharacterClass charClass = player.charClass;
|
||||||
keyMappings = new ObjectMap<>(31);
|
keyMappings = new ObjectMap<>(31);
|
||||||
Table top = new Table() {{
|
Table top = new Table() {{
|
||||||
add(new HotkeyButton(Skillicon, 14));
|
add(new HotkeyButton(Skillicon, 14, -1));
|
||||||
add(new HotkeyButton(Skillicon, 18));
|
add(new HotkeyButton(Skillicon, 18, -1));
|
||||||
pack();
|
pack();
|
||||||
}};
|
}};
|
||||||
Table[] tables = new Table[5];
|
Table[] tables = new Table[5];
|
||||||
@ -99,7 +99,7 @@ public class SpellsQuickPanel extends Table implements Disposable {
|
|||||||
icons = Skillicon;
|
icons = Skillicon;
|
||||||
iconCel = 20;
|
iconCel = 20;
|
||||||
}
|
}
|
||||||
final HotkeyButton button = new HotkeyButton(icons, iconCel);
|
final HotkeyButton button = new HotkeyButton(icons, iconCel, skill.Id);
|
||||||
if (skill.aura) {
|
if (skill.aura) {
|
||||||
button.setBlendMode(BlendMode.DARKEN, Riiablo.colors.darkenGold);
|
button.setBlendMode(BlendMode.DARKEN, Riiablo.colors.darkenGold);
|
||||||
}
|
}
|
||||||
@ -121,9 +121,9 @@ public class SpellsQuickPanel extends Table implements Disposable {
|
|||||||
table.add(button);
|
table.add(button);
|
||||||
}
|
}
|
||||||
Table bottom = new Table() {{
|
Table bottom = new Table() {{
|
||||||
add(new HotkeyButton(Skillicon, 4));
|
add(new HotkeyButton(Skillicon, 4, -1));
|
||||||
add(new HotkeyButton(Skillicon, 6));
|
add(new HotkeyButton(Skillicon, 6, -1));
|
||||||
add(new HotkeyButton(Skillicon, 2));
|
add(new HotkeyButton(Skillicon, 2, -1));
|
||||||
pack();
|
pack();
|
||||||
}};
|
}};
|
||||||
add(top).align(leftSkills ? Align.left : Align.right).row();
|
add(top).align(leftSkills ? Align.left : Align.right).row();
|
||||||
|
@ -66,6 +66,7 @@ import com.riiablo.server.Packet;
|
|||||||
import com.riiablo.server.Packets;
|
import com.riiablo.server.Packets;
|
||||||
import com.riiablo.server.PipedSocket;
|
import com.riiablo.server.PipedSocket;
|
||||||
import com.riiablo.widget.DCWrapper;
|
import com.riiablo.widget.DCWrapper;
|
||||||
|
import com.riiablo.widget.HotkeyButton;
|
||||||
import com.riiablo.widget.NpcDialogBox;
|
import com.riiablo.widget.NpcDialogBox;
|
||||||
import com.riiablo.widget.NpcMenu;
|
import com.riiablo.widget.NpcMenu;
|
||||||
import com.riiablo.widget.TextArea;
|
import com.riiablo.widget.TextArea;
|
||||||
@ -507,20 +508,17 @@ public class GameScreen extends ScreenAdapter implements LoadingScreen.Loadable
|
|||||||
mapListener.update();
|
mapListener.update();
|
||||||
//}
|
//}
|
||||||
|
|
||||||
if (Gdx.input.isKeyPressed(Input.Keys.F1) || Gdx.input.isButtonPressed(Input.Buttons.RIGHT)) {
|
if (Gdx.input.isButtonPressed(Input.Buttons.RIGHT)) {
|
||||||
mapRenderer.unproject(tmpVec2.set(Gdx.input.getX(), Gdx.input.getY()));
|
mapRenderer.unproject(tmpVec2.set(Gdx.input.getX(), Gdx.input.getY()));
|
||||||
player.lookAt(tmpVec2.x, tmpVec2.y);
|
player.lookAt(tmpVec2.x, tmpVec2.y);
|
||||||
boolean cast = player.cast(54);
|
HotkeyButton rightSkill = controlPanel.getRightSkill();
|
||||||
if (cast) {
|
boolean cast = player.cast(rightSkill.getSkill());
|
||||||
|
if (cast && rightSkill.getSkill() == 54) {
|
||||||
GridPoint2 dst = mapRenderer.coords(tmpVec2.x, tmpVec2.y);
|
GridPoint2 dst = mapRenderer.coords(tmpVec2.x, tmpVec2.y);
|
||||||
player.position().set(dst.x, dst.y);
|
player.position().set(dst.x, dst.y);
|
||||||
player.target().setZero();
|
player.target().setZero();
|
||||||
player.setPath(null, null);
|
player.setPath(null, null);
|
||||||
}
|
}
|
||||||
} else if (Gdx.input.isKeyPressed(Input.Keys.F2)) {
|
|
||||||
mapRenderer.unproject(tmpVec2.set(Gdx.input.getX(), Gdx.input.getY()));
|
|
||||||
player.lookAt(tmpVec2.x, tmpVec2.y);
|
|
||||||
boolean cast = player.cast(36);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (DEBUG_HIT) Gdx.app.debug(TAG, hit.toString());
|
else if (DEBUG_HIT) Gdx.app.debug(TAG, hit.toString());
|
||||||
|
@ -11,8 +11,9 @@ import com.riiablo.key.MappedKey;
|
|||||||
public class HotkeyButton extends Button {
|
public class HotkeyButton extends Button {
|
||||||
MappedKey mapping;
|
MappedKey mapping;
|
||||||
Label label;
|
Label label;
|
||||||
|
int skillId;
|
||||||
|
|
||||||
public HotkeyButton(final DC dc, final int index) {
|
public HotkeyButton(final DC dc, final int index, int skillId) {
|
||||||
super(new ButtonStyle() {{
|
super(new ButtonStyle() {{
|
||||||
up = new TextureRegionDrawable(dc.getTexture(index));
|
up = new TextureRegionDrawable(dc.getTexture(index));
|
||||||
down = new TextureRegionDrawable(dc.getTexture(index + 1));
|
down = new TextureRegionDrawable(dc.getTexture(index + 1));
|
||||||
@ -20,6 +21,7 @@ public class HotkeyButton extends Button {
|
|||||||
pressedOffsetX = pressedOffsetY = -2;
|
pressedOffsetX = pressedOffsetY = -2;
|
||||||
}});
|
}});
|
||||||
|
|
||||||
|
this.skillId = skillId;
|
||||||
add(label = new Label("", Riiablo.fonts.font16, Riiablo.colors.gold));
|
add(label = new Label("", Riiablo.fonts.font16, Riiablo.colors.gold));
|
||||||
align(Align.topRight);
|
align(Align.topRight);
|
||||||
pad(2);
|
pad(2);
|
||||||
@ -37,11 +39,16 @@ public class HotkeyButton extends Button {
|
|||||||
return mapping;
|
return mapping;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getSkill() {
|
||||||
|
return skillId;
|
||||||
|
}
|
||||||
|
|
||||||
public void copy(HotkeyButton other) {
|
public void copy(HotkeyButton other) {
|
||||||
setStyle(other.getStyle());
|
setStyle(other.getStyle());
|
||||||
setBlendMode(other.blendMode, other.color);
|
setBlendMode(other.blendMode, other.color);
|
||||||
setDisabledBlendMode(other.disabledBlendMode, other.disabledColor);
|
setDisabledBlendMode(other.disabledBlendMode, other.disabledColor);
|
||||||
setHighlightedBlendMode(other.highlightedBlendMode, other.highlightedColor);
|
setHighlightedBlendMode(other.highlightedBlendMode, other.highlightedColor);
|
||||||
label.setText(other.label.getText());
|
label.setText(other.label.getText());
|
||||||
|
skillId = other.skillId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user