132 lines
3.8 KiB
C#
132 lines
3.8 KiB
C#
using LitJson;
|
|
using Wizard;
|
|
using Wizard.Story;
|
|
|
|
public class StorySectionData
|
|
{
|
|
private static readonly string FORMAT_STORY_SECTION_NO = "story_section_no_{0:D2}";
|
|
|
|
public int Id { get; }
|
|
|
|
public int AllStoryOrderId { get; }
|
|
|
|
public string NameNo { get; }
|
|
|
|
public string Name { get; }
|
|
|
|
public string ImageName { get; }
|
|
|
|
public string OffStateButtonTextureName { get; }
|
|
|
|
public string OnStateButtonTextureName { get; }
|
|
|
|
public bool IsLeaderSelect { get; }
|
|
|
|
public bool IsFinish { get; }
|
|
|
|
public bool IsUnderMaintenance { get; }
|
|
|
|
public int ReleasedCharaCount { get; }
|
|
|
|
public int FinishedCharaCount { get; }
|
|
|
|
public int BackGroundId { get; }
|
|
|
|
public StoryApiType StoryApiType { get; }
|
|
|
|
public bool IsNew { get; }
|
|
|
|
public bool IsSpoiler { get; }
|
|
|
|
public string SpoilerMessage { get; }
|
|
|
|
public UIManager.ViewScene ChapterSelectionView { get; }
|
|
|
|
public bool IsPlayAnotherEndingAppearanceAnimation { get; }
|
|
|
|
public bool IsTutorialCategory => Id == StorySection.TUTORIAL_SECTION_ID;
|
|
|
|
public StorySectionData(JsonData jsonData)
|
|
{
|
|
Id = jsonData["section_id"].ToInt();
|
|
AllStoryOrderId = jsonData["all_story_order_id"].ToInt();
|
|
NameNo = GetNameNoText(jsonData);
|
|
Name = GetNameText(jsonData);
|
|
ImageName = jsonData["image_name"].ToString();
|
|
OffStateButtonTextureName = GetOffStateButtonTextureName(jsonData);
|
|
OnStateButtonTextureName = GetOnStateButtonTextureName(jsonData);
|
|
IsLeaderSelect = jsonData["is_leader_select"].ToBoolean();
|
|
IsFinish = jsonData["is_finished"].ToBoolean();
|
|
IsUnderMaintenance = jsonData["is_under_maintenance"].ToBoolean();
|
|
ReleasedCharaCount = jsonData["released_chara_count"].ToInt();
|
|
FinishedCharaCount = jsonData["finished_chara_count"].ToInt();
|
|
BackGroundId = jsonData["back_ground_id"].ToInt();
|
|
IsNew = jsonData["is_new"].ToBoolean();
|
|
IsSpoiler = jsonData.GetValueOrDefault("is_spoiler", defaultValue: false);
|
|
if (IsSpoiler)
|
|
{
|
|
SpoilerMessage = jsonData.GetValueOrDefault("spoiler_message", string.Empty);
|
|
}
|
|
StoryApiType = GetStoryApiType(jsonData["story_type_overwrite"].ToInt());
|
|
ChapterSelectionView = GetChapterSelectionView(jsonData);
|
|
IsPlayAnotherEndingAppearanceAnimation = jsonData["is_play_another_end_appearance_animation"].ToBoolean();
|
|
}
|
|
|
|
public StorySectionData(int id, int backgroundId, UIManager.ViewScene chapterSelectionView)
|
|
{
|
|
Id = id;
|
|
BackGroundId = backgroundId;
|
|
ChapterSelectionView = chapterSelectionView;
|
|
}
|
|
|
|
private static string GetNameNoText(JsonData jsonData)
|
|
{
|
|
int num = jsonData["section_id"].ToInt();
|
|
string key = string.Format(FORMAT_STORY_SECTION_NO, num);
|
|
return Data.Master.GetStorySectionTitleText(key);
|
|
}
|
|
|
|
private static string GetNameText(JsonData jsonData)
|
|
{
|
|
string key = jsonData["name"].ToString();
|
|
return Data.Master.GetStorySectionTitleText(key);
|
|
}
|
|
|
|
private static string GetOffStateButtonTextureName(JsonData jsonData)
|
|
{
|
|
return jsonData["image_name"].ToString() + "_off";
|
|
}
|
|
|
|
private static string GetOnStateButtonTextureName(JsonData jsonData)
|
|
{
|
|
return jsonData["image_name"].ToString() + "_on";
|
|
}
|
|
|
|
private static UIManager.ViewScene GetChapterSelectionView(JsonData jsonData)
|
|
{
|
|
if (jsonData["chapter_select_type"].ToInt() != 2)
|
|
{
|
|
return UIManager.ViewScene.AreaSelect;
|
|
}
|
|
return UIManager.ViewScene.StoryChapterSelectionFlowChart;
|
|
}
|
|
|
|
private static StoryApiType GetStoryApiType(int storyTypeOverwrite)
|
|
{
|
|
switch (storyTypeOverwrite)
|
|
{
|
|
case 0:
|
|
return StoryApiType.None;
|
|
case 1:
|
|
return StoryApiType.MainStory;
|
|
case 2:
|
|
return StoryApiType.LimitedStory;
|
|
case 3:
|
|
return StoryApiType.EventStory;
|
|
default:
|
|
Debug.LogError("StorySectionのstory_type_overwriteに想定外の値が設定された");
|
|
return StoryApiType.None;
|
|
}
|
|
}
|
|
}
|