generated from Anuken/MindustryJavaModTemplate
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
790bd07
commit b227689
Showing
9 changed files
with
563 additions
and
413 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,24 @@ | ||
<component name="ProjectRunConfigurationManager"> | ||
<configuration default="false" name="Mindustry-moreLogicMod [jar]" type="GradleRunConfiguration" factoryName="Gradle"> | ||
<ExternalSystemSettings> | ||
<option name="executionName" /> | ||
<option name="externalProjectPath" value="$PROJECT_DIR$" /> | ||
<option name="externalSystemIdString" value="GRADLE" /> | ||
<option name="scriptParameters" value="" /> | ||
<option name="taskDescriptions"> | ||
<list /> | ||
</option> | ||
<option name="taskNames"> | ||
<list> | ||
<option value="jar" /> | ||
</list> | ||
</option> | ||
<option name="vmOptions" /> | ||
</ExternalSystemSettings> | ||
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess> | ||
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess> | ||
<DebugAllEnabled>false</DebugAllEnabled> | ||
<RunAsTest>false</RunAsTest> | ||
<method v="2" /> | ||
</configuration> | ||
</component> |
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
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,22 @@ | ||
package bin.morelogic; | ||
|
||
import arc.util.Log; | ||
import mindustry.gen.LogicIO; | ||
import mindustry.logic.LAssembler; | ||
import mindustry.mod.Plugin; | ||
|
||
/** | ||
* @author bin | ||
* @version 1.0.0 | ||
* @since 2024/2/14 | ||
*/ | ||
@SuppressWarnings("unused") | ||
public class MoreStringLogicJavaPlugin extends Plugin { | ||
@Override | ||
public void init() { | ||
Log.info("Loading MoreStringLogicJavaPlugin."); | ||
LAssembler.customParsers.put(PrintBufferStatement.ID, PrintBufferStatement::read); | ||
LogicIO.allStatements.add(PrintBufferStatement::new); | ||
Log.info("End Loaded MoreStringLogicJavaPlugin."); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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,88 @@ | ||
package bin.morelogic; | ||
|
||
import arc.func.Cons; | ||
import arc.scene.ui.Button; | ||
import arc.scene.ui.TextField; | ||
import arc.scene.ui.layout.Cell; | ||
import arc.scene.ui.layout.Table; | ||
import arc.util.Strings; | ||
import bin.morelogic.statement.StringOp; | ||
import mindustry.logic.LAssembler; | ||
import mindustry.logic.LCategory; | ||
import mindustry.logic.LExecutor; | ||
import mindustry.logic.LStatement; | ||
|
||
/** | ||
* @author bin | ||
* @version 1.0.0 | ||
* @since 2024/2/14 | ||
*/ | ||
public class PrintBufferStatement extends LStatement { | ||
public static final String ID = "bin_String"; | ||
|
||
public StringOp op = StringOp.GetLength; | ||
public String[] args = {"dest", "a", "b", "c"}; | ||
|
||
@Override | ||
public Cell<TextField> field(Table table, String value, Cons<String> setter) { | ||
return super.field(table, value, setter); | ||
} | ||
|
||
@Override | ||
public void build(Table table) { | ||
op.invoke(this, table); | ||
} | ||
|
||
@Override | ||
public <T> void showSelect(Button b, T[] values, T current, Cons<T> getter) { | ||
super.showSelect(b, values, current, getter, 4, it -> it.size(144f, 40f)); | ||
} | ||
|
||
@Override | ||
public LExecutor.LInstruction build(LAssembler builder) { | ||
return op.invoke(vars(builder, args)); | ||
} | ||
|
||
@Override | ||
public LCategory category() { | ||
return LCategory.operation; | ||
} | ||
|
||
@Override | ||
public void write(StringBuilder builder) { | ||
builder.append(ID); | ||
builder.append(" ").append(op.name()); | ||
for (var s : args) { | ||
builder.append(" ").append(s); | ||
} | ||
} | ||
|
||
@Override | ||
public String name() { | ||
return Strings.insertSpaces("PrintBuffer"); | ||
} | ||
|
||
public static LStatement read(String[] tokens) { | ||
var statement = new PrintBufferStatement(); | ||
var length = tokens.length; | ||
if (length > 1) { | ||
statement.op = StringOp.value(tokens[1]); | ||
} | ||
var args = statement.args; | ||
for (int it = 0, size = Math.min(args.length, length - 2); it < size; it++) { | ||
String token = tokens[it + 2]; | ||
if (token != null) { | ||
args[it] = token; | ||
} | ||
} | ||
return statement; | ||
} | ||
|
||
public static int[] vars(LAssembler builder, String[] symbols) { | ||
var arr = new int[symbols.length]; | ||
for (int it = 0, size = symbols.length; it < size; it++) { | ||
arr[it] = builder.var(symbols[it]); | ||
} | ||
return arr; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.