private void Initialize() { m_TopOffset = 0; mPopupState = PopupState.slide; this.PopupMessageWindow.Left = -this.Width; this.PopupMessageWindow.Top = m_TopOffset; }
internal void Show(Popup popup) { _queue.Add(popup); if (_current == null) { _current = _queue[0]; _queue.RemoveAt(0); Cursor = _current.Cursor; CalculatePopupRect(); if (PopupUtil.ShouldShowPopup(this, _popupScreen)) { ShowPopup(); } else { _state = PopupState.Pending; _popupTimer.Interval = 200; _popupTimer.Start(); } } }
protected override bool CanAttack(Actor self, Target target) { if (state == PopupState.Transitioning) { return(false); } if (!base.CanAttack(self, target)) { return(false); } idleTicks = 0; if (state == PopupState.Closed) { state = PopupState.Transitioning; wsb.PlayCustomAnimation(self, info.OpeningSequence, () => { state = PopupState.Open; wsb.PlayCustomAnimationRepeating(self, wsb.Info.Sequence); }); return(false); } return(true); }
private void AnimateWaiting() { _popupTimer.Stop(); if (_queue.Count > 0) { _state = PopupState.Waiting; if (_current != null) { _current.Dispose(); } _current = _queue[0]; _queue.RemoveAt(0); if (_current == null) { throw new Exception("Expected current popup"); } CalculatePopupRect(); UpdateFromAnimationStep(); _popupTimer.Interval = _current.Duration; _popupTimer.Start(); Invalidate(); } else { CompleteClosing(); } }
public virtual void Hide() { if (State != PopupState.Hided) { State = PopupState.Hiding; } }
/// <summary> /// Pushes a popup onto the popup stack. /// </summary> /// <param name="popup">The popup.</param> /// <returns> /// The popup result. /// </returns> public object ShowPopup(UIElement popup) { // Raise the popup opened event. var args = new RoutedEventArgs(PopupOpenedEvent); RaiseEvent(args); // Create a new popup state with a new dispatcher frame. var popupState = new PopupState() { PopupElement = popup, DispatcherFrame = new DispatcherFrame() }; // Push our popup state onto the popup stack. popupStack.Push(popupState); // Transition the popup. popupAnimationHelper.ShowPopup(popupHost, popup); // Push the dispatcher frame - this will now block until we close the popup. Dispatcher.PushFrame(popupState.DispatcherFrame); // Return the popup result (which by now will be stored in its state). return(popupState.PopupResult); }
protected override bool CanAttack(Actor self, Target target) { if (state == PopupState.Transitioning || !building.Value.BuildComplete) { return(false); } if (!base.CanAttack(self, target)) { return(false); } idleTicks = 0; if (state == PopupState.Closed) { state = PopupState.Transitioning; rb.PlayCustomAnimThen(self, "opening", () => { state = PopupState.Open; rb.PlayCustomAnimRepeating(self, "idle"); }); return(false); } if (!turret.FaceTarget(self, target)) { return(false); } return(true); }
private void changeState(PopupState newState) { currentState = newState; switch (newState) { case PopupState.Uninitialized: case PopupState.AwaitingResults: RewardPanel.SetActive(value: false); EndGameButtonPanel.SetActive(value: false); ClaimButtonPanel.SetActive(value: false); CalculatingResultsPanel.SetActive(value: true); break; case PopupState.AwaitingClaim: ResultsAnimator.SetTrigger(ResultsAnimatorTrigger); RewardPanel.SetActive(value: true); EndGameButtonPanel.SetActive(value: false); ClaimButtonPanel.SetActive(value: true); CalculatingResultsPanel.SetActive(value: false); break; case PopupState.Complete: RewardPanel.SetActive(value: true); EndGameButtonPanel.SetActive(value: true); ClaimButtonPanel.SetActive(value: false); CalculatingResultsPanel.SetActive(value: false); break; } }
public void Show(Action _activatedCallback = null, Action _cancelledCallback = null, Action _deactivatedCallback = null) { activatedCallback = _activatedCallback; cancelledCallback = _cancelledCallback; deactivatedCallback = _deactivatedCallback; gameObject.SetActive(true); CurrentPopupState = PopupState.Open; if (isModal) { InputManager.Instance.PushModalInputHandler(gameObject); } if (closeOnNonTargetedTap) { InputManager.Instance.PushFallbackInputHandler(gameObject); } // the visual was activated via an interaction outside of the menu, let anyone who cares know if (this.activatedCallback != null) { this.activatedCallback(); } }
public override void OnNext(GameStateManager value) { switch (value.CurrentState) { case GameState.StartScreen: State = PopupState.Removed; break; case GameState.CharacterMenu: State = PopupState.Colapsed; break; case GameState.MapsMenu: State = PopupState.Colapsed; break; case GameState.GamePlay: State = PopupState.Removed; break; case GameState.GamePause: State = PopupState.GamePause; break; } }
private void SetupPopup() { var mover = (Mover)this.target; var drivers = mover.GetDrivers(); var labels = drivers.Select(x => string.Format("{0}", x.Name)); this.popupState = new PopupState(labels); }
public virtual void Show() { if (State != PopupState.Showed) { State = PopupState.Showing; } gameObject.SetActive(true); }
protected virtual void Hide() { if (usePause) { Game1.Paused = false; } popupState = PopupState.Finished; }
void INotifyBuildComplete.BuildingComplete(Actor self) { if (skippedMakeAnimation) { state = PopupState.Closed; wsb.PlayCustomAnimationRepeating(self, info.ClosedIdleSequence); turret.DesiredFacing = null; } }
public virtual void Initialize() { InitializePositions(); useOkayButton = true; popupState = PopupState.Hidden; canvasOrigin = new Vector2(canvas.SourceRectangle.Value.Width / 2, canvas.SourceRectangle.Value.Height / 2); canvasScale = new Vector2(1, 1); }
// Use this for initialization void Start() { m_CanvasGroup = GetComponent <CanvasGroup>(); m_CanvasGroup.alpha = 0.0f; // m_MainCanvas.GetComponent<CanvasGroup>().alpha = 1.0f; m_State = PopupState.NONE; }
public void ShowPopup(string message) { if (m_State == PopupState.NONE || m_State == PopupState.SHOWING_POP) { m_State = (m_State == PopupState.SHOWING_POP) ? PopupState.RE_FADING_OUT_POP : PopupState.FADING_OUT_MAIN; Text text = GetComponentInChildren <Text>(); text.text = message; } }
public void BuildingComplete(Actor self) { if (skippedMakeAnimation) { state = PopupState.Closed; rb.PlayCustomAnimRepeating(self, "closed-idle"); turret.DesiredFacing = null; } }
public virtual void Show() { popupState = PopupState.Showing; if (usePause) { Game1.Paused = true; } }
public void SwitchState(PopupState state) { if (state == PopupState.Highlighted) { SetStateHighlighted(); } else if (state == PopupState.NotHighlighted) { SetStateNotHighlighted(); } }
public override void BuildingComplete(Actor self) { // Set true for SkipMakeAnimsInit if (buildComplete) { State = PopupState.Closed; self.Trait <RenderBuilding>() .PlayCustomAnimRepeating(self, "closed-idle"); turret.desiredFacing = null; } buildComplete = true; }
public override void BuildingComplete(Actor self) { // Set true for SkipMakeAnimsInit if (buildComplete) { State = PopupState.Closed; self.Trait<RenderBuilding>() .PlayCustomAnimRepeating(self, "closed-idle"); turret.desiredFacing = null; } buildComplete = true; }
protected override void Created(Actor self) { base.Created(self); // Map placed actors are created in the closed state if (skippedMakeAnimation) { state = PopupState.Closed; wsb.PlayCustomAnimationRepeating(self, info.ClosedIdleSequence); turret.DesiredFacing = null; } }
public void Show(GameObject newlySelectedObject, Action _activatedCallback = null, Action _cancelledCallback = null, Action _deactivatedCallback = null) { // Skyler -- singleton show if (!Menu.Instance.SetMenu(gameObject)) { return; } transform.Find("TextureMenu").transform.GetComponentInChildren <TextureMenu> ().currentlySelected = newlySelectedObject; currentSelectedObject = newlySelectedObject; if (rootAnimator.isInitialized) { rootAnimator.Play("Hydrate"); rootAnimator.ResetTrigger("Dehydrate"); } // Debug.Log("Show stack retrace"); activatedCallback = _activatedCallback; cancelledCallback = _cancelledCallback; deactivatedCallback = _deactivatedCallback; gameObject.SetActive(true); CurrentPopupState = PopupState.Open; if (isModal) { InputManager.Instance.PushModalInputHandler(gameObject); } if (closeOnNonTargetedTap) { InputManager.Instance.PushFallbackInputHandler(gameObject); } // the visual was activated via an interaction outside of the menu, let anyone who cares know if (this.activatedCallback != null) { this.activatedCallback(); } //Debug.Log (this.gameObject+ " should be looking at you"); if (CenterOnCamera) { gameObject.transform.LookAt(gameObject.transform.position * 2 - GameObject.FindObjectOfType <Camera> ().transform.position); transform.Translate(Vector3.ClampMagnitude((GameObject.FindObjectOfType <Camera> ().transform.position - gameObject.transform.position).normalized, 1) * .8f, Space.World); transform.Translate(Vector3.left * .1f, Space.Self); } //Debug.Log("Finishing the Show function " + this.gameObject); }
public PopupBaseScript CreatePopup(PopupState eState){ CameraResume (false); MainData.POPUP = eState; GameObject oPopup = (GameObject)Instantiate (Resources.Load ("Main/Popup/" + eState.ToString())); PopupBaseScript sPopup = oPopup.GetComponent<PopupBaseScript> (); oPopup.name = eState.ToString (); oPopup.transform.parent = this.transform; oPopup.transform.localPosition = Vector3.zero; oPopup.transform.localScale = Vector3.one; sPopup.SetManager (this, MainData); sPopup.Init (); return sPopup; }
public void ShowNext() { if (_queue.Count == 0) { CancelAll(); } else { _state = PopupState.Waiting; AnimateWaiting(); } }
public AttackPopupTurreted(ActorInitializer init, AttackPopupTurretedInfo info) : base(init.self) { Info = info; Turret = init.self.Trait<Turreted>(); if (init.Contains<SkipMakeAnimsInit>()) { State = PopupState.Closed; init.self.Trait<RenderBuilding>() .PlayCustomAnimRepeating(init.self, "closed-idle"); Turret.desiredFacing = null; } }
private void OpeningComplete() { _animationStep = AnimationSteps; _state = PopupState.Waiting; UpdateFromAnimationStep(); if (!_mouseOver) { _popupTimer.Interval = _current.Duration; _popupTimer.Start(); } else { _popupTimer.Stop(); } }
/// <summary> /// Dismiss the details pane /// </summary> public void Dismiss() { Debug.Log("Being dismissed " + this.gameObject); currentSelectedObject = null; // Debug.Log(" Dismissing " + this.gameObject); Menu.Instance.currentMenu = null; // Deactivates the game object if (rootAnimator.isInitialized) { rootAnimator.SetTrigger("Dehydrate"); } else { gameObject.SetActive(false); } if (deactivatedCallback != null) { deactivatedCallback(); } if (isModal) { InputManager.Instance.PopModalInputHandler(); } if (closeOnNonTargetedTap) { // Debug.Log("Before Pop"); // InputManager.Instance.PopFallbackInputHandler(); //Debug.Log("After Pop"); } CurrentPopupState = PopupState.Closed; activatedCallback = null; cancelledCallback = null; deactivatedCallback = null; if (cancelButton) { cancelButton.Selected = false; } }
private void closeMenuBox(int i) { if (CurrentState == GameState.MapsMenu || CurrentState == GameState.CharacterMenu) { this.State = PopupState.Colapsed; } else { this.State = PopupState.Removed; } //Unpauses the game if in gamepuase if (CurrentState == GameState.GamePause) { CurrentState = GameState.GamePlay; } }
public void TickIdle(Actor self) { if (state == PopupState.Open && idleTicks++ > info.CloseDelay) { turret.DesiredFacing = info.DefaultFacing; state = PopupState.Rotating; } else if (state == PopupState.Rotating && turret.TurretFacing == info.DefaultFacing) { state = PopupState.Transitioning; rb.PlayCustomAnimThen(self, "closing", () => { state = PopupState.Closed; rb.PlayCustomAnimRepeating(self, "closed-idle"); turret.DesiredFacing = null; }); } }
/// <summary> /// Pushes a popup onto the popup stack. /// </summary> /// <param name="popup">The popup.</param> /// <param name="onPopopClosed">The action to invoke when the popop is closed.</param> public void ShowPopup(UIElement popup, Action <object> onPopopClosed) { // Fire the popup opened event. FirePopupOpened(); // Create the popup state. var popupState = new PopupState() { PopupElement = popup, ClosedAction = onPopopClosed }; // Push our popup onto the popup stack. popupStack.Push(popupState); // Transition the popup. popupAnimationHelper.ShowPopup(popupHost, popup); }
void INotifyIdle.TickIdle(Actor self) { if (state == PopupState.Open && idleTicks++ > info.CloseDelay) { turret.DesiredFacing = info.DefaultFacing; state = PopupState.Rotating; } else if (state == PopupState.Rotating && turret.TurretFacing == info.DefaultFacing) { state = PopupState.Transitioning; wsb.PlayCustomAnimation(self, info.ClosingSequence, () => { state = PopupState.Closed; wsb.PlayCustomAnimationRepeating(self, info.ClosedIdleSequence); turret.DesiredFacing = null; }); } }
public void TickIdle(Actor self) { if (State == PopupState.Open && IdleTicks++ > Info.CloseDelay) { turret.desiredFacing = Info.DefaultFacing; State = PopupState.Rotating; } else if (State == PopupState.Rotating && turret.turretFacing == Info.DefaultFacing) { State = PopupState.Transitioning; var rb = self.Trait<RenderBuilding>(); rb.PlayCustomAnimThen(self, "closing", () => { State = PopupState.Closed; rb.PlayCustomAnimRepeating(self, "closed-idle"); turret.desiredFacing = null; }); } }
public void TickIdle(Actor self) { if (State == PopupState.Open && IdleTicks++ > Info.CloseDelay) { turret.desiredFacing = Info.DefaultFacing; State = PopupState.Rotating; } else if (State == PopupState.Rotating && turret.turretFacing == Info.DefaultFacing) { State = PopupState.Transitioning; var rb = self.Trait <RenderBuilding>(); rb.PlayCustomAnimThen(self, "closing", () => { State = PopupState.Closed; rb.PlayCustomAnimRepeating(self, "closed-idle"); turret.desiredFacing = null; }); } }
private void OpeningComplete() { _animationStep = AnimationSteps; _state = PopupState.Waiting; UpdateFromAnimationStep(); if (!_mouseOver) { _popupTimer.Interval = _current.Duration; _popupTimer.Start(); } else { _popupTimer.Stop(); } }
private void onSlideStateFrame() { this.PopupMessageWindow.Left += PopupConfig.Instance.PixelsPerFrame; if (this.PopupMessageWindow.Left > PopupConfig.Instance.Margin) { this.PopupMessageWindow.Left = PopupConfig.Instance.Margin; mPopupState = PopupState.display; } }
public void ShowNext() { if (_queue.Count == 0) { CancelAll(); } else { _state = PopupState.Waiting; AnimateWaiting(); } }
public void Show(Action _activatedCallback = null, Action _cancelledCallback = null, Action _deactivatedCallback = null) { activatedCallback = _activatedCallback; cancelledCallback = _cancelledCallback; deactivatedCallback = _deactivatedCallback; gameObject.SetActive(true); CurrentPopupState = PopupState.Open; if (isModal) { InputManager.Instance.PushModalInputHandler(gameObject); } if (closeOnNonTargetedTap) { InputManager.Instance.PushFallbackInputHandler(gameObject); } // the visual was activated via an interaction outside of the menu, let anyone who cares know if (this.activatedCallback != null) { this.activatedCallback(); } }
/// <summary> /// Dismiss the details pane /// </summary> public void Dismiss() { // Deactivates the game object if (rootAnimator.isInitialized) { rootAnimator.SetTrigger("Dehydrate"); } else { gameObject.SetActive(false); } if (deactivatedCallback != null) { deactivatedCallback(); } if (isModal) { InputManager.Instance.PopModalInputHandler(); } if (closeOnNonTargetedTap) { InputManager.Instance.PopFallbackInputHandler(); } CurrentPopupState = PopupState.Closed; activatedCallback = null; cancelledCallback = null; deactivatedCallback = null; if (cancelButton) { cancelButton.Selected = false; } }
private void closeMenuBox(int i) { if (CurrentState == GameState.MapsMenu || CurrentState == GameState.CharacterMenu) this.State = PopupState.Colapsed; else this.State = PopupState.Removed; //Unpauses the game if in gamepuase if (CurrentState == GameState.GamePause) { CurrentState = GameState.GamePlay; } }
internal void Show(Popup popup) { _queue.Add(popup); if (_current == null) { _current = _queue[0]; _queue.RemoveAt(0); Cursor = _current.Cursor; CalculatePopupRect(); if (PopupUtil.ShouldShowPopup(this, _popupScreen)) { ShowPopup(); } else { _state = PopupState.Pending; _popupTimer.Interval = 200; _popupTimer.Start(); } } }
protected override bool CanAttack( Actor self, Target target ) { if (State == PopupState.Transitioning) return false; if( self.HasTrait<Building>() && !buildComplete ) return false; if (!base.CanAttack( self, target )) return false; IdleTicks = 0; if (State == PopupState.Closed) { State = PopupState.Transitioning; var rb = self.Trait<RenderBuilding>(); rb.PlayCustomAnimThen(self, "opening", () => { State = PopupState.Open; rb.PlayCustomAnimRepeating(self, "idle"); }); return false; } if (!turret.FaceTarget(self,target)) return false; return true; }
private void AnimateWaiting() { _popupTimer.Stop(); if (_queue.Count > 0) { _state = PopupState.Waiting; if (_current != null) { _current.Dispose(); } _current = _queue[0]; _queue.RemoveAt(0); if (_current == null) throw new Exception("Expected current popup"); CalculatePopupRect(); UpdateFromAnimationStep(); _popupTimer.Interval = _current.Duration; _popupTimer.Start(); Invalidate(); } else { CompleteClosing(); } }
public PopupStateChangedEvent(PopupState state) { this.state = state; }
private void ShowPopup() { Popup.RaisePopupOpening(new PopupEventArgs(_current)); if (DegradeVisualPerformance()) { OpeningComplete(); } else { _state = PopupState.Opening; _animationStep = 0; _popupTimer.Interval = _current.AnimationDuration / AnimationSteps; _popupTimer.Start(); NativeMethods.SetLayeredWindowAttributes(Handle, 0, 0, NativeMethods.LWA_ALPHA); } NativeMethods.ShowWindow(Handle, NativeMethods.SW_SHOWNOACTIVATE); }
protected override bool CanAttack( Actor self, Target target ) { if (State == PopupState.Transitioning) return false; if( self.HasTrait<Building>() && !buildComplete ) return false; if (!base.CanAttack( self, target )) return false; IdleTicks = 0; if (State == PopupState.Closed) { State = PopupState.Transitioning; var rb = self.Trait<RenderBuilding>(); rb.PlayCustomAnimThen(self, "opening", () => { State = PopupState.Open; rb.PlayCustomAnimRepeating(self, "idle"); }); return false; } Turret.desiredFacing = Util.GetFacing( target.CenterLocation - self.CenterLocation, Turret.turretFacing ); if( Turret.desiredFacing != Turret.turretFacing ) return false; return true; }
/// <summary> /// Runs when game menu is clicked on /// </summary> /// <param name="index">entry Index</param> private void gameMenuClick(int index) { switch (index) { case 0: CurrentState = GameState.CharacterMenu; //Deselects players character so menu don't think it's selected foreach (var pad in GamePadControllers) { pad.PlayerModel.SelectedCharacter = null; } break; case 1: CurrentState = GameState.MapsMenu; break; } Disabled = false; State = PopupState.Colapsed; AddController(new MenuController(Screen)); }
public override void OnNext(GameStateManager value) { switch (value.CurrentState) { case GameState.StartScreen: State = PopupState.Removed; break; case GameState.CharacterMenu: State = PopupState.Colapsed; break; case GameState.MapsMenu: State = PopupState.Colapsed; break; case GameState.GamePlay: State = PopupState.Removed; break; case GameState.GamePause: State = PopupState.GamePause; break; } }
private void onDisplayStateFrame() { display_interval -= frame_delay; if (display_interval <= 0) mPopupState = PopupState.die; }