Skip to content

Commit

Permalink
All: Fix various bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
0thElement committed Aug 7, 2024
1 parent 92ba067 commit 53a25a6
Show file tree
Hide file tree
Showing 9 changed files with 155 additions and 13 deletions.
72 changes: 63 additions & 9 deletions Assets/Fonts/NotoSans-Light SDF.asset

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Assets/Materials/Compose/Waveform.mat
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ Material:
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _ToSample: 18909312
- _ToSample: 24155812
- _UVSec: 0
- _ZWrite: 1
m_Colors:
Expand Down
12 changes: 9 additions & 3 deletions Assets/Scripts/Compose/EventsEditor/Group/GroupTable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,18 @@ private void OnRemoveButton()

int index = IndexOf(Selected);
int num = Selected.GroupNumber;
ICommand cmd = new RemoveTimingGroupCommand(I18n.S(

List<ArcEvent> scCamEvents = new List<ArcEvent>();
scCamEvents.AddRange(Services.Gameplay.Chart.GetAll<CameraEvent>().Where(c => c.TimingGroup == num));
scCamEvents.AddRange(Services.Gameplay.Chart.GetAll<ScenecontrolEvent>().Where(s => s.TimingGroup == num));
ICommand tgCmd = new RemoveTimingGroupCommand("", Selected);
ICommand evCmd = new EventCommand("", remove: scCamEvents);
ICommand combination = new CombinedCommand(I18n.S(
"Compose.Notify.GroupTable.RemoveGroup", new Dictionary<string, object>
{
{ "Number", num },
}), Selected);
Services.History.AddCommand(cmd);
}), tgCmd, evCmd);
Services.History.AddCommand(combination);

// Trigger OnEdittingTimingGroup
Values.EditingTimingGroup.Value = Mathf.Min(Selected.GroupNumber, Services.Gameplay.Chart.TimingGroups.Count - 1);
Expand Down
31 changes: 31 additions & 0 deletions Assets/Scripts/Gameplay/Camera/CameraService.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using ArcCreate.Gameplay.Chart;
using ArcCreate.Gameplay.Data;
using ArcCreate.Utility.Extension;
using UnityEngine;
Expand Down Expand Up @@ -107,6 +108,36 @@ public void Remove(IEnumerable<CameraEvent> events)
RebuildList();
}

public void RemoveTimingGroup(TimingGroup group)
{
events.RemoveAll(e => e.TimingGroup == group.GroupNumber);

foreach (var cam in events)
{
if (cam.TimingGroup > group.GroupNumber)
{
cam.TimingGroup -= 1;
cam.ResetTimingGroupChangedFrom();
}
}

RebuildList();
}

public void InsertTimingGroup(TimingGroup group)
{
foreach (var cam in events)
{
if (cam.TimingGroup >= group.GroupNumber)
{
cam.TimingGroup += 1;
cam.ResetTimingGroupChangedFrom();
}
}

RebuildList();
}

public IEnumerable<CameraEvent> FindByTiming(int from, int to)
{
for (int i = 0; i < events.Count; i++)
Expand Down
5 changes: 5 additions & 0 deletions Assets/Scripts/Gameplay/Camera/ICameraService.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using ArcCreate.Gameplay.Chart;
using ArcCreate.Gameplay.Data;
using UnityEngine;

Expand Down Expand Up @@ -67,6 +68,10 @@ public interface ICameraService : ICameraControl
/// <param name="events">The events collection.</param>
void Change(IEnumerable<CameraEvent> events);

void RemoveTimingGroup(TimingGroup group);

void InsertTimingGroup(TimingGroup group);

/// <summary>
/// Clear all events.
/// </summary>
Expand Down
5 changes: 5 additions & 0 deletions Assets/Scripts/Gameplay/Chart/ChartService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,8 @@ public TimingGroup GetTimingGroup(int tg)

public void RemoveTimingGroup(TimingGroup group)
{
Services.Camera.RemoveTimingGroup(group);
Services.Scenecontrol.RemoveTimingGroup(group);
for (int i = 0; i < timingGroups.Count; i++)
{
if (timingGroups[i] == group)
Expand All @@ -443,6 +445,9 @@ public void RemoveTimingGroup(TimingGroup group)

public void InsertTimingGroup(TimingGroup group)
{
Services.Camera.InsertTimingGroup(group);
Services.Scenecontrol.InsertTimingGroup(group);

if (string.IsNullOrEmpty(group.GroupProperties.FileName))
{
group.GroupProperties.FileName = timingGroups[0].GroupProperties.FileName;
Expand Down
5 changes: 5 additions & 0 deletions Assets/Scripts/Gameplay/Scenecontrol/IScenecontrolService.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using ArcCreate.Gameplay.Chart;
using ArcCreate.Gameplay.Data;
using TMPro;

Expand Down Expand Up @@ -57,6 +58,10 @@ public interface IScenecontrolService : IScenecontrolControl
/// <param name="events">The events collection.</param>
void Change(IEnumerable<ScenecontrolEvent> events);

void RemoveTimingGroup(TimingGroup group);

void InsertTimingGroup(TimingGroup group);

/// <summary>
/// Clear all events.
/// </summary>
Expand Down
31 changes: 31 additions & 0 deletions Assets/Scripts/Gameplay/Scenecontrol/ScenecontrolService.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Collections.Generic;
using ArcCreate.ChartFormat;
using ArcCreate.Gameplay.Chart;
using ArcCreate.Gameplay.Data;
using ArcCreate.Utility.Extension;
using Cysharp.Threading.Tasks;
Expand Down Expand Up @@ -76,6 +77,36 @@ public void Remove(IEnumerable<ScenecontrolEvent> events)
RebuildList();
}

public void RemoveTimingGroup(TimingGroup group)
{
events.RemoveAll(e => e.TimingGroup == group.GroupNumber);

foreach (var sc in events)
{
if (sc.TimingGroup > group.GroupNumber)
{
sc.TimingGroup -= 1;
sc.ResetTimingGroupChangedFrom();
}
}

RebuildList();
}

public void InsertTimingGroup(TimingGroup group)
{
foreach (var sc in events)
{
if (sc.TimingGroup >= group.GroupNumber)
{
sc.TimingGroup += 1;
sc.ResetTimingGroupChangedFrom();
}
}

RebuildList();
}

public IEnumerable<ScenecontrolEvent> FindByTiming(int from, int to)
{
int i = events.BisectLeft(from, n => n.Timing);
Expand Down
5 changes: 5 additions & 0 deletions Assets/Scripts/Storage/StorageData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,11 @@ public PackStorage GetLastSelectedPack()

public CharacterStorage GetSelectedCharacter()
{
if (CharacterCollection.Count() == 1)
{
return CharacterCollection.FindAll().First();
}

string id = PlayerPrefs.GetString("Selection.LastCharacter", null);
if (id == null)
{
Expand Down

0 comments on commit 53a25a6

Please sign in to comment.