fix string carousels
Some checks reported errors
studiorailgun/Renderer/pipeline/head Something is wrong with the build of this commit
Some checks reported errors
studiorailgun/Renderer/pipeline/head Something is wrong with the build of this commit
This commit is contained in:
parent
a5d4e2348e
commit
ec22fa9c68
@ -141,6 +141,13 @@
|
|||||||
"meshes" : [
|
"meshes" : [
|
||||||
"Hair"
|
"Hair"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id" : "hairshort2",
|
||||||
|
"model" : "Models/creatures/person2/hair/hairshort1meshed.fbx",
|
||||||
|
"meshes" : [
|
||||||
|
"Hair"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2064,6 +2064,7 @@ Refactor animation logic into dedicated actor class
|
|||||||
Simplify draw call logic
|
Simplify draw call logic
|
||||||
Error report on window.java
|
Error report on window.java
|
||||||
Delete ActorShaderMask
|
Delete ActorShaderMask
|
||||||
|
Fix string carousels
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -28,6 +28,7 @@ public class Signal {
|
|||||||
//UI
|
//UI
|
||||||
//
|
//
|
||||||
YOGA_APPLY,
|
YOGA_APPLY,
|
||||||
|
YOGA_APPLY_ROOT,
|
||||||
YOGA_DESTROY,
|
YOGA_DESTROY,
|
||||||
UI_MODIFICATION,
|
UI_MODIFICATION,
|
||||||
|
|
||||||
|
|||||||
@ -48,6 +48,7 @@ public class ElementService extends SignalServiceImpl {
|
|||||||
"ElementService",
|
"ElementService",
|
||||||
new SignalType[]{
|
new SignalType[]{
|
||||||
SignalType.YOGA_APPLY,
|
SignalType.YOGA_APPLY,
|
||||||
|
SignalType.YOGA_APPLY_ROOT,
|
||||||
SignalType.YOGA_DESTROY,
|
SignalType.YOGA_DESTROY,
|
||||||
SignalType.UI_MODIFICATION,
|
SignalType.UI_MODIFICATION,
|
||||||
}
|
}
|
||||||
@ -609,6 +610,18 @@ public class ElementService extends SignalServiceImpl {
|
|||||||
target.applyYoga(0, 0);
|
target.applyYoga(0, 0);
|
||||||
rVal = true;
|
rVal = true;
|
||||||
} break;
|
} break;
|
||||||
|
case YOGA_APPLY_ROOT: {
|
||||||
|
Element target = (Element)signal.getData();
|
||||||
|
if(target == null){
|
||||||
|
throw new Error("You forgot to include an element with the signal!");
|
||||||
|
}
|
||||||
|
//find the root node
|
||||||
|
while(target.getParent() != null){
|
||||||
|
target = target.getParent();
|
||||||
|
}
|
||||||
|
target.applyYoga(0, 0);
|
||||||
|
rVal = true;
|
||||||
|
} break;
|
||||||
case YOGA_DESTROY: {
|
case YOGA_DESTROY: {
|
||||||
Element target = (Element)signal.getData();
|
Element target = (Element)signal.getData();
|
||||||
target.destroy();
|
target.destroy();
|
||||||
|
|||||||
@ -181,7 +181,47 @@ public class StringCarousel extends StandardContainerElement implements Drawable
|
|||||||
public void setVisible(boolean draw) {
|
public void setVisible(boolean draw) {
|
||||||
this.visible = draw;
|
this.visible = draw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The default menu event handler
|
||||||
|
* @param event
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private boolean defaultMenuEventHandler(MenuEvent event){
|
||||||
|
if(event.getType() == MenuEventType.INCREMENT){
|
||||||
|
if(options.size() > 0){
|
||||||
|
currentOption++;
|
||||||
|
if(currentOption > options.size() - 1){
|
||||||
|
currentOption = 0;
|
||||||
|
}
|
||||||
|
String newOption = options.get(currentOption);
|
||||||
|
this.setText(newOption);
|
||||||
|
if(onValueChange != null){
|
||||||
|
onValueChange.execute(new ValueChangeEvent(newOption));
|
||||||
|
}
|
||||||
|
Globals.engineState.signalSystem.post(SignalType.YOGA_APPLY_ROOT,this);
|
||||||
|
}
|
||||||
|
} else if(event.getType() == MenuEventType.DECREMENT){
|
||||||
|
if(options.size() > 0){
|
||||||
|
currentOption--;
|
||||||
|
if(currentOption < 0){
|
||||||
|
currentOption = options.size() - 1;
|
||||||
|
}
|
||||||
|
String newOption = options.get(currentOption);
|
||||||
|
this.setText(newOption);
|
||||||
|
if(onValueChange != null){
|
||||||
|
onValueChange.execute(new ValueChangeEvent(newOption));
|
||||||
|
}
|
||||||
|
Globals.engineState.signalSystem.post(SignalType.YOGA_APPLY_ROOT,this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles an event
|
||||||
|
* @param event The event
|
||||||
|
*/
|
||||||
public boolean handleEvent(Event event){
|
public boolean handleEvent(Event event){
|
||||||
boolean propagate = true;
|
boolean propagate = true;
|
||||||
if(event instanceof MenuEvent){
|
if(event instanceof MenuEvent){
|
||||||
@ -190,33 +230,7 @@ public class StringCarousel extends StandardContainerElement implements Drawable
|
|||||||
propagate = onMenuEventCallback.execute(menuEvent);
|
propagate = onMenuEventCallback.execute(menuEvent);
|
||||||
} else {
|
} else {
|
||||||
//default behavior
|
//default behavior
|
||||||
if(menuEvent.getType() == MenuEventType.INCREMENT){
|
propagate = this.defaultMenuEventHandler(menuEvent);
|
||||||
propagate = false;
|
|
||||||
if(options.size() > 0){
|
|
||||||
currentOption++;
|
|
||||||
if(currentOption > options.size() - 1){
|
|
||||||
currentOption = 0;
|
|
||||||
}
|
|
||||||
String newOption = options.get(currentOption);
|
|
||||||
setText(newOption);
|
|
||||||
if(onValueChange != null){
|
|
||||||
onValueChange.execute(new ValueChangeEvent(newOption));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if(menuEvent.getType() == MenuEventType.DECREMENT){
|
|
||||||
propagate = false;
|
|
||||||
if(options.size() > 0){
|
|
||||||
currentOption--;
|
|
||||||
if(currentOption < 0){
|
|
||||||
currentOption = options.size() - 1;
|
|
||||||
}
|
|
||||||
String newOption = options.get(currentOption);
|
|
||||||
setText(newOption);
|
|
||||||
if(onValueChange != null){
|
|
||||||
onValueChange.execute(new ValueChangeEvent(newOption));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else if(event instanceof FocusEvent){
|
} else if(event instanceof FocusEvent){
|
||||||
FocusEvent focusEvent = (FocusEvent) event;
|
FocusEvent focusEvent = (FocusEvent) event;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user