public ILocatedWebElement OnElement(string selector) { var elem = Locator.Find(selector); elem?.Click(); return(elem); }
public void AddPowerup(string powerupType) { var powerupsConfig = Locator.Find<RootConfig>().PowerupsConfig; BasePowerup powerup = null; playerController.AddPowerup(powerup); }
protected void RouteTo <T>(object parameters = null) where T : BaseView { var router = Locator.Find <ViewRouter>(); if (router != null) { router.RouteTo <T>(this, parameters); } }
void Start() { gameContext = Locator.Find<GameContext>(); var subscription = gameContext.WhenPropertyChanged(c => c.IsPaused, OnPauseChanged); disposablePack.Add (subscription); gameContext.ResurectRequested += ResurectSession; gameContext.RestartRequested += RestartSession; playerController.OnDied += PlayerDied; playerController.Stay(); }
public void FinishJump() { var rootConfit = Locator.Find <RootConfig>(); var playerConfig = rootConfit != null ? rootConfit.PlayerConfig : new PlayerConfig(); var minJumpTime = playerConfig.jumpDuration * playerConfig.minJumpDurationKoef; // If releasing during high jump - reset vertical velocity if (jumpTime < minJumpTime && jumpTime > 0) { _velocity.y *= playerConfig.yVelocityReset; } jumpTime = 0; }
public void Reset() { transform.position = initialPosition; _velocity = Vector3.zero; //_characterPhysics.collisionState.reset(); // fix an issue when cat can't jump on resurrection after dying in the air canDoubleJump = true; var rootConfig = Locator.Find <RootConfig>(); PlayerConfig playerConfig = null; if (rootConfig != null) { playerConfig = rootConfig.PlayerConfig; } Configure(playerConfig ?? new PlayerConfig()); }
private IEnumerator PostponeTap() { var delay = 100f; var rootConfig = Locator.Find <RootConfig>(); if (rootConfig != null) { delay = rootConfig.InputConfig.TapDetectionTime; } yield return(new WaitForSeconds(delay)); if (!swipeHandled) { tapHandled = true; OnTap(); if (postponePointerUp) { postponePointerUp = false; OnPointerUp(); } } }
public ILocatedWebElement GetElement(string selector, ISearchContext root = null) { return(Locator.Find(selector, root)); }
void Awake() { DataContext = Locator.Find <GameContext>(); }
public T Locate <T>() where T : class { return(_locator.Find <T>()); }
public object Convert(object[] values, Type types, object parameter, CultureInfo cultureInfo) { var inlines = new List <Inline>(); if (values.Length == 3 && values[0] is string && values[1] is ICharacter && values[2] is MessageType) { inlines.Clear(); // simple insurance that there's no junk var text = (string)values[0]; // this is the beef of the message text = HttpUtility.HtmlDecode(text); // translate the HTML characters var user = (ICharacter)values[1]; // this is our poster's name var type = (MessageType)values[2]; // what kind of type our message is if (type == MessageType.Roll) { return(Parse(text)); } // this creates the name link var nameLink = MakeUsernameLink(user); inlines.Add(nameLink); // name first if (text[0] == '/') { var check = text.Substring(0, text.IndexOf(' ') + 1); Func <string, string> nonCommandCommand; if (CommandDefinitions.NonCommandCommands.TryGetValue(check, out nonCommandCommand)) { var command = text[1]; text = nonCommandCommand(text); if (command == 'm') // is an emote { inlines.Insert(0, new Run("*")); // push the name button to the second slot inlines[1].FontStyle = FontStyles.Italic; inlines.Add(new Italic(Parse(text))); inlines.Add(new Run("*")); } else if (command == 'w') // is a warn { var toAdd = Parse(text); toAdd.Foreground = Locator.Find <Brush>("ModeratorBrush"); toAdd.FontWeight = FontWeights.Medium; inlines.Add(toAdd); } else if (command == 'p') // is a post { inlines.Add(Parse(text)); } return(inlines); } inlines.Add(new Run(" : ")); inlines.Add(Parse(text)); return(inlines); } inlines.Add(new Run(" : ")); inlines.Add(new Run(text)); } else if (values.Length == 1 && values[0] is NotificationModel) { inlines.Clear(); if (values[0] is CharacterUpdateModel) { var notification = values[0] as CharacterUpdateModel; var user = notification.TargetCharacter; var text = HttpUtility.HtmlDecode(notification.Arguments.ToString()); var nameLink = MakeUsernameLink(user); inlines.Add(nameLink); inlines.Add(new Run(" ")); inlines.Add(Parse(text)); } } else { inlines.Clear(); } return(inlines); }
public ILocatedWebElement FindElement(string selector) { return(Locator.Find(selector, this)); }
public object Convert(object value, Type type, object parameter, CultureInfo cultureInfo) { var inlines = new List <Inline>(); if (value == null) { return(null); } var message = value as IMessage; // this is the beef of the message var text = message == null ? value as string : message.Message; if (string.IsNullOrEmpty(text)) { return(null); } // show more logic if (message != null) { // we don't want to collapse only one small sentence const int wiggleRoom = 75; if (message.Type == MessageType.Ad && text.Length > (ApplicationSettings.ShowMoreInAdsLength + wiggleRoom)) { // try to find a nice sentence to break after var start = ApplicationSettings.ShowMoreInAdsLength; do { if (char.IsPunctuation(text[start]) && char.IsWhiteSpace(text[start + 1])) { break; } start--; } while (start != 0); // if we didn't find one, just aggressively break at our point if (start == 0) { start = ApplicationSettings.ShowMoreInAdsLength; do { if (char.IsWhiteSpace(text[start])) { break; } start--; } while (start != 0); } if (start != 0) { var sb = new StringBuilder(text); sb.Insert(start + 1, "[collapse=Read More]"); sb.Append("[/collapse]"); text = sb.ToString(); } } } text = HttpUtility.HtmlDecode(text); // translate the HTML characters if (text[0] == '/') { var check = text.Substring(0, text.IndexOf(' ') + 1); var command = ' '; Func <string, string> nonCommandCommand; if (CommandDefinitions.NonCommandCommands.TryGetValue(check, out nonCommandCommand)) { command = text[1]; text = nonCommandCommand(text); } if (command == 'w' && permissions.IsModerator(message.Poster.Name)) { // a warn "command" gets a different appearance var toAdd = Parse(text); toAdd.Foreground = Locator.Find <Brush>("ModeratorBrush"); toAdd.FontWeight = FontWeights.Medium; inlines.Add(toAdd); } else if (command == 'm') // is an emote { inlines.Add(new Italic(Parse(text))); } else { inlines.Add(new Run(" : ")); inlines.Add(Parse(text)); } return(inlines); } inlines.Add(new Run(": ")); inlines.Add(Parse(text)); return(inlines); }