Пример #1
0
    /** 统计可接与可见任务列表 */
    private void countCanAcceptAndCanSeeQuests()
    {
        _canAcceptQuests.clear();
        _canSeeQuests.clear();

        QuestConfig[] values;
        QuestConfig   v;

        for (int i = (values = _waitAcceptQuests.getValues()).Length - 1; i >= 0; --i)
        {
            if ((v = values[i]) != null)
            {
                if (checkSeeConditions(v))
                {
                    _canSeeQuests.put(v.id, v);
                }

                if (checkAcceptConditions(v, false))
                {
                    _canAcceptQuests.put(v.id, v);
                }
            }
        }

        me.dispatch(GameEventType.RefreshCanAcceptQuests);
        me.dispatch(GameEventType.RefreshCanSeeQuests);

        checkAutoAccept();
    }
Пример #2
0
 public void clear()
 {
     _cds.clear();
     _groupMaxCDs.clear();
     _groupCDCount.clear();
     _groupCDChangePercents.clear();
     _groupCDChangeValues.clear();
 }
Пример #3
0
    public virtual void clear()
    {
        if (_buffDataDic != null)
        {
            _buffDataDic.clear();
        }

        _buffDatas.clear();
        _buffDatasByID.clear();
        _buffDatasForAllExist.clear();

        foreach (IntObjectMap <BuffData> v in _buffDatasBySubNums)
        {
            if (v != null)
            {
                v.clear();
            }
        }

        _buffInstanceIDMaker.reset();
        _skillProbChanges.clear();
        _intervalActions.clear();

        foreach (IntObjectMap <int[]> v in _attackProbActions)
        {
            if (v != null)
            {
                v.clear();
            }
        }

        _useSkillProbActions.clear();

        SList <DIntData>[] values = _shieldBuffDic.getValues();
        SList <DIntData>   v2;

        for (int i = values.Length - 1; i >= 0; --i)
        {
            if ((v2 = values[i]) != null)
            {
                v2.clear();
            }
        }

        _skillReplaceDic.clear();
        _skillProbReplaceDic.clear();

        _skillLevelUpDic.clear();
        _buffLevelUpDic.clear();
        _buffLastTimeAddDic.clear();

        _attributeRefreshVarDic.clear();
        _addAttributeRefreshVarASet.clear();
    }
Пример #4
0
    /** 缓存到当前数据(见BuffKeepType) */
    public void saveCache(MUnitCacheData data, int keepType)
    {
        data.cacheTime = getTimeMillis();

        //当前属性
        IntIntMap currentAttributes = data.currentAttributes;

        currentAttributes.clear();

        int[] currentList = AttributeControl.attribute.currentList;

        for (int i = currentList.Length - 1; i >= 0; --i)
        {
            currentAttributes.put(currentList[i], attribute.getAttribute(currentList[i]));
        }

        //buff
        IntObjectMap <BuffData> buffs = data.buffs;

        buffs.clear();

        BuffData[] values = buff.getBuffDatas().getValues();
        BuffData   v;

        for (int i = values.Length - 1; i >= 0; --i)
        {
            if ((v = values[i]) != null)
            {
                if (v.config.keepType == keepType)
                {
                    buffs.put(v.instanceID, (BuffData)v.clone());                   //clone
                }
            }
        }

        //cd
        IntObjectMap <CDData> cds = data.cds;

        cds.clear();

        CDData[] cdValues = cd.getCDs().getValues();
        CDData   cdV;

        for (int i = cdValues.Length - 1; i >= 0; --i)
        {
            if ((cdV = cdValues[i]) != null)
            {
                if (CDConfig.get(cdV.id).keepType == keepType)
                {
                    cds.put(cdV.id, (CDData)cdV.clone());                   //clone
                }
            }
        }
    }
Пример #5
0
    public override void dispose()
    {
        if (!_effectList.isEmpty())
        {
            SList <UnitEffect> unitEffects = _effectList;
            UnitEffect         effect;

            for (int i = unitEffects.size() - 1; i >= 0; --i)
            {
                effect = unitEffects[i];
                effect.dispose();
                GameC.pool.unitEffectPool.back(effect);
            }

            unitEffects.clear();
        }

        _effectNumDic.clear();

        disposeMainShow();

        //析构GameObject
        _transform = null;

        //TODO:拆掉Part


        _modelLoadTool.clear();

        AssetPoolLoadTool[] values;
        AssetPoolLoadTool   v;

        for (int i = (values = _partLoadToolDic.getValues()).Length - 1; i >= 0; --i)
        {
            if ((v = values[i]) != null)
            {
                v.clear();
            }
        }

        AssetPoolControl.unloadOne(AssetPoolType.UnitMain, AssetCustomType.UnitMainObj, _gameObject);
        _gameObject = null;

        _actionID    = MotionType.Idle;
        _showModelID = -1;
        _modelReady  = false;
        _partDic.clear();
        _partReady.clear();

        clearMotion();

        base.dispose();
    }
Пример #6
0
    /// <summary>
    /// 析构(回池前调用,与init成对)
    /// </summary>
    public override void dispose()
    {
        _petDic.forEachValueAndClear(v =>
        {
            v.dispose();
            GameC.pool.petUseLogicPool.back(v);
        });

        if (Global.isPetUnique)
        {
            _petDicByID.clear();
        }
    }
Пример #7
0
    /** 重新构造辅助数据 */
    private void reMakeData()
    {
        _itemNums.clear();
        _dicByID.clear();

        foreach (var kv in _dic.entrySet())
        {
            ItemData v = kv.value;
            //绑定index
            v.index = kv.key;
            v.reloadConfig();

            getItemDicByIDAbs(v.id).put(v.index, v);

            _itemNums.addValue(v.id, v.num);
        }
    }
Пример #8
0
    /** 写拷贝 */
    public void writeForCopy()
    {
        IntObjectMap <BuffData> dic = _buffDataDic;

        dic.clear();

        BuffData[] values = _buffDatas.getValues();
        BuffData   data;

        for (int i = values.Length - 1; i >= 0; --i)
        {
            if ((data = values[i]) != null)
            {
                dic.put(data.instanceID, data);
            }
        }
    }
Пример #9
0
    /** 读完所有表后处理 */
    public static void afterReadConfigAll()
    {
        _groupDic.clear();

        TriggerConfigData[] values;
        TriggerConfigData   v;

        for (int i = (values = _dic.getValues()).Length - 1; i >= 0; --i)
        {
            if ((v = values[i]) != null)
            {
                _groupDic.computeIfAbsent(v.groupType, k1 => new IntObjectMap <IntObjectMap <TriggerConfigData> >())
                .computeIfAbsent(v.groupID, k2 => new IntObjectMap <TriggerConfigData>())
                .put(v.id, v);
            }
        }
    }
Пример #10
0
    /** 统计所有可接任务列表 */
    private void countWaitAcceptQuests()
    {
        IntObjectMap <QuestConfig> dic = QuestConfig.getDic();

        if (dic == null)
        {
            return;
        }

        IntObjectMap <QuestConfig> waitAcceptQuests = _waitAcceptQuests;

        waitAcceptQuests.clear();

        IntObjectMap <QuestData> accepts = _d.accepts;
        IntSet completeIDs = _d.completeIDs;
        IntObjectMap <QuestCompleteData> completeQuestsDic = _d.completeQuestsDic;
        IntIntMap completeLines = _d.completeLines;

        QuestConfig[] values;
        QuestConfig   v;
        int           questID;
        DIntData      line;

        for (int i = (values = dic.getValues()).Length - 1; i >= 0; --i)
        {
            if ((v = values[i]) != null)
            {
                //可主动接
                if (v.acceptType != QuestAcceptType.Passive)
                {
                    questID = v.id;

                    //已接
                    if (accepts.contains(questID))
                    {
                        continue;
                    }

                    //完成
                    if (completeIDs.contains(questID))
                    {
                        continue;
                    }

                    //周期完成
                    if (completeQuestsDic.contains(questID))
                    {
                        continue;
                    }

                    //链完成
                    if (!(line = v.questLine).isEmpty() && line.value <= completeLines.getOrDefault(line.key, -1))
                    {
                        continue;
                    }

                    //前置未完成
                    if (!checkQuestPreAllComplete(v))
                    {
                        continue;
                    }

                    waitAcceptQuests.put(v.id, v);
                }
            }
        }
    }
Пример #11
0
    /** 重新构造辅助数据 */
    private void reMakeData()
    {
        IntSet itemTimeSet;

        if (!_itemRecordDic.isEmpty())
        {
            ItemRecordData[] values;
            ItemRecordData   v;

            for (int i = (values = _itemRecordDic.getValues()).Length - 1; i >= 0; --i)
            {
                if ((v = values[i]) != null)
                {
                    _recordDataPool.back(v);
                }
            }

            _itemRecordDic.clear();
        }

        (itemTimeSet = _itemTimeSet).clear();

        _nextFreeGridIndex = -1;

        int len = 0;

        SList <ItemData> list = _list;

        if (!list.isEmpty())
        {
            int index = list.size() - 1;

            //先去末尾null
            while (index >= 0 && list.get(index) == null)
            {
                --index;
            }

            list.justSetSize(index + 1);


            ItemData[] values = list.getValues();
            ItemData   data;

            len = list.size();

            ItemRecordData rData;

            for (int i = 0; i < len; ++i)
            {
                data = values[i];

                //空格子
                if (data == null)
                {
                    if (_nextFreeGridIndex == -1)
                    {
                        _nextFreeGridIndex = i;
                    }
                }
                else
                {
                    ++_useGridNum;

                    //构造配置
                    data.makeConfig();
                    data.index = i;

                    rData             = getRecordDataAbs(data.id);
                    rData.num        += data.num;
                    rData.removeIndex = i;

                    //不满
                    if (!data.isSingleNumMax())
                    {
                        //没有就添加
                        if (rData.addIndex != -1)
                        {
                            rData.addIndex = i;
                        }
                    }

                    if (!data.config.enableTimeT.isEmpty())
                    {
                        itemTimeSet.add(i);
                    }

                    //红点
                    if (data.hasRedPoint)
                    {
                        _redPointCount++;
                    }
                }
            }
        }

        if (_gridNum > 0)
        {
            if (_gridNum - len > 0)
            {
                if (_nextFreeGridIndex == -1)
                {
                    _nextFreeGridIndex = len;
                }
            }
        }
        else
        {
            if (_nextFreeGridIndex == -1)
            {
                _nextFreeGridIndex = len;
            }
        }
    }
Пример #12
0
    /** 结算移除结果 */
    protected void flushRemove(int way)
    {
        if (_operateRecordList.isEmpty())
        {
            return;
        }

        if (_flushing)
        {
            Ctrl.throwError("物品操作出现环");
            return;
        }

        _flushing = true;

        try
        {
            int[] values = _operateRecordList.getValues();

            int      index;
            int      num;
            ItemData data;
            ItemData oldData;

            //单个
            if (_operateRecordList.size() == 2)
            {
                data = getItem(index = _operateRecordList.get(0));
                num  = values[1];

                // toSendRemoveOneItem(index,data!=null ? data.num : 0,way);

                oldData = data != null ? data : _operateRecordRemoveDic.get(index);

                onItemRemove(index, oldData, num, way);
            }
            else
            {
                // IntIntMap dic=new IntIntMap();

                int len = _operateRecordList.size();

                for (int i = 0; i < len; i += 2)
                {
                    data = getItem(index = values[i]);
                    num  = values[i + 1];

                    // dic.put(index,data!=null ? data.num : 0);

                    oldData = data != null ? data : _operateRecordRemoveDic.get(index);

                    onItemRemove(index, oldData, num, way);
                }

                // toSendRemoveItem(dic,way);
            }

            _operateRecordList.clear();

            if (!_operateRecordRemoveDic.isEmpty())
            {
                ItemData[] values2;
                ItemData   v;

                for (int i = (values2 = _operateRecordRemoveDic.getValues()).Length - 1; i >= 0; --i)
                {
                    if ((v = values2[i]) != null)
                    {
                        if (v.canRelease)
                        {
                            releaseItem(v);
                        }
                    }
                }

                _operateRecordRemoveDic.clear();
            }

            onChanged();
        }
        catch (Exception e)
        {
            Ctrl.errorLog(e);
        }

        _flushing = false;
    }
Пример #13
0
    public void dispose()
    {
        if (_configDic == null)
        {
            return;
        }

        _configDic = null;
        _openDic.clear();

        foreach (var list in _eventActiveDic)
        {
            TriggerEventRegistData[] values1 = list.getValues();

            for (int i = 0, len = list.size(); i < len; ++i)
            {
                _eventRegistDataPool.back(values1[i]);
                values1[i] = null;
            }

            list.justClearSize();
        }

        int[]             keys   = _instanceDic.getKeys();
        TriggerInstance[] values = _instanceDic.getValues();
        int             fv       = _instanceDic.getFreeValue();
        TriggerInstance v;

        for (int i = keys.Length - 1; i >= 0; --i)
        {
            if ((keys[i]) != fv)
            {
                v = values[i];
                _instancePool.back(v);
                keys[i]   = fv;
                values[i] = null;
            }
        }

        _instanceDic.justClearSize();

        TriggerActionRunner[] keys2 = _timerRunnerDic.getKeys();
        TriggerActionRunner   k2;

        for (int i2 = keys2.Length - 1; i2 >= 0; --i2)
        {
            if ((k2 = keys2[i2]) != null)
            {
                _argPool.back(k2.arg);
                disposeActionRunner(k2);
                keys2[i2] = null;
            }
        }

        _timerRunnerDic.justClearSize();

        TriggerIntervalData[] keys3 = _timerIntervalDic.getKeys();
        TriggerIntervalData   k3;

        for (int i3 = keys3.Length - 1; i3 >= 0; --i3)
        {
            if ((k3 = keys3[i3]) != null)
            {
                _intervalPool.back(k3);
                keys3[i3] = null;
            }
        }

        _timerIntervalDic.justClearSize();
    }