Beispiel #1
0
            public LanguageConfigUI_BtnLanguage GetInstance()
            {
                LanguageConfigUI_BtnLanguage instance = null;

                if (mCachedInstances != null)
                {
                    while ((instance == null || instance.Equals(null)) && mCachedInstances.Count > 0)
                    {
                        instance = mCachedInstances.Dequeue();
                    }
                }
                if (instance == null || instance.Equals(null))
                {
                    instance = Instantiate <LanguageConfigUI_BtnLanguage>(m_BtnLanguage);
                }
                Transform t0 = m_BtnLanguage.transform;
                Transform t1 = instance.transform;

                t1.SetParent(t0.parent);
                t1.localPosition = t0.localPosition;
                t1.localRotation = t0.localRotation;
                t1.localScale    = t0.localScale;
                t1.SetSiblingIndex(t0.GetSiblingIndex() + 1);
                return(instance);
            }
Beispiel #2
0
 public bool CacheInstance(LanguageConfigUI_BtnLanguage instance)
 {
     if (instance == null || instance.Equals(null))
     {
         return(false);
     }
     if (mCachedInstances == null)
     {
         mCachedInstances = new Queue <LanguageConfigUI_BtnLanguage>();
     }
     if (mCachedInstances.Contains(instance))
     {
         return(false);
     }
     instance.gameObject.SetActive(false);
     mCachedInstances.Enqueue(instance);
     return(true);
 }
        public override void Init <T>(string name, UIInfo info, T arg)
        {
            base.Init(name, info, arg);

            GeneralConfigItem cfg = Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.LANGUAGE_LIST);

            BtnLanguage.gameObject.SetActive(false);
            for (int i = 0; i < cfg.contents.Length; i += 3)
            {
                LanguageConfigUI_BtnLanguage bl = BtnLanguage.GetInstance();
                bl.Init(cfg.contents[i + 1], cfg.contents[i], this);
                bl.transform.SetSiblingIndex(i);
                m_list.Add(bl);
            }

            BtnC.button.onClick.AddListener(TouchClose);

            RegisterListeners();
            ChangeLanguage();
        }