12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- function ScreenFadeBackground::resetColor(%this)
- {
- if(getWord(%this.getImageColor(), 3) == 0)
- {
- %this.setImageColor(%this.transparentColor);
- %extent = Canvas.getExtent();
- %this.setExtent(getWord(%extent, 0), getWord(%extent, 1));
- }
- }
- function ScreenFadeBackground::startSwap(%this)
- {
- %this.resetColor();
- %this.clear();
- Canvas.pushDialog(%this);
- %this.fadeTo(%this.solidColor, %this.swapTime, "EaseInOut");
- %this.schedule(%this.swapTime, "doSwap");
- }
- function ScreenFadeBackground::doSwap(%this)
- {
- Canvas.setContent(%this.swapContent);
- Canvas.pushDialog(%this);
- %this.schedule(%this.swapTime/2, "fadeSwap");
- }
- function ScreenFadeBackground::fadeSwap(%this)
- {
- %this.fadeTo(%this.transparentColor, %this.swapTime, "EaseInOut");
- %this.schedule(%this.swapTime, "finishSwap");
- }
- function ScreenFadeBackground::finishSwap(%this)
- {
- Canvas.popDialog(%this);
- %this.Owner.postEvent("SwapComplete");
- }
- function ScreenFadeBackground::openDialog(%this)
- {
- %this.resetColor();
- %this.add(%this.dialog);
- Canvas.pushDialog(%this);
- %this.fadeTo(%this.solidColor, %this.dialogTime, "EaseInOut");
- %this.schedule(%this.dialogTime, "openDialogComplete");
- }
- function ScreenFadeBackground::openDialogComplete(%this)
- {
- %this.Owner.postEvent("OpenComplete");
- %this.startListening(%this.dialog);
- }
- function ScreenFadeBackground::onDialogClose(%this)
- {
- if(%this.isAwake())
- {
- if(isEventPending(%this.hideSchedule))
- {
- cancel(%this.hideSchedule);
- }
- %this.clear();
- %this.fadeTo(%this.transparentColor, %this.dialogTime, "EaseIn");
- %this.hideSchedule = %this.schedule(%this.dialogTime, "onCloseComplete");
- }
- }
- function ScreenFadeBackground::onDialogSwap(%this, %dialog)
- {
- if(%this.isAwake() && isObject(%this.dialog))
- {
- if(isEventPending(%this.hideSchedule))
- {
- cancel(%this.hideSchedule);
- }
- %this.setImageColor(%this.solidColor);
- %this.stopListening(%this.dialog);
- %this.removeIfMember(%this.dialog);
- %this.dialog = %dialog;
- %this.add(%this.dialog);
- %this.startListening(%this.dialog);
- }
- }
- function ScreenFadeBackground::onCloseComplete(%this)
- {
- if(isObject(%this.dialog))
- {
- %this.stopListening(%this.dialog);
- %this.removeIfMember(%this.dialog);
- }
- Canvas.popDialog(%this);
- %this.Owner.postEvent("CloseComplete");
- }
|