예제 #1
0
    /** 取一个单位实例ID */
    public int getUnitInstanceID()
    {
        int re;

        while (_units.contains(re = _unitInstanceIDMaker.get()))
        {
            ;
        }

        return(re);
    }
예제 #2
0
    /** 取一个单位实例ID */
    private int getBuffInstanceID()
    {
        int re;

        while (_buffDatas.contains(re = _buffInstanceIDMaker.get()))
        {
            ;
        }

        return(re);
    }
예제 #3
0
    /** 获取一个新物品序号 */
    private int getNewIndex()
    {
        int index;

        while (_dic.contains(index = justGetNewIndex()))
        {
            ;
        }

        return(index);
    }
예제 #4
0
    /** 添加元素 */
    public void addElement(ScenePlaceElementConfig element)
    {
        if (BaseC.config.isIniting() && ShineSetting.openCheck)
        {
            if (elements.contains(element.instanceID))
            {
                Ctrl.errorLog("场景元素重复:", element.instanceID);
            }
        }

        elements.put(element.instanceID, element);
    }
예제 #5
0
    /// <summary>
    /// 注册目标完成回调(construct阶段用)
    /// </summary>
    public void registTaskCompleteFunc(int funcID, Action <TaskData> func)
    {
        if (ShineSetting.openCheck)
        {
            if (_taskCompleteFuncDic.contains(funcID))
            {
                Ctrl.throwError("registTaskCompleteFunc时,重复的功能ID", funcID);
            }
        }

        _taskCompleteFuncDic.put(funcID, func);
    }
예제 #6
0
    /** 获取一个可用的instanceID(会填补空位) */
    private int getOneElementInstanceID()
    {
        if (_elementInstanceID == -1)
        {
            _elementInstanceID = 0;
        }

        while (_elementDic.contains(++_elementInstanceID))
        {
        }

        return(_elementInstanceID);
    }
예제 #7
0
    /** 开启trigger */
    public void openTrigger(int id)
    {
        TriggerConfigData config = _configDic.get(id);

        if (config == null)
        {
            throwError("未找到trigger配置", id);
            return;
        }

        if (_openDic.contains(id))
        {
            warnLog("trigger已开启", id);
            return;
        }

        _openDic.put(id, config);


        TriggerFuncData[] events = config.events;
        TriggerFuncData   evt;
        TriggerInstance   instance;

        for (int i = 0; i < events.Length; i++)
        {
            evt = events[i];

            if (evt.id == TriggerEventType.OnInterval)
            {
                instance = getInstance(id);

                TriggerIntervalData iData = _intervalPool.getOne();

                TriggerArg one = _argPool.getOne();
                one.instance  = instance;
                iData.current = iData.delay = getInt(evt.args[0], one);
                _argPool.back(one);

                iData.instance = instance;

                instance.intervalDic.add(iData);
                _timerIntervalDic.add(iData);
            }
            else
            {
                addEventListener(config, i, events[i]);
            }
        }
    }
예제 #8
0
    public void initPetUseLogicByUseData(PetUseLogic logic, PetUseData useData)
    {
        me.character.initUseLogicByUseData(logic, useData, Global.isPetNeedEquip, true, false);

        _petDic.put(logic.index, logic);

        if (Global.isPetUnique)
        {
            if (_petDicByID.contains(useData.id))
            {
                me.errorLog("已存在的宠物数据");
            }

            _petDicByID.put(useData.id, logic);
        }
    }
예제 #9
0
    /// <summary>
    /// 添加角色战斗数据逻辑
    /// </summary>
    public void addMUnitUseLogic(MUnitUseLogic logic)
    {
        if (logic.index == -1)
        {
            me.throwError("未就绪的MUnitUseLogic");
        }

        if (_mUnitUseLogics.contains(logic.index))
        {
            me.throwError("重复的MUnitUseLogic" + logic.index);
        }

        _mUnitUseLogics.put(logic.index, logic);

        if (logic.isWorking())
        {
            _mUnitUseLogicOnWorking.put(logic.index, logic);
        }
    }
예제 #10
0
    /** 添加逻辑体 */
    public void addLogic(UILogicBase logic)
    {
        if (logic.id == -1)
        {
            Ctrl.print("逻辑体id未赋值:" + logic);
            return;
        }

        if (_logicDic.contains(logic.id))
        {
            Ctrl.print("已存在逻辑体:" + logic);
            return;
        }

        _logicDic.put(logic.id, logic);

        logic._parent = this;

        if (_inited)
        {
            logic.doInit();
        }
    }
예제 #11
0
    private void toRegistFuncTool(IPlayerFuncTool tool)
    {
        FuncTool fTool = (FuncTool)tool;

        IntObjectMap <FuncTool> dic = getFuncToolDic(fTool.getType());

        int funcID = fTool.getFuncID();

        if (ShineSetting.openCheck)
        {
            if (dic.contains(funcID))
            {
                Ctrl.throwError("已经存在功能插件:", fTool.getType(), funcID);
            }
        }

        //设置主角
        tool.setMe(me);

        dic.put(funcID, fTool);
        _funcToolList.add(fTool);
        _playerFuncToolList.add(tool);
        fTool.construct();
    }
예제 #12
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);
                }
            }
        }
    }