//文件是自动生成,请勿手动修改.此类用于定义通用数据. using System.Collections.Generic; using Thousandto.Code.Center; namespace XLua { //所有的字符串(从lua表获取) public class CfgStringLua { private static string[] strArr = null; public static string Get(int id) { #if UNITY_EDITOR if (UnityEngine.Application.isPlaying) { #endif if (strArr == null) { var strCount = GameCenter.LuaSystem.Adaptor.GetStringDefinedLength(); strArr = new string[strCount]; } if (id < 1 || id > strArr.Length) return null; //如果当前已经存在,直接返回 string str = strArr[id - 1]; if(str == null) { //没有到lua端获取,存到字典中 str = GameCenter.LuaSystem.Adaptor.GetStringByStringDefined(id); if (str == null) { str = ""; } strArr[id - 1] = str; } return str; #if UNITY_EDITOR } else { if (strArr == null) { ObjectCasters.IsLoadStringDefine = true; strArr = GameCenter.LuaSystem.GetGlobalInPath("DataConfig.StringDefines.StringDefine"); if (strArr == null) { GameCenter.LuaSystem.DoString("DataConfig.Load(StringDefines)"); strArr = GameCenter.LuaSystem.GetGlobalInPath("DataConfig.StringDefines.StringDefine"); } ObjectCasters.IsLoadStringDefine = false; } if (id < 1 || id > strArr.Length) return null; return strArr[id - 1]; } #endif } } }