protected virtual void GoToSection(int sectionIndex, ChangeType changeType) { var nextSectionKey = NonImageContent.Sections[sectionIndex].Key; var nextSection = UserEncounter.GetSection(nextSectionKey); var selectedArgs = new UserSectionSelectedEventArgs(nextSection, changeType); UserSectionSelector.Select(this, selectedArgs); }
protected virtual void OnSectionSelected(object sender, UserSectionSelectedEventArgs eventArgs) { if (CurrentSection != null) { CurrentSection.StatusChanged -= UpdateOn; } CurrentSection = eventArgs.SelectedSection; CurrentSection.StatusChanged += UpdateOn; UpdateOn(); }
protected virtual void SwipeEnd(Swipe obj) { var dist = GetDistance(obj); var swipingDirection = GetDirection(dist); if (swipingDirection == Direction.NA) { EndMove(); return; } UserSectionSelectedEventArgs sectionSelectedEventArgs = GetSwipeSectionSelectedEventArgs(obj, swipingDirection, dist); var changingSections = sectionSelectedEventArgs != null; if (changingSections) { SectionSelector.Select(this, sectionSelectedEventArgs); } dist = Mathf.Clamp01(Mathf.Abs(dist)); CurrentCoroutine = StartCoroutine(MoveSection(swipingDirection, dist, changingSections)); }
protected virtual void OnSectionSelected(object sender, UserSectionSelectedEventArgs e) { var encounter = EncounterSelectedListener.CurrentValue.Encounter; var nonImageContent = encounter.Data.Content.NonImageContent; var sectionIndex = nonImageContent.CurrentSectionIndex; PreviousSection = (sectionIndex > 0) ? encounter.Sections[sectionIndex - 1].Value : null; NextSection = (sectionIndex + 1 < encounter.Sections.Count) ? encounter.Sections[sectionIndex + 1].Value : null; CurrentSection = e.SelectedSection; if ((object)sender == this || (e.ChangeType != ChangeType.Next && e.ChangeType != ChangeType.Previous)) { return; } if (CurrentCoroutine != null) { StopCoroutine(CurrentCoroutine); } var direction = (e.ChangeType == ChangeType.Next) ? Direction.Next : Direction.Previous; CurrentCoroutine = StartCoroutine(SectionChanged(direction)); }
protected override void OnSectionSelected(object sender, UserSectionSelectedEventArgs e) { if (CurrentSection == e.SelectedSection) { return; } var encounter = EncounterSelector.CurrentValue.Encounter; var content = encounter.Data.Content.NonImageContent; var sections = encounter.Sections; var currentIndex = content.CurrentSectionIndex; CurrentSection = e.SelectedSection; NextSection = (currentIndex + 1 < sections.Count) ? sections[currentIndex + 1].Value : null; PreviousSection = (currentIndex > 0) ? sections[currentIndex - 1].Value : null; if (e.ChangeType != ChangeType.Next && e.ChangeType != ChangeType.Previous) { UpdatePosition(CurrentSection); } base.OnSectionSelected(sender, e); }
public override void Display(object sender, UserSectionSelectedEventArgs eventArgs) => SectionSelector.Select(sender, eventArgs);
protected virtual void OnSectionSelected(object sender, UserSectionSelectedEventArgs eventArgs) => CurrentUserSection = eventArgs.SelectedSection;
protected virtual void OnSectionSelected(object sender, UserSectionSelectedEventArgs e) => SectionButtons[e.SelectedSection].Select();