public override void PopulateFromJson(JObject jsonObject) { base.PopulateFromJson(jsonObject); m_eventsInvalidatingCost = Serialization.JsonArrayAsList <EventCategory>(jsonObject, "eventsInvalidatingCost"); m_eventsInvalidatingCasting = Serialization.JsonArrayAsList <EventCategory>(jsonObject, "eventsInvalidatingCasting"); m_spawnLocation = ICoordSelectorUtils.FromJsonProperty(jsonObject, "spawnLocation"); JArray val = Serialization.JsonArray(jsonObject, "cost"); m_cost = new List <Cost>((val != null) ? val.get_Count() : 0); if (val != null) { foreach (JToken item in val) { m_cost.Add(Cost.FromJsonToken(item)); } } JArray val2 = Serialization.JsonArray(jsonObject, "spells"); m_spells = new List <SpellOnSpawnWithDestination>((val2 != null) ? val2.get_Count() : 0); if (val2 != null) { foreach (JToken item2 in val2) { m_spells.Add(SpellOnSpawnWithDestination.FromJsonToken(item2)); } } m_autoResurrect = Serialization.JsonTokenValue <bool>(jsonObject, "autoResurrect", false); }
public static IEnumerable <Area> TargetsToCompareAreaList(ITargetSelector targetToCompare, DynamicValueContext context) { IEntitySelector entitySelector = targetToCompare as IEntitySelector; if (entitySelector != null) { foreach (IEntity item in entitySelector.EnumerateEntities(context)) { IEntityWithBoardPresence entityWithBoardPresence = item as IEntityWithBoardPresence; if (entityWithBoardPresence != null) { yield return(entityWithBoardPresence.area); } } } ICoordSelector coordSelector = targetToCompare as ICoordSelector; if (coordSelector != null) { foreach (Coord item2 in coordSelector.EnumerateCoords(context)) { yield return(new PointArea((Vector2Int)item2)); } } }
private static IEnumerable <Target> EnumerateCompanionAvailableLocations(ICoordSelector spawnLocation, CastTargetContext castTargetContext) { foreach (Coord item in spawnLocation.EnumerateCoords(castTargetContext)) { yield return(new Target(item)); } }
public IEnumerable <Vector2Int> EnumerateInstantiationPositions([NotNull] DynamicValueContext castTargetContext) { ICoordSelector coordSelector = m_originTarget as ICoordSelector; if (coordSelector != null) { foreach (Coord item in coordSelector.EnumerateCoords(castTargetContext)) { yield return(new Vector2Int(item.x, item.y)); } } }
public void Initialize(GameController puzzleController) { //puzzle this.PuzzleController = puzzleController; this.PuzzleTransform = GameObject.Find("Puzzle").transform; //board this.BoardTransform = this.PuzzleTransform.Find("Board").transform; //ray provider, selectors and responses this.RayProvider = this.GetComponent <IRayProvider>(); this.TransformSelector = this.GetComponent <ITransformSelector>(); this.BoardCoordSelector = this.GetComponent <ICoordSelector>(); this.PieceSelectionResponse = this.GetComponent <IPieceSelectionResponse>(); this.BoardSelectionResponse = this.GetComponent <IBoardSelectionResponse>(); }
public static bool StartInvokingCompanion(PlayerStatus casterStatus, ReserveCompanionStatus companionStatus) { if (s_currentCastType != 0) { Log.Error($"Tried to start invoking a companion while current cast type is {s_currentCastType}", 208, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\FightCastManager.cs"); return(false); } CompanionDefinition definition = companionStatus.definition; if (null == definition) { Log.Error("Tried to start invoking a companion without a loaded definition.", 215, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\FightCastManager.cs"); return(false); } OneCastTargetContext castTargetContext = new OneCastTargetContext(FightStatus.local, casterStatus.id, DynamicValueHolderType.Companion, definition.get_id(), companionStatus.level, 0); FightMap current = FightMap.current; if (null != current) { ICoordSelector spawnLocation = definition.spawnLocation; if (spawnLocation == null) { Log.Error("Tried to start invoking a companion that has no spawn location.", 227, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\FightCastManager.cs"); return(false); } FightMap fightMap = current; fightMap.onTargetChanged = (Action <Target?, CellObject>)Delegate.Combine(fightMap.onTargetChanged, new Action <Target?, CellObject>(OnCompanionInvocationLocationChanged)); FightMap fightMap2 = current; fightMap2.onTargetSelected = (Action <Target?>)Delegate.Combine(fightMap2.onTargetSelected, new Action <Target?>(OnCompanionInvocationLocationSelected)); current.SetTargetingPhase(EnumerateCompanionAvailableLocations(spawnLocation, castTargetContext)); } s_currentCastType = CurrentCastType.Companion; s_playerCasting = casterStatus; s_companionBeingInvoked = companionStatus; s_castTargetContext = castTargetContext; ShowCompanionCostsPreview(); return(true); }
public static ICoordSelector FromJsonProperty(JObject jsonObject, string propertyName, ICoordSelector defaultValue = null) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Invalid comparison between Unknown and I4 JProperty val = jsonObject.Property(propertyName); if (val == null || (int)val.get_Value().get_Type() == 10) { return(defaultValue); } return(FromJsonToken(val.get_Value())); }
public override void PopulateFromJson(JObject jsonObject) { base.PopulateFromJson(jsonObject); m_first = ICoordSelectorUtils.FromJsonProperty(jsonObject, "first"); m_second = ICoordSelectorUtils.FromJsonProperty(jsonObject, "second"); }