This commit is contained in:
SoulliesOfficial
2025-07-26 04:20:25 -04:00
parent bae0bfbc20
commit abf81ece7b
196 changed files with 3909 additions and 964 deletions

View File

@@ -41,8 +41,9 @@ namespace Ichni.Story
public void SetDialog(string dialogName)
{
string chapter = ChapterSelectionManager.instance.currentChapter.chapterName;
string chapter = ChapterSelectionManager.instance.currentChapter.chapterIndex;
TextAsset dialog = Resources.Load<TextAsset>("Story/" + chapter + "/Dialogs/" + dialogName);
dialogUIPage.dialogContentFrame.ClearAllSentences();
SetDialog(new List<TextAsset> { dialog });
}
@@ -53,12 +54,10 @@ namespace Ichni.Story
isPlayingDialog = true;
currentDialog = "NULL";
LoadDialog(dialogFiles, out string firstHeader);
Debug.Log($"Loaded dialog, first header: {firstHeader}");
currentDialog = dialogParagraphName == "" ? firstHeader : dialogParagraphName;
Debug.Log($"Setting dialog to: {currentDialog}");
}
public void PlayNextDialogParagraph(string nextDialog, bool invokeFunctions = true)
@@ -138,6 +137,9 @@ namespace Ichni.Story
{
StoryManager.instance.storyline.currentBlock.state = StoryBlockState.Completed;
isPlayingDialog = false;
dialogUIPage.FadeOut();
Debug.Log("Dialog completed, setting block state to Completed.");
StoryManager.instance.storyline.SaveStoryline(ChapterSelectionManager.instance.currentChapter.chapterIndex);
}
}
@@ -145,7 +147,7 @@ namespace Ichni.Story
{
string finalType;
int max = 0;
Debug.Log($"Revealing dialog: {currentDialog}, currentFinalType: {currentFinalType}");
do
{
finalType = currentFinalType;

View File

@@ -26,6 +26,7 @@ namespace Ichni.Story
FunctionInterpreter.SetFunction("GetVariable", new Func<string, int>(GetStoryVariable));
FunctionInterpreter.SetFunction("GenerateDialogBlock", new Action<string>(GenerateDialogBlock));
FunctionInterpreter.SetFunction("GenerateSongBlock", new Action<string>(GenerateSongBlock));
FunctionInterpreter.SetFunction("SetUnlockKey", new Action<string>(SetUnlockKey));
}
static void SetConditionInterpreter()
@@ -75,5 +76,13 @@ namespace Ichni.Story
SongBlockUI newBlock = StoryManager.instance.storyline.GenerateSongBlock(blockName, currentBlock.blockPosition + positionOffset, StoryBlockState.Current);
StoryManager.instance.storyline.GenerateConnector(currentBlock, newBlock);
}
static void SetUnlockKey(string key)
{
if (GameSaveManager.instance.SongSaveModule.unlockKeys.Add(key))
{
GameSaveManager.instance.SongSaveModule.SaveUnlockKeys();
}
}
}
}

View File

@@ -26,7 +26,12 @@ namespace Ichni.Story
public partial class StoryManager
{
[Button]
public void ClearAllStorySave()
{
GameSaveManager.instance.StorySaveModule.ClearAllStoryline();
GameSaveManager.instance.SongSaveModule.ClearUnlock();
}
}
public enum StoryBlockState

View File

@@ -25,6 +25,8 @@ namespace Ichni.Story.UI
button.onClick.AddListener(() =>
{
state = this.state;
if(state == StoryBlockState.Locked) return;
StoryManager.instance.storyline.currentBlock = this;

View File

@@ -45,33 +45,30 @@ namespace Ichni.Story.UI
{
SongStatusSave songStatusSave = GameSaveManager.instance.SongSaveModule.songStatusSaves[songName];
string chapter = ChapterSelectionManager.instance.currentChapter.chapterName;
string chapter = ChapterSelectionManager.instance.currentChapter.chapterIndex;
ChapterSelectionUnit cpt = ChapterSelectionManager.instance.chapters.First(c => c.chapterIndex == chapter);
SongItemData song = cpt.songs.First(s => s.songName == this.songName);
foreach (DifficultyData difficulty in song.difficultyDataList)
for (var index = 0; index < song.difficultyDataList.Count; index++)
{
foreach (KeyValuePair<string, BeatmapSave> beatmapSave in songStatusSave.beatmapSaves)
var difficulty = song.difficultyDataList[index];
var beatmapSave = songStatusSave.beatmapSaves[index];
if (beatmapSave.isAllPerfect)
{
if (beatmapSave.Key == difficulty.difficultyName)
{
if (beatmapSave.Value.isAllPerfect)
{
GameObject mark = Instantiate(beatmapStatusMarkPrefab, beatmapStatusMarkContainer);
mark.GetComponent<Image>().color = difficulty.color;
mark.transform.GetChild(0).GetComponent<TMP_Text>().color = difficulty.color;
mark.transform.GetChild(0).GetComponent<TMP_Text>().text = "AP";
break;
}
if (beatmapSave.Value.isFullCombo)
{
GameObject mark = Instantiate(beatmapStatusMarkPrefab, beatmapStatusMarkContainer);
mark.GetComponent<Image>().color = difficulty.color;
mark.transform.GetChild(0).GetComponent<TMP_Text>().color = difficulty.color;
mark.transform.GetChild(0).GetComponent<TMP_Text>().text = "FC";
break;
}
}
GameObject mark = Instantiate(beatmapStatusMarkPrefab, beatmapStatusMarkContainer);
mark.GetComponent<Image>().color = difficulty.color;
mark.transform.GetChild(0).GetComponent<TMP_Text>().color = difficulty.color;
mark.transform.GetChild(0).GetComponent<TMP_Text>().text = "AP";
break;
}
if (beatmapSave.isFullCombo)
{
GameObject mark = Instantiate(beatmapStatusMarkPrefab, beatmapStatusMarkContainer);
mark.GetComponent<Image>().color = difficulty.color;
mark.transform.GetChild(0).GetComponent<TMP_Text>().color = difficulty.color;
mark.transform.GetChild(0).GetComponent<TMP_Text>().text = "FC";
break;
}
}
}

View File

@@ -28,7 +28,7 @@ namespace Ichni.Story.UI
int cIndex = index; // Capture the current index for the listener
GameObject choiceButton = Instantiate(choiceButtonPrefab, container);
choiceButton.GetComponentInChildren<Localize>().SetTerm(ChapterSelectionManager.instance.currentChapter + "/" + choice.choiceText);
choiceButton.GetComponentInChildren<Localize>().SetTerm(ChapterSelectionManager.instance.currentChapter.chapterIndex + "/" + choice.choiceText);
choiceButton.GetComponent<Button>().onClick.AddListener(() =>
{
DialogManager.instance.PlayNextDialogParagraph(choice.nextDialogName);

View File

@@ -27,7 +27,7 @@ namespace Ichni.Story
{
DialogTextUI dialogTextUI = Instantiate(textPrefab, dialogContentContainer).GetComponent<DialogTextUI>();
dialogTextUI.speakerNameText.SetTerm("Characters/" + speakerName);
dialogTextUI.contentText.SetTerm(ChapterSelectionManager.instance.currentChapter +"/" +content);
dialogTextUI.contentText.SetTerm(ChapterSelectionManager.instance.currentChapter.chapterIndex +"/" +content);
dialogTexts.Add(dialogTextUI);
}

View File

@@ -5,11 +5,22 @@ using Ichni.UI;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.Serialization;
using UnityEngine.UI;
namespace Ichni.Story.UI
{
public class DialogUIPage : UIPageBase
{
public Button closeButton;
public DialogContentFrame dialogContentFrame;
private void Start()
{
closeButton.onClick.AddListener(() =>
{
FadeOut();
dialogContentFrame.ClearAllSentences();
});
}
}
}

View File

@@ -40,14 +40,7 @@ namespace Ichni.Story.UI
tutorialBlocks = new List<TutorialBlockUI>();
connectors = new List<BlockConnectorUI>();
//TutorialBlockUI t0 = GenerateTutorialBlock(new Vector2(200, -400), "ZakoCurse 0");
//TextBlockUI b1 = GenerateTextBlock("Departure_P1_A", new Vector2(1000, -400), StoryBlockState.Current);
SetUpStoryline(ChapterSelectionManager.instance.currentChapter.chapterName);
/*GenerateTextBlock("Departure_P1_A", new Vector2(1000, -400), StoryBlockState.Current);
GenerateTextBlock("Departure_P2_A", new Vector2(1500, -400), StoryBlockState.Current);
GenerateConnector("Departure_P1_A", "Departure_P2_A");*/
SetUpStoryline(ChapterSelectionManager.instance.currentChapter.chapterIndex);
SetUpBackground();
connectionContainer.SetParent(content);
@@ -60,7 +53,7 @@ namespace Ichni.Story.UI
public TutorialBlockUI GenerateTutorialBlock(string blockName, Vector2 position, StoryBlockState state)
{
TutorialBlockUI block = Instantiate(tutorialBlockPrefab, content).GetComponent<TutorialBlockUI>();
StoryData storyData = StoryManager.instance.storyDatas[ChapterSelectionManager.instance.currentChapter.chapterName];
StoryData storyData = StoryManager.instance.storyDatas[ChapterSelectionManager.instance.currentChapter.chapterIndex];
TutorialBlockData blockData = storyData.tutorialBlockDatas.FirstOrDefault(data => data.blockName == blockName);
if (blockData == null) throw new KeyNotFoundException("There is no block with name " + blockName);
@@ -76,7 +69,7 @@ namespace Ichni.Story.UI
public DialogBlockUI GenerateDialogBlock(string blockName, Vector2 position, StoryBlockState state)
{
DialogBlockUI block = Instantiate(dialogBlockPrefab, content).GetComponent<DialogBlockUI>();
StoryData storyData = StoryManager.instance.storyDatas[ChapterSelectionManager.instance.currentChapter.chapterName];
StoryData storyData = StoryManager.instance.storyDatas[ChapterSelectionManager.instance.currentChapter.chapterIndex];
DialogBlockData blockData = storyData.dialogBlockDatas.FirstOrDefault(data => data.blockName == blockName);
if (blockData == null) throw new KeyNotFoundException("There is no block with name " + blockName);
@@ -92,7 +85,7 @@ namespace Ichni.Story.UI
public SongBlockUI GenerateSongBlock(string blockName, Vector2 position, StoryBlockState state)
{
SongBlockUI block = Instantiate(musicBlockPrefab, content).GetComponent<SongBlockUI>();
StoryData storyData = StoryManager.instance.storyDatas[ChapterSelectionManager.instance.currentChapter.chapterName];
StoryData storyData = StoryManager.instance.storyDatas[ChapterSelectionManager.instance.currentChapter.chapterIndex];
SongBlockData blockData = storyData.songBlockDatas.FirstOrDefault(data => data.blockName == blockName);
if (blockData == null) throw new KeyNotFoundException("There is no block with name " + blockName);
@@ -194,32 +187,32 @@ namespace Ichni.Story.UI
public partial class Storyline
{
public void SetUpStoryline(string chapterName)
public void SetUpStoryline(string chapterIndex)
{
if (GameSaveManager.instance.StorySaveModule.IsNewStoryline(chapterName))
if (GameSaveManager.instance.StorySaveModule.IsNewStoryline(chapterIndex))
{
ResetStory(chapterName);
ResetStory(chapterIndex);
return;
}
GameSaveManager.instance.StorySaveModule.LoadStoryline(chapterName);
GameSaveManager.instance.StorySaveModule.LoadStoryline(chapterIndex);
foreach (var blockSave in GameSaveManager.instance.StorySaveModule.tutorialBlockSaves[chapterName])
foreach (var blockSave in GameSaveManager.instance.StorySaveModule.tutorialBlockSaves[chapterIndex])
{
GenerateTutorialBlock(blockSave.blockName, blockSave.position, blockSave.state);
}
foreach (var blockSave in GameSaveManager.instance.StorySaveModule.songBlockSaves[chapterName])
foreach (var blockSave in GameSaveManager.instance.StorySaveModule.songBlockSaves[chapterIndex])
{
GenerateSongBlock(blockSave.blockName, blockSave.position, blockSave.state);
}
foreach (var blockSave in GameSaveManager.instance.StorySaveModule.dialogBlockSaves[chapterName])
foreach (var blockSave in GameSaveManager.instance.StorySaveModule.dialogBlockSaves[chapterIndex])
{
GenerateDialogBlock(blockSave.blockName, blockSave.position, blockSave.state);
}
foreach (var connectorSave in GameSaveManager.instance.StorySaveModule.connectorSaves[chapterName])
foreach (var connectorSave in GameSaveManager.instance.StorySaveModule.connectorSaves[chapterIndex])
{
GenerateConnector(connectorSave.startBlockName, connectorSave.endBlockName);
}