Exemplo n.º 1
0
    protected T GetModel <T>(SerializableDictionaryBase <string, T> listModel, string assetBundlePath, string name, string remarkResourcesPath) where T : UnityEngine.Object
    {
        if (name == null)
        {
            return(null);
        }
        if (listModel.TryGetValue(name, out T value))
        {
            return(value);
        }

        T model = null;

#if UNITY_EDITOR
        //编辑器模式下直接加载资源
        if (!remarkResourcesPath.IsNull())
        {
            model = LoadAssetUtil.LoadAssetAtPathForEditor <T>(remarkResourcesPath);
        }
        else
        {
            model = LoadAssetUtil.SyncLoadAsset <T>(assetBundlePath, name);
        }
#else
        model = LoadAssetUtil.SyncLoadAsset <T>(assetBundlePath, name);
#endif

        if (model != null)
        {
            listModel.Add(name, model);
        }
        return(model);
    }
        public ToolData()
        {
            Map = new SerializableDictionaryBase <Tool, SingleToolData>();

            foreach (var type in Utility.GetEnumValues <Tool>())
            {
                Map[type] = new SingleToolData();
            }
        }
Exemplo n.º 3
0
    public RefineTask(SerializableDictionaryBase <Resource, float> affinities,
                      float gangue_affinity,
                      float maximum_concentration,
                      float optimal_distance,
                      float half_distance)
        : base(optimal_distance, half_distance)
    {
        foreach (Resource resource in affinities.Keys)
        {
            Affinities[resource] = affinities[resource];
        }

        GangueAffinity = gangue_affinity;

        MaximumConcentration = maximum_concentration;
    }
Exemplo n.º 4
0
    protected T GetModel <T>(SerializableDictionaryBase <string, T> listModel, string assetBundlePath, string name) where T : Object
    {
        if (name == null)
        {
            return(null);
        }
        if (listModel.TryGetValue(name, out T value))
        {
            return(value);
        }

        T anim = LoadAssetUtil.SyncLoadAsset <T>(assetBundlePath, name);

        if (anim != null)
        {
            listModel.Add(name, anim);
        }
        return(anim);
    }
Exemplo n.º 5
0
 public static IEnumerable <V> Select <T, U, V>(
     this SerializableDictionaryBase <T, U> dictionary,
     Func <T, U, V> Selector)
 {
     return(dictionary.Select(pair => Selector(pair.Key, pair.Value)));
 }
Exemplo n.º 6
0
 protected T GetModel <T>(SerializableDictionaryBase <string, T> listModel, string assetBundlePath, string name) where T : UnityEngine.Object
 {
     return(GetModel <T>(listModel, assetBundlePath, name, null));
 }