private IEnumerator LoadFightMap() { string fightMapBundleName = AssetBundlesUtility.GetFightMapAssetBundleName(m_fightMapId); string fightMapSceneName = ScenesUtility.GetFightMapSceneName(m_fightMapId); yield return(LoadSceneAndBundleRequest(fightMapSceneName, fightMapBundleName)); Scene sceneByName = SceneManager.GetSceneByName(fightMapSceneName); if (!sceneByName.IsValid()) { Log.Error("Could not load scene named '" + fightMapSceneName + "' from bundle named '" + fightMapBundleName + "'.", 217, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\States\\FightState.cs"); yield break; } m_fightMapScene = sceneByName; FightMap componentInRootGameObjects = ScenesUtility.GetComponentInRootGameObjects <FightMap>(sceneByName); if (null == componentInRootGameObjects) { Log.Error("Could not find a FightMap in scene named '" + fightMapSceneName + "'.", 226, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\States\\FightState.cs"); yield break; } FightMap.current = componentInRootGameObjects; MapRenderSettings.ApplyToScene(FightMap.current.ambience); }
private void OnDestinationSelected(Target?obj) { if (!obj.HasValue) { return; } Target value = obj.Value; if (value.type == Target.Type.Coord) { if (m_selectedEntity == null) { SetTargetingPhase(null); return; } Coord coord = value.coord; AbstractFightAdminCommand.SendAdminCommand(new AdminRequestCmd { Teleport = new AdminRequestCmd.Types.TeleportAdminCmd { TargetEntityId = m_selectedEntity.id, Destination = coord.ToCellCoord() } }); m_movingEntity = new Tuple <IEntityWithBoardPresence, Coord>(m_selectedEntity, coord); m_selectedEntity = null; FightMap fightMap = m_fightMap; fightMap.onTargetSelected = (Action <Target?>)Delegate.Remove(fightMap.onTargetSelected, new Action <Target?>(OnDestinationSelected)); EndTargetingPhase(); } }
public override IEnumerator UpdateView(FightStatus fightStatus) { if (fightStatus.TryGetEntity(concernedEntity, out CompanionStatus companionStatus)) { if (fightStatus.TryGetEntity(ownerId, out PlayerStatus ownerStatus)) { if (!ownerStatus.isLocalPlayer) { FightMap current = FightMap.current; if (null != current) { if (current.TryGetCellObject(refCoord.X, refCoord.Y, out CellObject cellObject)) { ReserveCompanionStatus reserveCompanion = new ReserveCompanionStatus(ownerStatus, (CompanionDefinition)companionStatus.definition, level); yield return(FightUIRework.ShowPlayingCompanion(reserveCompanion, cellObject)); } else { Log.Error(FightEventErrors.InvalidPosition(refCoord), 59, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\CompanionAddedEvent.cs"); } } } yield return(CreateCompanionCharacterObject(fightStatus, companionStatus, ownerStatus, refCoord.X, refCoord.Y, (Direction)direction)); } else { Log.Error(FightEventErrors.PlayerNotFound(ownerId), 70, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\CompanionAddedEvent.cs"); } } else { Log.Error(FightEventErrors.EntityNotFound <CompanionStatus>(concernedEntity), 75, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\CompanionAddedEvent.cs"); } FightLogicExecutor.FireUpdateView(fightStatus.fightId, EventCategory.EntityAddedOrRemoved); }
protected override void Stop() { FightMap fightMap = m_fightMap; fightMap.onTargetSelected = (Action <Target?>)Delegate.Remove(fightMap.onTargetSelected, new Action <Target?>(OnUpdateTarget)); EndTargetingPhase(); }
public override IEnumerator UpdateView(FightStatus fightStatus) { MonoBehaviour monoBehaviour = Main.monoBehaviour; List <IEntityWithBoardPresence> removedEntities = m_removedEntities; int count = removedEntities.Count; for (int i = 0; i < count; i++) { IEntityWithBoardPresence entity = removedEntities[i]; MonoBehaviourExtensions.StartCoroutineImmediateSafe(monoBehaviour, RemoveEntityFromBoard(entity), null); } if (GameStatus.fightType == FightType.BossFight && fightStatus.endReason == FightStatusEndReason.Lose) { FightMap current = FightMap.current; if (null != current) { if (fightStatus.TryGetEntity((PlayerStatus p) => p.teamIndex == GameStatus.localPlayerTeamIndex, out PlayerStatus entityStatus)) { HeroStatus heroStatus = entityStatus.heroStatus; if (heroStatus != null) { Vector2Int refCoord = heroStatus.area.refCoord; current.AddHeroLostFeedback(refCoord); } } MonoBehaviourExtensions.StartCoroutineImmediateSafe(monoBehaviour, current.ClearMonsterSpawnCells(fightStatus.fightId), null); } } if (fightStatus == FightStatus.local && !GameStatus.hasEnded) { yield return(DisplayFightResultFeedback(fightStatus)); } }
/// <summary> /// 设置对阵信息 /// </summary> /// <param name="round"></param> /// <param name="homeId"></param> /// <param name="awayId"></param> /// <param name="homeGoals"></param> /// <param name="awayGoals"></param> /// <returns></returns> public MessageCode SetFightMap(int round, int homeId, int awayId, int homeGoals, int awayGoals) { if (_leagueFightMapEntity == null) { return(MessageCode.NbParameterError); } if (FightMap == null || FightMap.Count == 0) { AnalyseFightMap(); } if (FightMap == null) { FightMap = new Dictionary <int, List <LeagueFight> >(); } if (!FightMap.ContainsKey(round)) { FightMap.Add(round, new List <LeagueFight>()); } var entity = new LeagueFight(); entity.H = homeId; entity.A = awayId; entity.AG = awayGoals; entity.HG = homeGoals; entity.R = round; if (!FightMap[round].Exists(r => r.H == homeId)) { FightMap[round].Add(entity); } return(MessageCode.Success); }
public static void StopCastingSpell(bool cancelled) { if (s_currentCastType != CurrentCastType.Spell) { Log.Error($"Tried to stop casting a spell while current cast type is {s_currentCastType}", 155, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\FightCastManager.cs"); return; } if (cancelled) { FightCastManager.OnUserActionEnd?.Invoke(FightCastState.Cancelled); } else { FightCastManager.OnUserActionEnd?.Invoke(FightCastState.DoneCasting); } HideSpellCostsPreview(cancelled); FightMap current = FightMap.current; if (null != current) { FightMap fightMap = current; fightMap.onTargetChanged = (Action <Target?, CellObject>)Delegate.Remove(fightMap.onTargetChanged, new Action <Target?, CellObject>(OnSpellTargetChanged)); FightMap fightMap2 = current; fightMap2.onTargetSelected = (Action <Target?>)Delegate.Remove(fightMap2.onTargetSelected, new Action <Target?>(OnSpellTargetSelected)); RevertFightMapTargetingPhase(current); } s_currentCastType = CurrentCastType.None; s_playerCasting = null; s_spellBeingCast = null; s_castTargetDefinition = null; s_castTargetContext = null; }
protected override IEnumerator Unload() { while (FightLogicExecutor.isValid) { yield return(null); } FightMap current = FightMap.current; if (null != current) { current.Release(); FightMap.current = null; } if (FightSpellEffectFactory.isReady) { yield return(FightSpellEffectFactory.Unload()); } if (FightObjectFactory.isReady) { yield return(FightObjectFactory.Unload()); } if (FightUIFactory.isReady) { yield return(FightUIFactory.Unload()); } VisualEffectFactory.Dispose(); yield return(RuntimeData.UnloadTextCollectionAsync("Fight")); yield return(_003C_003En__0()); DragNDropListener.instance.CancelSnapDrag(); instance = null; }
} //IL_0006: Unknown result type (might be due to invalid IL or missing references) protected override void Start() { m_fightMap.SetTargetingPhase(EnumerateEntitiesAsTargets <IEntityWithLife>()); FightMap fightMap = m_fightMap; fightMap.onTargetSelected = (Action <Target?>)Delegate.Combine(fightMap.onTargetSelected, new Action <Target?>(OnUpdateTarget)); }
private static CellObject GetTargetedCell(FightStatus fightStatus, CastTarget castTarget) { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) FightMap current = FightMap.current; if (null == current) { return(null); } switch (castTarget.ValueCase) { case CastTarget.ValueOneofCase.Cell: { CellCoord cell = castTarget.Cell; return(current.GetCellObject(cell.X, cell.Y)); } case CastTarget.ValueOneofCase.EntityId: { int entityId = castTarget.EntityId; if (fightStatus.TryGetEntity(entityId, out IEntityWithBoardPresence entityStatus)) { Vector2Int refCoord = entityStatus.area.refCoord; return(current.GetCellObject(refCoord.get_x(), refCoord.get_y())); } return(null); } default: return(null); } }
protected override void Start() { m_propertySelector.SetActive(active: true); SetTargetingPhase(); FightMap fightMap = m_fightMap; fightMap.onTargetSelected = (Action <Target?>)Delegate.Combine(fightMap.onTargetSelected, new Action <Target?>(OnEntitySelected)); }
protected override void Stop() { m_propertySelector.SetActive(active: false); FightMap fightMap = m_fightMap; fightMap.onTargetSelected = (Action <Target?>)Delegate.Remove(fightMap.onTargetSelected, new Action <Target?>(OnEntitySelected)); EndTargetingPhase(); }
protected AbstractFightAdminCommand(string name, KeyCode key) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) this.key = key; this.name = name; m_fightStatus = FightStatus.local; m_fightMap = FightMap.current; }
protected override void Stop() { m_creatureDropper.OnSelected -= OnDefinitionSelected; m_creatureDropper.SetSelected(null); m_creatureDropper.SetActive(active: false); m_targeting = false; EndTargetingPhase(); FightMap fightMap = m_fightMap; fightMap.onTargetSelected = (Action <Target?>)Delegate.Remove(fightMap.onTargetSelected, new Action <Target?>(InvokeCreatureAt)); }
private static void UpdateAudioContext(PlayerStatus ownerStatus, int life) { if (ownerStatus.isLocalPlayer) { FightMap current = FightMap.current; if (null != current) { current.SetLocalPlayerHeroLife(life, life); } } }
protected override void Stop() { FightMap fightMap = m_fightMap; fightMap.onTargetSelected = (Action <Target?>)Delegate.Remove(fightMap.onTargetSelected, new Action <Target?>(OnEntitySelected)); FightMap fightMap2 = m_fightMap; fightMap2.onTargetSelected = (Action <Target?>)Delegate.Remove(fightMap2.onTargetSelected, new Action <Target?>(OnDestinationSelected)); EndTargetingPhase(); m_movingEntity = null; }
public new void Serialize(IDataWriter writer) { base.Serialize(writer); writer.WriteByte(Reason); writer.WriteVarLong(MemberId); writer.WriteInt((Int32)MemberAccountId); writer.WriteUTF(MemberName); writer.WriteInt(FightId); FightMap.Serialize(writer); writer.WriteVarShort(TimeBeforeFightStart); }
protected override void Start() { m_targeting = false; m_creatureDropper.OnSelected += OnDefinitionSelected; FightMap fightMap = m_fightMap; fightMap.onTargetSelected = (Action <Target?>)Delegate.Combine(fightMap.onTargetSelected, new Action <Target?>(InvokeCreatureAt)); m_creatureDropper.SetCloseKeyCode(27); m_creatureDropper.SetSelected(null); m_creatureDropper.SetActive(active: true); m_creatureDropper.SetLocalPlayerLevel(); }
public override IEnumerator UpdateView(FightStatus fightStatus) { if (fightStatus == FightStatus.local) { FightMap current = FightMap.current; IBossSpell bossSpell; if (null != current && (bossSpell = (current.bossObject as IBossSpell)) != null) { yield return(bossSpell.PlaySpellAnim(spellId)); } } }
public static bool StartCastingSpell(PlayerStatus casterStatus, SpellStatus spellStatus) { if (s_currentCastType != 0) { Log.Error($"Tried to start casting a spell while current cast type is {s_currentCastType}", 59, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\FightCastManager.cs"); return(false); } SpellDefinition definition = spellStatus.definition; if (null == definition) { Log.Error("Tried to start casting a spell without a loaded definition.", 66, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\FightCastManager.cs"); return(false); } ICastTargetDefinition castTarget = definition.castTarget; if (castTarget == null) { Log.Error("Tried to cast a spell that has no cast target definition.", 73, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\FightCastManager.cs"); return(false); } CastTargetContext castTargetContext = castTarget.CreateCastTargetContext(FightStatus.local, casterStatus.id, DynamicValueHolderType.Spell, definition.get_id(), spellStatus.level, spellStatus.instanceId); IReadOnlyList <Cost> costs = definition.costs; int count = costs.Count; for (int i = 0; i < count; i++) { if (costs[i].CheckValidity(casterStatus, castTargetContext) != 0) { Log.Error("Tried to cast a spell but one cost requirement is not met.", 86, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\FightCastManager.cs"); return(false); } } FightMap current = FightMap.current; if (null != current) { FightMap fightMap = current; fightMap.onTargetChanged = (Action <Target?, CellObject>)Delegate.Combine(fightMap.onTargetChanged, new Action <Target?, CellObject>(OnSpellTargetChanged)); FightMap fightMap2 = current; fightMap2.onTargetSelected = (Action <Target?>)Delegate.Combine(fightMap2.onTargetSelected, new Action <Target?>(OnSpellTargetSelected)); current.SetTargetingPhase(castTarget.EnumerateTargets(castTargetContext)); } s_currentCastType = CurrentCastType.Spell; s_playerCasting = casterStatus; s_spellBeingCast = spellStatus; s_castTargetDefinition = castTarget; s_castTargetContext = castTargetContext; ShowSpellCostsPreview(); return(true); }
public override IEnumerator UpdateView(FightStatus fightStatus) { if (fightStatus != FightStatus.local) { yield break; } FightUIRework instance = FightUIRework.instance; if (null != instance) { switch (GameStatus.fightType) { case FightType.BossFight: if (GameStatus.localPlayerTeamIndex == teamIndex) { TurnFeedbackUI.Type type2 = fightStatus.isEnded ? TurnFeedbackUI.Type.PlayerTeam : TurnFeedbackUI.Type.Player; yield return(instance.ShowTurnFeedback(type2, 61373)); } else { yield return(instance.ShowTurnFeedback(TurnFeedbackUI.Type.Boss, 30091)); } break; case FightType.TeamVersus: if (GameStatus.localPlayerTeamIndex == teamIndex) { TurnFeedbackUI.Type type = fightStatus.isEnded ? TurnFeedbackUI.Type.PlayerTeam : TurnFeedbackUI.Type.Player; yield return(instance.ShowTurnFeedback(type, 61373)); } else { yield return(instance.ShowTurnFeedback(TurnFeedbackUI.Type.OpponentTeam, 30091)); } break; default: throw new ArgumentOutOfRangeException(); case FightType.Versus: break; } } FightMap current = FightMap.current; if (null != current) { current.SetTurnIndex(turnIndex); } }
public override void UpdateStatus(FightStatus fightStatus) { fightStatus.currentTurnPlayerId = 0; if (fightStatus != FightStatus.local || fightStatus.localPlayerId != concernedEntity) { return; } switch (FightCastManager.currentCastType) { case FightCastManager.CurrentCastType.Spell: FightCastManager.StopCastingSpell(cancelled: true); break; case FightCastManager.CurrentCastType.Companion: FightCastManager.StopInvokingCompanion(cancelled: true); break; default: throw new ArgumentOutOfRangeException(); case FightCastManager.CurrentCastType.None: break; } FightMap current = FightMap.current; if (null != current) { current.SetNoInteractionPhase(); } FightUIRework instance = FightUIRework.instance; if (null != instance) { instance.EndLocalPlayerTurn(); } if (fightStatus.TryGetEntity(concernedEntity, out PlayerStatus entityStatus)) { AbstractPlayerUIRework view = entityStatus.view; if (null != view) { view.SetUIInteractable(interactable: false); } } else { Log.Error(FightEventErrors.PlayerNotFound(concernedEntity), 60, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\TurnEndedEvent.cs"); } }
protected override void Enable() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) m_uiRework.OnQuitRequest += OnQuitClick; m_uiRework.onTurnEndButtonClick = EndTurn; SceneManager.SetActiveScene(m_fightMapScene); RenderSettings.set_ambientLight(FightMap.current.ambience.lightSettings.ambientColor); FightLogicExecutor.Start(); FightMap current = FightMap.current; if (null != current) { current.Begin(); } }
private static void RevertFightMapTargetingPhase(FightMap fightMap) { FightStatus local = FightStatus.local; if (local != null && local.currentTurnPlayerId == s_playerCasting.id) { if (fightMap.IsInTargetingPhase()) { fightMap.SetMovementPhase(); } } else { fightMap.EndCurrentPhase(); } }
private static bool HasCompanionValidTargets(PlayerStatus casterStatus, ReserveCompanionStatus companionStatus) { CompanionDefinition definition = companionStatus.definition; if (null == definition) { return(false); } OneCastTargetContext context = new OneCastTargetContext(FightStatus.local, casterStatus.id, DynamicValueHolderType.Companion, definition.get_id(), companionStatus.level, 0); FightMap current = FightMap.current; if (null == current) { return(false); } return(definition.spawnLocation?.EnumerateCoords(context).GetEnumerator().MoveNext() ?? false); }
public override IEnumerator UpdateView(FightStatus fightStatus) { if (fightStatus != FightStatus.local) { yield break; } CameraHandler current = CameraHandler.current; if (null != current) { FightMap current2 = FightMap.current; if (null != current2) { yield return(current.FocusOnMapRegion(current2.definition, fightStatus.fightId, current.cinematicControlParameters)); } } }
protected override void Disable() { if (frame != null) { frame.Dispose(); frame = null; } m_uiRework.OnQuitRequest -= OnQuitClick; m_uiRework.onTurnEndButtonClick = null; FightMap current = FightMap.current; if (null != current) { current.End(); } FightLogicExecutor.Stop(); }
public override IEnumerator UpdateView(FightStatus fightStatus) { if (fightStatus.TryGetEntity(concernedEntity, out IEntityWithBoardPresence entityStatus)) { IObjectWithArmoredLife objectWithArmoredLife; if ((objectWithArmoredLife = (entityStatus.view as IObjectWithArmoredLife)) != null) { objectWithArmoredLife.SetBaseLife(maxLifeAfter); } else { Log.Error(FightEventErrors.EntityHasIncompatibleView <IObjectWithArmoredLife>(entityStatus), 37, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\MaxLifeChangedEvent.cs"); } if (entityStatus.type == EntityType.Hero) { HeroStatus heroStatus = (HeroStatus)entityStatus; if (heroStatus.ownerId == fightStatus.localPlayerId) { FightMap current = FightMap.current; if (null != current) { current.SetLocalPlayerHeroLife(heroStatus.life, maxLifeAfter); } } if (fightStatus.TryGetEntity(heroStatus.ownerId, out PlayerStatus entityStatus2)) { AbstractPlayerUIRework view = entityStatus2.view; if (null != view) { view.ChangeHeroBaseLifePoints(maxLifeAfter); } } else { Log.Error(FightEventErrors.PlayerNotFound(heroStatus.ownerId), 62, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\MaxLifeChangedEvent.cs"); } } } else { Log.Error(FightEventErrors.EntityNotFound <IEntityWithBoardPresence>(concernedEntity), 68, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\MaxLifeChangedEvent.cs"); } FightLogicExecutor.FireUpdateView(fightStatus.fightId, EventCategory.LifeArmorChanged); yield break; }
public override IEnumerator UpdateView(FightStatus fightStatus) { if (fightStatus != FightStatus.local) { yield break; } FightMap current = FightMap.current; if (null != current) { current.SetBossEvolutionStep(valueAfter); IBossEvolution bossEvolution; if ((bossEvolution = (current.bossObject as IBossEvolution)) != null) { yield return(bossEvolution.PlayLevelChangeAnim(valueBefore, valueAfter)); } } }
/// <summary> /// 获取对阵 /// </summary> /// <param name="round"></param> /// <returns></returns> public List <LeagueFight> GetFightMap(int round) { if (_leagueFightMapEntity != null) { if (FightMap == null || FightMap.Count == 0) { AnalyseFightMap(); } if (FightMap == null) { return(new List <LeagueFight>()); } if (FightMap.ContainsKey(round)) { return(FightMap[round]); } } return(new List <LeagueFight>()); }
public override void Initialize() { Hero.Mana = 100; if (G.willFightBoss) Music.Play("boss"); else Music.Play("monster"); Cursor.SetVisibility(false); _hero = new Entity(new Pos(100, 400)); _ennemy = new Ennemy(new Pos(800, 400)); _map = new FightMap(); _hero.LoadContent("fight", "1"); _ennemy.LoadContent("fight", "3"); _ennemy.Life = 10000; if (G.willFightBoss) { _ennemy.LoadContent("main deco/9"); _ennemy.Life = 20000; } _background = new Entity(); _background.LoadContent("fight/9"); _background2 = new Entity(new Pos(0, 450)); _background2.LoadContent("fight/9"); _fireball = new Entity(); _fireball.LoadContent("fight/fireball"); _fireball.Visible = false; _ennemyFireball = new Entity(); _ennemyFireball.LoadContent("fight/fireball2"); _fireball.Visible = false; _ennemyFireball.Pos = new Pos(_ennemy.Pos.I, _ennemy.Pos.J - 32); }