Exemplo n.º 1
0
    /// <summary>
    /// 通过保存数据初始化
    /// </summary>
    public virtual void initUseLogicByUseData(MUnitUseLogic logic, MUnitUseData useData, bool needFuncTool, bool needBindPlayer, bool isClientDrive)
    {
        //基础部分
        logic.init(useData, isClientDrive);

        if (needBindPlayer)
        {
            logic.setPlayer(me);
        }

        if (isClientDrive)
        {
            //补满血蓝
            logic.getAttributeLogic().fillHpMp();
            //刷属性
            logic.getAttributeLogic().refreshAttributes();
        }

        if (needFuncTool)
        {
            int funcID = logic.getMUnitFuncID(FunctionType.Equip);
            PlayerEquipContainerTool funcTool = toCreatePlayerEquipContainerTool(funcID);
            //互相绑定
            funcTool.setMUnitLogic(logic);
            logic.setEquipTool(funcTool);

            me.func.addFuncTool(funcTool, useData.equips);
        }
    }
Exemplo n.º 2
0
    /** 析构 */
    public void dispose()
    {
        if (isWorking())
        {
            setIsWorking(false);
        }

        if (_equipTool != null)
        {
            _player.func.removeFuncTool(_equipTool);
            _equipTool.setMUnitLogic(null);
            _equipTool = null;
        }

        _fightLogic.setData(null, null);
        setPlayer(null);

        _data = null;

        _attributeLogic = null;
        _buffLogic      = null;
        index           = -1;
    }