public override string ToString() { if (PreviousAction == ActionType.Fold) { return(PreviousAction.ToString() + ", " + Position + ", bets: " + NumRaises + ", limpers: " + NumCallers); } else { string posTrs = InPositionOnFlop ? "inp" : "oop"; return(PreviousAction.ToString() + ", " + posTrs + ", players: " + NumActivePlayers + ", raises: " + NumRaises + ", callers: " + NumCallers); } }
/// <summary> /// Notifies the BattleManager to officially end the BattleEntity's turn /// </summary> public void EndTurn() { if (this != BattleManager.Instance.EntityTurn) { Debug.LogError($"Attempting to end the turn of {Name} when it's not their turn!"); return; } //End the action PreviousAction?.OnActionEnded(); TurnsUsed++; BattleManager.Instance.TurnEnd(); }
/// <summary> /// Officially ends the BattleEntity's turn. /// </summary> public void EndTurn() { if (this != BattleManager.Instance.EntityTurn) { Debug.LogError($"Attempting to end the turn of {Name} when it's not their turn!"); return; } //End the action PreviousAction?.OnActionEnded(); OnTurnEnd(); //Invoke the event TurnEndEvent?.Invoke(); //Increment the number of turns TurnsUsed++; }
/// <summary> /// Makes the BattleEntity perform a MoveAction. /// The actual action performed may not be the one passed in if the BattleEntity is affected by Confusion. /// </summary> /// <param name="action">The MoveAction to perform.</param> /// <param name="ignoreConfusion">Whether to ignore the effects of Confusion for this action or not. /// This is often true when a certain action must be performed at a certain time (Ex. Koopas doing nothing when flipped, /// Veil's second part).</param> /// <param name="targets">The BattleEntities the MoveAction targets.</param> public void StartAction(MoveAction action, bool ignoreConfusion, params BattleEntity[] targets) { MoveAction actualAction = action; BattleEntity[] actualTargets = targets; //Check for Confused and handle it appropriately if (ignoreConfusion == false && EntityProperties.HasAdditionalProperty(AdditionalProperty.ConfusionPercent) == true) { BattleGlobals.ActionHolder holder = HandleConfusion(action, targets); actualAction = holder.Action; actualTargets = holder.Targets; } PreviousAction = actualAction; //Start the action PreviousAction.OnActionStarted(); PreviousAction.StartSequence(actualTargets); }
public virtual void Draw() { AnimManager.CurrentAnim?.Draw(Position, TintColor, EntityType != EntityTypes.Enemy, .1f); PreviousAction?.Draw(); //Draw Status Effect icons on the BattleEntity //You can't see the icons unless it's Mario or his Partner's turn and they're not in a Sequence if (BattleManager.Instance.ShouldShowPlayerTurnUI == true) { Vector2 statusIconPos = new Vector2(Position.X + 10, Position.Y - 40); StatusEffect[] statuses = EntityProperties.GetStatuses(); int index = 0; for (int i = 0; i < statuses.Length; i++) { StatusEffect status = statuses[i]; CroppedTexture2D texture = status.StatusIcon; //Don't draw the status if it doesn't have an icon if (texture == null || texture.Tex == null) { continue; } float yOffset = ((index + 1) * StatusGlobals.IconYOffset); Vector2 iconPos = Camera.Instance.SpriteToUIPos(new Vector2(statusIconPos.X, statusIconPos.Y - yOffset)); float depth = .35f - (index * .01f); float turnStringDepth = depth + .0001f; status.DrawStatusInfo(iconPos, depth, turnStringDepth); index++; } } }
private void SetFormActions(IPortalContext portalContext, FormActionMetadata formActionMetadata, int languageCode, string portalName = null, bool addSubmitButton = false, bool addNextPrevious = false) { var actions = formActionMetadata.Actions.OrderBy(a => a.ActionIndex).ToList(); if (addSubmitButton) { var submitActions = actions.Where(a => a is SubmitAction); if (!(submitActions.Any())) { var newSubmitAction = new SubmitAction() { ActionButtonAlignment = JsonConfiguration.ActionButtonAlignment.Left, ActionButtonPlacement = JsonConfiguration.ActionButtonPlacement.BelowForm, ActionButtonStyle = JsonConfiguration.ActionButtonStyle.ButtonGroup, ActionIndex = -1, ButtonCssClass = "btn-primary" }; actions.Insert(0, newSubmitAction); } } if (addNextPrevious && AutoGenerateSteps) { var nextActions = actions.Where(a => a is NextAction); if (!(nextActions.Any())) { var newNextAction = new NextAction() { ActionButtonAlignment = JsonConfiguration.ActionButtonAlignment.Left, ActionButtonPlacement = JsonConfiguration.ActionButtonPlacement.BelowForm, ActionButtonStyle = JsonConfiguration.ActionButtonStyle.ButtonGroup, ActionIndex = -1, ButtonCssClass = "btn btn-primary navbar-btn button next next-btn" }; actions.Insert(0, newNextAction); } var previousActions = actions.Where(a => a is PreviousAction); if (!(previousActions.Any())) { var newPreviousAction = new PreviousAction() { ActionButtonAlignment = JsonConfiguration.ActionButtonAlignment.Left, ActionButtonPlacement = JsonConfiguration.ActionButtonPlacement.BelowForm, ActionButtonStyle = JsonConfiguration.ActionButtonStyle.ButtonGroup, ActionIndex = -2, ButtonCssClass = "btn btn-default navbar-btn button previous previous-btn" }; actions.Insert(0, newPreviousAction); } } var topItemActionLinks = new List <ViewActionLink>(); var bottomItemActionLinks = new List <ViewActionLink>(); foreach (var action in actions) { if (action is WorkflowAction) { var workflowAction = (WorkflowAction)action; if (!workflowAction.IsConfigurationValid()) { continue; } var workflowActionLink = new WorkflowActionLink(portalContext, new EntityReference("workflow", workflowAction.WorkflowId), formActionMetadata, languageCode, workflowAction, true, null, portalName); AddActionLinkToSet(topItemActionLinks, bottomItemActionLinks, workflowActionLink); } if (action is DeleteAction) { var deleteAction = (DeleteAction)action; if (!deleteAction.IsConfigurationValid()) { continue; } var deleteActionLink = new DeleteActionLink(portalContext, formActionMetadata, languageCode, deleteAction, true, null, portalName); DeleteActionLink = deleteActionLink; AddActionLinkToSet(topItemActionLinks, bottomItemActionLinks, deleteActionLink); } if (action is SubmitAction) { var submitAction = (SubmitAction)action; if (!submitAction.IsConfigurationValid()) { continue; } var submitActionLink = new SubmitActionLink(portalContext, languageCode, submitAction, true, null, portalName); SubmitActionLink = submitActionLink; AddActionLinkToSet(topItemActionLinks, bottomItemActionLinks, submitActionLink); } if (action is PreviousAction) { var previousAction = (PreviousAction)action; if (!previousAction.IsConfigurationValid()) { continue; } var previousActionLink = new PreviousActionLink(portalContext, languageCode, previousAction, true, null, portalName); PreviousActionLink = previousActionLink; AddActionLinkToSet(topItemActionLinks, bottomItemActionLinks, previousActionLink); } if (action is NextAction) { var nextAction = (NextAction)action; if (!nextAction.IsConfigurationValid()) { continue; } var nextActionLink = new NextActionLink(portalContext, languageCode, nextAction, true, null, portalName); NextActionLink = nextActionLink; AddActionLinkToSet(topItemActionLinks, bottomItemActionLinks, nextActionLink); } if (action is CreateRelatedRecordAction) { var createRelatedRecordAction = (CreateRelatedRecordAction)action; if (!createRelatedRecordAction.IsConfigurationValid()) { continue; } var createRelatedRecordActionLink = new CreateRelatedRecordActionLink(portalContext, formActionMetadata, languageCode, createRelatedRecordAction, true, portalName); CreateRelatedRecordActionLink = createRelatedRecordActionLink; AddActionLinkToSet(topItemActionLinks, bottomItemActionLinks, createRelatedRecordActionLink); } SetSpecialMessageActions(portalContext, formActionMetadata, languageCode, action, topItemActionLinks, bottomItemActionLinks, portalName); } TopFormActionLinks = topItemActionLinks; BottomFormActionLinks = bottomItemActionLinks; }
public PreviousActionLink(IPortalContext portalContext, int languageCode, PreviousAction action, bool enabled = true, UrlBuilder url = null, string portalName = null) : base(portalContext, languageCode, action, LinkActionType.Previous, enabled, url, portalName, DefaultButtonLabel, DefaultButtonTooltip) { }
/// <summary> /// What happens during the entity's turn (choosing action commands, etc.) /// </summary> public virtual void TurnUpdate() { PreviousAction?.Update(); }