[fix] Fixed an issue that playing with offset might not work properly.
This commit is contained in:
parent
1c9aa9340d
commit
fc81f9dcc7
@ -4,22 +4,22 @@ actor [0..1] {
|
||||
clip_left := 0.1;
|
||||
}
|
||||
background [0..1] {
|
||||
inner_r = 0.8;
|
||||
inner_g = 0.8;
|
||||
inner_b = 0.8;
|
||||
inner_a = 1;
|
||||
inner_r := 0.8;
|
||||
inner_g := 0.8;
|
||||
inner_b := 0.8;
|
||||
inner_a := 1;
|
||||
|
||||
outer_r = 0;
|
||||
outer_g = 0;
|
||||
outer_b = 0;
|
||||
outer_a = 1;
|
||||
outer_r := 0;
|
||||
outer_g := 0;
|
||||
outer_b := 0;
|
||||
outer_a := 1;
|
||||
}
|
||||
posteffect [0..1] {
|
||||
clip_left := 0.1;
|
||||
clip_right := 0.1;
|
||||
}
|
||||
variable [0..3.5] {
|
||||
hoge = 1-time;
|
||||
variable [0..1] {
|
||||
hoge = 1;
|
||||
}
|
||||
|
||||
$repeat i 2 {
|
||||
|
@ -26,9 +26,22 @@ abstract class AbstractScheduledController : ScheduledControllerInterface {
|
||||
}
|
||||
|
||||
override void Operate(float time) {
|
||||
FinalizeCurrentOperationIfEnded(time);
|
||||
PrepareNextOperationIfStarted(time);
|
||||
ProcessCurrentOperationIfAvailable(time);
|
||||
while (true) {
|
||||
if (next_operation_index_ >= 1) {
|
||||
const current = &operations_[next_operation_index_-1];
|
||||
ProcessOperation(
|
||||
current.period.ConvertToRelativeTime(time), *current);
|
||||
if (current.period.end > time) return;
|
||||
FinalizeOperation(*current);
|
||||
}
|
||||
|
||||
if (next_operation_index_ >= operations_.length) return;
|
||||
|
||||
const next = &operations_[next_operation_index_];
|
||||
if (next.period.start > time) return;
|
||||
++next_operation_index_;
|
||||
PrepareOperation(*next);
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -87,33 +100,6 @@ abstract class AbstractScheduledController : ScheduledControllerInterface {
|
||||
}
|
||||
|
||||
private:
|
||||
void FinalizeCurrentOperationIfEnded(float time) {
|
||||
if (next_operation_index_ < 1) return;
|
||||
|
||||
const current = &operations_[next_operation_index_-1];
|
||||
if (current.period.end > time) return;
|
||||
|
||||
FinalizeOperation(*current);
|
||||
}
|
||||
void PrepareNextOperationIfStarted(float time) {
|
||||
if (next_operation_index_ >= operations_.length) return;
|
||||
|
||||
const next = &operations_[next_operation_index_];
|
||||
if (next.period.start > time) return;
|
||||
|
||||
++next_operation_index_;
|
||||
PrepareOperation(*next);
|
||||
}
|
||||
void ProcessCurrentOperationIfAvailable(float time) {
|
||||
if (next_operation_index_ < 1) return;
|
||||
|
||||
const current = &operations_[next_operation_index_-1];
|
||||
if (current.period.end <= time) return;
|
||||
|
||||
ProcessOperation(
|
||||
current.period.ConvertToRelativeTime(time), *current);
|
||||
}
|
||||
|
||||
const VarStoreInterface varstore_;
|
||||
|
||||
const ParametersBlock[] operations_;
|
||||
|
@ -39,7 +39,12 @@ class Context {
|
||||
sjplayer.CircleElement,
|
||||
sjplayer.SquareElement,
|
||||
sjplayer.TriangleElement;
|
||||
// FIXME: fucking solution
|
||||
auto factories = tuple(
|
||||
tuple(
|
||||
"variable",
|
||||
VarStoreScheduledControllerFactory(varstore),
|
||||
),
|
||||
tuple(
|
||||
"actor",
|
||||
ActorControllerFactory(varstore, actor_),
|
||||
@ -65,10 +70,6 @@ class Context {
|
||||
"triangle",
|
||||
TriangleElementScheduledControllerFactory(programs, varstore),
|
||||
),
|
||||
tuple(
|
||||
"variable",
|
||||
VarStoreScheduledControllerFactory(varstore),
|
||||
),
|
||||
);
|
||||
foreach (ref factory; factories) {
|
||||
factory[1].
|
||||
@ -84,8 +85,8 @@ class Context {
|
||||
drawers_ = builder.drawers[];
|
||||
controllers_ = builder.controllers[];
|
||||
|
||||
actor_controller_ = factories[0][1].product;
|
||||
posteffect_controller_ = factories[1][1].product;
|
||||
actor_controller_ = factories[1][1].product;
|
||||
posteffect_controller_ = factories[2][1].product;
|
||||
}
|
||||
///
|
||||
~this() {
|
||||
|
@ -22,6 +22,7 @@ class VarStoreScheduledController : AbstractScheduledController {
|
||||
varstore_ = varstore;
|
||||
}
|
||||
|
||||
protected:
|
||||
override void SetParameter(
|
||||
ref in Parameter param,
|
||||
ref in AbstractScheduledController.VarStore vars) {
|
||||
|
Reference in New Issue
Block a user