private void Update() { if (this.leftIcon != null) { this.leftIcon.localScale = Vector3.Lerp(this.leftIcon.localScale, (!this.IsToggled) ? (Vector3.one * 1.2f) : Vector3.one, Time.deltaTime * 20f); } if (this.rightIcon != null) { this.rightIcon.localScale = Vector3.Lerp(this.rightIcon.localScale, (!this.IsToggled) ? Vector3.one : (Vector3.one * 1.2f), Time.deltaTime * 20f); } if (this.isDragging) { if (this.wasToggled != this.IsToggled && this.m_toggleSound && Time.realtimeSinceStartup - this.lastTimeToggleSoundPlayed > this.m_toggleSound.clip.length * 0.3f) { Singleton <AudioManager> .Instance.Play2dEffect(this.m_toggleSound); this.lastTimeToggleSoundPlayed = Time.realtimeSinceStartup; } GuiManager.Pointer pointer = GuiManager.GetPointer(); if (pointer.widget != this) { this.OnInput(new InputEvent(InputEvent.EventType.Release, pointer.position)); } this.wasToggled = this.IsToggled; return; } this.wasToggled = this.IsToggled; if (this.freezeFrames > 0) { this.freezeFrames--; return; } this.slider.localPosition = Vector3.Lerp(this.slider.localPosition, (!this.IsToggled) ? this.sliderLeftPosition : this.sliderRightPosition, Time.deltaTime * 20f); }
private void DoPanning() { if (DeviceInfo.UsesTouchInput) { if (Input.touchCount == 1) { if (!this.isPanning) { if (!this.m_isStartingPan && Input.GetTouch(0).phase == TouchPhase.Began && !GuiManager.GetPointer().onWidget) { this.m_panStartPosition = Input.GetTouch(0).position; this.m_panTouchFingerId = Input.GetTouch(0).fingerId; this.m_isStartingPan = true; } if (this.m_isStartingPan && Input.GetTouch(0).fingerId == this.m_panTouchFingerId && Vector3.Distance(Input.GetTouch(0).position, this.m_panStartPosition) > 30f) { this.isPanning = true; this.m_panningSpeed = 0f; } } } else { this.m_isStartingPan = false; this.isPanning = false; } } else { GuiManager.Pointer pointer = GuiManager.GetPointer(); if (pointer.down && !pointer.onWidget) { this.m_panStartPosition = Input.mousePosition; this.m_isStartingPan = true; } if (pointer.dragging) { if (this.m_isStartingPan && Vector3.Distance(Input.mousePosition, this.m_panStartPosition) > 30f) { this.isPanning = true; this.m_isStartingPan = false; this.m_panningSpeed = 0f; } } else { this.isPanning = false; this.m_isStartingPan = false; } } }
private void Update() { float num = (float)Screen.width / (float)Screen.height / 1.33333337f; this.m_comic.transform.localScale = new Vector3(num, num, num); float y = this.m_comic.GetComponent <UnmanagedSprite>().Size.y; float num2 = 0.5f * y - 10f + 1.3f * num * this.m_continueButtonHeight; float a = 10f - 0.5f * y; Camera component = GameObject.FindGameObjectWithTag("HUDCamera").GetComponent <Camera>(); GuiManager.Pointer pointer = GuiManager.GetPointer(); if (pointer.up) { this.m_scrolling = true; } if (pointer.down) { this.m_scrolling = false; this.m_dragStartPosition = component.ScreenToWorldPoint(pointer.position); } else if (pointer.dragging) { Vector3 vector = component.ScreenToWorldPoint(pointer.position); Vector3 newDelta = vector - this.m_dragStartPosition; this.CalculateScrollVelocity(newDelta); this.m_dragStartPosition = vector; float min = Mathf.Min(a, this.m_position.y); this.m_position.y = this.m_position.y + newDelta.y; this.m_position.y = Mathf.Clamp(this.m_position.y, min, num2); } else if (Input.GetAxis("Mouse ScrollWheel") != 0f) { float min2 = Mathf.Min(a, this.m_position.y); this.m_position.y = this.m_position.y + -10f * Input.GetAxis("Mouse ScrollWheel") * 2f; this.m_position.y = Mathf.Clamp(this.m_position.y, min2, num2); } else if (this.m_scrollVelocity.magnitude > 0.01f) { Vector3 vector2 = Time.deltaTime * this.m_scrollVelocity; this.m_scrollVelocity *= Mathf.Pow(0.925f, Time.deltaTime / 0.0166666675f); float min3 = Mathf.Min(a, this.m_position.y); this.m_position.y = this.m_position.y + vector2.y; this.m_position.y = Mathf.Clamp(this.m_position.y, min3, num2); } if (this.m_scrolling) { this.m_position.y = this.m_position.y + 2f * Time.deltaTime; this.m_position.y = Mathf.Min(this.m_position.y, num2); } this.m_comic.transform.position = this.m_position; }
private void Update() { if (this.m_disableScrolling) { return; } Camera component = GameObject.FindGameObjectWithTag("HUDCamera").GetComponent <Camera>(); GuiManager.Pointer pointer = GuiManager.GetPointer(); if (pointer.up) { this.m_scrolling = true; } if (pointer.down) { this.m_scrolling = false; this.m_dragStartPosition = component.ScreenToWorldPoint(pointer.position); } else if (pointer.dragging && !LootCrateOpenDialog.DialogOpen) { Vector3 vector = component.ScreenToWorldPoint(pointer.position); Vector3 newDelta = vector - this.m_dragStartPosition; this.CalculateScrollVelocity(newDelta); this.m_dragStartPosition = vector; this.m_position.y = this.m_position.y + newDelta.y; } else if (Input.GetAxis("Mouse ScrollWheel") != 0f) { this.m_position.y = this.m_position.y + -10f * Input.GetAxis("Mouse ScrollWheel"); } else if (this.m_scrollVelocity.magnitude > 0.01f) { Vector3 vector2 = Time.deltaTime * this.m_scrollVelocity; this.m_scrollVelocity *= Mathf.Pow(0.925f, Time.deltaTime / 0.0166666675f); this.m_position.y = this.m_position.y + vector2.y; } if (this.m_scrolling || LootCrateOpenDialog.DialogOpen) { this.m_position.y = this.m_position.y + 1.5f * Time.deltaTime; } if (this.m_position.y < 25f) { this.m_position = new Vector3(this.m_position.x, this.wrapLimitUp, this.m_position.z); } else if (this.m_position.y > this.wrapLimitUp) { this.m_position = new Vector3(this.m_position.x, 25f, this.m_position.z); } base.transform.position = this.m_position; }
private void Update() { GuiManager.Pointer pointer = GuiManager.GetPointer(); if (pointer.dragging && !this.interacting && this.PointerIsTouching(pointer.position)) { this.lastInputPos = pointer.position; this.interacting = true; if (this.OnPartListDragBegin != null) { this.OnPartListDragBegin(); } } if (pointer.dragging && this.interacting) { Vector3 vector = WPFMonoBehaviour.hudCamera.ScreenToWorldPoint(this.lastInputPos); Vector3 vector2 = WPFMonoBehaviour.hudCamera.ScreenToWorldPoint(pointer.position); this.lastInputPos = pointer.position; this.deltaX = vector2.x - vector.x; this.lastMovement += Mathf.Abs(this.deltaX); if (Mathf.Abs(this.deltaX) > 0f) { this.Move(this.deltaX, true); } } if (pointer.up && this.interacting) { this.interacting = false; this.lastMovement = 0f; } if (!this.interacting) { if (Mathf.Abs(this.deltaX) > 0.1f) { this.Move(this.deltaX, true); this.deltaX -= this.deltaX / (float)this.momentumSlide; } else { float num = this.scrollPivot.localPosition.x - this.targetPosition; float num2 = Mathf.SmoothDamp(num, 0f, ref this.xVelocity, 0.2f); this.Move(num2 - num, false); } } }
private void Update() { GuiManager.Pointer pointer = GuiManager.GetPointer(); if (pointer.down) { this.m_pointerDownPos = (this.m_lastInputPos = pointer.position); } if (pointer.dragging && !LootCrateOpenDialog.DialogOpen && !TextDialog.DialogOpen) { Vector3 vector = this.m_hudCamera.ScreenToWorldPoint(this.m_lastInputPos); Vector3 vector2 = this.m_hudCamera.ScreenToWorldPoint(pointer.position); this.m_lastInputPos = pointer.position; float num = vector2.x - vector.x; this.m_scrollPivot.localPosition = new Vector3(this.m_scrollPivot.localPosition.x + num, this.m_scrollPivot.localPosition.y, this.m_scrollPivot.localPosition.z); Vector3 vector3 = this.m_hudCamera.ScreenToWorldPoint(this.m_pointerDownPos); if (Mathf.Abs(vector2.x - vector3.x) > 1f) { Singleton <GuiManager> .Instance.ResetFocus(); } } if (pointer.up) { float num2 = this.m_lastInputPos.x - this.m_pointerDownPos.x; if (Mathf.Abs(num2) > (float)(Screen.width / 16)) { int page = this.m_page; this.m_page += ((num2 >= 0f) ? -1 : 1); this.m_page = Mathf.Clamp(this.m_page, 0, this.m_pageCount - 1); if (page != this.m_page) { this.OnPageChanged(page, this.m_page); } } } if (!pointer.down && !pointer.dragging) { Vector3 targetPosition = this.GetTargetPosition(this.m_page); if (Vector3.SqrMagnitude(targetPosition - this.m_scrollPivot.localPosition) > 1E-05f) { this.m_scrollPivot.localPosition += (targetPosition - this.m_scrollPivot.localPosition) * Time.unscaledDeltaTime * 4f; } } }
private void Update() { if (this.dragging) { GuiManager.Pointer pointer = GuiManager.GetPointer(); Vector3 vector = Singleton <GuiManager> .Instance.FindCamera().ScreenToWorldPoint(pointer.position); float z = base.transform.position.z - 1f; Vector3 position = new Vector3(vector.x, vector.y, z); if (this.dragIcon) { this.dragIcon.transform.position = position; } if (pointer.up) { if (this.dragIcon) { this.dragIcon.SetActive(false); this.dragIcon.transform.localPosition = Vector3.zero; } this.dragging = false; if (this.m_listener != null) { this.m_listener.Drop(this, position, this.dragObject); } } } if (this.animate) { float num = base.transform.localScale.x; if (this.down && num < 1.2f) { num = Mathf.Min(num + Time.deltaTime * 7f, 1.2f); } else if (!this.down && num > 1f) { num = Mathf.Max(num - Time.deltaTime * 7f, 1f); } base.transform.localScale = new Vector3(num, num, 1f); } this.ButtonUpdate(); }
private void Update() { if (this.m_screenWidth != Screen.width || this.m_screenHeight != Screen.height) { this.m_screenWidth = Screen.width; this.m_screenHeight = Screen.height; this.SetPage(0); this.Layout(); Transform transform = base.transform.Find("PageDots"); int num = 0; if (transform != null) { num = transform.childCount; } if ((this.m_pageCount > 1 && transform == null) || num <= 1) { this.CreatePageDots(); } else if (this.m_pageCount <= 1 && num >= 1) { transform.gameObject.SetActive(false); } else if (this.m_pageCount > 1 && num >= 1) { for (int i = 0; i < this.m_dotsList.Count; i++) { if (i == this.m_page) { this.m_dotsList[i].Enable(); } else { this.m_dotsList[i].Disable(); } } } } if (this.m_pageCount <= 1) { return; } if (!this.m_interacting) { Vector3 a = new Vector3(-this.m_hudCamera.ScreenToWorldPoint(new Vector3((float)(Screen.width / 2 + Screen.width * this.m_page), 0f, 0f)).x, this.m_scrollPivot.transform.localPosition.y, this.m_scrollPivot.transform.localPosition.z); this.m_scrollPivot.transform.position += (a - this.m_scrollPivot.transform.position) * Time.deltaTime * 4f; float magnitude = (a - this.m_scrollPivot.transform.position).magnitude; if (magnitude < 1f) { if (UserSettings.GetInt(Singleton <GameManager> .Instance.CurrentSceneName + "_active_page", -1) != this.m_page) { UserSettings.SetInt(Singleton <GameManager> .Instance.CurrentSceneName + "_active_page", this.m_page); } if (!DeviceInfo.UsesTouchInput) { this.m_rightScroll.SetActive(true); this.m_leftScroll.SetActive(true); } } else if (!DeviceInfo.UsesTouchInput) { this.m_rightScroll.SetActive(false); this.m_leftScroll.SetActive(false); } if (!DeviceInfo.UsesTouchInput) { if (this.CurrentPage == 0) { this.m_leftScroll.SetActive(false); } if (this.CurrentPage == this.m_pageCount || this.m_pageCount == 1) { this.m_rightScroll.SetActive(false); } } } GuiManager.Pointer pointer = GuiManager.GetPointer(); if (pointer.down && pointer.widget != this.m_leftScroll.GetComponent <Widget>() && pointer.widget != this.m_rightScroll.GetComponent <Widget>()) { this.m_initialInputPos = pointer.position; this.m_lastInputPos = pointer.position; this.m_interacting = true; } if (pointer.dragging && this.m_interacting) { Vector3 vector = this.m_hudCamera.ScreenToWorldPoint(this.m_lastInputPos); Vector3 vector2 = this.m_hudCamera.ScreenToWorldPoint(pointer.position); this.m_lastInputPos = pointer.position; float num2 = vector2.x - vector.x; this.m_scrollPivot.transform.localPosition = new Vector3(Mathf.Clamp(this.m_scrollPivot.transform.localPosition.x + num2, this.m_rightDragLimit, this.m_leftDragLimit), this.m_scrollPivot.transform.localPosition.y, this.m_scrollPivot.transform.localPosition.z); Vector3 vector3 = this.m_hudCamera.ScreenToWorldPoint(this.m_initialInputPos); if (!DeviceInfo.UsesTouchInput && Mathf.Abs(vector2.x - vector3.x) > 0.2f) { this.m_rightScroll.SetActive(false); this.m_leftScroll.SetActive(false); } if (Mathf.Abs(vector2.x - vector3.x) > 1f) { Singleton <GuiManager> .Instance.ResetFocus(); } } if (pointer.up && this.m_interacting) { float num3 = this.m_lastInputPos.x - this.m_initialInputPos.x; if (num3 < (float)(-(float)Screen.width / 16)) { this.m_page++; this.m_page = Mathf.Clamp(this.m_page, 0, this.m_pageCount - 1); for (int j = 0; j < this.m_dotsList.Count; j++) { if (j == this.m_page) { this.m_dotsList[j].Enable(); } else { this.m_dotsList[j].Disable(); } } } else if (num3 > (float)(Screen.width / 16)) { this.m_page--; this.m_page = Mathf.Clamp(this.m_page, 0, this.m_pageCount - 1); for (int k = 0; k < this.m_dotsList.Count; k++) { if (k == this.m_page) { this.m_dotsList[k].Enable(); } else { this.m_dotsList[k].Disable(); } } } this.m_page = Mathf.Clamp(this.m_page, 0, this.m_pageCount - 1); this.m_interacting = false; } }
private void Update() { if (this.m_screenWidth != Screen.width || this.m_screenHeight != Screen.height) { this.m_screenWidth = Screen.width; this.m_screenHeight = Screen.height; this.Layout(); } GuiManager.Pointer pointer = GuiManager.GetPointer(); if (pointer.down) { this.m_initialInputPos = pointer.position; this.m_lastInputPos = pointer.position; this.m_interacting = true; RaycastHit raycastHit; if (Physics.Raycast(this.m_hudCamera.ScreenPointToRay(pointer.position), out raycastHit)) { if (raycastHit.collider.transform.name.Equals("SliderToggle")) { this.m_interacting = false; } Transform parent = raycastHit.collider.transform.parent; CompactEpisodeTarget component = raycastHit.collider.transform.GetComponent <CompactEpisodeTarget>(); if (component || (raycastHit.collider.transform.GetComponent <Button>() == null && parent && parent.GetComponent <CompactEpisodeTarget>())) { if (component) { this.SetCenterEpisode(raycastHit.collider.transform.gameObject); } else { this.SetCenterEpisode(parent.gameObject); } if (this.m_centerEpisode == this.CurrentEpisodes[0] && this.m_preButtons != null) { this.SetCenterEpisode(this.m_preButtons[0]); } else if (this.m_centerEpisode == this.CurrentEpisodes[this.EpisodeCount - 1]) { this.SetCenterEpisode(this.CurrentEpisodes[this.EpisodeCount - 2]); } if (this.m_isRotated) { for (int i = 0; i < this.m_episodesToggled.Count; i++) { if (this.m_centerEpisode == this.m_episodesToggled[i]) { int value = Mathf.Clamp(i, 0, this.m_episodesToggled.Count - 1); UserSettings.SetInt(CompactEpisodeSelector.CurrentSandboxEpisodeKey, value); } } } } } } bool flag = TextDialog.DialogOpen || DailyChallengeDialog.DialogOpen || SnoutCoinShopPopup.DialogOpen || LootWheelPopup.DialogOpen; if (pointer.dragging && this.m_interacting && !flag && this.m_movableEpisodes) { Vector3 vector = this.m_hudCamera.ScreenToWorldPoint(this.m_lastInputPos); Vector3 vector2 = this.m_hudCamera.ScreenToWorldPoint(pointer.position); this.m_lastInputPos = pointer.position; this.m_deltaX = vector2.x - vector.x; if (Mathf.Abs(this.m_deltaX) > 0f) { this.MoveEpisodes(this.m_deltaX, true); } Vector3 vector3 = this.m_hudCamera.ScreenToWorldPoint(this.m_initialInputPos); if (!this.m_focusIsReset && Mathf.Abs(vector2.x - vector3.x) > 0.1f) { this.m_focusIsReset = true; } if (this.m_focusIsReset) { Singleton <GuiManager> .Instance.ResetFocus(); } } if (pointer.up && this.m_interacting) { this.m_focusIsReset = false; this.m_interacting = false; this.m_moveToCenter = true; } if (!this.m_interacting && this.m_movableEpisodes && this.m_momentumSlide > 0 && this.m_centerEpisode) { float x = this.m_centerEpisode.transform.position.x; if (Mathf.Abs(this.m_deltaX) > 0.1f) { this.MoveEpisodes(this.m_deltaX, true); this.m_deltaX -= this.m_deltaX / (float)this.m_momentumSlide; } else if (this.m_centerEpisode != null && this.m_moveToCenter) { float num = Mathf.SmoothDamp(x, 0f, ref this.xVelocity, 0.2f); this.MoveEpisodes(num - x, false); } } this.ScaleEpisodes(); }
private void Update() { if (this.m_currentScreenWidth != Screen.width || this.m_currentScreenHeight != Screen.height) { this.LayoutButtons(this.m_page); this.m_currentScreenWidth = Screen.width; this.m_currentScreenHeight = Screen.height; } if (!this.m_interacting) { Vector3 a = new Vector3(-WPFMonoBehaviour.hudCamera.ScreenToWorldPoint(new Vector3((float)(Screen.width / 2 + Screen.width * this.m_page), 0f, 0f)).x, this.m_buttonGrid.transform.localPosition.y, this.m_buttonGrid.transform.localPosition.z); this.m_buttonGrid.transform.position += (a - this.m_buttonGrid.transform.position) * Time.deltaTime * 4f; float magnitude = (a - this.m_buttonGrid.transform.position).magnitude; if (magnitude < 1f) { if (UserSettings.GetInt(Singleton <GameManager> .Instance.CurrentSceneName + "_active_page", -1) != this.m_page) { UserSettings.SetInt(Singleton <GameManager> .Instance.CurrentSceneName + "_active_page", this.m_page); } if (!DeviceInfo.UsesTouchInput) { this.m_rightScroll.SetActive(true); this.m_leftScroll.SetActive(true); } } else if (!DeviceInfo.UsesTouchInput) { this.m_rightScroll.SetActive(false); this.m_leftScroll.SetActive(false); } if (!DeviceInfo.UsesTouchInput) { if (this.CurrentPage == 0) { this.m_leftScroll.SetActive(false); } if (this.CurrentPage == this.m_pageCount || this.m_pageCount == 1) { this.m_rightScroll.SetActive(false); } } } if (this.m_isIapOpen || this.m_isDialogOpen) { return; } GuiManager.Pointer pointer = GuiManager.GetPointer(); if (pointer.down && pointer.widget != this.m_leftScroll.GetComponent <Widget>() && pointer.widget != this.m_rightScroll.GetComponent <Widget>()) { this.m_initialInputPos = pointer.position; this.m_lastInputPos = pointer.position; this.m_interacting = true; } if (pointer.dragging && this.m_interacting) { Vector3 vector = WPFMonoBehaviour.hudCamera.ScreenToWorldPoint(this.m_lastInputPos); Vector3 vector2 = WPFMonoBehaviour.hudCamera.ScreenToWorldPoint(pointer.position); this.m_lastInputPos = pointer.position; float num = vector2.x - vector.x; this.m_buttonGrid.transform.localPosition = new Vector3(Mathf.Clamp(this.m_buttonGrid.transform.localPosition.x + num, this.m_rightDragLimit, this.m_leftDragLimit), this.m_buttonGrid.transform.localPosition.y, this.m_buttonGrid.transform.localPosition.z); Vector3 vector3 = WPFMonoBehaviour.hudCamera.ScreenToWorldPoint(this.m_initialInputPos); if (!DeviceInfo.UsesTouchInput && Mathf.Abs(vector2.x - vector3.x) > 0.2f) { this.m_rightScroll.SetActive(false); this.m_leftScroll.SetActive(false); } if (Mathf.Abs(vector2.x - vector3.x) > 1f) { Singleton <GuiManager> .Instance.ResetFocus(); } } if (pointer.up && this.m_interacting) { float num2 = this.m_lastInputPos.x - this.m_initialInputPos.x; int page = this.m_page; if (num2 < (float)(-(float)Screen.width / 16)) { this.m_page++; this.m_page = Mathf.Clamp(this.m_page, 0, this.m_pageCount - 1); for (int i = 0; i < this.m_dotsList.Count; i++) { if (i == this.m_page) { this.m_dotsList[i].Enable(); } else { this.m_dotsList[i].Disable(); } } } else if (num2 > (float)(Screen.width / 16)) { this.m_page--; this.m_page = Mathf.Clamp(this.m_page, 0, this.m_pageCount - 1); for (int j = 0; j < this.m_dotsList.Count; j++) { if (j == this.m_page) { this.m_dotsList[j].Enable(); } else { this.m_dotsList[j].Disable(); } } } this.m_page = Mathf.Clamp(this.m_page, 0, this.m_pageCount - 1); if (page != this.m_page) { this.OnPageChanged(); } this.m_interacting = false; } if (this.m_startingCutsceneButton.gameObject.activeInHierarchy) { float num3 = 4f; float num4 = (float)Screen.width / (float)Screen.height; if (num4 < 1.45f) { num3 /= 1.45f / num4; } Vector3 position = this.m_buttonGrid.transform.GetChild(0).position - Vector3.right * num3; this.m_startingCutsceneButton.position = position; } if (this.m_midCutsceneButton && this.m_midCutsceneButton.gameObject.activeInHierarchy && this.m_midCutsceneButtonPage * 15 < this.m_buttonGrid.transform.childCount) { float num5 = 4f; float num6 = (float)Screen.width / (float)Screen.height; if (num6 < 1.45f) { num5 /= 1.45f / num6; } int num7 = this.m_midCutsceneButtonPage * 15; Mathf.Clamp(num7, 0, this.m_buttonGrid.transform.childCount - 1); Vector3 position2 = this.m_buttonGrid.transform.GetChild(num7).position - Vector3.right * num5; this.m_midCutsceneButton.position = position2; } if (this.m_endingCutsceneButton.gameObject.activeInHierarchy) { float num8 = 4f; float num9 = (float)Screen.width / (float)Screen.height; if (num9 < 1.45f) { num8 /= 1.45f / num9; } this.m_endingCutsceneButton.position = this.m_buttonGrid.transform.GetChild(this.m_buttonGrid.transform.childCount - 1).position + Vector3.right * num8; } }
private void Update() { if (this.m_BuyButton != null) { if (Singleton <BuildCustomizationLoader> .Instance.IsChina && this.availableDessertsCount == 0) { this.m_BuyButton.SetActive(true); } else { this.m_BuyButton.SetActive(false); } } if (this.scaleAnimTime >= 0f) { this.scaleAnimTime += Time.deltaTime / this.m_GrowDuration; if (this.scaleAnimTime > 1f) { this.isEating = false; this.scaleAnimTime = -1f; } else { this.m_kingPig.transform.parent.localScale = Vector3.Lerp(this.scaleStart, Vector3.one * this.m_CurGrowScale, this.scaleAnimTime); } } if (this.m_IsIdleEnabled) { this.m_IdleTime += Time.deltaTime; if (this.m_IdleTime >= this.m_IdleTimeout) { this.m_IdleTime = this.m_IdleTimeout; this.m_IdleAnimTime += Time.deltaTime; if (this.m_IdleAnimTime > this.m_CurIdleAnimTimeOut) { this.m_IdleAnimTime = 0f; this.m_CurIdleAnimTimeOut = UnityEngine.Random.Range(this.m_IdleAnimTimeoutMin, this.m_IdleAnimTimeoutMax); base.StartCoroutine(this.PlayIdleAnim()); } } } if (this.m_draggingDessert) { GuiManager.Pointer pointer = GuiManager.GetPointer(); Vector3 position = this.m_mainCam.ScreenToWorldPoint(pointer.position); EventManager.Send(new DraggingPartEvent(BasePart.PartType.Balloon, position)); KingPig component = this.m_kingPig.GetComponent <KingPig>(); if (component.m_currentExpression == Pig.Expressions.Normal) { component.SetExpression(Pig.Expressions.WaitForFood); } if (component.m_currentExpression == Pig.Expressions.WaitForFood) { this.m_waitForFoodTimer -= Time.deltaTime; if (this.m_waitForFoodTimer <= 0f) { this.PlayKingPigExpressionAudioEffect(Pig.Expressions.WaitForFood); this.m_waitForFoodTimer = 7f; } } } else if (this.m_dessertInScene) { Vector3 position2 = this.m_dessertInScene.transform.position; EventManager.Send(new DraggingPartEvent(BasePart.PartType.Balloon, position2)); } }
private void Update() { if (this.m_screenWidth != Screen.width || this.m_screenHeight != Screen.height) { this.m_screenWidth = Screen.width; this.m_screenHeight = Screen.height; this.Layout(); } this.ScaleEpisodes(); GuiManager.Pointer pointer = GuiManager.GetPointer(); if (pointer.down) { this.m_initialInputPos = pointer.position; this.m_lastInputPos = pointer.position; this.m_interacting = true; } if (pointer.dragging && this.m_interacting && this.m_movableEpisodes) { Vector3 vector = this.m_hudCamera.ScreenToWorldPoint(this.m_lastInputPos); Vector3 vector2 = this.m_hudCamera.ScreenToWorldPoint(pointer.position); this.m_lastInputPos = pointer.position; this.m_deltaX = vector2.x - vector.x; if (Mathf.Abs(this.m_deltaX) > 0f) { this.MoveEpisodes(this.m_deltaX, true); } Vector3 vector3 = this.m_hudCamera.ScreenToWorldPoint(this.m_initialInputPos); if (Mathf.Abs(vector2.x - vector3.x) > 1f) { Singleton <GuiManager> .Instance.ResetFocus(); } } if (pointer.up && this.m_interacting) { this.m_interacting = false; this.m_moveToCenter = true; } if (!this.m_interacting && this.m_movableEpisodes && this.m_momentumSlide > 0) { float num = Mathf.Abs(this.m_centerEpisode.transform.localPosition.x); float num2 = Mathf.Sign(this.m_centerEpisode.transform.localPosition.x); if (Mathf.Abs(this.m_deltaX) > 0.1f) { this.MoveEpisodes(this.m_deltaX, true); this.m_deltaX -= this.m_deltaX / (float)this.m_momentumSlide; this.m_moveToCenter = true; if (this.m_deltaX < 0.15f && (double)num < 0.2) { this.m_deltaX = 0f; } } else if (this.m_centerEpisode != null && this.m_moveToCenter) { if ((double)num > 0.2) { this.MoveEpisodes(-num2 * Time.deltaTime * this.CenteringSpeed, false); } else { this.m_moveToCenter = false; } } } }