slave-princess-charlotte/data/Script/eventcommand/eventcommand-messagescroll.js
2025-10-12 13:17:46 -05:00

95 lines
2.3 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

var MessageScrollEventCommand = defineObject(BaseEventCommand,
{
_text: null,
_scrollTextView: null,
_isSkipAllowed: false,
enterEventCommandCycle: function() {
this._prepareEventCommandMemberData();
if (!this._checkEventCommand()) {
return EnterResult.NOTENTER;
}
return this._completeEventCommandMemberData();
},
moveEventCommandCycle: function() {
if (this._isSkipAllowed && InputControl.isSelectAction()) {
return MoveResult.END;
}
if (this._scrollTextView.moveScrollTextViewCycle() !== MoveResult.CONTINUE) {
return MoveResult.END;
}
return MoveResult.CONTINUE;
},
drawEventCommandCycle: function() {
this._scrollTextView.drawScrollTextViewCycle();
},
isEventCommandSkipAllowed: function() {
return this._isSkipAllowed;
},
_prepareEventCommandMemberData: function() {
this._text = null;
this._scrollTextView = createObject(ScrollTextView);
this._checkSkipAction();
},
_checkEventCommand: function() {
if (!this._isSkipAllowed) {
return true;
}
return this.isEventCommandContinue();
},
_completeEventCommandMemberData: function() {
var scrollTextParam;
var eventCommandData = root.getEventCommandObject();
var replacer = createObject(VariableReplacer);
if (eventCommandData.isStaffRoll()) {
this._text = replacer.startReplace(root.getConfigInfo().getStaffRollString());
}
else {
this._text = replacer.startReplace(eventCommandData.getText());
}
// startReplace縺ョ蠕後〒螳溯。後☆繧九縺ィ
scrollTextParam = this._createScrollTextParam();
this._scrollTextView.openScrollTextViewCycle(scrollTextParam);
return EnterResult.OK;
},
_createScrollTextParam: function() {
var eventCommandData = root.getEventCommandObject();
var scrollTextParam = StructureBuilder.buildScrollTextParam();
scrollTextParam.margin = 0;
scrollTextParam.x = eventCommandData.getX();
scrollTextParam.speedType = eventCommandData.getSpeedType();
scrollTextParam.text = this._text;
if (eventCommandData.isCenterShow()) {
scrollTextParam.x = -1;
}
return scrollTextParam;
},
_checkSkipAction: function() {
var eventCommandData = root.getEventCommandObject();
this._isSkipAllowed = !eventCommandData.isStaffRoll();
}
}
);