synchronize string fields
All checks were successful
studiorailgun/highlevel-netcode-gen/pipeline/head This commit looks good
All checks were successful
studiorailgun/highlevel-netcode-gen/pipeline/head This commit looks good
This commit is contained in:
parent
2851c9b6a5
commit
71a4d91497
14
highestLevelDesignNotes.md
Normal file
14
highestLevelDesignNotes.md
Normal file
@ -0,0 +1,14 @@
|
||||
|
||||
|
||||
Effectively we want two mechanisms for most trees
|
||||
|
||||
Client sends a signal to server requesting some mutation
|
||||
|
||||
Server sends update of state to client
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Typical behavior tree should basically be a loop that constantly sends these updates to the client
|
||||
The client triggers this loop in the first place by sending one of these signals to the server
|
||||
@ -19,7 +19,7 @@ import electrosphere.main.targets.TargetFile;
|
||||
*/
|
||||
public class Main {
|
||||
|
||||
public static String topLevelFolderPathWindows = "C:\\Users\\satellite\\Documents\\Renderer";
|
||||
public static String topLevelFolderPathWindows = "C:\\Users\\satellite\\p\\Renderer";
|
||||
static String topLevelFolderPathMac = "/Users/satellite/p/Renderer";
|
||||
|
||||
public static int bTreeIterator = 0;
|
||||
|
||||
@ -34,10 +34,15 @@ public class ClientSynchronizationManager {
|
||||
case "long":
|
||||
case "float":
|
||||
case "double":
|
||||
case "String":
|
||||
{
|
||||
throw new UnsupportedOperationException("Trying to parse type that is not supported yet");
|
||||
}
|
||||
case "String": {
|
||||
updateCases = updateCases + " case " + field.id + ":{\n";
|
||||
updateCases = updateCases + " " + treeName + " tree = " + treeName + ".get" + treeName + "(entity);\n";
|
||||
updateCases = updateCases + " tree." + field.getSetterName() + "(message.getstringValue());\n";
|
||||
updateCases = updateCases + " } break;\n";
|
||||
} break;
|
||||
default: {
|
||||
SynchronizedType type = structure.getType(field.typeName);
|
||||
String typeClass = type.getTargetFile().getSource().getName();
|
||||
|
||||
@ -70,10 +70,26 @@ public class SynchronizedField {
|
||||
}
|
||||
|
||||
public String getServerSetterContent(ProjectStructure structure){
|
||||
SynchronizedType type = structure.getType(typeName);
|
||||
String packetContentFiller = " int value = " + type.getContainingClassName() + "." + type.getToShortConversionMethodName() + "(state);\n";
|
||||
packetContentFiller = packetContentFiller + " DataCellSearchUtils.getEntityDataCell(parent).broadcastNetworkMessage(SynchronizationMessage.constructUpdateClientStateMessage(parent.getId(), " + parent.id + ", " + id + ", value));";
|
||||
String rVal = TemplateInjectionUtils.getFragmentWithReplacement("/server/Setter.java", fieldName, Utilities.camelCase(fieldName), typeName, packetContentFiller);
|
||||
String rVal = null;
|
||||
switch(typeName){
|
||||
case "int":
|
||||
case "long":
|
||||
case "float":
|
||||
case "double":
|
||||
{
|
||||
throw new UnsupportedOperationException("Trying to parse type that is not supported yet");
|
||||
}
|
||||
case "String": {
|
||||
String packetContentFiller = " DataCellSearchUtils.getEntityDataCell(parent).broadcastNetworkMessage(SynchronizationMessage.constructUpdateClientStringStateMessage(parent.getId(), " + parent.id + ", " + id + ", " + fieldName + "));";
|
||||
rVal = TemplateInjectionUtils.getFragmentWithReplacement("/server/Setter.java", fieldName, Utilities.camelCase(fieldName), typeName, packetContentFiller);
|
||||
} break;
|
||||
default: {
|
||||
SynchronizedType type = structure.getType(typeName);
|
||||
String packetContentFiller = " int value = " + type.getContainingClassName() + "." + type.getToShortConversionMethodName() + "(" + fieldName + ");\n";
|
||||
packetContentFiller = packetContentFiller + " DataCellSearchUtils.getEntityDataCell(parent).broadcastNetworkMessage(SynchronizationMessage.constructUpdateClientStateMessage(parent.getId(), " + parent.id + ", " + id + ", value));";
|
||||
rVal = TemplateInjectionUtils.getFragmentWithReplacement("/server/Setter.java", fieldName, Utilities.camelCase(fieldName), typeName, packetContentFiller);
|
||||
} break;
|
||||
}
|
||||
return rVal;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user