12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- #if UNITY_EDITOR
- using System.Collections.Generic;
- using UnityEngine;
- using DataTools;
- using System.Linq;
- using UnityEditor;
- public class GigActionDataFiller : MonoBehaviour
- {
- public GigsGigActionsData data;
- public TextAsset text;
- public void CopyFormTextToData()
- {
- string[] cols;
- List<GigsGigActionChart> chartList = new List<GigsGigActionChart>();
- int i = -1;
- GigsGigActions current = null;
- string txt = text.text.Replace("\r", "");
- foreach(string row in txt.Split('\n'))
- {
- cols = row.Split(';');
- if(cols.Length == 1)
- {
- if(current != null)
- current.gigsGigActionChart = chartList.ToArray();
- if(cols[0] == "END")
- continue;
- DataTools.GigType type = WebTools.Phone.TweetBehaviour.GetGigTypeFromString(cols[0]);
- current = data.GigsGigActions.Where(x => x.type == type).First();
- chartList.Clear();
- }
- if(cols.Length == 6)
- {
- GigsGigActionChart temp = new GigsGigActionChart();
- temp.gigId = cols[0];
- temp.motivationCost = int.Parse(cols[1]);
- temp.starsAmmount = int.Parse(cols[2]);
- temp.motivationReward = int.Parse(cols[3]);
- temp.dollarsReward = int.Parse(cols[4]);
- temp.xpReward = int.Parse(cols[5]);
- chartList.Add(temp);
- }
- }
- CopyCharts(DataTools.GigType.Photoshoot, DataTools.GigType.Practice);
- EditorUtility.SetDirty(data);
- AssetDatabase.SaveAssets();
- }
- public void CopyCharts(DataTools.GigType t_from, DataTools.GigType t_to)
- {
- GigsGigActions g_from = data.GigsGigActions.Where(x => x.type == t_from).First();
- GigsGigActions g_to = data.GigsGigActions.Where(x => x.type == t_to).First();
- g_to.gigsGigActionChart = g_from.gigsGigActionChart;
- }
- }
- #endif
|