public override void onSecond(int delay) { base.onSecond(delay); LongObjectMap <PlayerApplyRoleGroupSelfData> applyDic = _d.applyDic; if (applyDic != null && !applyDic.isEmpty()) { long now = me.getTimeMillis(); foreach (PlayerApplyRoleGroupSelfData v in applyDic) { if (v.disableTime > 0 && now > v.disableTime) { applyDic.remove(v.data.groupID); } } } if (!_roleGroupDic.isEmpty()) { foreach (PlayerRoleGroup v in _roleGroupDic) { v.onSecond(delay); } } }
public override void dispose() { base.dispose(); foreach (PlayerRoleGroup v in _roleGroupDic) { v.dispose(); _roleGroupDic.remove(v.groupID); } _onlyOne = null; }
/** 执行移除角色 */ public void toRemoveRole(Role role) { long playerID = role.playerID; // SceneRoleData data=role.getData(); onRemoveRole(role); role.enabled = false; role.dispose(); _roleDic.remove(playerID); //回收 GameC.pool.rolePool.back(role); }
/** 删除单位 */ 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); } }
/// <summary> /// 移除角色社交数据 /// </summary> public void removePlayerRoleSocial(long playerID) { _roleSocialDic.remove(playerID); }