Beispiel #1
0
            public CampTaskDetails_DayTaskItemUI GetInstance()
            {
                CampTaskDetails_DayTaskItemUI 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 <CampTaskDetails_DayTaskItemUI>(m_DayTaskItemUI);
                }
                Transform t0 = m_DayTaskItemUI.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 void ChangeShowIndex()
        {
            Dictionary <int, CampTaskDetails_DayTaskItemUI> dic = new Dictionary <int, CampTaskDetails_DayTaskItemUI>();

            int[] arr = new int[m_ItemList.Count];
            for (int i = 0; i < m_ItemList.Count; i++)
            {
                CampTaskDetails_DayTaskItemUI itemUI = m_ItemList[i];
                arr[i]      = itemUI.m_ShowIndex;
                dic[arr[i]] = itemUI;
            }
            Array.Sort(arr);
            for (int i = 0; i < arr.Length; i++)
            {
                dic[arr[i]].transform.SetSiblingIndex(i);
            }
        }
Beispiel #3
0
 public bool CacheInstance(CampTaskDetails_DayTaskItemUI instance)
 {
     if (instance == null || instance.Equals(null))
     {
         return(false);
     }
     if (mCachedInstances == null)
     {
         mCachedInstances = new Queue <CampTaskDetails_DayTaskItemUI>();
     }
     if (mCachedInstances.Contains(instance))
     {
         return(false);
     }
     instance.gameObject.SetActive(false);
     mCachedInstances.Enqueue(instance);
     return(true);
 }
Beispiel #4
0
        private void InitNode()
        {
            DayTaskItemUI.gameObject.SetActive(false);
            TotalTaskItem.gameObject.SetActive(false);
            List <NpcQuestItemDTO> nqidList = Global.gApp.gSystemMgr.GetNpcMgr().NpcQuestList;

            for (int i = 0; i < nqidList.Count; i++)
            {
                if (nqidList[i].npcQuestId == -1)
                {
                    continue;
                }
                CampNpcItem campNpcItem = Global.gApp.gGameData.CampNpcConfig.Get(nqidList[i].npcId);
                ItemItem    npcItem     = Global.gApp.gGameData.GetItemDataByName(nqidList[i].npcId);
                if (campNpcItem.notFresh == 1)
                {
                    CampTasksItem taskCfg = Global.gApp.gGameData.CampTasksConfig.Get(nqidList[i].npcQuestId);
                    if (taskCfg == null)
                    {
                        continue;
                    }
                    CampTaskDetails_TotalTaskItem itemUI = TotalTaskItem.GetInstance();
                    itemUI.InitNode(nqidList[i], i, this);
                    m_TotalItemList.Add(itemUI);
                }
                else
                {
                    CampTasksItem taskCfg = Global.gApp.gGameData.CampTasksConfig.Get(nqidList[i].npcQuestId);
                    if (taskCfg == null)
                    {
                        continue;
                    }
                    CampTaskDetails_DayTaskItemUI itemUI = DayTaskItemUI.GetInstance();
                    itemUI.InitNode(nqidList[i], i, this);
                    m_ItemList.Add(itemUI);
                }
            }
            m_none.gameObject.SetActive(m_TotalItemList.Count == 0);
            ChangeTotalShowIndex();
            ChangeShowIndex();

            CloseBtn.button.onClick.AddListener(TouchClose);
        }