Ejemplo n.º 1
0
    // 更新从operatecardList 中用的格子
    public void UpdateOperate(CSItem item, ENSortType sortType, int index = 0)
    {
        if (null == item)
        {
            return;
        }

        int cardID = item.IDInTable;

        HeroInfo heroInfo = GameTable.HeroInfoTableAsset.Lookup(cardID);

        if (null == heroInfo)
        {
            return;
        }

        m_index = index;

        Update(item, sortType, m_index);

        OperateCardList.Singleton.m_curChosenIndex = -1;

        // 已选择索引
        if (OperateCardList.Singleton.m_curType == OperateCardList.TYPE.enCardLevelUpDataCardType)
        {
            OperateCardList.Singleton.m_curChosenIndex = OperateCardList.Singleton.LevelUpList.IndexOf(item.Guid) + 1;
        }
        else if (OperateCardList.Singleton.m_curType == OperateCardList.TYPE.enSellType)
        {
            OperateCardList.Singleton.m_curChosenIndex = OperateCardList.Singleton.m_sellList.IndexOf(item.Guid) + 1;
        }


        m_tag.spriteName = "" + OperateCardList.Singleton.m_curChosenIndex;
        m_param.m_id     = (int)Team.EDITTYPE.enNone;

        // 使用中
        m_chosen.SetActive(Team.Singleton.IsCardInTeam(item.Guid));


        bool bShowShadow = false;

        if (OperateCardList.Singleton.m_curChosenIndex == 0)
        {
            if (OperateCardList.Singleton.m_chosenCardNum >= 10)
            {
                bShowShadow = true;
            }
        }

        m_shadow.SetActive(bShowShadow);
        m_break.text = Localization.Get("LevelBreak") + item.BreakCounts;
        m_break.gameObject.SetActive(true);
        m_tips.SetActive(false);
        m_mask.SetActive(false);
        m_shadow.SetActive(false);
        m_love.gameObject.SetActive(false);
        m_tag.gameObject.SetActive(true);
    }
Ejemplo n.º 2
0
    public string GetSrotString(ENSortType sortType)
    {
        string retStr = "";

        if (m_sortStringByType.TryGetValue((int)sortType, out retStr))
        {
            return(retStr);
        }
        return("");
    }
Ejemplo n.º 3
0
    SortDelegate GetSortFunc(ENSortType type)
    {
        SortDelegate func = null;

        if (m_sortDelegates.TryGetValue((int)type, out func))
        {
            return(func);
        }
        return(null);
    }
Ejemplo n.º 4
0
 public void SortCards(ENSortType sortType, bool reverse)
 {
     if (sortType == ENSortType.enDefault)
     {
         sortType = ENSortType.enLoadTime;
     }
     m_sortType = sortType;
     //m_lastDirReverse = reverse;
     m_sortFriendList = CardBag.Singleton.SortByList(sortType, ENSortClassType.enFriend, reverse, m_friendInfoList);
     SortCardUpdateInfo();
 }
Ejemplo n.º 5
0
    public float GetSortValue(SortableItem item, ENSortType sortType, out Dictionary <float, List <CSItem> > dicTeam, out List <float> tempTeam)
    {
        tempTeam = new List <float>();
        dicTeam  = new Dictionary <float, List <CSItem> >();
        FriendItem friendItem = (FriendItem)item;

        if (sortType != ENSortType.enLoadTime)
        {
            CSItem itemData = friendItem.GetItem();
            return(GetSortValue(itemData, sortType, out dicTeam, out tempTeam));
        }


        return(friendItem.beforLoadTime());
    }
Ejemplo n.º 6
0
    public void SortCards(ENSortType sortType, bool reverse, ENSortClassType classType)
    {
        if (sortType == ENSortType.enDefault)
        {
            sortType = ENSortType.enGotTime;
        }
        SortDelegate sortFunc = GetSortFunc((ENSortType)sortType);

        if (sortFunc != null)
        {
            m_lastSortType   = sortType;
            m_lastDirReverse = reverse;
            m_sortedCardList = sortFunc(sortType, reverse);
            CardBag.Singleton.NotifySortResult();
        }

        //SetVisable(false);
    }
Ejemplo n.º 7
0
    public float GetSortValue(CSItem item, ENSortType sortType, out Dictionary <float, List <CSItem> > dicTeam, out List <float> tempTeam)
    {
        tempTeam = new List <float>();
        dicTeam  = new Dictionary <float, List <CSItem> >();
        float propVal = 0f;

        switch (sortType)
        {
        case ENSortType.enByPhyAttack:
            propVal = item.GetPhyAttack();
            break;

        case ENSortType.enByMagAttack:
            propVal = item.GetMagAttack();
            break;

        case ENSortType.enByHp:
            propVal = item.GetHp();
            break;

        default:
            UnityEngine.Debug.Log("SortByProperty err, type = " + sortType);
            break;
            // return 0;
        }
        if (Team.Singleton.IsCardInTeam(item.Guid))
        {
            if (dicTeam.ContainsKey(propVal))
            {
                dicTeam[propVal].Add(item);
            }
            else
            {
                List <CSItem> tmpItemList = new List <CSItem>();
                tmpItemList.Add(item);
                dicTeam.Add(propVal, tmpItemList);
                tempTeam.Add(propVal);
            }
        }
        return(propVal);
    }
Ejemplo n.º 8
0
    public void OnSortButtonClicked(object sender, EventArgs e)
    {
        GameObject sortButton = sender as GameObject;
        string     objName    = sortButton.name;

        Debug.Log(objName + "OnClicked");

        ENSortType sortType = ENSortType.enDefault;

        try
        {
            sortType = (ENSortType)(Convert.ToInt32(objName));
        }
        catch
        {
            return;
        }
//		ENSortType newSortType;
        bool reverse = false;

        if (m_lastSortType == sortType)
        {
            reverse = !m_lastDirReverse;
        }
        else
        {
//			newSortType = sortType;
        }
        if (ENSortClassType.enFriend != m_curSortClassType)
        {
            SortCards(sortType, reverse);
        }
        else
        {
            FriendList.Singleton.SortCards(sortType, reverse);
        }
        SetVisable(false);
    }
Ejemplo n.º 9
0
    //////////////////////////////特殊的排序/////////////////////////////////////
    //出售
    public List <CSItemGuid> SortCardBySellPrice(ENSortType sortType, bool reverse)
    {
        //不包含队伍,和最爱
        List <int> temp = new List <int>();
        Dictionary <int, List <CSItem> > dic = new Dictionary <int, List <CSItem> >();

        foreach (CSItem item in itemList)
        {
            HeroInfo heroInfo = item.GetHeroInfo();
            if (heroInfo == null)
            {
                UnityEngine.Debug.Log("SortCardByGotTime  heroInfo == null , id = " + item.IDInTable);
                return(null);
            }
            if (item.Guid == User.Singleton.RepresentativeCard)
            {
                continue;
            }

            int intVal = 0;
            switch (sortType)
            {
            case ENSortType.enGold:
                intVal = heroInfo.Price;
                break;

            case ENSortType.enRing:
                intVal = heroInfo.Ring;
                break;

            default:
                UnityEngine.Debug.Log("SortCardByOccOrRace err, type = " + sortType);
                return(null);
            }

            // 队伍中的 和最爱的不参与排序
            if (Team.Singleton.IsCardInTeam(item.Guid))
            {
                continue;
            }
            if (item.GetHeroCardPart().m_favorite)
            {
                continue;
            }

            if (dic.ContainsKey(intVal))
            {
                dic[intVal].Add(item);
            }
            else
            {
                List <CSItem> tmpItemList = new List <CSItem>();
                tmpItemList.Add(item);
                dic.Add(intVal, tmpItemList);
                temp.Add(intVal);
            }
        }
        temp.Sort();
        if (!reverse)
        {
            temp.Reverse();
        }

        List <CSItem> resultList = new List <CSItem>();

        resultList.Clear();
        foreach (int intVal in temp)
        {
            dic[intVal].Sort(new ItemGotTimeCompare());
            foreach (CSItem item in dic[intVal])
            {
                resultList.Add(item);
            }
        }
        //全部统计好了,将ID返回出去
        List <CSItemGuid> guidList = new List <CSItemGuid>();

        foreach (CSItem item in resultList)
        {
            guidList.Add(item.Guid);
        }
        return(guidList);
    }
Ejemplo n.º 10
0
 void RegisterSortFunc(ENSortType sortType, SortDelegate degelate)
 {
     m_sortDelegates.Add((int)sortType, degelate);
 }
Ejemplo n.º 11
0
    //  点击响应
    public void OnClickTeamItem(UICardItem item, ENSortType sortType)
    {
        int    leadship = 0;
        CSItem card     = null;

        // 编辑全队
        if (Team.Singleton.m_curEditType == Team.EDITTYPE.enALL)
        {
            // 要判断领导力
            // 不在编队中
            if (item.m_param.m_id == (int)Team.EDITTYPE.enNone)
            {
                // 点选角色
                card = CardBag.Singleton.GetCardByGuid(item.m_param.m_guid);

                if (null != card)
                {
                    leadship = Team.Singleton.GetAllCost() + GameTable.HeroInfoTableAsset.Lookup(card.IDInTable).Cost;
                }
                // 如果领导力不够 则返回
                if (leadship > User.Singleton.GetLeadership())
                {
                    return;
                }

                Team.EDITTYPE type = Team.EDITTYPE.enNone;

                if (Team.Singleton.m_bagMainSlotId.Equals(CSItemGuid.Zero))
                {
                    Team.Singleton.m_bagMainSlotId = item.m_param.m_guid;
                    type = Team.EDITTYPE.enMain;
                }

                else if (Team.Singleton.m_bagDeputySlotId == CSItemGuid.Zero)
                {
                    Team.Singleton.m_bagDeputySlotId = item.m_param.m_guid;
                    type = Team.EDITTYPE.enDeputy;
                }

                else if (Team.Singleton.m_bagSupportSlotId == CSItemGuid.Zero)
                {
                    Team.Singleton.m_bagSupportSlotId = item.m_param.m_guid;
                    type = Team.EDITTYPE.enSupport;
                }

                item.m_param.m_id = (int)type;

                item.UpdateOperateTeam(card, sortType, type, item.m_index);
            }
            // 在编队中
            else
            {
                if (item.m_param.m_id == (int)Team.EDITTYPE.enMain)
                {
                    Team.Singleton.m_bagMainSlotId = CSItemGuid.Zero;
                    item.m_param.m_id = (int)Team.EDITTYPE.enNone;
                }
                else if (item.m_param.m_id == (int)Team.EDITTYPE.enDeputy)
                {
                    Team.Singleton.m_bagDeputySlotId = CSItemGuid.Zero;
                    item.m_param.m_id = (int)Team.EDITTYPE.enNone;
                }
                else if (item.m_param.m_id == (int)Team.EDITTYPE.enSupport)
                {
                    Team.Singleton.m_bagSupportSlotId = CSItemGuid.Zero;
                    item.m_param.m_id = (int)Team.EDITTYPE.enNone;
                }

                item.UpdateOperateTeam(card, sortType, Team.EDITTYPE.enNone, item.m_index);
            }
        }
        // 编辑单个队伍
        else
        {
            // 如果是移除标志位 则移除当前 队伍成员
            if (item.m_param.m_id == -1)
            {
                Team.Singleton.RemoveTeamMember(Team.Singleton.m_curTeamIndex, Team.Singleton.m_curEditType);
                Team.Singleton.UpdateTeamBagAllSlotId();
                return;
            }

            // 如果是当前队伍中的队伍成员 则返回
            if (Team.Singleton.IsCardInTheTeam(Team.Singleton.m_curTeamIndex, item.m_param.m_guid))
            {
                return;
            }

            card = CardBag.Singleton.GetCardByGuid(item.m_param.m_guid);
            HeroInfo heroInfo = GameTable.HeroInfoTableAsset.Lookup(card.IDInTable);

            if (null == heroInfo)
            {
                Debug.LogWarning("null == heroInfo card.IDInTable:" + card.IDInTable);
                return;
            }


            // 将要被替换角色的领导力
            CSItem replaceCard = Team.Singleton.GetCard(Team.Singleton.m_curTeamIndex, Team.Singleton.m_curEditType);
            int    replaceCost = 0;
            if (null != replaceCard)
            {
                replaceCost = GameTable.HeroInfoTableAsset.Lookup(replaceCard.IDInTable).Cost;
            }
            // 要判断领导力

            // 如果领导力不够 则返回
            if (OperateCardList.Singleton.m_leadShipCost - replaceCost + heroInfo.Cost > User.Singleton.GetLeadership())
            {
                return;
            }

            // 添加
            if (item.m_param.m_id != -1)
            {
                Team.Singleton.AddTeamMember(Team.Singleton.m_curTeamIndex, Team.Singleton.m_curEditType, item.m_param.m_guid);
            }

            Team.Singleton.UpdateTeamBagAllSlotId();
        }
    }
Ejemplo n.º 12
0
 //  点击响应
 public void OnClickItem(UICardItem item, ENSortType sortType)
 {
     CardUpdateProp.Singleton.OnShowCardUpdate(item.m_param.m_guid);
     //MainUIManager.Singleton.OnSwitchSingelUI(MainUIManager.EDUITYPE.enCardUpdate);
 }
Ejemplo n.º 13
0
 //  点击响应
 public void OnClickItem(UICardItem item, ENSortType sortType)
 {
 }
Ejemplo n.º 14
0
    //是否可进化(最特殊)
    public List <CSItemGuid> SortCardByEvolve(ENSortType sortType, bool reverse)
    {
        //该序列不做逆序排列
        List <CSItem> list1 = new List <CSItem>();              //队伍中   等级满足		素材满足		亮
        List <CSItem> list2 = new List <CSItem>();              //非队中   等级满足		素材满足		亮
        List <CSItem> list3 = new List <CSItem>();              //队伍中   等级不满		素材满足		亮
        List <CSItem> list4 = new List <CSItem>();              //非队中   等级不满		素材满足		亮
        List <CSItem> list5 = new List <CSItem>();              //队伍中   等级满足		素材不满		暗
        List <CSItem> list6 = new List <CSItem>();              //非队中		等级满足		素材不满		暗
        List <CSItem> list7 = new List <CSItem>();              //队伍中		等级不满		素材不满		暗
        List <CSItem> list8 = new List <CSItem>();              //非队中		等级不满		素材不满		暗

        int inTeam         = 1 << 2;
        int levelEnough    = 1 << 1;
        int foodCardEnough = 1 << 0;

        Dictionary <int, List <CSItem> > listDic = new Dictionary <int, List <CSItem> >();

        {
            listDic.Add((inTeam | levelEnough | foodCardEnough), list1);              //111	7
            listDic.Add((levelEnough | foodCardEnough), list2);                       //011	3
            listDic.Add((inTeam | foodCardEnough), list3);                            //101	5
            listDic.Add((foodCardEnough), list4);                                     //001	1
            listDic.Add((inTeam | levelEnough), list5);                               //110	6
            listDic.Add((levelEnough), list6);                                        //010	2
            listDic.Add((inTeam), list7);                                             //100	4
            listDic.Add((0), list8);                                                  //000	0
        }

        foreach (CSItem item in itemList)
        {
            HeroInfo heroInfo = item.GetHeroInfo();
            if (heroInfo == null)
            {
                UnityEngine.Debug.Log("SortCardByGotTime  heroInfo == null , id = " + item.IDInTable);
                continue;
            }
            if (item.Guid == User.Singleton.RepresentativeCard)
            {
                continue;
            }
            int resultFlag = 0;
            //是否在队伍里
            if (Team.Singleton.IsCardInTeam(item.Guid))
            {
                resultFlag = resultFlag | inTeam;
            }
            if (item.ReachEvlotionLevel())
            {
                resultFlag = resultFlag | levelEnough;
            }

            if (CardBag.Singleton.CardEvolutionFoodEnough(item.Guid))
            {
                resultFlag = resultFlag | foodCardEnough;
            }
            //加入到对应的list
            listDic[resultFlag].Add(item);
        }
        foreach (KeyValuePair <int, List <CSItem> > listItem in listDic)
        {
            listItem.Value.Sort(new ItemGotTimeCompare());
        }

        //特殊处理代表卡,只考虑等级和材料
        int    RepresentativeCardFlag = 0;
        CSItem repCard = CardBag.Singleton.GetCardByGuid(User.Singleton.RepresentativeCard);

        if (repCard != null)
        {
            if (repCard.ReachEvlotionLevel())
            {
                RepresentativeCardFlag = RepresentativeCardFlag | levelEnough;
            }

            if (CardBag.Singleton.CardEvolutionFoodEnough(repCard.Guid))
            {
                RepresentativeCardFlag = RepresentativeCardFlag | foodCardEnough;
            }
        }

        if (RepresentativeCardFlag == (levelEnough | foodCardEnough))
        {
            list1.Insert(0, repCard);
        }
        else if (RepresentativeCardFlag == foodCardEnough)
        {
            list3.Insert(0, repCard);
        }
        else if (RepresentativeCardFlag == levelEnough)
        {
            list5.Insert(0, repCard);
        }
        else if (RepresentativeCardFlag == 0)
        {
            list7.Insert(0, repCard);
        }

        List <CSItem> resultList = new List <CSItem>();

        resultList.Clear();
        {
            resultList.AddRange(list1);
            resultList.AddRange(list2);
            resultList.AddRange(list3);
            resultList.AddRange(list4);
            resultList.AddRange(list5);
            resultList.AddRange(list6);
            resultList.AddRange(list7);
            resultList.AddRange(list8);
        }

        //全部统计好了,将ID返回出去
        List <CSItemGuid> guidList = new List <CSItemGuid>();

        foreach (CSItem item in resultList)
        {
            guidList.Add(item.Guid);
        }
        return(guidList);
    }
Ejemplo n.º 15
0
    public void Update(CSItem card, ENSortType sortType, int index = 0)
    {
        if (null == card)
        {
            return;
        }

        ShowWindow();

        m_index = index;     // 表示 用显示卡牌详情
        int cardID = card.IDInTable;

        m_bg.gameObject.SetActive(true);

        HeroInfo heroInfo = GameTable.HeroInfoTableAsset.Lookup(cardID);

        if (heroInfo != null)
        {
            // 道具ID
            m_param.m_guid = card.Guid;

            // 头像
            IconInfomation iconInfo = GameTable.IconInfoTableAsset.Lookup(heroInfo.headImageId);
            if (null != iconInfo)
            {
                m_headImage.mainTexture = PoolManager.Singleton.LoadIcon <Texture>(iconInfo.dirName);
            }

            // 等级
            m_level.gameObject.SetActive(true);

            // 排序后的 应显示的 属性
            switch (sortType)
            {
            case ENSortType.enByRarity:
            {
                m_level.text = heroInfo.Rarity.ToString();
                break;
            }

            case ENSortType.enByPhyAttack:
            {
                m_level.text = card.GetPhyAttack().ToString();
                break;
            }

            case ENSortType.enByMagAttack:
            {
                m_level.text = card.GetMagAttack().ToString();
                break;
            }

            case ENSortType.enByHp:
            {
                m_level.text = card.GetHp().ToString();
                break;
            }

            default:
                int levelMax = card.GetMaxLevel();

                if (card.Level >= levelMax)
                {
                    m_level.text = Localization.Get("MaxCardLevel");
                }
                else
                {
                    m_level.text = Localization.Get("CardLevel") + card.Level;
                }
                break;
            }
            // 文字闪现 播放一致
            m_chosen.GetComponent <TweenAlpha>().ResetToBeginning();

            // 是否在编队中
            m_chosen.SetActive(Team.Singleton.IsCardInTeam(card.Guid));

            // 是否是最爱
            m_love.gameObject.SetActive(card.Love);

            m_defaultHead.gameObject.SetActive(false);

            // 职业
            OccupationInfo occupationInfo = GameTable.OccupationInfoAsset.LookUp(heroInfo.Occupation);
            if (null != occupationInfo)
            {
                iconInfo = GameTable.IconInfoTableAsset.Lookup(occupationInfo.m_iconId);

                if (null != iconInfo)
                {
                    m_occ.gameObject.SetActive(true);

                    m_occ.mainTexture = PoolManager.Singleton.LoadIcon <Texture>(iconInfo.dirName);
                }
            }


            RarityRelativeInfo rarityInfo = GameTable.RarityRelativeAsset.LookUp(heroInfo.Rarity);
            if (null != rarityInfo)
            {
                iconInfo = GameTable.IconInfoTableAsset.Lookup(rarityInfo.m_iconId);

                m_rarity.gameObject.SetActive(true);

                m_rarity.mainTexture = PoolManager.Singleton.LoadIcon <Texture>(iconInfo.dirName);
            }
        }
    }
Ejemplo n.º 16
0
    //星级排序
    public List <CSItemGuid> SortByRarity(ENSortType sortType, bool reverse)
    {
        //队伍
        List <int> tempTeam = new List <int>();
        Dictionary <int, List <CSItem> > dicTeam = new Dictionary <int, List <CSItem> >();
        //其他
        List <int> temp = new List <int>();
        Dictionary <int, List <CSItem> > dic = new Dictionary <int, List <CSItem> >();

        // 先是 队伍
        // 再是 其他
        foreach (CSItem item in itemList)
        {
            HeroInfo heroInfo = item.GetHeroInfo();
            if (heroInfo == null)
            {
                UnityEngine.Debug.Log("SortCardByGotTime  heroInfo == null , id = " + item.IDInTable);
                continue;
            }
            if (item.Guid == User.Singleton.RepresentativeCard)
            {
                continue;
            }

            int rarity = heroInfo.Rarity;
            // 队伍中的
            if (Team.Singleton.IsCardInTeam(item.Guid))
            {
                if (dicTeam.ContainsKey(rarity))
                {
                    dicTeam[rarity].Add(item);
                }
                else
                {
                    List <CSItem> tmpItemList = new List <CSItem>();
                    tmpItemList.Add(item);
                    dicTeam.Add(rarity, tmpItemList);
                    tempTeam.Add(rarity);
                }
            }
            else
            {
                if (dic.ContainsKey(rarity))
                {
                    dic[rarity].Add(item);
                }
                else
                {
                    List <CSItem> tmpItemList = new List <CSItem>();
                    tmpItemList.Add(item);
                    dic.Add(rarity, tmpItemList);
                    temp.Add(rarity);
                }
            }
        }
        tempTeam.Sort();
        temp.Sort();
        if (!reverse)
        {
            tempTeam.Reverse();
            temp.Reverse();
        }

        List <CSItem> resultList = new List <CSItem>();

        resultList.Clear();
        foreach (int rarity in tempTeam)
        {
            dicTeam[rarity].Sort(new ItemIdCompare());
            foreach (CSItem item in dicTeam[rarity])
            {
                resultList.Add(item);
            }
        }
        foreach (int rarity in temp)
        {
            dic[rarity].Sort(new ItemIdCompare());
            foreach (CSItem item in dic[rarity])
            {
                resultList.Add(item);
            }
        }
        //全部统计好了,将ID返回出去
        List <CSItemGuid> guidList = new List <CSItemGuid>();

        guidList.Add(User.Singleton.RepresentativeCard);

        foreach (CSItem item in resultList)
        {
            guidList.Add(item.Guid);
        }
        return(guidList);
    }
Ejemplo n.º 17
0
    public List <SortableItem> SortByList(ENSortType sortType, ENSortClassType classType, bool reverse, List <SortableItem> sortList)
    {
        List <float> tempTeam = new List <float>();
        Dictionary <float, List <CSItem> > dicTeam = new Dictionary <float, List <CSItem> >();

        Dictionary <float, List <SortableItem> > dic = new Dictionary <float, List <SortableItem> >();
        List <float> tmpKeyList = new List <float>();

        foreach (SortableItem item in sortList)
        {
            float propVal = 0f;
            switch (classType)
            {
            case ENSortClassType.enCSItem:
                CSItem itemData = (CSItem)item;
                propVal = GetSortValue(itemData, sortType, out dicTeam, out tempTeam);
                break;

            case ENSortClassType.enFriend:
                FriendItem tmpFriendItem = (FriendItem)item;
                propVal = GetSortValue(tmpFriendItem, sortType, out dicTeam, out tempTeam);
                break;

            default:
                UnityEngine.Debug.Log("SortByProperty err, type = " + sortType);
                return(null);
            }
            if (dic.ContainsKey(propVal))
            {
                dic[propVal].Add(item);
            }
            else
            {
                List <SortableItem> tmpItemList = new List <SortableItem>();
                tmpItemList.Add(item);
                dic.Add(propVal, tmpItemList);
                tmpKeyList.Add(propVal);
            }
        }
        tmpKeyList.Sort();
        tempTeam.Reverse();
        if (!reverse)
        {
            tempTeam.Reverse();
            tmpKeyList.Reverse();
        }
        List <SortableItem> resultList = new List <SortableItem>();

        resultList.Clear();
        foreach (float propVal in tempTeam)
        {
            dicTeam[propVal].Sort(new ItemGotTimeCompare());
            foreach (CSItem item in dicTeam[propVal])
            {
                resultList.Add(item);
            }
        }
        foreach (float propVal in tmpKeyList)
        {
            if (dic.ContainsKey(propVal))
            {
                if (ENSortClassType.enCSItem == classType)
                {
                    dic[propVal].Sort(new ItemGotTimeCompareMy());
                }

                foreach (SortableItem item in dic[propVal])
                {
                    resultList.Add(item);
                }
            }
        }
//         //全部统计好了,将ID返回出去
//         List<CSItemGuid> guidList = new List<CSItemGuid>();
//         guidList.Add(User.Singleton.RepresentativeCard);
//
//         foreach (CSItem item in resultList)
//         {
//             guidList.Add(item.Guid);
//         }
        return(resultList);

//         List<int> tmp = new List<int>();
//         return tmp;
    }
Ejemplo n.º 18
0
    // 设置编辑队伍 相关
    public void UpdateOperateTeam(CSItem card, ENSortType sortType, Team.EDITTYPE type = Team.EDITTYPE.enALL, int index = 0)
    {
        if (card == null)
        {
            return;
        }


        Update(card, sortType, index);

        m_param.m_id   = (int)Team.EDITTYPE.enNone;
        m_param.m_guid = card.Guid;

        int cardID = card.IDInTable;

        HeroInfo heroInfo = GameTable.HeroInfoTableAsset.Lookup(cardID);

        if (heroInfo == null)
        {
            return;
        }

        string strShadow = "";

        // 编辑全部队员类型
        if (Team.Singleton.m_curEditType == Team.EDITTYPE.enALL)
        {
            string     coverName = "";
            CSItemGuid guid      = Team.Singleton.m_bagMainSlotId;
            switch (type)
            {
            case Team.EDITTYPE.enMain:
            {
                coverName = "cardCover-team-1";
                guid      = Team.Singleton.m_bagMainSlotId;
                break;
            }

            case Team.EDITTYPE.enDeputy:
            {
                coverName = "cardCover-team-2";
                guid      = Team.Singleton.m_bagDeputySlotId;
                break;
            }

            case Team.EDITTYPE.enSupport:
            {
                coverName = "cardCover-team-3";
                guid      = Team.Singleton.m_bagSupportSlotId;
                break;
            }

            case Team.EDITTYPE.enNone:
            {
                coverName = "";
                guid      = card.Guid;
                break;
            }

            case Team.EDITTYPE.enALL:
            {
                // 队伍索引图标
                if (Team.Singleton.m_bagMainSlotId.Equals(card.Guid))
                {
                    coverName = "cardCover-team-1";
                    type      = Team.EDITTYPE.enMain;
                }
                else if (Team.Singleton.m_bagDeputySlotId.Equals(card.Guid))
                {
                    coverName = "cardCover-team-2";
                    type      = Team.EDITTYPE.enDeputy;
                }
                else if (Team.Singleton.m_bagSupportSlotId.Equals(card.Guid))
                {
                    coverName = "cardCover-team-3";
                    type      = Team.EDITTYPE.enSupport;
                }
                guid = card.Guid;
                break;
            }
            }

            //  如果已选 则显示相应的 已选的图片
            if (guid.Equals(card.Guid))
            {
                m_tips.GetComponent <UISprite>().spriteName = coverName;
                m_param.m_type = (int)Team.Singleton.m_curEditType;
                m_param.m_id   = (int)type;
            }

            m_chosen.gameObject.SetActive(m_param.m_id != (int)Team.EDITTYPE.enNone);

            //获取世界参数表提取队伍最大人数
            WorldParamInfo info    = GameTable.WorldParamTableAsset.Lookup((int)ENWorldParamIndex.enTeamRoleMaxNum);
            int            roleMax = 0;
            if (null != info)
            {
                roleMax = info.IntTypeValue;
            }
            else
            {
                roleMax = 3;
            }
            // 如果超过了 玩家的领导力
            if (Team.Singleton.GetTheTeamCostExcept(card.Guid) + heroInfo.Cost > User.Singleton.GetLeadership())
            {
                strShadow = "cost_Not_Enough";
            }
            else if (OperateCardList.Singleton.m_hadItemList.Count >= roleMax)         //队伍内人数是否大于等于队伍最大人数
            {
                strShadow = "mask_card";
            }
        }
        // 编辑单个队伍类型
        else
        {
            // 突破
            m_break.text = Localization.Get("LevelBreak") + card.BreakCounts;

            m_tips.GetComponent <UISprite>().spriteName = "cardCover-choose";

            // 将要被替换角色的领导力
            CSItem replaceCard = Team.Singleton.GetCard(Team.Singleton.m_curTeamIndex, Team.Singleton.m_curEditType);
            int    replaceCost = 0;
            if (null != replaceCard)
            {
                replaceCost = GameTable.HeroInfoTableAsset.Lookup(replaceCard.IDInTable).Cost;
            }
            // 如果超过了 玩家的领导力()
            if (OperateCardList.Singleton.m_leadShipCost - replaceCost + heroInfo.Cost > User.Singleton.GetLeadership())
            {
                strShadow = "cost_Not_Enough";
            }
        }

        m_tips.SetActive(true);
        m_mask.SetActive(true);
        m_defaultHead.gameObject.SetActive(false);
        m_tag.spriteName = "";
        m_shadow.GetComponent <UISprite>().spriteName = strShadow;
        m_love.gameObject.SetActive(false);
    }
Ejemplo n.º 19
0
    //int属性排序(level,favorite)
    public List <CSItemGuid> SortByIntProperty(ENSortType sortType, bool reverse)
    {
        //队伍
        List <int> tempTeam = new List <int>();
        Dictionary <int, List <CSItem> > dicTeam = new Dictionary <int, List <CSItem> >();
        //其他
        List <int> temp = new List <int>();
        Dictionary <int, List <CSItem> > dic = new Dictionary <int, List <CSItem> >();

        // 先是 队伍
        // 再是 其他
        foreach (CSItem item in itemList)
        {
            HeroInfo heroInfo = item.GetHeroInfo();
            if (heroInfo == null)
            {
                UnityEngine.Debug.Log("SortCardByGotTime  heroInfo == null , id = " + item.IDInTable);
                continue;
            }
            if (item.Guid == User.Singleton.RepresentativeCard)
            {
                continue;
            }

            int propVal = 0;
            switch (sortType)
            {
            case ENSortType.enByLevel:
                propVal = item.Level;
                break;

            case ENSortType.enByFavorite:
                propVal = item.GetHeroCardPart().m_favorite == true?1:0;
                break;

            default:
                UnityEngine.Debug.Log("SortByProperty err, type = " + sortType);
                return(null);
            }
            // 队伍中的
            if (Team.Singleton.IsCardInTeam(item.Guid))
            {
                if (dicTeam.ContainsKey(propVal))
                {
                    dicTeam[propVal].Add(item);
                }
                else
                {
                    List <CSItem> tmpItemList = new List <CSItem>();
                    tmpItemList.Add(item);
                    dicTeam.Add(propVal, tmpItemList);
                    tempTeam.Add(propVal);
                }
            }
            else
            {
                if (dic.ContainsKey(propVal))
                {
                    dic[propVal].Add(item);
                }
                else
                {
                    List <CSItem> tmpItemList = new List <CSItem>();
                    tmpItemList.Add(item);
                    dic.Add(propVal, tmpItemList);
                    temp.Add(propVal);
                }
            }
        }
        tempTeam.Sort();
        temp.Sort();
        if (!reverse)
        {
            tempTeam.Reverse();
            temp.Reverse();
        }

        List <CSItem> resultList = new List <CSItem>();

        resultList.Clear();
        foreach (int propVal in tempTeam)
        {
            dicTeam[propVal].Sort(new ItemGotTimeCompare());
            foreach (CSItem item in dicTeam[propVal])
            {
                resultList.Add(item);
            }
        }
        foreach (int propVal in temp)
        {
            dic[propVal].Sort(new ItemGotTimeCompare());
            foreach (CSItem item in dic[propVal])
            {
                resultList.Add(item);
            }
        }
        //全部统计好了,将ID返回出去
        List <CSItemGuid> guidList = new List <CSItemGuid>();

        guidList.Add(User.Singleton.RepresentativeCard);
        foreach (CSItem item in resultList)
        {
            guidList.Add(item.Guid);
        }
        return(guidList);
    }
Ejemplo n.º 20
0
    void UpdateInfo()
    {
        // if hide then not update
        if (WindowRoot.activeSelf == false)
        {
            return;
        }
        m_capacity.text    = "" + CardBag.Singleton.m_cardNum;
        m_maxCapacity.text = "/" + CardBag.Singleton.m_capacity;

        if (CardBag.Singleton.m_cardNum > CardBag.Singleton.m_capacity)
        {
            m_capacity.color = Color.red;
        }
        else
        {
            m_capacity.color = Color.black;
        }

        m_cardSortLable.text = CardBag.Singleton.GetSrotString(m_cardSortUI.GetLastSortType());
        // 排序好的列表
        List <CSItemGuid> cardList = m_cardSortUI.GetSortReslut(); // CardBag.Singleton.GetSortedCardList();
        // 排序类型
        ENSortType sortType = m_cardSortUI.GetLastSortType();

        int i = 1;

        foreach (CSItemGuid item in cardList)
        {
            CSItem card = CardBag.Singleton.GetCardByGuid(item);
            if (null == card)
            {
                continue;
            }

            int      cardID   = card.IDInTable;
            HeroInfo heroInfo = GameTable.HeroInfoTableAsset.Lookup(cardID);

            if (null == heroInfo)
            {
                Debug.LogWarning("heroInfo == NULL heroInfo cardID:" + cardID);
                continue;
            }
            // 职业刷选
            if (m_cardSortUI.GetSelectedOcc().Count != 0)
            {
                // 如果不是是选中的职业 则不显示
                if (!m_cardSortUI.GetSelectedOcc().Contains(heroInfo.Occupation))
                {
                    continue;
                }
            }

            // 种族筛选
            if (m_cardSortUI.GetSelectedRace().Count != 0)
            {
                // 如果不是是选中的职业 则不显示
                if (!m_cardSortUI.GetSelectedRace().Contains(heroInfo.Type))
                {
                    continue;
                }
            }


            if (false == m_gridList.ContainsKey(i))
            {
                CreateOneGird(i);
            }

            m_gridList[i].Update(card, sortType, i);

            i++;
        }

        // 把剩余的空格子图片置空
        for (; i <= m_gridList.Count; i++)
        {
            if (!m_gridList.ContainsKey(i))
            {
                continue;
            }

            m_gridList[i].SetEmpty();
        }

        // 最后一个格子 是扩充按钮
        int tempInt = CardBag.Singleton.m_capacity + 1;

        if (CardBag.Singleton.m_cardNum > CardBag.Singleton.m_capacity)
        {
            tempInt = CardBag.Singleton.m_cardNum + 1;
        }


        CreateOneGird(tempInt);

        m_gridList[tempInt].SetExpand();

        m_grid.Reposition();

        // 设置背包 中卡牌的空隙 中用来拖拽的 BOX大小
        BoxCollider boxCollider = m_dragBox.GetComponent <BoxCollider>();
        int         totalCol    = User.Singleton.GetBagCapcity() / m_grid.maxPerLine;

        boxCollider.size = new Vector3(boxCollider.size.x, totalCol * m_grid.cellHeight * 2, 0);

        boxCollider.center = new Vector3(boxCollider.center.x, (-1) * totalCol * m_grid.cellHeight / 2, 0);
    }
Ejemplo n.º 21
0
 //  点击响应
 public void OnClickItem(UICardItem item, ENSortType sortType)
 {
     OperateCardList.Singleton.LevelUpItemOperation(item.m_param.m_guid);
 }
Ejemplo n.º 22
0
    // 更新
    void UpdateInfo()
    {
        m_tempIndex = 1;

        // 不同类型显示内容不同
        ShowCurTypeLayout();

        // 排序好的列表
        List <CSItemGuid> cardList = m_cardSortUI.GetSortReslut();
        ENSortType        sortType = m_cardSortUI.GetLastSortType();

        // 显示卡牌列表
        foreach (CSItemGuid itemGuid in cardList)
        {
            CSItem item = CardBag.Singleton.GetCardByGuid(itemGuid);
            if (null == item)
            {
                continue;
            }

            int cardID = item.IDInTable;

            HeroInfo heroInfo = GameTable.HeroInfoTableAsset.Lookup(cardID);

            if (null == heroInfo)
            {
                Debug.LogWarning("heroInfo == NULL heroInfo cardID:" + cardID);
                continue;
            }

            // 筛选
            if (SortConditon(item))
            {
                continue;
            }

            // 格子不够增加格子
            if (false == m_gridList.ContainsKey(m_tempIndex))
            {
                ExpandOneGrid();
            }

            // 更新格子
            UICardItem cardItem = m_gridList[m_tempIndex];

            cardItem.UpdateOperate(item, sortType, m_tempIndex);

            m_tempIndex++;
        }


        // 把剩余的空格子图片置空
        for (; m_tempIndex <= m_gridList.Count; m_tempIndex++)
        {
            UICardItem cardItem = m_gridList[m_tempIndex];
            cardItem.SetEmpty();
            cardItem.HideWindow();
        }

        m_gridItemList.Reposition();
    }
 //  点击响应
 public void OnClickItem(UICardItem item, ENSortType sortType)
 {
     ShowRepresentativeCardInfo(item.m_param.m_guid);
     m_nowSelectCRGuid = item.m_param.m_guid;
 }