Ejemplo n.º 1
0
 public ComposeManager(InventoryManager inventoryManager)
 {
     m_inventoryManager = inventoryManager;
     AddListener();
     m_versionID = inventoryManager.m_versionId;
     Instance    = this;
 }
Ejemplo n.º 2
0
 public ComposeManager(InventoryManager inventoryManager)
 {
     m_inventoryManager = inventoryManager;
     AddListener();
     m_versionID = inventoryManager.m_versionId;
     Instance = this;
 }
Ejemplo n.º 3
0
    public InventoryManager(EntityMyself _myself)
    {
        Instance = this;
        myself = _myself;
        m_itemsInBag[ITEM_TYPE_EQUIPMENT] = new Dictionary<int, ItemParent>();
        m_itemsInBag[ITEM_TYPE_JEWEL] = new Dictionary<int, ItemParent>();
        m_itemsInBag[ITEM_TYPE_MATERIAL] = new Dictionary<int, ItemParent>();
        InitData();
        m_versionId = 0;
        composeManager = new ComposeManager(this);
        insetManager = new InsetManager(this);
        decomposeManager = new DecomposeManager(m_itemsInBag[ITEM_TYPE_EQUIPMENT], this);
        equipUpgradeManager = new EquipUpgradeManager();
        m_versionId++;
        AddListeners();


    }
Ejemplo n.º 4
0
    /// <summary>
    /// 初始化
    /// </summary>
    private void InitWidgets()
    {
        if (initWidgets)
        {
            return;
        }
        initWidgets = true;

        m_mgr = DataManager.Manager <ComposeManager>();
        Transform clone = null;

        if (null != m_trans_UIIFGTarget && null == m_targetNeedGrid)
        {
            clone = m_trans_UIIFGTarget.GetChild(0);
            if (null != clone)
            {
                m_targetNeedGrid = clone.GetComponent <UIComposeNeedGrid>();
                if (null == m_targetNeedGrid)
                {
                    m_targetNeedGrid = clone.gameObject.AddComponent <UIComposeNeedGrid>();
                }
            }
            m_targetNeedGrid.RegisterUIEventDelegate(OnGridEventDlg);
        }

        if (null != m_trans_UIIFGCost1 && null == m_costNeedGrid1)
        {
            clone = m_trans_UIIFGCost1.GetChild(0);
            if (null != clone)
            {
                Util.AddChildToTarget(m_trans_UIIFGCost1, clone);
                m_costNeedGrid1 = clone.GetComponent <UIComposeNeedGrid>();
                if (null == m_costNeedGrid1)
                {
                    m_costNeedGrid1 = clone.gameObject.AddComponent <UIComposeNeedGrid>();
                }
            }
            m_costNeedGrid1.RegisterUIEventDelegate(OnGridEventDlg);
        }

        if (null != m_trans_UIIFGCost2 && null == m_costNeedGrid2)
        {
            clone = m_trans_UIIFGCost2.GetChild(0);
            if (null != clone)
            {
                Util.AddChildToTarget(m_trans_UIIFGCost2, clone);
                m_costNeedGrid2 = clone.GetComponent <UIComposeNeedGrid>();
                if (null == m_costNeedGrid2)
                {
                    m_costNeedGrid2 = clone.gameObject.AddComponent <UIComposeNeedGrid>();
                }
            }
            m_costNeedGrid2.RegisterUIEventDelegate(OnGridEventDlg);
        }

        if (null != m_trans_UIIFGCost3 && null == m_costNeedGrid3)
        {
            clone = m_trans_UIIFGCost3.GetChild(0);
            if (null != clone)
            {
                Util.AddChildToTarget(m_trans_UIIFGCost3, clone);
                m_costNeedGrid3 = clone.GetComponent <UIComposeNeedGrid>();
                if (null == m_costNeedGrid3)
                {
                    m_costNeedGrid3 = clone.gameObject.AddComponent <UIComposeNeedGrid>();
                }
            }
            m_costNeedGrid3.RegisterUIEventDelegate(OnGridEventDlg);
        }

        if (null != m_trans_UIIFGCost4 && null == m_costNeedGrid4)
        {
            clone = m_trans_UIIFGCost4.GetChild(0);
            if (null != clone)
            {
                Util.AddChildToTarget(m_trans_UIIFGCost4, clone);
                m_costNeedGrid4 = clone.GetComponent <UIComposeNeedGrid>();
                if (null == m_costNeedGrid4)
                {
                    m_costNeedGrid4 = clone.gameObject.AddComponent <UIComposeNeedGrid>();
                }
            }
            m_costNeedGrid4.RegisterUIEventDelegate(OnGridEventDlg);
        }

        if (null != m_trans_UIIFGCost5 && null == m_costNeedGrid5)
        {
            clone = m_trans_UIIFGCost5.GetChild(0);
            if (null != clone)
            {
                Util.AddChildToTarget(m_trans_UIIFGCost5, clone);
                m_costNeedGrid5 = clone.GetComponent <UIComposeNeedGrid>();
                if (null == m_costNeedGrid5)
                {
                    m_costNeedGrid5 = clone.gameObject.AddComponent <UIComposeNeedGrid>();
                }
            }
            m_costNeedGrid5.RegisterUIEventDelegate(OnGridEventDlg);
        }

        if (null != m_trans_SingleCompoundCurrency && null == m_composeSingleC)
        {
            m_composeSingleC = m_trans_SingleCompoundCurrency.GetComponent <UICurrencyGrid>();
            if (null == m_composeSingleC)
            {
                m_composeSingleC = m_trans_SingleCompoundCurrency.gameObject.AddComponent <UICurrencyGrid>();
            }
        }
        if (null != m_trans_CompoundAllCurrency && null == m_composeAllC)
        {
            m_composeAllC = m_trans_CompoundAllCurrency.GetComponent <UICurrencyGrid>();
            if (null == m_composeAllC)
            {
                m_composeAllC = m_trans_CompoundAllCurrency.gameObject.AddComponent <UICurrencyGrid>();
            }
        }


        //构建1级2级分类页签
        if (null != m_scrollview_TypeScrollView && null == mSecondTabCreator)
        {
            mSecondTabCreator = m_scrollview_TypeScrollView.GetComponent <UISecondTabCreatorBase>();
            if (null != mSecondTabCreator)
            {
                GameObject cloneFTemp = UIManager.GetResGameObj(GridID.Uictrtypegrid) as GameObject;
                GameObject cloneSTemp = UIManager.GetResGameObj(GridID.Uisecondtypegrid) as GameObject;
                mSecondTabCreator.Initialize <UISecondTypeGrid>(cloneFTemp, cloneSTemp
                                                                , OnGridUpdate, OnUpdateSecondTabGrid, OnGridEventDlg);
            }
        }

        if (null == mlstFirstTabIds)
        {
            mlstFirstTabIds = new List <uint>();
        }
        mlstFirstTabIds.Clear();

        List <CategoryTypeData> firstTabDatas = new List <CategoryTypeData>();

        firstTabDatas = m_mgr.GetCategoryTypeDatasByFirstType();
        if (null == firstTabDatas ||
            firstTabDatas.Count == 0)
        {
            Engine.Utility.Log.Error("ComposePanel InitWidgets Error,get cateoryTypeData null");
            return;
        }

        firstTabDatas.Sort((left, right) =>
        {
            return((int)left.m_uint_categoryId - (int)right.m_uint_categoryId);
        });
        List <int>       secondTabsNums = new List <int>();
        CategoryTypeData ctData         = null;
        int num = 0;

        for (int i = 0; i < firstTabDatas.Count; i++)
        {
            ctData = firstTabDatas[i];
            num    = (null != ctData) ? ctData.Count : 0;
            secondTabsNums.Add(num);
            if (!mlstFirstTabIds.Contains(firstTabDatas[i].m_uint_categoryId))
            {
                mlstFirstTabIds.Add(firstTabDatas[i].m_uint_categoryId);
            }
        }

        if (null != mSecondTabCreator)
        {
            mSecondTabCreator.CreateGrids(secondTabsNums);
        }

        SetSelectFirstType(0, true);
        UpdateCanComposeRedPoint();
    }