Ejemplo n.º 1
0
    private bool CanJewelUpgrade(int jewelTemplateId)
    {
        if (jewelTemplateId == -1)
        {
            return(false);
        }
        ItemJewelData jewel = ItemJewelData.dataMap[jewelTemplateId];
        int           level = jewel.level;

        PrivilegeData privilegeData = PrivilegeData.dataMap[MogoWorld.thePlayer.VipLevel];

        if (level + 1 > privilegeData.jewelSynthesisMaxLevel)
        {
            return(false);
        }

        int subtype = jewel.subtype;
        int count   = 0;

        if (m_itemsJewelSorted == null)
        {
            return(false);
        }
        for (int i = 0; i < m_itemsJewelSorted.Count; i++)
        {
            ItemJewel item = m_itemsJewelSorted[i];
            if (item.level < level)
            {
                return(false);
            }
            if (item.subtype != subtype)
            {
                continue;
            }
            if (item.level > level)
            {
                continue;
            }
            count += item.stack;
            if (count >= 2)
            {
                return(true);
            }
        }
        return(false);
    }
Ejemplo n.º 2
0
        private void privilege_CheckedChanged(object sender, EventArgs e)
        {
            if (startMonitor && (currentUserPrivilege != null))
            {
                Privilege privilege = Privilege.NON;
                foreach (MaterialCheckBox checkedItem in groupBoxPrivileges.Controls)
                {
                    if (checkedItem.Checked)
                    {
                        PrivilegeData data = checkedItem.Tag as PrivilegeData;
                        privilege |= data.PrivilegeName;
                    }
                }

                currentUserPrivilege.Privileges = privilege;
                privilegeManager.UpdateUser(currentUserPrivilege);
            }
        }
Ejemplo n.º 3
0
        private void listBoxUsers_SelectedIndexChanged(object sender, EventArgs e)
        {
            startMonitor      = false;
            btnRemove.Enabled = (listBoxUsers.SelectedItems.Count > 0);
            if (listBoxUsers.SelectedItems.Count > 0)
            {
                ListViewItem selected_item = null;
                foreach (ListViewItem item in this.listBoxUsers.SelectedItems)
                {
                    selected_item = item;
                    break;
                }

                UserPrivilege privilege = selected_item.Tag as UserPrivilege;
                currentUserPrivilege = privilege;
                foreach (MaterialCheckBox checkedItem in groupBoxPrivileges.Controls)
                {
                    PrivilegeData data = checkedItem.Tag as PrivilegeData;
                    checkedItem.Checked = ((privilege.Privileges & data.PrivilegeName) == data.PrivilegeName);
                }
            }
            startMonitor = true;
        }
Ejemplo n.º 4
0
    private void InitLayout()
    {
        RectTransform tempTransform;
        PrivilegeData tempData;

        tempTransform          = selfTransform.FindChild("RightPanel/SubPanel/LayoutP").GetComponent <RectTransform>();
        tempTransform.position = m_PrevPoint.transform.position;
        tempData       = new PrivilegeData(tempTransform, m_OriginalTipsObject, m_VipReader);
        m_DataArray[0] = tempData;

        tempTransform          = selfTransform.FindChild("RightPanel/SubPanel/LayoutC").GetComponent <RectTransform>();
        tempTransform.position = m_CenterPoint.transform.position;
        tempData       = new PrivilegeData(tempTransform, m_OriginalTipsObject, m_VipReader);
        m_DataArray[1] = tempData;

        tempTransform          = selfTransform.FindChild("RightPanel/SubPanel/LayoutN").GetComponent <RectTransform>();
        tempTransform.position = m_NextPoint.transform.position;
        tempData       = new PrivilegeData(tempTransform, m_OriginalTipsObject, m_VipReader);
        m_DataArray[2] = tempData;



        if (m_CurBrowseLv > 1)
        {
            m_DataArray[0].LoadPrivilegeData((byte)(m_CurBrowseLv - 1));
        }
        m_DataArray[1].LoadPrivilegeData((byte)(m_CurBrowseLv));
        if (m_CurBrowseLv < m_MaxVipLv)
        {
            m_DataArray[2].LoadPrivilegeData((byte)(m_CurBrowseLv + 1));
        }

        m_CurDataArrayIdx    = 1;
        m_ScrollRect.content = m_DataArray[m_CurDataArrayIdx].m_LayoutObject;
//        m_ScrollRect.velocity = new Vector2(0, -25);
    }
Ejemplo n.º 5
0
    public void RefreshUI()
    {
        //if (m_versionID >= m_inventoryManager.m_versionId) return;
        if (ComposeUIViewManager.Instance == null)
        {
            return;
        }

        if (m_isRefreshing)
        {
            //Debug.LogError("Debug.LogError(m_isRefreshing);");
            m_isNeedRefresh = true;
            return;
        }
        m_isRefreshing = true;
        Debug.Log("RefreshUI");
        UpdateJewelDic();
        Dictionary <int, LanguageData> nameData = LanguageData.dataMap;
        ComposeUIViewManager           view     = ComposeUIViewManager.Instance;
        Dictionary <int, Dictionary <int, ItemJewelData> > jewelDB = ItemJewelData.GetJewelDic();

        view.RemoveIconList();

        PrivilegeData privilegeData = PrivilegeData.dataMap[MogoWorld.thePlayer.VipLevel];

        //可合成宝石

        int count = 0;

        m_jewelCanComposeList.Clear();

        List <string> canComposeStrList = new List <string>();

        for (int subtype = 1; subtype <= ItemJewelData.TypeNum; subtype++)
        {
            if (!m_jewelDic.ContainsKey(subtype))
            {
                continue;
            }
            for (int level = privilegeData.jewelSynthesisMaxLevel - 1; level >= 1; level--)
            {
                if (!m_jewelDic[subtype].ContainsKey(level))
                {
                    continue;
                }

                if (m_jewelDic[subtype][level] > 2)
                {
                    canComposeStrList.Add(string.Concat("[FFFFFF]", jewelDB[subtype][level + 1].NameWithoutColor, "[-]"));
                    count++;
                    m_jewelCanComposeList.Add(jewelDB[subtype][level].id);
                }
            }
        }

        //计算要加载的条数,用于异步加载
        view.IconGridNum      = ItemJewelData.TypeNum + 1;
        view.IconChildGridNum = (privilegeData.jewelSynthesisMaxLevel - 1) * (ItemJewelData.TypeNum) + canComposeStrList.Count;
        view.AddIconListGrid(nameData[JEWEL_NAME_START_ID].content, 0);

        for (int i = 0; i < canComposeStrList.Count; i++)
        {
            view.AddIconListGridChild(0, i, canComposeStrList[i]);
        }


        //核心宝石
        //int coreJewelType = 1;

        //string coreJewelName = nameData[JEWEL_NAME_START_ID + coreJewelType].content;
        //view.AddIconListGrid(coreJewelName, 1);
        //for (int j = 0; j < 8; ++j)
        //{
        //    int level = j + 2;
        //    if (level > privilegeData.jewelSynthesisMaxLevel) break;
        //    view.AddIconListGridChild(1, j, jewelDB[coreJewelType][j + 2].Name);
        //}

        //其他宝石
        Debug.Log("ItemJewelData.MaxType:" + ItemJewelData.MaxType);

        for (int i = 0; i < ItemJewelData.TypeNum; ++i)
        {
            int type = i + 1;
            if (!jewelDB.ContainsKey(type))
            {
                continue;
            }

            view.AddIconListGrid(nameData[JEWEL_NAME_START_ID + type].content, type);

            for (int j = 0; j < ItemJewelData.JewelLevelNum - 1; ++j)
            {
                int level = j + 2;
                if (level > privilegeData.jewelSynthesisMaxLevel)
                {
                    break;
                }
                string name = jewelDB[type][level].NameWithoutColor;
                //Debug.Log(name);
                if (m_jewelDic.ContainsKey(type))
                {
                    if (m_jewelDic[type].ContainsKey(level - 1))
                    {
                        if (m_jewelDic[type][level - 1] > 2)
                        {
                            name = string.Concat("[FFFFFF]", name, "[-]");
                        }
                    }
                }
                //Debug.Log("type:" + type + ",j:" + j + ",name:" + name);
                view.AddIconListGridChild(type, j, name);
            }
        }

        view.SetComposePearlLeftIcon(IconData.none);
        view.SetComposePearlRightIcon(IconData.none);
        view.SetComposePearlUpIcon(IconData.none);

        view.RepositionNow();


        if (m_currentJewel == null)
        {
            if (m_jewelCanComposeList.Count > 0)
            {
                Debug.Log("(0, 0)");
                m_currentParentId = 0;
                m_currentChildId  = 0;
            }
            else
            {
                Debug.Log("(1, 0)");
                m_currentParentId = 1;
                m_currentChildId  = 0;
            }
        }

        Debug.Log("m_currentParentId:" + m_currentParentId + ",m_currentChildId:" + m_currentChildId);
        OnJewelSelect(m_currentParentId, m_currentChildId);
        m_versionID = m_inventoryManager.m_versionId;
        Debug.Log("m_currentParentId:" + m_currentParentId + ",m_currentChildId:" + m_currentChildId);


        MogoUIManager.Instance.SwitchComposeUI(delegate()
        {
            //Debug.LogError("SwitchComposeUI done");
            view.SetCurrentGridDown(m_currentParentId, m_currentChildId);
            m_isRefreshing = false;
            if (m_isNeedRefresh)
            {
                //Debug.LogError("m_isNeedRefresh");
                m_isNeedRefresh = false;
                RefreshUI();
            }
            //TimerHeap.AddTimer(400, 0, delegate()
            //{
            //    view.SetCurrentGridDown(m_currentParentId, m_currentChildId);
            //});
        }, false);
        //TimerHeap.AddTimer(500, 0, delegate()
        //{
        //    view.SetCurrentGridDown(m_currentParentId, m_currentChildId);
        //});
        Debug.Log("refreshUi done");
    }