import work
All checks were successful
studiorailgun/highlevel-netcode-gen/pipeline/head This commit looks good

This commit is contained in:
austin 2024-07-31 16:35:00 -04:00
parent 6390c0b0c2
commit 65b5cb6dc2
15 changed files with 93 additions and 32 deletions

View File

@ -1,5 +1,6 @@
package electrosphere.main.client.syncmanager.methods; package electrosphere.main.client.syncmanager.methods;
import java.util.LinkedList;
import java.util.List; import java.util.List;
import electrosphere.main.core.btree.BehaviorTree; import electrosphere.main.core.btree.BehaviorTree;
@ -75,9 +76,6 @@ public class UpdateEntityState implements VirtualMethod {
} }
updateCases = updateCases + " }\n"; updateCases = updateCases + " }\n";
updateCases = updateCases + " } break;\n"; updateCases = updateCases + " } break;\n";
// //guarantee import
// ClassSourceUtils.importClass(structure, this.file, structure.getTree(serverTree.getCorrespondingTreeName()).getTargetFile().getQualifiedPath());
} }
} }
String fullReplacementText = TemplateInjectionUtils.getFragmentWithReplacement("/client/UpdateEntityState.java", updateCases); String fullReplacementText = TemplateInjectionUtils.getFragmentWithReplacement("/client/UpdateEntityState.java", updateCases);
@ -86,8 +84,15 @@ public class UpdateEntityState implements VirtualMethod {
@Override @Override
public List<String> getImports(ProjectStructure projectStructure) { public List<String> getImports(ProjectStructure projectStructure) {
// TODO Auto-generated method stub List<String> rVal = new LinkedList<String>();
throw new UnsupportedOperationException("Unimplemented method 'getImports'");
//add server trees
for(BehaviorTree bTree : projectStructure.getBehaviorTrees()){
if(bTree.getName().contains("client")){
rVal.add(bTree.getTargetFile().getQualifiedPath());
}
}
return rVal;
} }
@Override @Override

View File

@ -1,5 +1,6 @@
package electrosphere.main.core.btree.methods; package electrosphere.main.core.btree.methods;
import java.util.Arrays;
import java.util.List; import java.util.List;
import electrosphere.main.project.ProjectStructure; import electrosphere.main.project.ProjectStructure;
@ -42,8 +43,10 @@ public class ClientAttach implements VirtualMethod {
@Override @Override
public List<String> getImports(ProjectStructure projectStructure) { public List<String> getImports(ProjectStructure projectStructure) {
// TODO Auto-generated method stub List<String> rVal = Arrays.asList(new String[]{
throw new UnsupportedOperationException("Unimplemented method 'getImports'"); "electrosphere.net.synchronization.BehaviorTreeIdEnums",
});
return rVal;
} }
@Override @Override

View File

@ -1,5 +1,6 @@
package electrosphere.main.core.btree.methods; package electrosphere.main.core.btree.methods;
import java.util.Arrays;
import java.util.List; import java.util.List;
import electrosphere.main.project.ProjectStructure; import electrosphere.main.project.ProjectStructure;
@ -42,8 +43,9 @@ public class ClientDetach implements VirtualMethod {
@Override @Override
public List<String> getImports(ProjectStructure projectStructure) { public List<String> getImports(ProjectStructure projectStructure) {
// TODO Auto-generated method stub List<String> rVal = Arrays.asList(new String[]{
throw new UnsupportedOperationException("Unimplemented method 'getImports'"); });
return rVal;
} }
@Override @Override

View File

@ -1,5 +1,6 @@
package electrosphere.main.core.btree.methods; package electrosphere.main.core.btree.methods;
import java.util.Arrays;
import java.util.List; import java.util.List;
import electrosphere.main.core.btree.BehaviorTree; import electrosphere.main.core.btree.BehaviorTree;
@ -49,8 +50,9 @@ public class ClientFieldGetter implements VirtualMethod {
@Override @Override
public List<String> getImports(ProjectStructure projectStructure) { public List<String> getImports(ProjectStructure projectStructure) {
// TODO Auto-generated method stub List<String> rVal = Arrays.asList(new String[]{
throw new UnsupportedOperationException("Unimplemented method 'getImports'"); });
return rVal;
} }
@Override @Override

View File

@ -1,5 +1,6 @@
package electrosphere.main.core.btree.methods; package electrosphere.main.core.btree.methods;
import java.util.Arrays;
import java.util.List; import java.util.List;
import electrosphere.main.core.btree.BehaviorTree; import electrosphere.main.core.btree.BehaviorTree;
@ -49,8 +50,9 @@ public class ClientFieldSetter implements VirtualMethod {
@Override @Override
public List<String> getImports(ProjectStructure projectStructure) { public List<String> getImports(ProjectStructure projectStructure) {
// TODO Auto-generated method stub List<String> rVal = Arrays.asList(new String[]{
throw new UnsupportedOperationException("Unimplemented method 'getImports'"); });
return rVal;
} }
@Override @Override

View File

@ -1,5 +1,6 @@
package electrosphere.main.core.btree.methods; package electrosphere.main.core.btree.methods;
import java.util.Arrays;
import java.util.List; import java.util.List;
import electrosphere.main.project.ProjectStructure; import electrosphere.main.project.ProjectStructure;
@ -41,8 +42,9 @@ public class Constructor implements VirtualMethod {
@Override @Override
public List<String> getImports(ProjectStructure projectStructure) { public List<String> getImports(ProjectStructure projectStructure) {
// TODO Auto-generated method stub List<String> rVal = Arrays.asList(new String[]{
throw new UnsupportedOperationException("Unimplemented method 'getImports'"); });
return rVal;
} }
@Override @Override

View File

@ -1,5 +1,6 @@
package electrosphere.main.core.btree.methods; package electrosphere.main.core.btree.methods;
import java.util.Arrays;
import java.util.List; import java.util.List;
import electrosphere.main.project.ProjectStructure; import electrosphere.main.project.ProjectStructure;
@ -41,8 +42,9 @@ public class Fetch implements VirtualMethod {
@Override @Override
public List<String> getImports(ProjectStructure projectStructure) { public List<String> getImports(ProjectStructure projectStructure) {
// TODO Auto-generated method stub List<String> rVal = Arrays.asList(new String[]{
throw new UnsupportedOperationException("Unimplemented method 'getImports'"); });
return rVal;
} }
@Override @Override

View File

@ -1,5 +1,6 @@
package electrosphere.main.core.btree.methods; package electrosphere.main.core.btree.methods;
import java.util.Arrays;
import java.util.List; import java.util.List;
import electrosphere.main.core.syncfield.SynchronizedType; import electrosphere.main.core.syncfield.SynchronizedType;
@ -47,8 +48,9 @@ public class FromTypeConversion implements VirtualMethod {
@Override @Override
public List<String> getImports(ProjectStructure projectStructure) { public List<String> getImports(ProjectStructure projectStructure) {
// TODO Auto-generated method stub List<String> rVal = Arrays.asList(new String[]{
throw new UnsupportedOperationException("Unimplemented method 'getImports'"); });
return rVal;
} }
@Override @Override

View File

@ -1,5 +1,6 @@
package electrosphere.main.core.btree.methods; package electrosphere.main.core.btree.methods;
import java.util.Arrays;
import java.util.List; import java.util.List;
import electrosphere.main.project.ProjectStructure; import electrosphere.main.project.ProjectStructure;
@ -42,8 +43,11 @@ public class ServerAttach implements VirtualMethod {
@Override @Override
public List<String> getImports(ProjectStructure projectStructure) { public List<String> getImports(ProjectStructure projectStructure) {
// TODO Auto-generated method stub List<String> rVal = Arrays.asList(new String[]{
throw new UnsupportedOperationException("Unimplemented method 'getImports'"); "electrosphere.server.datacell.utils.ServerBehaviorTreeUtils",
"electrosphere.net.synchronization.BehaviorTreeIdEnums",
});
return rVal;
} }
@Override @Override

View File

@ -1,5 +1,6 @@
package electrosphere.main.core.btree.methods; package electrosphere.main.core.btree.methods;
import java.util.Arrays;
import java.util.List; import java.util.List;
import electrosphere.main.project.ProjectStructure; import electrosphere.main.project.ProjectStructure;
@ -42,8 +43,9 @@ public class ServerDetach implements VirtualMethod {
@Override @Override
public List<String> getImports(ProjectStructure projectStructure) { public List<String> getImports(ProjectStructure projectStructure) {
// TODO Auto-generated method stub List<String> rVal = Arrays.asList(new String[]{
throw new UnsupportedOperationException("Unimplemented method 'getImports'"); });
return rVal;
} }
@Override @Override

View File

@ -1,5 +1,6 @@
package electrosphere.main.core.btree.methods; package electrosphere.main.core.btree.methods;
import java.util.Arrays;
import java.util.List; import java.util.List;
import electrosphere.main.core.btree.BehaviorTree; import electrosphere.main.core.btree.BehaviorTree;
@ -48,8 +49,9 @@ public class ServerFieldGetter implements VirtualMethod {
@Override @Override
public List<String> getImports(ProjectStructure projectStructure) { public List<String> getImports(ProjectStructure projectStructure) {
// TODO Auto-generated method stub List<String> rVal = Arrays.asList(new String[]{
throw new UnsupportedOperationException("Unimplemented method 'getImports'"); });
return rVal;
} }
@Override @Override

View File

@ -1,5 +1,6 @@
package electrosphere.main.core.btree.methods; package electrosphere.main.core.btree.methods;
import java.util.Arrays;
import java.util.List; import java.util.List;
import electrosphere.main.core.btree.BehaviorTree; import electrosphere.main.core.btree.BehaviorTree;
@ -79,8 +80,12 @@ public class ServerFieldSetter implements VirtualMethod {
@Override @Override
public List<String> getImports(ProjectStructure projectStructure) { public List<String> getImports(ProjectStructure projectStructure) {
// TODO Auto-generated method stub List<String> rVal = Arrays.asList(new String[]{
throw new UnsupportedOperationException("Unimplemented method 'getImports'"); "electrosphere.net.parser.net.message.SynchronizationMessage",
"electrosphere.server.datacell.utils.DataCellSearchUtils",
"electrosphere.net.synchronization.FieldIdEnums",
});
return rVal;
} }
@Override @Override

View File

@ -1,5 +1,6 @@
package electrosphere.main.core.btree.methods; package electrosphere.main.core.btree.methods;
import java.util.Arrays;
import java.util.List; import java.util.List;
import electrosphere.main.core.syncfield.SynchronizedType; import electrosphere.main.core.syncfield.SynchronizedType;
@ -50,8 +51,9 @@ public class ToTypeConversion implements VirtualMethod {
@Override @Override
public List<String> getImports(ProjectStructure projectStructure) { public List<String> getImports(ProjectStructure projectStructure) {
// TODO Auto-generated method stub List<String> rVal = Arrays.asList(new String[]{
throw new UnsupportedOperationException("Unimplemented method 'getImports'"); });
return rVal;
} }
@Override @Override

View File

@ -82,6 +82,13 @@ public class BTreeParser {
rVal.addMethod(new Constructor(bTreeName, target.getSource().getName())); rVal.addMethod(new Constructor(bTreeName, target.getSource().getName()));
rVal.addMethod(new Fetch(bTreeName, target.getSource().getName())); rVal.addMethod(new Fetch(bTreeName, target.getSource().getName()));
//
//
// ADD IMPORTS HERE
//
//
rVal.addImport("electrosphere.net.synchronization.BehaviorTreeIdEnums");
} }
// //

View File

@ -92,6 +92,9 @@ public abstract class VirtualClass {
* @param structure The project * @param structure The project
*/ */
public void updateFile(ProjectStructure structure){ public void updateFile(ProjectStructure structure){
//
//define methods
for(VirtualMethod method : this.methods){ for(VirtualMethod method : this.methods){
if(method.shouldOverwrite()){ if(method.shouldOverwrite()){
ClassSourceUtils.addOrReplaceMethod(structure, this.targetFile, method.getName(structure), method.getContent(structure)); ClassSourceUtils.addOrReplaceMethod(structure, this.targetFile, method.getName(structure), method.getContent(structure));
@ -99,9 +102,17 @@ public abstract class VirtualClass {
ClassSourceUtils.addMethodIfAbsent(structure, this.targetFile, method.getName(structure), method.getContent(structure)); ClassSourceUtils.addMethodIfAbsent(structure, this.targetFile, method.getName(structure), method.getContent(structure));
} }
} }
// for(VirtualField field : this.fields){
// throw new UnsupportedOperationException("updating fields not supported yet!"); //
// } //imports from methods
for(VirtualMethod method : this.methods){
for(String currentImport : method.getImports(structure)){
ClassSourceUtils.importClass(structure, this.targetFile, currentImport);
}
}
//
//direct imports from the class
for(String currentImport : this.imports){ for(String currentImport : this.imports){
ClassSourceUtils.importClass(structure, this.targetFile, currentImport); ClassSourceUtils.importClass(structure, this.targetFile, currentImport);
} }
@ -123,5 +134,13 @@ public abstract class VirtualClass {
this.methods.add(method); this.methods.add(method);
} }
/**
* Adds a new import statement
* @param newImport The import
*/
public void addImport(String newImport){
this.imports.add(newImport);
}
} }