-
Notifications
You must be signed in to change notification settings - Fork 591
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into linkedAbilityV2
- Loading branch information
Showing
576 changed files
with
13,014 additions
and
5,692 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Test build | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
java: [ '8', '11' ] | ||
name: Test with Java ${{ matrix.Java }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Setup java | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'temurin' | ||
java-version: ${{ matrix.java }} | ||
cache: 'maven' | ||
|
||
- name: Install virtual framebuffer (if not available) to allow running GUI on a headless server | ||
run: command -v Xvfb >/dev/null 2>&1 || { sudo apt update && sudo apt install -y xvfb; } | ||
|
||
- name: Run tests in virtual framebuffer | ||
run: | | ||
export DISPLAY=":1" | ||
Xvfb :1 -screen 0 800x600x8 & | ||
mvn -U -B clean -P windows-linux test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
115 changes: 115 additions & 0 deletions
115
forge-adventure/src/main/java/forge/adventure/editor/EffectEditor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
package forge.adventure.editor; | ||
|
||
import forge.adventure.data.EffectData; | ||
|
||
import javax.swing.*; | ||
import javax.swing.event.ChangeEvent; | ||
import javax.swing.event.ChangeListener; | ||
import java.awt.*; | ||
|
||
public class EffectEditor extends JComponent { | ||
EffectData currentData; | ||
|
||
|
||
JTextField name =new JTextField(); | ||
JSpinner changeStartCards = new JSpinner(new SpinnerNumberModel(0, 0, 1000, 1)); | ||
JSpinner lifeModifier = new JSpinner(new SpinnerNumberModel(0, 0, 1000, 1)); | ||
JSpinner moveSpeed = new JSpinner(new SpinnerNumberModel(0f, 0, 1, 0.1f)); | ||
TextListEdit startBattleWithCard =new TextListEdit(); | ||
JCheckBox colorView =new JCheckBox(); | ||
EffectEditor opponent = null; | ||
private boolean updating=false; | ||
|
||
public EffectEditor(boolean isOpponentEffect) | ||
{ | ||
if(!isOpponentEffect) | ||
opponent=new EffectEditor(true); | ||
setLayout(new BoxLayout(this,BoxLayout.Y_AXIS)); | ||
JPanel parameters=new JPanel(); | ||
parameters.setBorder(BorderFactory.createTitledBorder("Effect")); | ||
parameters.setLayout(new GridLayout(7,2)) ; | ||
|
||
parameters.add(new JLabel("Name:")); parameters.add(name); | ||
parameters.add(new JLabel("Start with extra cards:")); parameters.add(changeStartCards); | ||
parameters.add(new JLabel("Change life:")); parameters.add(lifeModifier); | ||
parameters.add(new JLabel("Movement speed:")); parameters.add(moveSpeed); | ||
parameters.add(new JLabel("Start battle with cards:")); parameters.add(startBattleWithCard); | ||
parameters.add(new JLabel("color view:")); parameters.add(colorView); | ||
add(parameters); | ||
if(!isOpponentEffect) | ||
{ add(new JLabel("Opponent:")); add(opponent);} | ||
|
||
|
||
changeStartCards.addChangeListener(e -> EffectEditor.this.updateEffect()); | ||
lifeModifier.addChangeListener(e -> EffectEditor.this.updateEffect()); | ||
moveSpeed.addChangeListener(e -> EffectEditor.this.updateEffect()); | ||
colorView.addChangeListener(e -> EffectEditor.this.updateEffect()); | ||
name.getDocument().addDocumentListener(new DocumentChangeListener(() -> EffectEditor.this.updateEffect())); | ||
startBattleWithCard.getEdit().getDocument().addDocumentListener(new DocumentChangeListener(() -> EffectEditor.this.updateEffect())); | ||
if(opponent!=null) | ||
|
||
opponent.addChangeListener(e -> EffectEditor.this.updateEffect()); | ||
|
||
} | ||
|
||
private void updateEffect() { | ||
if(currentData==null||updating) | ||
return; | ||
|
||
|
||
|
||
currentData.name=name.getText(); | ||
currentData.changeStartCards=((Integer)changeStartCards.getValue()).intValue(); | ||
currentData.lifeModifier= ((Integer)lifeModifier.getValue()).intValue(); | ||
currentData.moveSpeed= ((Float)moveSpeed.getValue()).floatValue(); | ||
currentData.startBattleWithCard = startBattleWithCard.getList(); | ||
currentData.colorView = colorView.isSelected(); | ||
currentData.opponent = opponent.currentData; | ||
|
||
ChangeListener[] listeners = listenerList.getListeners(ChangeListener.class); | ||
if (listeners != null && listeners.length > 0) { | ||
ChangeEvent evt = new ChangeEvent(this); | ||
for (ChangeListener listener : listeners) { | ||
listener.stateChanged(evt); | ||
} | ||
} | ||
|
||
} | ||
public void addChangeListener(ChangeListener l) { | ||
listenerList.add(ChangeListener.class, l); | ||
} | ||
public void setCurrentEffect(EffectData data) | ||
{ | ||
if(data==null) | ||
return; | ||
currentData=data; | ||
refresh(); | ||
} | ||
public EffectData getCurrentEffect() | ||
{ | ||
return currentData; | ||
} | ||
|
||
private void refresh() { | ||
setEnabled(currentData!=null); | ||
if(currentData==null) | ||
{ | ||
return; | ||
} | ||
updating=true; | ||
name.setText(currentData.name); | ||
|
||
|
||
|
||
lifeModifier.setValue(currentData.lifeModifier); | ||
changeStartCards.setValue(currentData.changeStartCards); | ||
startBattleWithCard.setText(currentData.startBattleWithCard); | ||
colorView.setSelected(currentData.colorView); | ||
moveSpeed.setValue(currentData.moveSpeed); | ||
if(opponent!=null) | ||
opponent.setCurrentEffect(currentData.opponent); | ||
|
||
|
||
updating=false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
fef579b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[stale:linkedAbilityV2]
@Hanmac Your branch linkedAbilityV2 hasn't been updated in the last 90 days and is marked as stale. It will be removed in a 7 days.
If you want to keep this branch around, add new commits to this branch or protect it.