Esempio n. 1
0
        static void Main(string[] args)
        {
            Dictionary <int, string> Ogrenci = new Dictionary <int, string>();

            Ogrenci.Add(1, "sefa");
            Ogrenci.Add(2, "ali");
            int ogrenci_sayisi = Ogrenci.Count;

            Console.WriteLine(Ogrenci[1]);
            Console.WriteLine(ogrenci_sayisi);

            MyDic <int, String> Teacher = new MyDic <int, string>();

            Teacher.Add(5, "ali");

            Teacher.Add(5, "ali");
            int deneme = Teacher.Count;

            Console.WriteLine(deneme);
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            var myMap = new MyDic <int, string>();

            myMap.Add(new Item <int, string>(1, "One"));
            myMap.Add(new Item <int, string>(2, "Two"));
            myMap.Add(new Item <int, string>(3, "Three"));
            myMap.Add(new Item <int, string>(4, "Four"));
            myMap.Add(new Item <int, string>(5, "Five"));
            foreach (var item in myMap)
            {
                Console.Write(item + " ");
            }
            Console.WriteLine();
            Console.WriteLine(myMap.Search(6) ?? "Not found");
            myMap.Remove(4);
            myMap.Remove(2);
            foreach (var item in myMap)
            {
                Console.Write(item + " ");
            }
            Console.WriteLine();

            var easyMap = new EasyMap <int, string>();

            easyMap.Add(new Item <int, string>(1, "One"));
            easyMap.Add(new Item <int, string>(2, "Two"));
            easyMap.Add(new Item <int, string>(3, "Three"));
            foreach (var item in easyMap)
            {
                Console.Write(item + " ");
            }
            Console.WriteLine();
            Console.WriteLine(easyMap.Search(5) ?? "Not found");
            Console.WriteLine(easyMap.Search(2) ?? "Not found");
            Console.ReadLine();
        }
Esempio n. 3
0
    /// <summary>
    /// 根据versionName获取需要打包的所有资源并返回AssetBundleBuild数组
    /// </summary>
    /// <param name="versionName">一般是平台名字,也可以加其他文件夹在</param>
    /// <returns>返回一个数组,可以直接用于BuildPipeline.BuildAssetBundles</returns>
    private static AssetBundleBuild[] GetBuildMapByVersion(string versionName)
    {
        List <AssetBundleBuild> list = new List <AssetBundleBuild>();

        if (!Directory.Exists(ABSH.NeedBuildABPath))
        {
            return(null);
        }
        var NeedBuildABFileList = GetAllFilesWithoutMeta(ABSH.NeedBuildABPath);
        var dicDependencies     = new Dictionary <string, string>();

        //遍历这些文件去找到所有的依赖项
        foreach (var file in NeedBuildABFileList)
        {
            //添加正向依赖,这个不可能会重复,所以不用判断ContainsKey
            ABDependenciesPositive.Add(file.Key, ABDependenciesPositive.GetDRAC(file.Key));
            //var relativePath = Path.Combine();
            var dps = AssetDatabase.GetDependencies(file.Key);
            //                                                                         这里文件名进行了转换,windows下都变成\\,OSX下都是/
            //也转换了一下小写
            foreach (var dp in dps.Where(d => !d.EndsWith(".cs")).Select(d => AssetBundleSettingHelper.PathToPlatformFormat(d.ToLower())))           //脚本文件排除
            {
                {
                    //增加反向依赖,这个会统计数量
                    if (!file.Key.Equals(dp))
                    {
                        if (!ABDependenciesReverse.ContainsKey(dp))
                        {
                            ABDependenciesReverse.Add(dp, ABDependenciesReverse.GetDRAC(dp));
                        }
                        ABDependenciesReverse[dp].AddRef(file.Key);

                        //正向依赖
                        ABDependenciesPositive[file.Key].AddRef(dp);
                    }
                }
                if (dicDependencies.ContainsKey(dp))
                {
                    continue;
                }
                else
                {
                    dicDependencies.Add(dp, dp);
                }
            }
        }
        //这里根据依赖关系,把只被一个单独AB依赖的资源不设置单独打包
        foreach (var abd in ABDependenciesReverse.GetDic().Where(dr => dr.Value.Count == 1))
        {
            if (dicDependencies.ContainsKey(abd.Key))
            {
                dicDependencies.Remove(abd.Key);
            }
        }
        //这里已经获得了所有的资源名称,可以直接生成AssetBundleBuild了
        foreach (var file in dicDependencies)
        {
            //目前先把所有资源单独打包,不做任何合并处理
            var tmp = new AssetBundleBuild();
            {
                tmp.assetBundleName = ABSH.ResourceNameToBundleName(file.Key);
                string[] assets = new string[1] {
                    file.Key
                };
                tmp.assetNames = assets;
            }
            list.Add(tmp);
        }

        return(list.ToArray());
    }