Example #1
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);
                    }
                }
            }
        }
    }
Example #2
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);
            }
        }
    }