示例#1
0
        private static void Main(string[] args)
        {
            Console.WriteLine("***** Fun with Map *****");

            var simpleMap = new DefaultMap <int, string>(100);

            simpleMap.Add(new Item <int, string>(1, "Homer"));
            simpleMap.Add(new Item <int, string>(2, "Marge"));
            simpleMap.Add(new Item <int, string>(3, "Bard"));
            simpleMap.Add(new Item <int, string>(3, "Bard"));
            simpleMap.Add(new Item <int, string>(4, "Liza"));

            foreach (var item in simpleMap)
            {
                Console.WriteLine(item);
            }
        }
示例#2
0
        private void Awake()
        {
            // Init Default Map
            DefaultMap.Clear();
            for (int i = 0; i < m_DefaultData.Length - 1; i += 2)
            {
                var key = m_DefaultData[i];
                if (DefaultMap.ContainsKey(key))
                {
                    DefaultMap.Add(key, m_DefaultData[i + 1]);
                }
            }
            m_DefaultData = null;

            // Init Index
            if (LanguageIndex < 0)
            {
                LanguageIndex.Value = (int)Application.systemLanguage;
            }

            // Load Language
            var language = (SystemLanguage)LanguageIndex.Value;

            if (language == SystemLanguage.Chinese)
            {
                language = SystemLanguage.ChineseSimplified;
            }
            bool success = LoadLanguage(language);

            if (!success)
            {
                switch (language)
                {
                case SystemLanguage.Chinese:
                    success = LoadLanguage(SystemLanguage.ChineseSimplified);
                    if (!success)
                    {
                        success = LoadLanguage(SystemLanguage.ChineseTraditional);
                    }
                    break;

                case SystemLanguage.ChineseSimplified:
                    success = LoadLanguage(SystemLanguage.Chinese);
                    if (!success)
                    {
                        success = LoadLanguage(SystemLanguage.ChineseTraditional);
                    }
                    break;

                case SystemLanguage.ChineseTraditional:
                    success = LoadLanguage(SystemLanguage.Chinese);
                    if (!success)
                    {
                        success = LoadLanguage(SystemLanguage.ChineseSimplified);
                    }
                    break;
                }
            }
            if (!success)
            {
                LoadLanguage(SystemLanguage.English);
            }
        }