| | |
| | | bool isPlaying = true;
|
| | |
|
| | | bool m_Inited = false;
|
| | | public bool inited
|
| | | {
|
| | | public bool inited {
|
| | | get { return m_Inited; }
|
| | | private set { m_Inited = value; }
|
| | | }
|
| | |
| | |
|
| | | public void LoadPriorBundleConfig()
|
| | | {
|
| | | StartSyncTask<PriorBundleConfig>(AssetPath.Resource);
|
| | | StartSyncTask<PriorBundleConfig>();
|
| | | }
|
| | |
|
| | | public void PreLoadConfigs()
|
| | | {
|
| | | StartSyncTask<PriorBundleConfig>(AssetPath.Resource);
|
| | | StartSyncTask<PriorLanguageConfig>(AssetPath.Resource);
|
| | | StartSyncTask<ContactConfig>(AssetPath.Resource);
|
| | | StartSyncTask<HelpInfoConfig>(AssetPath.Resource);
|
| | | StartSyncTask<PriorBundleConfig>();
|
| | | StartSyncTask<PriorLanguageConfig>();
|
| | | StartSyncTask<ContactConfig>();
|
| | | StartSyncTask<HelpInfoConfig>();
|
| | | }
|
| | |
|
| | | List<ConfigTask> configTasks = new List<ConfigTask>();
|
| | |
|
| | | public IEnumerator Co_LoadConfigs()
|
| | | {
|
| | | StartSyncTask<LoginSeverListConfig>(AssetSource.refdataFromEditor ? AssetPath.ResourceOut : AssetPath.External);
|
| | | StartSyncTask<LoginSeverListConfig>();
|
| | | AddAsyncTask<IconConfig>();
|
| | | AddAsyncTask<ItemConfig>();
|
| | | AddAsyncTask<SkillConfig>();
|
| | |
| | |
|
| | | public void SyncLoadConfigs()
|
| | | {
|
| | | StartSyncTask<NPCConfig>(AssetPath.ResourceOut);
|
| | | StartSyncTask<ModelResConfig>(AssetPath.ResourceOut);
|
| | | StartSyncTask<ActorShowConfig>(AssetPath.ResourceOut);
|
| | | StartSyncTask<IconConfig>(AssetPath.ResourceOut);
|
| | | StartSyncTask<SysInfoConfig>(AssetPath.ResourceOut);
|
| | | StartSyncTask<LanguageConfig>(AssetPath.ResourceOut);
|
| | | StartSyncTask<RealmConfig>(AssetPath.ResourceOut);
|
| | | StartSyncTask<NPCConfig>();
|
| | | StartSyncTask<ModelResConfig>();
|
| | | StartSyncTask<ActorShowConfig>();
|
| | | StartSyncTask<IconConfig>();
|
| | | StartSyncTask<SysInfoConfig>();
|
| | | StartSyncTask<LanguageConfig>();
|
| | | StartSyncTask<RealmConfig>();
|
| | | }
|
| | |
|
| | | public bool AllCompleted()
|
| | |
| | | path = AssetVersionUtility.GetAssetFilePath(StringUtility.Contact("config/", fileName, ".txt"));
|
| | | }
|
| | |
|
| | | var task = new ConfigTask(typeof(T), AssetSource.refdataFromEditor ? AssetPath.ResourceOut : AssetPath.External, path);
|
| | | var task = new ConfigTask(typeof(T), path);
|
| | | Action<ConfigTask> launch = (ConfigTask _task) => { ReadFile(_task, OnEndReadFile<T>); };
|
| | | task.launch = launch;
|
| | | configTasks.Add(task);
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | private void StartSyncTask<T>(AssetPath _assetPath) where T : ConfigBase, new()
|
| | | private void StartSyncTask<T>() where T : ConfigBase, new()
|
| | | {
|
| | | var typeName = typeof(T).Name;
|
| | | var fileName = typeName.Substring(0, typeName.Length - 6);
|
| | | string[] lines = null;
|
| | | var path = string.Empty;
|
| | |
|
| | | switch (_assetPath)
|
| | | if (AssetSource.refdataFromEditor)
|
| | | {
|
| | | case AssetPath.Resource:
|
| | | path = AssetVersionUtility.GetBuiltInAssetFilePath(StringUtility.Contact("config/", fileName, ".txt"));
|
| | | if (File.Exists(path))
|
| | | {
|
| | | lines = File.ReadAllLines(path, Encoding.UTF8);
|
| | | }
|
| | | else
|
| | | {
|
| | | path = StringUtility.Contact("Config/", fileName);
|
| | | var textAsset = Resources.Load<TextAsset>(path);
|
| | | lines = textAsset.text.Split(new string[] { "\r\n" }, StringSplitOptions.None);
|
| | | }
|
| | | break;
|
| | | case AssetPath.ResourceOut:
|
| | | path = StringUtility.Contact(ResourcesPath.CONFIG_FODLER, "/", fileName, ".txt");
|
| | | lines = File.ReadAllLines(path, Encoding.UTF8);
|
| | | break;
|
| | | case AssetPath.External:
|
| | | path = AssetVersionUtility.GetAssetFilePath(StringUtility.Contact("config/", fileName, ".txt"));
|
| | | lines = File.ReadAllLines(path, Encoding.UTF8);
|
| | | break;
|
| | | path = ResourcesPath.CONFIG_FODLER + "/" + fileName + ".txt";
|
| | | }
|
| | | else
|
| | | {
|
| | | path = AssetVersionUtility.GetAssetFilePath(StringUtility.Contact("config/", fileName, ".txt"));
|
| | | }
|
| | |
|
| | | var task = new ConfigTask(typeof(T), _assetPath, path);
|
| | | task.contentLines = lines;
|
| | | if (lines != null && lines.Length > 3)
|
| | | var task = new ConfigTask(typeof(T), path);
|
| | | task.contentLines = File.ReadAllLines(path, Encoding.UTF8);
|
| | | if (task.contentLines != null && task.contentLines.Length > 3)
|
| | | {
|
| | | var length = Mathf.Max(lines.Length - 3, 0);
|
| | | var length = Mathf.Max(task.contentLines.Length - 3, 0);
|
| | | task.capacity = length;
|
| | | task.container = new Dictionary<string, ConfigBase>(length);
|
| | | task.state = TaskState.ReadFileSuccess;
|
| | |
| | | public readonly Type type;
|
| | | public readonly int token;
|
| | | public readonly string taskName;
|
| | | public readonly AssetPath assetPath;
|
| | | public readonly string filePath;
|
| | |
|
| | | public Action<ConfigTask> launch;
|
| | |
| | | public Dictionary<string, ConfigBase> container;
|
| | | public TaskState state = TaskState.None;
|
| | |
|
| | | public ConfigTask(Type _type, AssetPath _assetPath, string _filePath)
|
| | | public ConfigTask(Type _type, string _filePath)
|
| | | {
|
| | | type = _type;
|
| | | assetPath = _assetPath;
|
| | | taskName = type.Name;
|
| | | token = type.MetadataToken;
|
| | |
|