refactoring
This commit is contained in:
@@ -3,8 +3,10 @@ using System;
|
||||
using System.Linq;
|
||||
using WacK;
|
||||
|
||||
public partial class SnapArrows : HBoxContainer
|
||||
namespace WacK.Things.TunnelObjects
|
||||
{
|
||||
public partial class SnapArrows : HBoxContainer
|
||||
{
|
||||
private TextureRect[] arrows = new TextureRect[20];
|
||||
|
||||
// Called when the node enters the scene tree for the first time.
|
||||
@@ -54,4 +56,5 @@ public partial class SnapArrows : HBoxContainer
|
||||
p.X = -Size.X / 2 + noteCtrPos;
|
||||
Position = p;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,12 +13,7 @@ namespace WacK.Things.TunnelObjects
|
||||
shader = (ShaderMaterial) Material;
|
||||
}
|
||||
|
||||
public void SetCW(bool isCW)
|
||||
{
|
||||
shader.SetShaderParameter("isCw", isCW);
|
||||
}
|
||||
|
||||
public void SetPosSize(int pos, int size)
|
||||
public void Init(int pos, int size, bool isCW)
|
||||
{
|
||||
var p = Position;
|
||||
var s = Size;
|
||||
@@ -39,6 +34,7 @@ namespace WacK.Things.TunnelObjects
|
||||
Position = p;
|
||||
Size = s;
|
||||
shader.SetShaderParameter("TileMult", s.Y / 64);
|
||||
shader.SetShaderParameter("isCw", isCW);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,14 +14,6 @@ namespace WacK.Things.TunnelObjects
|
||||
{
|
||||
this.noteData = noteData;
|
||||
SetPosSize((int)noteData.pos, (int)noteData.size);
|
||||
|
||||
// handle swipe arrow color
|
||||
if (noteData.type == NotePlayType.SwipeCW)
|
||||
{
|
||||
var n = (SwipeArrow) FindChild("SwipeArrow");
|
||||
// n.SetCW(noteData.type == NotePlayType.SwipeCW);
|
||||
n.CallDeferred("SetCW", noteData.type == NotePlayType.SwipeCW);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetPosSize(int pos, int size)
|
||||
@@ -44,19 +36,17 @@ namespace WacK.Things.TunnelObjects
|
||||
nSize.X = sizePx;
|
||||
noteBase.SetDeferred("size", nSize);
|
||||
|
||||
// handle swipe arrow pos & size
|
||||
// handle swipe arrow
|
||||
if (noteData.type == NotePlayType.SwipeCW || noteData.type == NotePlayType.SwipeCCW)
|
||||
{
|
||||
var n = (SwipeArrow) FindChild("SwipeArrow");
|
||||
// n.SetPosSize(pos, size);
|
||||
n.CallDeferred("SetPosSize", pos, size);
|
||||
n.CallDeferred("Init", pos, size, noteData.type == NotePlayType.SwipeCW);
|
||||
}
|
||||
|
||||
// handle snap arrow pos & size
|
||||
// handle snap arrow
|
||||
if (noteData.type == NotePlayType.SnapIn || noteData.type == NotePlayType.SnapOut)
|
||||
{
|
||||
var n = (SnapArrows)FindChild("SnapArrows");
|
||||
// n.SetPosSize(pos, size);
|
||||
n.CallDeferred("Init", pos, size, noteData.type == NotePlayType.SnapIn);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user