private bool toRemoveBuffFromDic(BuffData data) { if (_buffDatas.remove(data.instanceID) == null) { return(false); } if (data.config.plusType == BuffPlusType.AllExist) { _buffDatasForAllExist.get(data.id).remove(data.instanceID); } else { _buffDatasByID.remove(data.id); } int[][] subNums; if ((subNums = data.config.subNums).Length > 0) { foreach (int[] v in subNums) { _buffDatasBySubNums[v[0]].remove(data.instanceID); } } return(true); }
/** 一秒十次 */ 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); } } } } }
/** 执行接取任务 */ private void doAcceptQuest(QuestData data) { _d.accepts.put(data.id, data); bool isComplete = data.isComplete(); if (!isComplete) { addRunningQuest(data); } _waitAcceptQuests.remove(data.id); _canAcceptQuests.remove(data.id); _canSeeQuests.remove(data.id); //推送 me.dispatch(GameEventType.RefreshCanAcceptQuests); me.dispatch(GameEventType.RefreshCanSeeQuests); me.dispatch(GameEventType.AcceptQuest, data.id); if (isComplete) { preQuestComplete(data); } }
/** 移除指定序号的物品(倒序)(以及空闲格子计算) */ private void removeItemFromPos(int index, ItemData data) { _dic.remove(index); getItemDicByIDAbs(data.id).remove(index); _showListDirty = true; }
/// <summary> /// 删除宠物 /// </summary> public void removePet(int index) { PetUseLogic logic = getPet(index); if (logic == null) { me.warnLog("删除宠物时,未找到", index); return; } int id = logic.getData().id; logic.dispose(); _d.petDic.remove(index); _petDic.remove(index); if (Global.isPetUnique) { _petDicByID.remove(id); } GameC.pool.petUseLogicPool.back(logic); me.dispatch(GameEventType.RemovePet, index); }
public override void onSecond() { if (!_selfFieldItemBagDic.isEmpty()) { long now = _scene.getTimeMillis(); foreach (FieldItemBagBindData v in _selfFieldItemBagDic) { if (now > v.removeTime) { _selfFieldItemBagDic.remove(v.instanceID); onRemoveFieldItemBagBind(v); } } } }
/// <summary> /// 移除执行目标 /// </summary> public void removeRunningTask(TaskData data) { _runningTaskDic.remove(data.instanceID); TaskTypeConfig tConfig; IntObjectMap <TaskData> dic; //双键 if ((tConfig = TaskTypeConfig.get(data.config.type)).needSecondKey) { if ((dic = _runningTaskTypeTwoDic.get((long)data.config.type << 32 | data.config.args[1])) != null) { dic.remove(data.instanceID); } if (tConfig.needSecondKey2) { if ((dic = _runningTaskTypeTwoDic2.get((long)data.config.type << 32 | data.config.args[2])) != null) { dic.remove(data.instanceID); } } } //单键 else { if ((dic = _runningTaskTypeOneDic.get(data.config.type)) != null) { dic.remove(data.instanceID); } } }
/// <summary> /// 移除监听 /// </summary> public void removeListener(int type, int index) { IntObjectMap <BaseEventAction> dic = _listenerDic.get(type); if (dic == null) { return; } dic.remove(index); _indexToTypeDic.remove(index); }
/// <summary> /// 移除角色战斗数据逻辑 /// </summary> public void removeMUnitUseLogic(MUnitUseLogic logic) { if (logic.index == -1) { Ctrl.throwError("未就绪的MUnitUseLogic"); } _mUnitUseLogics.remove(logic.index); if (logic.isWorking()) { _mUnitUseLogicOnWorking.remove(logic.index); } }
/** 移除逻辑体 */ public void removeLogic(UILogicBase logic) { if (logic._parent != this) { Ctrl.print("找不到逻辑体存在:" + logic); return; } _logicDic.remove(logic.id); logic._parent = null; logic.dispose(); }
/// <summary> /// 移除功能插件 /// </summary> public void removeFuncTool(FuncTool tool) { if (!tool.isAdded) { Ctrl.throwError("不可删除非added的FuncTool"); return; } _funcToolList.removeObj(tool); _playerFuncToolList.removeObj((IPlayerFuncTool)tool); IntObjectMap <FuncTool> dic = getFuncToolDic(tool.getType()); dic.remove(tool.getFuncID()); }
private void clearRecordDatas() { IntObjectMap <ItemRecordData> itemRecordDic = _itemRecordDic; ObjectPool <ItemRecordData> pool = _recordDataPool; if (!itemRecordDic.isEmpty()) { foreach (ItemRecordData v in itemRecordDic) { if (v.num == 0) { itemRecordDic.remove(v.id); pool.back(v); } } } }
/** 根据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(); } }
/** 删除单位 */ private void deleteElement(SceneElementEditorData data) { GameObject gameObject = data.gameObject; _elementDicByObj.remove(gameObject); _elementDic.remove(data.config.instanceID); _elementInstanceID = -1; try { GameObject.DestroyImmediate(gameObject); } catch (Exception e) { } }
/** 移除组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(); } }
/** 设置部件 */ public void setPart(int type, int partID) { //空部件不处理 if (partID <= 0) { return; } _partDic.put(type, partID); _partReady.remove(type); AssetPoolLoadTool tool = getPartLoadTool(type); AvatarPartConfig config = AvatarPartConfig.get(type, partID); tool.loadOne(config.sourceT, obj => partLoadOver(type, partID, obj)); }
/** 关闭trigger */ public void closeTrigger(int id) { TriggerConfigData config = _openDic.remove(id); if (config == null) { warnLog("trigger已关闭", id); return; } 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[] keys1 = instance.intervalDic.getKeys(); TriggerIntervalData k1; for (int i1 = keys1.Length - 1; i1 >= 0; --i1) { if ((k1 = keys1[i1]) != null) { _timerIntervalDic.remove(k1); keys1[i1] = null; _intervalPool.back(k1); } } instance.intervalDic.justClearSize(); } else { removeEventListener(config, i, evt); } } }
//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; } }
/** 删除单位 */ public void removeUnit(int instanceID) { Unit unit = _units.get(instanceID); if (unit == null) { if (ShineSetting.openCheck) { Ctrl.throwError("单位不存在:" + instanceID); } return; } UnitSimpleData sData = _bindVisionUnits.get(instanceID); if (sData != null) { unit.makeSimpleUnitData(sData); } //场景移除单位 onRemoveUnit(unit); //预移除 unit.preRemove(); //没有aoi //标记 unit.enabled = false; //析构 unit.dispose(); //字典移除 _units.remove(instanceID); bool canFight = unit.canFight() && !isSimple(); if (canFight) { _fightUnits.remove(instanceID); } UnitData data = unit.getUnitData(); if (unit.isCharacter()) { CharacterIdentityData iData = (CharacterIdentityData)data.identity; if (_config.instanceType == SceneInstanceType.FiniteBattleWithFrameSync) { _charactersByIndex.remove(iData.syncIndex); } _characters.remove(iData.playerID); } unit.setScene(null); //双解绑 if (canFight) { data.fightDataLogic.setUnit(null); } unit.setUnitData(null); if (canFight && isNeedReleaseFightDataLogic(unit)) { //清空数据 data.fightDataLogic.clear(); //析构数据逻辑 data.fightDataLogic.setData(null, null); GameC.pool.releaseUnitFightDataLogic(data.fightDataLogic); data.fightDataLogic = null; } if (isNeedReleaseUnit(unit)) { GameC.pool.releaseUnit(unit); } }
public void removeBindVision(int instanceID) { _bindVisionUnits.remove(instanceID); }
public static void unload(int id) { _dic.remove(id); BaseConfig.toUnloadSplit(ConfigType.MapInfo, CommonSetting.mapInfo, id); }