Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/windows_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:

# Cache
- name: Cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ matrix.projectPath }}/Library
key: ${{ matrix.projectPath }}-${{ matrix.targetPlatform }}-${{
Expand All @@ -35,7 +35,7 @@ jobs:
Library-
# Build
- name: Build
uses: game-ci/unity-builder@v2
uses: game-ci/unity-builder@v4
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
with:
Expand All @@ -44,7 +44,7 @@ jobs:

# Upload Build
- name: Upload Build
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: Build-${{ matrix.targetPlatform }}
path: build/${{ matrix.targetPlatform }}
path: build/${{ matrix.targetPlatform }}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
> [!Note]
> インストール用URLはこちら
> ```
> https://github.com/murasaqi/Unity_TimeMachine.git?path=/jp.iridescent.timemachine#v1.0.0
> https://github.com/murasaqi/Unity_TimeMachine.git?path=/jp.iridescent.timemachine#v1.0.1
> ```
>

Expand Down
20 changes: 13 additions & 7 deletions jp.iridescent.timemachine/Runtime/TimeMachineControlMixer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ public class TimeMachineControlMixer : PlayableBehaviour
public TimelineClip CurrentTimelineClip => currentTimelineClip;
public TimeMachineTrackManager timeMachineTrackManager => trackBinding;

private List<TimelineClip> syncClips = new();

public override void OnPlayableCreate(Playable playable)
{
initialized = false;
Expand Down Expand Up @@ -62,11 +64,10 @@ public override void ProcessFrame(Playable playable, FrameData info, object play
}

double time = playableDirector.time;




var syncClips = new List<TimelineClip>();
syncClips.Clear();

foreach (var clip in clips)
{

Expand All @@ -82,8 +83,15 @@ public override void ProcessFrame(Playable playable, FrameData info, object play

if (timeMachineControlClip.isSyncClip)
{
if (timeMachineControlClip.syncClip.asset != null &&
syncClips.Find(c => c ==timeMachineControlClip.syncClip) == null)
bool foundSyncClip = false;
foreach (var c in syncClips)
if(c == timeMachineControlClip.syncClip)
{
foundSyncClip = true;
break;
}

if (timeMachineControlClip.syncClip.asset != null && !foundSyncClip)
{
clip.start = timeMachineControlClip.syncClip.start;
clip.duration = timeMachineControlClip.syncClip.duration;
Expand All @@ -93,7 +101,6 @@ public override void ProcessFrame(Playable playable, FrameData info, object play
{
timeMachineControlClip.isSyncClip = false;
}

}
}

Expand Down Expand Up @@ -127,7 +134,6 @@ public override void ProcessFrame(Playable playable, FrameData info, object play
timeMachineControlClip.isFireOnClipEnd = false;
}
}
;

for (var i = 0; i < clips.Count; i++)
{
Expand Down
28 changes: 11 additions & 17 deletions jp.iridescent.timemachine/Runtime/TimeMachineDebugViewer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,10 @@ public class TimeMachineDebugViewer : MonoBehaviour
private Dictionary<TimelineClip,ClipButtonGUI> clipButtonTextDictionary = new Dictionary<TimelineClip, ClipButtonGUI>();
[SerializeField] private List<RectTransform> buttonRectTransforms = new List<RectTransform>();

private bool _isPause = false;
private string[] tcFormatArray = null;

private bool isPause = false;

// Start is called before the first frame update
void Start()
{
Init();
Expand Down Expand Up @@ -96,7 +97,7 @@ public void Init()
if(timeMachineTrackManager ==null) return;
var buttonPrefab = Resources.Load<Button>("TimeMachinePrefab/TimeMachineClipButton");



var resetButton = Instantiate(buttonPrefab);
var resetButtonTextMeshProUGUI = resetButton.GetComponentInChildren<TextMeshProUGUI>();
Expand Down Expand Up @@ -159,7 +160,7 @@ public void Init()
pauseAndPlayButtonTextMeshProUGUI.text = "Pause and Play";
pauseAndPlayButton.onClick.AddListener(() =>
{
if (_isPause)
if (isPause)
{
timeMachineTrackManager.Play();
}
Expand All @@ -172,6 +173,8 @@ public void Init()
pauseAndPlayButton.transform.SetParent(clipButtonContainer);
buttonRectTransforms.Add(pauseAndPlayButton.GetComponent<RectTransform>());
buttonRectTransforms.Last().sizeDelta = clipButtonSize;

tcFormatArray = tcFormat.Split();
}

private string GetClipButtonName(TimelineClip clip)
Expand Down Expand Up @@ -209,23 +212,21 @@ private void OnDisable()
DestroyButtons();
}


private void UpdateTC()
{
if(stringBuilder == null)
{
stringBuilder = new StringBuilder();
}

var format = tcFormat.Split();
stringBuilder.Clear();

var fps = (float)timelineAsset.editorSettings.frameRate;
var dateTime = TimeSpan.FromSeconds(timeMachineTrackManager.playableDirector.time);
var currentClip = timeMachineControlTrack.timeMachineControlMixer.CurrentTimelineClip;
var timeMachineControlClip = currentClip.asset as TimeMachineControlClip;
var clipName = currentClip != null ? timeMachineControlClip.sectionName : "null";
foreach (var f in format)
foreach (var f in tcFormatArray)
{
switch (f)
{
Expand Down Expand Up @@ -253,7 +254,7 @@ private void UpdateTC()
}

}
// Update is called once per frame

void Update()
{

Expand All @@ -269,10 +270,6 @@ void Update()
var currentClip = timeMachineControlTrack.timeMachineControlMixer.CurrentTimelineClip;
var timeMachineControlClip = currentClip.asset as TimeMachineControlClip;
if(timeMachineControlClip == null) return;





UpdateTC();

Expand All @@ -285,14 +282,11 @@ void Update()
if (clipTextPair.Key == currentClip)
{
clipButtonGUI.textMeshProUGUI.color = new Color(activeTextColor.r,activeTextColor.g,activeTextColor.b,0.6f + Mathf.Sin(Time.time*4)*0.4f);
clipButtonGUI.textMeshProUGUI.text =GetClipButtonName(clip);
reachCurrentClip = true;

reachCurrentClip = true;
}
else
{
clipTextPair.Value.textMeshProUGUI.color = reachCurrentClip ? defaultTextColor:finishTextColor;
clipTextPair.Value.textMeshProUGUI.text = GetClipButtonName(clip);
}

var progress =Mathf.Clamp( (float)(timeMachineTrackManager.playableDirector.time - clip.start) / (float)(clip.end - clip.start),0f,1f);
Expand Down
Loading