コード例 #1
0
        public static Table GetTable(string tablePath)
        {
            var id = AssetId.Parse(tablePath, _DefaultBundle);

            for (var i = 0; i < 2; i++)
            {
                if (_Tables.TryGetValue(id, out var value) && value.UnDeserialized == null)
                {
                    return(value.Deserialized);
                }

                if (value.UnDeserialized != null)
                {
                    value.Deserialized =
                        new Table(JsonConvert.DeserializeObject <JsonTableReciever>(value.UnDeserialized));
                    value.UnDeserialized = null;
                    _Tables[id]          = value;
                    return(value.Deserialized);
                }

                LoadBundle(id);

                Assert.IsTrue(_Tables.TryGetValue(id, out _),
                              $"未在 {id.Bundle} 内找到名为 {id.Name} 的table");
            }

            return(default);
コード例 #2
0
ファイル: DataBaseSys.cs プロジェクト: t61789/Thunder
        public static Table GetTable(string tablePath)
        {
            var id = AssetId.Parse(tablePath);

            for (var i = 0; i < 2; i++)
            {
                if (_Tables.TryGetValue(id, out var value) && string.IsNullOrEmpty(value.UnDeserialized))
                {
                    return(value.Deserialized);
                }

                if (value.UnDeserialized != null)
                {
                    value.Deserialized =
                        new Table(JsonConvert.DeserializeObject <JsonTableReceiver>(value.UnDeserialized));
                    value.UnDeserialized = null;
                    _Tables[id]          = value;
                    return(value.Deserialized);
                }

                LoadBundle(id);

                if (!_Tables.TryGetValue(id, out _))
                {
                    throw new Exception($"未在 {id.Bundle} 内找到名为 {id.Name} 的table");
                }
            }

            return(default);
コード例 #3
0
        /// <summary>
        ///     删除指定bundle的所有表
        /// </summary>
        /// <param name="bundlePath"></param>
        public static void DeleteAllTable(string bundlePath)
        {
            var id   = AssetId.Parse(bundlePath, _DefaultBundle);
            var keys = _Tables.Keys.Where(x => x.Bundle == id.Bundle).ToArray();

            foreach (var tableId in keys)
            {
                _Tables.Remove(tableId);
            }
        }
コード例 #4
0
ファイル: GameObjectPool.cs プロジェクト: t61789/Thunder
 /// <summary>
 /// 从对象池中取出对象
 /// </summary>
 /// <typeparam name="T">需要转换的类型</typeparam>
 /// <param name="assetPath"></param>
 /// <returns></returns>
 public static T Get <T>(string assetPath) where T : MonoBehaviour
 {
     return(Get <T>(AssetId.Parse(assetPath)));
 }
コード例 #5
0
ファイル: BundleSys.cs プロジェクト: t61789/Thunder
 public static T GetAsset <T>(string assetPath) where T : Object
 {
     return(GetAsset <T>(AssetId.Parse(assetPath)));
 }
コード例 #6
0
ファイル: ValueSys.cs プロジェクト: t61789/ThunderCS
 public static T GetValue <T>(string valuePath)
 {
     return(GetValue <T>(AssetId.Parse(valuePath, _DefaultBundle)));
 }
コード例 #7
0
 /// <summary>
 ///     谨慎使用,若删除表后再获取会引起大量的重复载入
 /// </summary>
 public static bool DeleteTable(string tablePath)
 {
     return(_Tables.Remove(AssetId.Parse(tablePath, _DefaultBundle)));
 }
コード例 #8
0
 public static T GetValue <T>(string assetPath)
 {
     return(GetValue <T>(AssetId.Parse(assetPath)));
 }
コード例 #9
0
 public static string GetRawValue(string assetPath)
 {
     return(GetRawValue(AssetId.Parse(assetPath)));
 }