1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- using System;
- using System.Collections.Generic;
- using UnityEngine;
- [ExecuteInEditMode]
- [CreateAssetMenu(fileName = "LocationsInfo", menuName = "EditorDatas/LocationsInfo", order = 1)]
- public class DataLocationsInfo : ScriptableObject
- {
- [Serializable]
- public struct City
- {
- public string name;
- public List<string> places;
- }
- [Serializable]
- public struct State
- {
- public string name;
- public List<City> cities;
- }
- public List<State> states = new List<State>();
- public void GetLocationData(string locId, out string locCity, out string locState)
- {
- locCity = "";
- locState = "";
- foreach(State state in states)
- {
- foreach(City city in state.cities)
- {
- foreach(string place in city.places)
- {
- if(place.ToUpper() == locId.ToUpper())
- {
- locCity = city.name;
- locState = state.name;
- return;
- }
- }
- }
- }
- }
- }
|