Skip to content

Instantly share code, notes, and snippets.

@magcius
Created April 30, 2020 03:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save magcius/bff948b13128b70695e3841e208407ce to your computer and use it in GitHub Desktop.
Save magcius/bff948b13128b70695e3841e208407ce to your computer and use it in GitHub Desktop.
#base_path "../Adventure"
//////////////////////////////////////////////////////////////////////////////
// 部品
//////////////////////////////////////////////////////////////////////////////
class CControl
{
method CControl()
{
CreateObject(name="Arrow"
, x=722, y=552
, class=@Arrow());
CreateButtonEx(name="Skip"
, x=710+13+16, y=517+13
, normal ="ButtonSkip.png"
, focus ="ButtonSkip_f.png"
, down ="ButtonSkip_d.png"
, invalid="ButtonSkip_i.png"
, sound ="../SystemSE/Adv_Skip.wav"
, tab ="Invalid"
, group ="Control"
, class =@CControlButton(order=@Skip()));
CreateImage(name="Skip/Logo"
, image ="ButtonSkip_d.png");
CreateButtonEx(name="Auto"
, x=710+13+20, y=539+13
, normal ="ButtonAuto.png"
, focus ="ButtonAuto_f.png"
, down ="ButtonAuto_d.png"
, invalid="ButtonAuto_i.png"
, tab ="Invalid"
, group ="Control"
, class =@CControlButton(order=@Auto()));
CreateButtonEx(name="System"
, x=711+13+27, y=560+14
, normal ="ButtonSystem.png"
, focus ="ButtonSystem_f.png"
, down ="ButtonSystem_d.png"
, invalid="ButtonSystem_i.png"
, tab ="Invalid"
, group ="Control"
, sound ="../SystemSE/Adv_System.wav"
, class =@CControlButton(order=@System()));
}
method OnEnter()
{
Enter(to="Arrow, Skip, Auto, System");
SetHitMode(to="*/*", hit="Rect");
}
}
// 矢印回転管理クラス
class Arrow
{
method Arrow()
{
CreateObject(name="Image"
, sx=150%, sy=150%
, class=@ArrowRingImage());
}
method OnEnter()
{
SetHitMode(to="*", hit="None");
Zoom(sx=0%, sy=0%);
Enter(to="*");
}
// 停止
method Stop()
{
// サイズ0にする
Rotate(time=250, angle=-90, relative=true);
Zoom(time=250, sx=0%, sy=0%, step="Acc2");
}
// オート開始
method Auto(percent $rate=100%)
{
// 大きさ速度を計算
float $x = (sqrt(Float($rate))-1.0)/5.0;
percent $large = 30% + 85%*Percent($x);
percent $small = 20% + 75%*Percent($x);
int $time = 3000 - Int(2000.0 * $x);
// ぶわっと膨らむ
Opaque(alpha=100%);
Rotate(time=250, angle=-90, relative=true);
Zoom(time=250, sx=$large, sy=$large, step="AccSig");
wait 250;
// 薄くなりながら縮む
Opaque(time=1000, alpha=25%, step="AccSig");
Zoom(time=250, sx=$small, sy=$small, step="Acc2");
// 回転を続ける
while(true)
{
Rotate(angle=360, relative=true);
Rotate(time=$time, angle=-360, relative=true);
wait $time;
}
}
method SilentAuto(percent $rate=100%)
{
// 大きさ速度を計算
float $x = (sqrt(Float($rate))-1.0)/5.0;
percent $large = 30% + 85%*Percent($x);
percent $small = 20% + 75%*Percent($x);
int $time = 3000 - Int(2000.0 * $x);
// 薄くなりながら縮む
Opaque(time=1000, alpha=25%, step="AccSig");
Zoom(time=500, sx=$small, sy=$small, step="AccSig");
// 回転を続ける
while(true)
{
Rotate(angle=360, relative=true);
Rotate(time=$time, angle=-360, relative=true);
wait $time;
}
}
// スキップ開始
method Skip()
{
// ぶわっと膨らむ
Opaque(alpha=100%);
Rotate(time=100, angle=-48, relative=true);
Zoom(time=100, sx=120%, sy=120%, step="AccSig");
wait 100;
// 薄くなりながら縮む
Opaque(time=1000, alpha=25%, step="AccSig");
Zoom(time=250, sx=100%, sy=100%, step="AccSig");
// 回転を続ける
while(true)
{
Rotate(angle=360, relative=true);
Rotate(time=1000, angle=-480, relative=true);
wait 1000;
}
}
// スキップからオートへ
method Return(percent $rate=100%)
{
// 大きさ速度を計算
float $x = (sqrt(Float($rate))-1.0)/5.0;
percent $small = 20% + 75%*Percent($x);
int $time = 3000 - Int(2000.0 * $x);
// 縮む
Opaque(alpha=100%);
Rotate(time=$time/4, angle=-90, relative=true);
Zoom(time=250, sx=$small, sy=$small, step="Acc2");
wait $time/4;
// 薄くなる
Opaque(time=1000, alpha=25%, step="AccSig");
// 回転を続ける
while(true)
{
Rotate(angle=360, relative=true);
Rotate(time=$time, angle=-360, relative=true);
wait $time;
}
}
}
// 矢印アニメーション管理クラス
class ArrowRingImage
{
method ArrowRingImage()
{
CreateImage(name="Auto", ox=86-15, oy=86-1
, sx=100%, sy=100%, hit="None"
, image="ArrowAuto.png");
CreateImage(name="Skip", ox=93-2, oy=93-14
, sx=100%, sy=100%, hit="None"
, image="ArrowSkip.png");
}
method OnEnter()
{
Enter(to="Auto");
}
// オートからスキップへ
method Skip()
{
// 尖った矢印になる
Exit(to="Auto");
Enter(to="Skip");
}
// スキップからオートへ
method Auto()
{
// 尖った矢印から元に戻る
Exit(to="Skip");
Enter(to="Auto");
}
}
class CControlButton
{
command $m_order=@Dummy();
method CControlButton(command $order=@Dummy())
{
operate $m_order=$order;
CreateObject(name="Push"
, class=@CPushAction());
}
method OnEnter()
{
SetOrigin(to="*", ox="EvenCenter", oy="EvenMiddle", save=false);
SetSampling(to="*", sampling="BieLinear");
}
method OnButton_Down()
{
Request(to="Push", order=@Push());
System(order=$m_order);
}
method OnButton_Disable()
{
Opaque(to="Normal", time=200, alpha=0%);
}
method OnButton_Enable()
{
Opaque(to="Normal", time=200, alpha=100%);
}
}
class CPushAction
{
method CPushAction()
{
}
method Push()
{
SetOrigin(to="..", ox="Center", oy="Middle");
SetSampling(to="..", sampling="BieLinear");
Zoom(to="..", time=100, sx=90%, sy=90%, step="AccSig");
wait 100;
Zoom(to="..", time=100, sx=100%, sy=100%, step="AccSig");
}
}
//////////////////////////////////////////////////////////////////////////////
// 部品
//////////////////////////////////////////////////////////////////////////////
// キーウエイトアイコン
class CWaitIcon
{
method CWaitIcon()
{
CreateObject(name="L", class=@CFeather());
CreateObject(name="S", class=@CFeather());
}
method OnEnter()
{
}
}
// キーウエイトアイコン(大)
class CFeather
{
method CFeather()
{
CreateImage(name="Image"
, x=0, y=16
, ox="Left", oy="Bottom"
, sx=65%, sy=65%
, image="WaitIcon.png", sampling="BieLinear");
}
method OnEnter()
{
Enter(to="*");
call Action();
}
method Action()
{
while(true)
{
Rotate(to="*", time=0, angle=0);
Rotate(to="*", time=200, angle=-8, step="AccSig");
wait 200;
Rotate(to="*", time=200, angle=0, step="AccSig");
wait 200;
Rotate(to="*", time=200, angle=-8, step="AccSig");
wait 200;
Rotate(to="*", time=200, angle=0, step="AccSig");
wait 200;
wait 500;
// Rotate(to="*", time=500, angle=-4, step="AccSig");
// wait 500;
// Rotate(to="*", time=500, angle=0, step="AccSig");
// wait 500;
}
}
}
/*
// キーウエイトアイコン(大)
class CWaitIconL
{
method CWaitIconL()
{
CreateImage(name="I0", image="WaitIcon01.png", x="InLeft", ox="Center", oy="Middle");
CreateImage(name="I1", image="WaitIcon02.png", x="InLeft", ox="Center", oy="Middle");
CreateImage(name="I2", image="WaitIcon03.png", x="InLeft", ox="Center", oy="Middle");
CreateImage(name="I3", image="WaitIcon04.png", x="InLeft", ox="Center", oy="Middle");
CreateImage(name="I4", image="WaitIcon05.png", x="InLeft", ox="Center", oy="Middle");
CreateImage(name="I5", image="WaitIcon06.png", x="InLeft", ox="Center", oy="Middle");
}
method OnEnter()
{
Enter(to="*");
call Action();
}
method Action()
{
while(true)
{
Opaque(to="*", time=0, alpha=0%);
Rotate(to="*", time=0, angle=0);
Opaque(to="I1", time=200, alpha=100%);
wait 200;
Opaque(to="I2", time=200, alpha=100%);
wait 200;
Opaque(to="I3", time=200, alpha=100%);
wait 200;
Opaque(to="I4", time=200, alpha=100%);
wait 200;
Opaque(to="I5", time=200, alpha=100%);
wait 200;
Opaque(to="I0", time=200, alpha=100%);
wait 200;
Opaque(to="I0,I1,I2,I3,I4,I5", time=1200, alpha=0%);
Rotate(to="*", time=1200, angle=-360);
wait 200;
// Opaque(to="I0", time=1000, alpha=0%);
wait 1000;
}
}
}
// キーウエイトアイコン(小)
class CWaitIconS
{
method CWaitIconS()
{
CreateImage(name="I0", image="WaitIcon01.png", x="InLeft", ox="Center", oy="Middle");
CreateImage(name="I1", image="WaitIcon02.png", x="InLeft", ox="Center", oy="Middle");
CreateImage(name="I2", image="WaitIcon03.png", x="InLeft", ox="Center", oy="Middle");
CreateImage(name="I3", image="WaitIcon04.png", x="InLeft", ox="Center", oy="Middle");
CreateImage(name="I4", image="WaitIcon05.png", x="InLeft", ox="Center", oy="Middle");
CreateImage(name="I5", image="WaitIcon06.png", x="InLeft", ox="Center", oy="Middle");
}
method OnEnter()
{
Enter(to="*");
call Action();
}
method Action()
{
while(true)
{
Opaque(to="*", time=0, alpha=0%);
Rotate(to="*", time=0, angle=0);
Opaque(to="I1", time=200, alpha=100%);
wait 200;
Opaque(to="I2", time=200, alpha=100%);
wait 200;
Opaque(to="I3", time=200, alpha=100%);
wait 200;
Opaque(to="I4", time=200, alpha=100%);
wait 200;
Opaque(to="I5", time=200, alpha=100%);
wait 200;
Opaque(to="I0", time=200, alpha=100%);
wait 200;
Opaque(to="I1,I2,I3,I4,I5", time=200, alpha=0%);
Rotate(to="*", time=1200, angle=-360);
wait 200;
Opaque(to="I0", time=1000, alpha=0%);
wait 1000;
}
}
}*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment