123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class GigDataHelper : MonoBehaviour
- {
- public DataTools.DataGame dataGame;
- public DataTools.DataGigComments dataComments;
- public int chapterIndex = 0;
- private void GEN_CREW()
- {
- DataTools.Chapter chapter = dataGame.GameData.Chapters[chapterIndex];
- foreach(DataTools.Gig gig in chapter.Gigs)
- {
- string location = gig.Location;
- int table_i = dataComments.tablesList.FindIndex(t => t.locationId == location);
- if(table_i == -1)
- {
- dataComments.tablesList.Add(new DataTools.GigCommentsTable(location, new List<DataTools.GigCommentSheet>()));
- table_i = dataComments.tablesList.Count - 1;
- }
- string gigId = gig.Id;
- int sheet_i = dataComments.tablesList[table_i].sheetsList.FindIndex(s => s.gigId == gigId);
- if(sheet_i == -1)
- {
- dataComments.tablesList[table_i].sheetsList.Add(new DataTools.GigCommentSheet(gigId, new List<DataTools.GigComment>(), new List<string>()));
- sheet_i = dataComments.tablesList[table_i].sheetsList.Count - 1;
- }
- DataTools.Conversation c = dataGame.GameData.GetConversationById(gig.Conversation != null ? gig.Conversation : "", chapterIndex);
- List<string> crew = c!=null ? c.NpcId : null;
- if (crew != null)
- {
- dataComments.tablesList[table_i].sheetsList[sheet_i].crewList.Clear();
- dataComments.tablesList[table_i].sheetsList[sheet_i].crewList.AddRange(crew);
- }
- }
- #if UNITY_EDITOR
- UnityEditor.EditorUtility.SetDirty(dataComments);
- UnityEditor.AssetDatabase.SaveAssets();
- #endif
- }
- void Start ()
- {
- GEN_CREW();
- }
- }
|