Example #1
0
    /// <summary>
    /// 读完所有表后处理
    /// </summary>
    public static void afterReadConfigAll()
    {
        conditionDic = new IntObjectMap <IntObjectMap <FunctionConfig> >();

        foreach (FunctionConfig v in getDic())
        {
            foreach (int[] arr in v.openConditions)
            {
                conditionDic.computeIfAbsent(arr[0], k => new IntObjectMap <FunctionConfig>()).put(v.id, v);
            }

            if (v.closeConditions.Length == 0)
            {
                v.needClose = false;
            }
            else
            {
                v.needClose = true;

                foreach (int[] arr in v.closeConditions)
                {
                    conditionDic.computeIfAbsent(arr[0], k => new IntObjectMap <FunctionConfig>()).put(v.id, v);
                }
            }
        }
    }
Example #2
0
    private void toAddBuffToDic(BuffData data)
    {
        _buffDatas.put(data.instanceID, data);

        if (data.config.plusType == BuffPlusType.AllExist)
        {
            _buffDatasForAllExist.computeIfAbsent(data.id, k => new IntObjectMap <BuffData>()).put(data.instanceID, data);
        }
        else
        {
            _buffDatasByID.put(data.id, data);
        }

        int[][] subNums;

        if ((subNums = data.config.subNums).Length > 0)
        {
            foreach (int[] v in subNums)
            {
                IntObjectMap <BuffData> dic = _buffDatasBySubNums[v[0]];

                if (dic == null)
                {
                    _buffDatasBySubNums[v[0]] = dic = new IntObjectMap <BuffData>();
                }

                dic.put(data.instanceID, data);
            }
        }
    }
Example #3
0
    protected void addEventListener(TriggerConfigData config, int index, TriggerFuncData data)
    {
        SList <TriggerEventRegistData> list = _eventActiveDic.computeIfAbsent(data.id, k => new SList <TriggerEventRegistData>());

        TriggerEventRegistData eData = _eventRegistDataPool.getOne();

        eData.config   = config;
        eData.index    = index;
        eData.data     = data;
        eData.priority = config.priority;

        if (list.isEmpty())
        {
            list.add(eData);
        }
        else
        {
            TriggerEventRegistData[] values = list.getValues();
            int idx = Array.BinarySearch(values, 0, list.size(), eData, _comparer);

            if (idx >= 0)
            {
                list.insert(idx, eData);
            }
            else
            {
                list.insert(-idx + 1, eData);
            }
        }
    }
Example #4
0
    /// <summary>
    /// 读完所有表后处理
    /// </summary>
    public static void afterReadConfigAll()
    {
        _randomDic = new IntObjectMap <RandomNameGroupData>();

        if (_dic != null)
        {
            RandomNameConfig[] values;
            RandomNameConfig   v;

            RandomNameGroupData gData;

            for (int i = (values = _dic.getValues()).Length - 1; i >= 0; --i)
            {
                if ((v = values[i]) != null)
                {
                    gData = _randomDic.computeIfAbsent(v.group, k => new RandomNameGroupData());

                    if (v.firstName.isEmpty())
                    {
                        gData.firstNames.add(v.firstName);
                    }

                    if (!v.secondName.isEmpty())
                    {
                        gData.secondNames.add(v.secondName);
                    }
                }
            }
        }
    }
Example #5
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);
            }
        }
    }
Example #6
0
    /** 执行添加任务目标 */
    private void doAddRunningTask(TaskData data)
    {
        _runningTaskDic.put(data.instanceID, data);

        TaskTypeConfig tConfig;

        //双键
        if ((tConfig = TaskTypeConfig.get(data.config.type)).needSecondKey)
        {
            _runningTaskTypeTwoDic.computeIfAbsent((long)data.config.type << 32 | data.config.args[1], k => new IntObjectMap <TaskData>()).put(data.instanceID, data);

            if (tConfig.needSecondKey2)
            {
                _runningTaskTypeTwoDic2.computeIfAbsent((long)data.config.type << 32 | data.config.args[2], k => new IntObjectMap <TaskData>()).put(data.instanceID, data);
            }
        }
        //单键
        else
        {
            _runningTaskTypeOneDic.computeIfAbsent(data.config.type, k => new IntObjectMap <TaskData>()).put(data.instanceID, data);
        }
    }
Example #7
0
 /** 获取场景布置配置 */
 public static ScenePlaceConfig get(int id)
 {
     return(_dic.computeIfAbsent(id, k => new ScenePlaceConfig(k)));
 }
Example #8
0
    public void init(SList <AttributeOneInfo> list, int size)
    {
        this.size             = size;
        currentToIndex        = new int[size];
        currentDefaultFullSet = new bool[size];
        currentCanOverMax     = new bool[size];
        maxToCurrentMap       = new int[size];
        currentToMaxMap       = new int[size];
        formulaTypeDic        = new int[size][];
        elementToResultDic    = new int[size][];
        increaseToCurrentMap  = new int[size];
        currentToIncreaseMap  = new int[size];
        increaseToIndex       = new int[size];

        needDispatchSet = new bool[size];
        simpleUnitSet   = new bool[size];

        IntList tCurrentList       = new IntList();
        IntList tFormulaResultList = new IntList();
        IntList tNeedDispatchList  = new IntList();
        IntList tIncreaseList      = new IntList();
        IntList tSimpleUnitList    = new IntList();

        IntObjectMap <IntList> tElementToResultDic = new IntObjectMap <IntList>();

        AttributeOneInfo[] values = list.getValues();
        AttributeOneInfo   v;

        for (int i = 0, len = list.size(); i < len; ++i)
        {
            v = values[i];

            int type = v.id;

            //是当前属性
            if (v.currentMaxID > 0)
            {
                currentToIndex[type] = tCurrentList.size();
                tCurrentList.add(type);
                maxToCurrentMap[v.currentMaxID] = type;
                currentToMaxMap[type]           = v.currentMaxID;

                if (v.isCurrentDefaultFull)
                {
                    currentDefaultFullSet[type] = true;
                }

                if (v.isCurrentCanOverMax)
                {
                    currentCanOverMax[type] = true;
                }
            }

            if (v.increaseID > 0)
            {
                increaseToIndex[type] = tIncreaseList.size();
                tIncreaseList.add(type);
                increaseToCurrentMap[type]         = v.increaseID;
                currentToIncreaseMap[v.increaseID] = type;
            }

            if (v.formula != null && v.formula.Length > 0)
            {
                tFormulaResultList.add(type);
                formulaTypeDic[type] = v.formula;

                for (int j = 1; j < v.formula.Length; j++)
                {
                    tElementToResultDic.computeIfAbsent(v.formula[j], k => new IntList()).add(type);
                }
            }

            //以客户端推送方式为准
            if (v.sendSelfType != AttributeSendSelfType.None)
            {
                tNeedDispatchList.add(type);
                needDispatchSet[type] = true;
            }

            if (v.isSimpleUnitNeed)
            {
                tSimpleUnitList.add(type);
                simpleUnitSet[type] = true;
            }
        }

        currentList       = tCurrentList.toArray();
        formulaResultList = tFormulaResultList.toArray();
        needDispatchList  = tNeedDispatchList.toArray();
        increaseList      = tIncreaseList.toArray();

        tElementToResultDic.forEach((k, v2) =>
        {
            elementToResultDic[k] = v2.toArray();
        });

        simpleUnitList = tSimpleUnitList.toArray();
    }
Example #9
0
    //buff响应

    /** 执行单个动作 */
    protected virtual void doOneAction(BuffData data, int index, int[] args, bool isAdd, bool isFull)
    {
        bool isDriveAll = _parent.isDriveAll();

        switch (args[0])
        {
        case BuffActionType.AddStatus:
        {
            if (!isDriveAll)
            {
                return;
            }

            if (!isFull)
            {
                return;
            }

            if (isAdd)
            {
                _parent.status.addStatus(args[1]);
            }
            else
            {
                _parent.status.subStatus(args[1]);
            }
        }
        break;

        case BuffActionType.AddAttribute:
        {
            if (!isDriveAll)
            {
                return;
            }

            if (!isFull)
            {
                return;
            }

            _parent.attribute.addOneAttribute(args[1], isAdd ? args[2] : -args[2]);
        }
        break;

        case BuffActionType.AddAttributeVar:
        {
            if (!isDriveAll)
            {
                return;
            }

            if (!isFull)
            {
                return;
            }

            if (isAdd)
            {
                int value = _parent.getSkillVarValueT(args[2], data.adderInstanceID);

                _parent.attribute.addOneAttribute(args[1], value);

                _attributeVarDic.put(data.instanceID << CommonSetting.buffActionIndexOff | index, value);
            }
            else
            {
                int value = _attributeVarDic.remove(data.instanceID << CommonSetting.buffActionIndexOff | index);

                _parent.attribute.subOneAttribute(args[1], value);
            }
        }
        break;

        case BuffActionType.IntervalMakeAttack:
        {
            //不是客户端驱动战斗
//				if(!SceneDriveType.isClientDriveAttackHapen(CommonSetting.sceneDriveType))
//					return;

            //不是客户端驱动战斗
            if (!_parent.isSelfDriveAttackHapen())
            {
                return;
            }

            if (isAdd)
            {
                BuffIntervalActionData mData = GameC.pool.buffIntervalActionDataPool.getOne();
                mData.adderInstanceID = data.adderInstanceID;
                mData.readFromConfig(args);

                mData.type = BuffIntervalActionType.Attack;

                Unit selfUnit = _parent.getUnit();

                UnitFightDataLogic attackerLogic = null;

                if (data.adderInstanceID == -1)
                {
                    attackerLogic = _parent;
                }
                else
                {
                    Unit attacker;

                    if (selfUnit != null && (attacker = selfUnit.getScene().getFightUnit(data.adderInstanceID)) != null)
                    {
                        attackerLogic = attacker.fight.getDataLogic();
                    }
                }

                //存在再添加
                if ((args.Length > 4 && args[4] > 0) && attackerLogic != null)
                {
                    mData.calculateSelfAttackValue(attackerLogic);
                }

                _intervalActions.put(data.instanceID << CommonSetting.buffActionIndexOff | index, mData);
            }
            else
            {
                BuffIntervalActionData mData = _intervalActions.remove(data.instanceID << CommonSetting.buffActionIndexOff | index);

                if (mData == null)
                {
                    Ctrl.throwError("不该找不到BuffIntervalActionData");
                }
                else
                {
                    GameC.pool.buffIntervalActionDataPool.back(mData);
                }
            }
        }
        break;

        case BuffActionType.AddGroupCDTimeMaxPercent:
        {
            if (!isDriveAll)
            {
                return;
            }

            _parent.cd.addGroupTimeMaxPercent(args[1], isAdd ? args[2] : -args[2]);
        }
        break;

        case BuffActionType.AddGroupCDTimeMaxValue:
        {
            if (!isDriveAll)
            {
                return;
            }

            _parent.cd.addGroupTimeMaxValue(args[1], isAdd ? args[2] : -args[2]);
        }
        break;

        case BuffActionType.AddSkillProb:
        {
            addSkillProb(args[1], isAdd ? args[2] : -args[2]);
        }
        break;

        case BuffActionType.ChangeFacade:
        {
            if (!isDriveAll)
            {
                return;
            }

            if (isAdd)
            {
                _parent.avatar.addFacade(args[1]);
            }
            else
            {
                _parent.avatar.removeFacade(args[1]);
            }
        }
        break;

        case BuffActionType.AddAvatarPart:
        {
            if (!isDriveAll)
            {
                return;
            }

            if (isAdd)
            {
                _parent.avatar.addPart(args[1], args[2]);
            }
            else
            {
                _parent.avatar.removePart(args[1], args[2]);
            }
        }
        break;

        case BuffActionType.AttackProbAction:
        {
            if (!isDriveAll)
            {
                return;
            }

            IntObjectMap <int[]> dic = _attackProbActions[args[1]];

            if (dic == null)
            {
                dic = new IntObjectMap <int[]>();
                _attackProbActions[args[1]] = dic;
            }

            if (isAdd)
            {
                dic.put(data.instanceID << CommonSetting.buffActionIndexOff | index, args);
            }
            else
            {
                dic.remove(data.instanceID << CommonSetting.buffActionIndexOff | index);
            }
        }
        break;

        case BuffActionType.AddShield:
        case BuffActionType.AddShieldVar:
        {
            if (!isDriveAll)
            {
                return;
            }

            if (!isFull)
            {
                Ctrl.throwError("不支持初始化添加护盾");
                return;
            }

            //盾同一个buff就存在一个,不然会互斥

            if (isAdd)
            {
                int value;

                if (args[0] == BuffActionType.AddShield)
                {
                    value = args[2];
                }
                else
                {
                    value = _parent.getSkillVarValueT(args[2], data.adderInstanceID);
                }

                //盾值
                _parent.attribute.addOneAttribute(args[1], value);

                _shieldBuffDic.computeIfAbsent(args[1], k => new SList <DIntData>()).add(DIntData.create(data.instanceID, value));
            }
            else
            {
                SList <DIntData> list = _shieldBuffDic.get(args[1]);
                DIntData         v;
                for (int i = 0, len = list.length(); i < len; ++i)
                {
                    if ((v = list.get(i)).key == data.instanceID)
                    {
                        //移除剩余盾值
                        if (v.value > 0)
                        {
                            _parent.attribute.subOneAttribute(args[1], v.value);
                        }

                        list.remove(i);
                        --len;
                        --i;
                    }
                }
            }
        }
        break;

        case BuffActionType.SkillReplace:
        {
            if (isAdd)
            {
                if (ShineSetting.openCheck)
                {
                    if (_skillReplaceDic.contains(args[1]))
                    {
                        Ctrl.throwError("目前,相同技能ID同时只支持一个替换技能");
                    }
                }

                _skillReplaceDic.put(args[1], args[2]);
            }
            else
            {
                _skillReplaceDic.remove(args[1]);
            }
        }
        break;

        case BuffActionType.SkillProbReplace:
        {
            SList <int[]> list = _skillProbReplaceDic.computeIfAbsent(args[1], k => new SList <int[]>());

            if (isAdd)
            {
                int[] a;

                for (int i = 0, len = list.length(); i < len; ++i)
                {
                    a = list.get(i);

                    if (compareSkillProbArgs(args, a) <= 0)
                    {
                        list.insert(i, args);
                        return;
                    }
                }

                list.add(args);
            }
            else
            {
                int[] a;

                for (int i = 0, len = list.length(); i < len; ++i)
                {
                    a = list.get(i);

                    if (args[2] == a[2] && args[3] == a[3])
                    {
                        list.remove(i);
                        break;
                    }
                }
            }
        }
        break;

        case BuffActionType.IntervalAddAttribute:
        {
            if (!isDriveAll)
            {
                return;
            }

            if (!isFull)
            {
                return;
            }

            if (isAdd)
            {
                BuffIntervalActionData mData = GameC.pool.buffIntervalActionDataPool.getOne();
                mData.type = BuffIntervalActionType.AddAttribute;
                mData.readFromConfig(args);

                _intervalActions.put(data.instanceID << CommonSetting.buffActionIndexOff | index, mData);
            }
            else
            {
                BuffIntervalActionData mData = _intervalActions.remove(data.instanceID << CommonSetting.buffActionIndexOff | index);

                if (mData == null)
                {
                    Ctrl.throwError("不该找不到BuffIntervalActionData");
                }
                else
                {
                    GameC.pool.buffIntervalActionDataPool.back(mData);
                }
            }
        }
        break;

        case BuffActionType.IntervalAddAttributeVar:
        {
            if (!isDriveAll)
            {
                return;
            }

            if (!isFull)
            {
                return;
            }

            if (isAdd)
            {
                BuffIntervalActionData mData = GameC.pool.buffIntervalActionDataPool.getOne();
                mData.type = BuffIntervalActionType.AddAttributeVar;
                mData.readFromConfig(args);

                _intervalActions.put(data.instanceID << CommonSetting.buffActionIndexOff | index, mData);
            }
            else
            {
                BuffIntervalActionData mData = _intervalActions.remove(data.instanceID << CommonSetting.buffActionIndexOff | index);

                if (mData == null)
                {
                    Ctrl.throwError("不该找不到BuffIntervalActionData");
                }
                else
                {
                    GameC.pool.buffIntervalActionDataPool.back(mData);
                }
            }
        }
        break;

        case BuffActionType.SkillLevelUp:
        {
            _skillLevelUpDic.addValue(args[1], isAdd ? args[2] : -args[2]);
        }
        break;

        case BuffActionType.AddBuffLastTime:
        {
            if (!isDriveAll)
            {
                return;
            }

            _buffLastTimeAddDic.addValue(args[1], isAdd ? args[2] : -args[2]);
        }
        break;

        case BuffActionType.BuffLevelUp:
        {
            if (!isDriveAll)
            {
                return;
            }

            int level = isAdd ? args[2] : -args[2];

            _buffLevelUpDic.addValue(args[1], level);

            //需要立即更新
            if (args.Length > 3 && args[3] > 0)
            {
                if (data.config.hasGroup(args[1]))
                {
                    Ctrl.throwError("不能影响自己所在组的buffLevel");
                    return;
                }

                refreshBuffLevelUp(args[1], level);
            }
        }
        break;

        case BuffActionType.AddAttributeRefreshVar:
        {
            if (!isDriveAll)
            {
                return;
            }

            if (!isFull)
            {
                return;
            }

            SkillVarConfig vConfig = SkillVarConfig.get(args[2]);

            foreach (int[] v in vConfig.args)
            {
                switch (v[0])
                {
                case SkillVarSourceType.SelfAttribute:
                case SkillVarSourceType.TargetAttribute:
                {
                    _addAttributeRefreshVarASet.addValue(v[1], isAdd ? 1 : -1);
                }
                break;

                case SkillVarSourceType.SelfCurrentAttributePercent:
                case SkillVarSourceType.TargetCurrentAttributePercent:
                case SkillVarSourceType.SelfCurrentAttributeLostPercent:
                case SkillVarSourceType.TargetCurrentAttributeLostPercent:
                {
                    //当前+max
                    _addAttributeRefreshVarASet.addValue(v[1], isAdd ? 1 : -1);
                    _addAttributeRefreshVarASet.addValue(AttributeControl.attribute.currentToMaxMap[v[1]], isAdd ? 1 : -1);
                }
                break;
                }
            }

            if (isAdd)
            {
                int value = _parent.getSkillVarValueT(vConfig.id, data.adderInstanceID);

                _parent.attribute.addOneAttribute(args[1], value);

                BuffAddAttributeRefreshVarData bData = new BuffAddAttributeRefreshVarData();
                bData.adderInstanceID = data.adderInstanceID;
                bData.varID           = vConfig.id;
                bData.type            = args[1];
                bData.value           = value;

                _attributeRefreshVarDic.put(data.instanceID << CommonSetting.buffActionIndexOff | index, bData);
            }
            else
            {
                BuffAddAttributeRefreshVarData bData = _attributeRefreshVarDic.remove(data.instanceID << CommonSetting.buffActionIndexOff | index);

                _parent.attribute.subOneAttribute(args[1], bData.value);
            }
        }
        break;

        case BuffActionType.UseSkillProbAction:
        {
            if (!isDriveAll)
            {
                return;
            }

            if (isAdd)
            {
                _useSkillProbActions.put(data.instanceID << CommonSetting.buffActionIndexOff | index, args);
            }
            else
            {
                _useSkillProbActions.remove(data.instanceID << CommonSetting.buffActionIndexOff | index);
            }
        }
        break;

        case BuffActionType.IgnoreBuffGroup:
        {
            if (!isDriveAll)
            {
                return;
            }

            if (!isFull)
            {
                return;
            }

            _ignoreBuffGroupDic.addValue(args[0], isAdd ? 1 : -1);

            if (isAdd)
            {
                removeBuffByGroup(args[0]);
            }
        }
        break;
        }
    }
Example #10
0
    /// <summary>
    /// 读完所有表后处理
    /// </summary>
    public static void afterReadConfigAll()
    {
        if (_dic == null)
        {
            return;
        }

        initQuests   = new IntList();
        questLineDic = new IntObjectMap <SList <QuestConfig> >();

        QuestConfig[] values;
        QuestConfig   v;
        QuestConfig   v2;

        for (int i = (values = _dic.getValues()).Length - 1; i >= 0; --i)
        {
            if ((v = values[i]) != null)
            {
                //可主动接
                if (v.acceptType != QuestAcceptType.Passive)
                {
                    if (v.preQuests.Length > 0)
                    {
                        foreach (int v3 in v.preQuests)
                        {
                            //只能以单次任务作为前置
                            if ((v2 = _dic.get(v3)).repeatType != QuestRepeatType.Once)
                            {
                                Ctrl.throwError("只能以单次任务作为前置");
                                return;
                            }

                            v2.afterQuests.add(v.id);
                        }
                    }
                    else
                    {
                        //满足自动接取
                        if (v.acceptType == QuestAcceptType.Auto)
                        {
                            initQuests.add(v.id);
                        }
                    }
                }

                if (!v.questLine.isEmpty())
                {
                    SList <QuestConfig> list = questLineDic.computeIfAbsent(v.questLine.key, k => new SList <QuestConfig>());
                    list.add(v);
                }
            }
        }


        SList <QuestConfig>[] values1;
        SList <QuestConfig>   v1;

        for (int i1 = (values1 = questLineDic.getValues()).Length - 1; i1 >= 0; --i1)
        {
            if ((v1 = values1[i1]) != null)
            {
                v1.sort(sortQuestLine);

                QuestConfig[] values3 = v1.getValues();
                QuestConfig   v3;

                for (int i3 = 0, len3 = v1.size(); i3 < len3; ++i3)
                {
                    //现算序号
                    values3[i3].questLineIndex = i3;
                }
            }
        }
    }