コード例 #1
0
    /** 一秒十次 */
    public void onPiece(int delay)
    {
        IntObjectMap <CDData> cds;

        if ((cds = _cds).isEmpty())
        {
            return;
        }

        IntObjectMap <CDData> groupMaxCDs  = _groupMaxCDs;
        IntIntMap             groupCDCount = _groupCDCount;
        UnitFightDataLogic    parent       = _parent;

        foreach (CDData data in _cds)
        {
            if ((data.timePass += delay) >= data.timeMax)
            {
                cds.remove(data.id);

                //移除对应组CD
                foreach (int gv in data.config.groups)
                {
                    groupCDCount.addValue(gv, -1);

                    if (groupMaxCDs.get(gv) == data)
                    {
                        groupMaxCDs.remove(gv);

                        parent.onEndGroupCD(gv);
                    }
                }
            }
        }
    }
コード例 #2
0
    /** 根据keep移除cd组(不推送) */
    public void removeCDByKeep(int keepType)
    {
        IntObjectMap <CDData> cds          = _cds;
        IntObjectMap <CDData> groupMaxCDs  = _groupMaxCDs;
        IntIntMap             groupCDCount = _groupCDCount;
        UnitFightDataLogic    parent       = _parent;
        int executeNum = 0;

        bool has = false;

        foreach (CDData data in cds)
        {
            //大于等于的移除
            if (data.config.keepType >= keepType)
            {
                has = true;
                cds.remove(data.id);

                //移除对应组CD
                foreach (int gv in data.config.groups)
                {
                    if (groupMaxCDs.get(gv) == data)
                    {
                        groupMaxCDs.remove(gv);
                        ++executeNum;
                    }

                    if (groupCDCount.addValue(gv, -1) <= 0)
                    {
                        --executeNum;
                        parent.onEndGroupCD(gv);
                    }
                }
            }
        }

        if (has)
        {
            if (executeNum != 0)
            {
                reCountGroupCDMax();
            }

            _parent.onCDChange();
        }
    }
コード例 #3
0
    /** 移除组cd */
    public void removeGroupCD(int groupID)
    {
        bool has = false;
        IntObjectMap <CDData> cds          = _cds;
        IntObjectMap <CDData> groupMaxCDs  = _groupMaxCDs;
        IntIntMap             groupCDCount = _groupCDCount;
        UnitFightDataLogic    parent       = _parent;
        //FIXME:SMap
        int executeNum = 0;

        foreach (CDData data in cds)
        {
            if (data.config.hasGroup(groupID))
            {
                has = true;

                cds.remove(data.id);

                foreach (int gv in data.config.groups)
                {
                    if (groupMaxCDs.get(gv) == data)
                    {
                        groupMaxCDs.remove(gv);
                        ++executeNum;
                    }

                    if (groupCDCount.addValue(gv, -1) <= 0)
                    {
                        --executeNum;
                        parent.onEndGroupCD(gv);
                    }
                }
            }
        }

        if (has)
        {
            if (executeNum != 0)
            {
                reCountGroupCDMax();
            }

            _parent.onCDChange();
        }
    }