コード例 #1
0
 public void ReturnInstantiatedObject(string _key, GameObject _o)
 {
     if (m_pObjectPools.ContainsKey(_key))
     {
         UIObjectPool o = m_pObjectPools[_key];
         o.Destroy(_o);
     }
 }
コード例 #2
0
        protected void LoadResource(string _path, string _name, int _poolCount = 1)
        {
            string       path   = _path + _name;
            GameObject   prefab = Resources.Load <GameObject>(path);
            UIObjectPool pool   = new UIObjectPool(_name, prefab, this.gameObject, _poolCount, false, true);

            m_pObjectPools.Add(_name, pool);
        }
コード例 #3
0
 protected GameObject GetInstantiatedObject(string _key, Transform _parent)
 {
     if (m_pObjectPools.ContainsKey(_key))
     {
         UIObjectPool pool = m_pObjectPools[_key];
         GameObject   o    = pool.Instantiate();
         o.transform.SetParent(_parent);
         o.transform.localScale    = Vector3.one;
         o.transform.localPosition = Vector3.zero;
         return(o);
     }
     return(null);
 }
コード例 #4
0
    public void SetDataOnScreen(Operation operation)
    {
        int index = 0;

        if (null == objectPool)
        {
            objectPool = UIObjectPool.Instance;
        }
        objectPool.Clear();
        foreach (Level lev in operation.level)
        {
            SetLevelUI(lev, index);
            index++;
        }
        headingText.text = operation.name;
        gameObject.SetActive(true);
    }
コード例 #5
0
    private void Awake()
    {
        // if the singleton hasn't been initialized yet
        if (instance != null && instance != this)
        {
            Destroy(this.gameObject);
        }

        instance            = this;
        activeLevelUIPool   = new List <LevelUI>();
        inactiveLevelUIPool = new List <LevelUI>();

        inactiveSubTopicUIPool = new List <TMP_Dropdown>();
        activeSubTopicUIPool   = new List <TMP_Dropdown>();

        DontDestroyOnLoad(this.gameObject);
    }
コード例 #6
0
    public void Initialize()
    {
        items         = GetComponent <ShopDataController>().GetDisplayedItems();
        pageNumber    = 0;
        pagePositions = new float[items.Count / 4 + 1];
        for (int i = 0; i < items.Count / 4 + 1; i++)
        {
            pagePositions [i] = -880f * i;
        }
        curSelectedItem = null;
        panelController = panel.gameObject.GetComponent <PanelController>();
        shopWindowContent.GetComponent <RectTransform> ().anchoredPosition = new Vector3(pagePositions[pageNumber], 0f, 0f);
        //buttonPool = new UIObjectPool(prefabItemButton, shopWindowContent.transform);
        buttonPool = gameObject.AddComponent <UIObjectPool>();
        buttonPool.InitializeObjectPool(prefabItemButton, shopWindowContent.transform);

        RefreshShopDisplay();
    }