private void DestroyTargetArrow(bool destroyEnemyArrow, bool isLocallyCanceled) { if (this.IsActive()) { if (destroyEnemyArrow != this.m_isEnemyArrow) { Log.Rachelle.Print(string.Format("trying to destroy {0} arrow but the active arrow is {1}", !destroyEnemyArrow ? "friendly" : "enemy", !this.m_isEnemyArrow ? "friendly" : "enemy"), new object[0]); } else { if (isLocallyCanceled) { Entity entity = GameState.Get().GetEntity(this.m_sourceEntityID); if (entity != null) { entity.GetCard().NotifyTargetingCanceled(); } } this.m_originLocationEntityID = -1; this.m_sourceEntityID = -1; if (!this.m_isEnemyArrow) { RemoteActionHandler.Get().NotifyOpponentOfTargetEnd(); PegCursor.Get().Show(); } this.ActivateArrow(false); this.ShowDamageIndicator(false); } } }
public void OnEndTurnRequested() { PegCursor.Get().SetMode(PegCursor.Mode.WAITING); this.SetStateToWaiting(); base.GetComponent <Collider>().enabled = false; GameState.Get().UnregisterOptionsReceivedListener(new GameState.OptionsReceivedCallback(this.OnOptionsReceived)); }
private void CreateTargetArrow(bool isEnemyArrow, int originLocationEntityID, int sourceEntityID, string damageIndicatorText, bool showArrow, bool useHandAsOrigin = false) { if (this.IsActive()) { Log.Rachelle.Print("Uh-oh... creating a targeting arrow but one is already active...", new object[0]); this.DestroyCurrentArrow(false); } this.m_isEnemyArrow = isEnemyArrow; this.m_sourceEntityID = sourceEntityID; this.m_originLocationEntityID = originLocationEntityID; this.m_showArrow = showArrow; this.m_useHandAsOrigin = useHandAsOrigin; this.UpdateArrowOriginPosition(); bool flag = (GameMgr.Get() != null) && GameMgr.Get().IsSpectator(); if (this.m_isEnemyArrow || flag) { this.m_remoteArrowPosition = this.m_targetArrowOrigin; this.m_arrow.transform.position = this.m_targetArrowOrigin; } this.ActivateArrow(true); this.ShowBullseye(false); this.ShowDamageIndicator(!this.m_isEnemyArrow); this.UpdateArrowPosition(); if (!this.m_isEnemyArrow) { base.StartCoroutine(this.SetDamageText(damageIndicatorText)); if (!flag) { PegCursor.Get().Hide(); } } }
private bool UpdateMouseLeftClick() { bool flag = false; if (UniversalInputManager.Get().GetMouseButtonDown(0)) { flag = true; if (this.m_currentElement.GetCursorDown() != PegCursor.Mode.NONE) { PegCursor.Get().SetMode(this.m_currentElement.GetCursorDown()); } else { PegCursor.Get().SetMode(PegCursor.Mode.DOWN); } if (UniversalInputManager.Get().IsTouchMode() && this.m_currentElement.GetReceiveOverWithMouseDown()) { this.m_currentElement.TriggerOver(); } this.m_currentElement.TriggerPress(); this.m_lastClickPosition = UniversalInputManager.Get().GetMousePosition(); this.m_mouseDownElement = this.m_currentElement; } if (UniversalInputManager.Get().GetMouseButtonUp(0)) { flag = true; if (((this.m_lastClickTimer > 0f) && (this.m_lastClickTimer <= 0.7f)) && this.m_currentElement.GetDoubleClickEnabled()) { this.m_currentElement.TriggerDoubleClick(); this.m_lastClickTimer = -1f; } else { if ((this.m_mouseDownElement == this.m_currentElement) || this.m_currentElement.GetReceiveReleaseWithoutMouseDown()) { this.m_currentElement.TriggerRelease(); } if (this.m_currentElement.GetReceiveOverWithMouseDown()) { this.m_currentElement.TriggerOut(); } if (this.m_mouseDownElement != null) { this.m_lastClickTimer = 0f; this.m_mouseDownElement.TriggerReleaseAll(this.m_currentElement == this.m_mouseDownElement); this.m_mouseDownElement = null; } } if (this.m_currentElement.GetCursorOver() != PegCursor.Mode.NONE) { PegCursor.Get().SetMode(this.m_currentElement.GetCursorOver()); } else { PegCursor.Get().SetMode(PegCursor.Mode.OVER); } this.m_lastClickPosition = Vector3.zero; } return(flag); }
public bool GrabCard(CollectionCardVisual cardVisual) { Actor actor = cardVisual.GetActor(); if (!this.CanGrabItem(actor)) { return(false); } if (!this.m_heldCardVisual.ChangeActor(actor, cardVisual.GetVisualType())) { return(false); } this.m_scrollBar.Pause(true); PegCursor.Get().SetMode(PegCursor.Mode.DRAG); CollectionCardBack component = actor.GetComponent <CollectionCardBack>(); this.m_heldCardVisual.SetSlot(null); if (component != null) { this.m_heldCardVisual.SetCardBackId(component.GetCardBackId()); } this.m_heldCardVisual.transform.position = actor.transform.position; this.m_heldCardVisual.Show(this.m_mouseIsOverDeck); SoundManager.Get().LoadAndPlay("collection_manager_pick_up_card", this.m_heldCardVisual.gameObject); return(true); }
public void OnTurnStartManagerFinished() { PegCursor.Get().SetMode(PegCursor.Mode.STOPWAITING); this.m_playedNmpSoundThisTurn = false; this.SetStateToYourTurn(); base.GetComponent <Collider>().enabled = true; GameState.Get().RegisterOptionsReceivedListener(new GameState.OptionsReceivedCallback(this.OnOptionsReceived)); }
private void UpdateMouseOver() { if ((!UniversalInputManager.Get().IsTouchMode() || (UniversalInputManager.Get().GetMouseButton(0) && this.m_currentElement.GetReceiveOverWithMouseDown())) && (this.m_currentElement != this.m_prevElement)) { if (this.m_currentElement.GetCursorOver() != PegCursor.Mode.NONE) { PegCursor.Get().SetMode(this.m_currentElement.GetCursorOver()); } else { PegCursor.Get().SetMode(PegCursor.Mode.OVER); } this.m_currentElement.TriggerOver(); } }
private void OnMouseOnOrOffScreen(bool onScreen) { if (!onScreen) { this.m_lastClickPosition = Vector3.zero; if (this.m_currentElement != null) { this.m_currentElement.TriggerOut(); this.m_currentElement = null; } PegCursor.Get().SetMode(PegCursor.Mode.UP); if (this.m_prevElement != null) { this.m_prevElement.TriggerOut(); this.m_prevElement = null; } this.m_lastClickTimer = -1f; } }
private bool UpdateMouseLeftHold() { if (!UniversalInputManager.Get().GetMouseButton(0)) { return(false); } if (this.m_currentElement.GetReceiveOverWithMouseDown() && (this.m_currentElement != this.m_prevElement)) { if (this.m_currentElement.GetCursorOver() != PegCursor.Mode.NONE) { PegCursor.Get().SetMode(this.m_currentElement.GetCursorOver()); } else { PegCursor.Get().SetMode(PegCursor.Mode.OVER); } this.m_currentElement.TriggerOver(); } return(true); }
public bool GrabCard(DeckTrayDeckTileVisual deckTileVisual) { Actor actor = deckTileVisual.GetActor(); if (!this.CanGrabItem(actor)) { return(false); } if (!this.m_heldCardVisual.ChangeActor(actor, CollectionManagerDisplay.ViewMode.CARDS)) { return(false); } this.m_scrollBar.Pause(true); PegCursor.Get().SetMode(PegCursor.Mode.DRAG); this.m_heldCardVisual.SetSlot(deckTileVisual.GetSlot()); this.m_heldCardVisual.transform.position = actor.transform.position; this.m_heldCardVisual.Show(this.m_mouseIsOverDeck); SoundManager.Get().LoadAndPlay("collection_manager_pick_up_card", this.m_heldCardVisual.gameObject); CollectionDeckTray.Get().RemoveCard(this.m_heldCardVisual.GetCardID(), this.m_heldCardVisual.GetCardFlair(), deckTileVisual.IsOwnedSlot()); return(true); }
private void DropCard(bool dragCanceled, DeckTrayDeckTileVisual deckTileToRemove) { PegCursor.Get().SetMode(PegCursor.Mode.STOPDRAG); if (!dragCanceled) { if (!this.m_mouseIsOverDeck) { SoundManager.Get().LoadAndPlay("collection_manager_drop_card", this.m_heldCardVisual.gameObject); } else { switch (this.m_heldCardVisual.GetVisualType()) { case CollectionManagerDisplay.ViewMode.CARDS: CollectionDeckTray.Get().AddCard(this.m_heldCardVisual.GetEntityDef(), this.m_heldCardVisual.GetCardFlair(), deckTileToRemove, true, null); break; case CollectionManagerDisplay.ViewMode.HERO_SKINS: CollectionDeckTray.Get().GetHeroSkinContent().UpdateHeroSkin(this.m_heldCardVisual.GetEntityDef(), this.m_heldCardVisual.GetCardFlair(), true); break; case CollectionManagerDisplay.ViewMode.CARD_BACKS: { object cardBackId = this.m_heldCardVisual.GetCardBackId(); if (cardBackId != null) { CollectionDeckTray.Get().GetCardBackContent().UpdateCardBack((int)cardBackId, true, null); break; } Debug.LogWarning("Cardback ID not set for dragging card back."); break; } } } } this.m_heldCardVisual.Hide(); this.m_scrollBar.Pause(false); }
private void DropPack() { PegCursor.Get().SetMode(PegCursor.Mode.STOPDRAG); this.m_Socket.OnPackReleased(); this.m_SocketAccent.OnPackReleased(); if (UniversalInputManager.Get().InputIsOver(this.m_Socket.gameObject)) { if (BattleNet.GetAccountCountry() == "KOR") { m_hasAcknowledgedKoreanWarning = true; } this.OpenBooster(this.m_draggedPack); this.HideHint(); } else { this.PutBackBooster(); this.DestroyHint(); } this.DestroyDraggedPack(); this.UpdateUIEvents(); this.m_DragPlane.SetActive(false); }
private void MouseInputUpdate() { if (this.m_UICam != null) { bool flag = false; foreach (PegUICustomBehavior behavior in this.m_customBehaviors) { if (behavior.UpdateUI()) { flag = true; break; } } if (flag) { if (this.m_mouseDownElement != null) { this.m_mouseDownElement.TriggerOut(); } this.m_mouseDownElement = null; } else { if ((UniversalInputManager.Get().GetMouseButton(0) && (this.m_mouseDownElement != null)) && ((this.m_lastClickPosition != Vector3.zero) && (Vector3.Distance(this.m_lastClickPosition, UniversalInputManager.Get().GetMousePosition()) > this.m_mouseDownElement.GetDragTolerance()))) { this.m_mouseDownElement.TriggerHold(); } if (this.m_lastClickTimer != -1f) { this.m_lastClickTimer += UnityEngine.Time.deltaTime; } PegUIElement element = this.FindHitElement(); this.m_prevElement = this.m_currentElement; if ((element != null) && element.IsEnabled()) { this.m_currentElement = element; } else { this.m_currentElement = null; } if ((this.m_prevElement != null) && (this.m_currentElement != this.m_prevElement)) { PegCursor.Get().SetMode(PegCursor.Mode.UP); this.m_prevElement.TriggerOut(); } if (this.m_currentElement == null) { if (UniversalInputManager.Get().GetMouseButtonDown(0)) { PegCursor.Get().SetMode(PegCursor.Mode.DOWN); } else if (!UniversalInputManager.Get().GetMouseButton(0)) { PegCursor.Get().SetMode(PegCursor.Mode.UP); } if ((this.m_mouseDownElement != null) && UniversalInputManager.Get().GetMouseButtonUp(0)) { this.m_mouseDownElement.TriggerReleaseAll(false); this.m_mouseDownElement = null; } } else if (!this.UpdateMouseLeftClick() && (!this.UpdateMouseLeftHold() && !this.UpdateMouseRightClick())) { this.UpdateMouseOver(); } } } }
public bool drop_held_card_worker(int requested_zone_position) { PegCursor.Get().SetMode(PegCursor.Mode.STOPDRAG); InputManager input_man = InputManager.Get(); if (input_man.heldObject == null) { Log.log("Nothing held, when trying to drop"); return(false); } Card component = input_man.heldObject.GetComponent <Card>(); ZonePlay m_myPlayZone = PrivateHacker.get_m_myPlayZone(); ZoneHand m_myHandZone = PrivateHacker.get_m_myHandZone(); component.SetDoNotSort(false); iTween.Stop(input_man.heldObject); Entity entity = component.GetEntity(); component.NotifyLeftPlayfield(); GameState.Get().GetGameEntity().NotifyOfCardDropped(entity); m_myPlayZone.UnHighlightBattlefield(); DragCardSoundEffects component2 = component.GetComponent <DragCardSoundEffects>(); if (component2) { component2.Disable(); } UnityEngine.Object.Destroy(input_man.heldObject.GetComponent <DragRotator>()); input_man.heldObject = null; ProjectedShadow componentInChildren = component.GetActor().GetComponentInChildren <ProjectedShadow>(); if (componentInChildren != null) { componentInChildren.DisableShadow(); } // Check that the card is on the hand Zone card_zone = component.GetZone(); if ((card_zone == null) || card_zone.m_ServerTag != TAG_ZONE.HAND) { return(false); } bool does_target = false; bool is_minion = entity.IsMinion(); bool is_weapon = entity.IsWeapon(); if (is_minion || is_weapon) { Zone zone = (!is_weapon) ? (Zone)m_myPlayZone : (Zone)PrivateHacker.get_m_myWeaponZone(); if (zone) { GameState gameState = GameState.Get(); int card_position = Network.NoPosition; if (is_minion) { card_position = ZoneMgr.Get().PredictZonePosition(zone, requested_zone_position); gameState.SetSelectedOptionPosition(card_position); } if (input_man.DoNetworkResponse(entity)) { if (is_weapon) { PrivateHacker.set_m_lastZoneChangeList(ZoneMgr.Get().AddLocalZoneChange(component, zone, zone.GetLastPos())); } else { PrivateHacker.set_m_lastZoneChangeList(ZoneMgr.Get().AddPredictedLocalZoneChange(component, zone, requested_zone_position, card_position)); } PrivateHacker.ForceManaUpdate(entity); if (is_minion && gameState.EntityHasTargets(entity)) { does_target = true; if (TargetReticleManager.Get()) { bool showArrow = true; TargetReticleManager.Get().CreateFriendlyTargetArrow(entity, entity, true, showArrow, null); } PrivateHacker.set_m_battlecrySourceCard(component); } } else { gameState.SetSelectedOptionPosition(Network.NoPosition); } } } // Spell support else { if (entity.IsSpell()) { if (GameState.Get().EntityHasTargets(entity)) { input_man.heldObject = null; EnemyActionHandler.Get().NotifyOpponentOfCardDropped(); m_myHandZone.UpdateLayout(-1, true); m_myPlayZone.SortWithSpotForHeldCard(-1); return(true); } if (!GameState.Get().HasResponse(entity)) { PlayErrors.DisplayPlayError(PlayErrors.GetPlayEntityError(entity), entity); } else { input_man.DoNetworkResponse(entity); if (entity.IsSecret()) { ZoneSecret m_mySecretZone = PrivateHacker.get_m_mySecretZone(); PrivateHacker.set_m_lastZoneChangeList(ZoneMgr.Get().AddLocalZoneChange(component, m_mySecretZone, m_mySecretZone.GetLastPos())); } else { PrivateHacker.set_m_lastZoneChangeList(ZoneMgr.Get().AddLocalZoneChange(component, TAG_ZONE.PLAY)); } PrivateHacker.ForceManaUpdate(entity); PrivateHacker.PlayPowerUpSpell(component); PrivateHacker.PlayPlaySpell(component); } } } m_myHandZone.UpdateLayout(-1, true); m_myPlayZone.SortWithSpotForHeldCard(-1); if (does_target) { if (EnemyActionHandler.Get()) { EnemyActionHandler.Get().NotifyOpponentOfTargetModeBegin(component); } } else { if (GameState.Get().GetResponseMode() != GameState.ResponseMode.SUB_OPTION) { EnemyActionHandler.Get().NotifyOpponentOfCardDropped(); } } return(true); }