Ejemplo n.º 1
0
        /// <summary>
        /// 通过[ID]二分快速查表
        /// </summary>
        /// <param name="dwID">ID</param>
        /// <returns></returns>
        public static GrowUpDabaBase Query(this List <GrowUpDabaBase> sorted, uint dwID)
        {
            var key = new GrowUpDabaBase()
            {
                dwID = dwID
            };
            var comparer = new Comparer1();
            var index    = sorted.BinarySearch(key, comparer);

            return(index >= 0 ? sorted[index] : default(GrowUpDabaBase));
        }
Ejemplo n.º 2
0
    private void OnGridUIEvent(UIEventType eventType, object data, object param)
    {
        if (eventType == UIEventType.Click)
        {
            if (data is UIGrowUpGrid)
            {
                UIGrowUpGrid grid = data as UIGrowUpGrid;
                if (grid == null)
                {
                    return;
                }

                int gotoBtnIndex = 1;

                if (param != null && (int)param == gotoBtnIndex)
                {
                    //立即前往
                    GrowUpDabaBase growUpDB = GameTableManager.Instance.GetTableItem <GrowUpDabaBase>(grid.Id);
                    if (growUpDB != null)
                    {
                        ItemManager.DoJump(growUpDB.JumpId);
                    }
                }
            }

            if (data is UIGrowUpFightPowerGrid)
            {
                UIGrowUpFightPowerGrid grid = data as UIGrowUpFightPowerGrid;
                if (grid == null)
                {
                    return;
                }

                int gotoBtnIndex = 1;
                if (param != null && (int)param == gotoBtnIndex)
                {
                    //立即前往
                    GrowUpFightPowerDabaBase growUpFightPowerDB = GameTableManager.Instance.GetTableItem <GrowUpFightPowerDabaBase>(grid.Id);
                    if (growUpFightPowerDB != null)
                    {
                        ItemManager.DoJump(growUpFightPowerDB.JumpId);
                    }
                }
            }
        }
    }
Ejemplo n.º 3
0
    private void OnUpdateGrowUpSecondTypeGrid(UIGridBase gridBase, object id, int index)
    {
        UIGrowUpSecondTypeGrid grid = gridBase as UIGrowUpSecondTypeGrid;

        if (grid == null)
        {
            return;
        }

        Dictionary <uint, List <uint> > secondKeyDic;

        if (m_dicGrowUp.TryGetValue((uint)id, out secondKeyDic))
        {
            List <uint> secondKeyIdList = secondKeyDic.Keys.ToList <uint>();
            if (secondKeyIdList.Count > index)
            {
                uint secondKeyId = secondKeyIdList[index];

                grid.SetData((uint)id, secondKeyId);
                grid.SetSelect((uint)id == m_selectFirstKeyId && secondKeyId == m_selectSecondKeyId);

                List <uint> idList;
                if (DataManager.Manager <GrowUpManager>().TryGetGrowUpIdListByKeyAndSecondkey((uint)id, secondKeyId, out idList))
                {
                    if (idList.Count > 0)
                    {
                        GrowUpDabaBase growUpDabaBase = GameTableManager.Instance.GetTableItem <GrowUpDabaBase>(idList[0]);

                        if (growUpDabaBase == null)
                        {
                            return;
                        }
                        grid.SetName(growUpDabaBase.IndexTypeName);
                    }
                }
            }
        }
    }
Ejemplo n.º 4
0
    private void OnUpdateGrowUpCtrTypeGrid(UIGridBase gridBase, int index)
    {
        if (m_dicGrowUp != null && m_dicGrowUp.Keys.Count > index)
        {
            UICtrTypeGrid grid = gridBase as UICtrTypeGrid;
            if (grid == null)
            {
                return;
            }

            List <uint> keyIdList = m_dicGrowUp.Keys.ToList <uint>();
            uint        keyId     = keyIdList[index];

            Dictionary <uint, List <uint> > secondKeyDic;
            if (m_dicGrowUp.TryGetValue(keyId, out secondKeyDic))
            {
                GrowUpDabaBase growUpDabaBase = m_lstGrowUpDabaBase.Find((data) => { return(data.Type == keyId); });
                if (growUpDabaBase != null)
                {
                    grid.SetData(keyId, growUpDabaBase.TypeName, secondKeyDic.Keys.Count);
                }
            }
        }
    }
Ejemplo n.º 5
0
    private void OnGridDataUpdate(UIGridBase gridData, int index)
    {
        if (gridData is UIGrowUpGrid)
        {
            List <uint> idList;
            if (DataManager.Manager <GrowUpManager>().TryGetGrowUpIdListByKeyAndSecondkey(this.m_selectFirstKeyId, this.m_selectSecondKeyId, out idList))
            {
                if (idList.Count > index)
                {
                    UIGrowUpGrid grid = gridData as UIGrowUpGrid;
                    if (grid == null)
                    {
                        return;
                    }

                    GrowUpDabaBase growUpDB = m_lstGrowUpDabaBase.Find((data) => { return(data.dwID == idList[index]); });
                    if (growUpDB == null)
                    {
                        return;
                    }

                    grid.SetGridData(idList[index]);
                    grid.SetName(growUpDB.Name);
                    grid.SetIcon(growUpDB.IconName);
                    grid.SetStar(growUpDB.Star);
                    grid.SetDes(growUpDB.Des);

                    IPlayer MainPlayer = Client.ClientGlobal.Instance().MainPlayer;
                    if (MainPlayer != null)
                    {
                        int playerLv = MainPlayer.GetProp((int)Client.CreatureProp.Level);
                        grid.SetGotoBtnEnable(playerLv >= growUpDB.OpenLv, growUpDB.OpenLv);
                    }
                }
            }
        }

        //战斗力
        if (gridData is UIGrowUpFightPowerGrid)
        {
            if (m_lstGrowUpFightPowerDB != null && m_lstGrowUpFightPowerDB.Count > index)
            {
                UIGrowUpFightPowerGrid grid = gridData as UIGrowUpFightPowerGrid;
                if (grid == null)
                {
                    return;
                }

                grid.SetGridData(m_lstGrowUpFightPowerDB[index].dwID);
                grid.SetName(m_lstGrowUpFightPowerDB[index].Name);

                string des = m_lstGrowUpFightPowerDB[index].Des;
                uint[] desData;
                if (DataManager.Manager <GrowUpManager>().TryGetFightPowerDatabaseById(m_lstGrowUpFightPowerDB[index].dwID, out desData))
                {
                    if (desData.Length == 1)
                    {
                        des = string.Format(m_lstGrowUpFightPowerDB[index].Des, desData[0]);
                    }
                    else if (desData.Length == 2)
                    {
                        des = string.Format(m_lstGrowUpFightPowerDB[index].Des, desData[0], desData[1]);
                    }
                }
                grid.SetDes(des);
                grid.SetIcon(m_lstGrowUpFightPowerDB[index].IconName);
                float value = DataManager.Manager <GrowUpManager>().GetFightPowerSliderValueById(m_lstGrowUpFightPowerDB[index].dwID);
                grid.SetSliderAndPercent(value);

                int[] arr = new int[3];

                string s = string.Format("", arr);
            }
        }
    }