Пример #1
0
 private void CompleteOpen()
 {
     for (int i = m_Cards.Count - 1; i >= 0; i--)
     {
         OpenMixBoxUI_card cardUI = m_Cards[i];
         if (i < m_Cards.Count - 1)
         {
             gameObject.AddComponent <DelayCallBack>().SetAction(() =>
             {
                 cardUI.Show.gameObject.SetActive(true);
             }, m_Delay * (m_Cards.Count - i - 1), true);
         }
         else
         {
             cardUI.Show.gameObject.SetActive(true);
         }
     }
     box_open.gameObject.SetActive(true);
     box_close.gameObject.SetActive(false);
     Global.gApp.gAudioSource.PlayOneShot("box", true);
     gameObject.AddComponent <DelayCallBack>().SetAction(() =>
     {
         Global.gApp.gMsgDispatcher.Broadcast(MsgIds.UIFresh);
         Global.gApp.gGameCtrl.RemoveGlobalTouchMask();
     }, m_Delay * (m_Cards.Count - 0.7f), true);
 }
Пример #2
0
            public OpenMixBoxUI_card GetInstance()
            {
                OpenMixBoxUI_card 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 <OpenMixBoxUI_card>(m_card);
                }
                Transform t0 = m_card.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);
            }
Пример #3
0
        public override void Init <T>(string name, UIInfo info, T arg)
        {
            base.Init(name, info, arg);
            Global.gApp.gGameCtrl.AddGlobalTouchMask();
            m_ItemDTOs = arg as List <ItemDTO>;
            m_Cards    = new List <OpenMixBoxUI_card>();

            box_open.gameObject.SetActive(false);
            box_close.gameObject.SetActive(true);
            card.gameObject.SetActive(false);
            for (int i = m_ItemDTOs.Count - 1; i >= 0; i--)
            {
                ItemDTO           itemDTO = m_ItemDTOs[i];
                OpenMixBoxUI_card cardUI  = card.GetInstance();
                ItemItem          itemCfg = Global.gApp.gGameData.ItemData.Get(itemDTO.itemId);
                cardUI.num.text.text     = UiTools.FormateMoneyUP(itemDTO.num);
                cardUI.icon.image.sprite = Global.gApp.gResMgr.LoadAssets <Sprite>(string.Format(CommonResourceConstVal.RESOURCE_PATH, itemDTO.itemId));
                m_Cards.Add(cardUI);
                cardUI.gameObject.SetActive(true);
                cardUI.Show.gameObject.SetActive(false);
                cardUI.title.text.text = Global.gApp.gGameData.GetTipsInCurLanguage(itemCfg.sourceLanguage);
            }

            gameObject.AddComponent <DelayCallBack>().SetAction(() =>
            {
                OnOpen();
            }, m_Delay, true);
            RegisterListeners();

            base.ChangeLanguage();
        }
Пример #4
0
 public bool CacheInstance(OpenMixBoxUI_card instance)
 {
     if (instance == null || instance.Equals(null))
     {
         return(false);
     }
     if (mCachedInstances == null)
     {
         mCachedInstances = new Queue <OpenMixBoxUI_card>();
     }
     if (mCachedInstances.Contains(instance))
     {
         return(false);
     }
     instance.gameObject.SetActive(false);
     mCachedInstances.Enqueue(instance);
     return(true);
 }