A class that contains the base event data that is common to all event types in the new EventSystem.
public void PointerDownEvent(UnityEngine.EventSystems.BaseEventData baseEvent) { if (m_playerCharacter != null) { m_playerCharacter.SendMessage("MobileAttackOn"); } }
// Fire bullet in direction of player public void FireBullet(UnityEngine.EventSystems.BaseEventData baseEvent) { if (GetComponent <NetworkView> ().isMine) { Network.Instantiate(bulletPrefab, transform.position, transform.rotation, 0); } }
public void OnPointerDeselect(BaseEventData eventData) { Left.enable = false; Top.enable = false; Bot.enable = false; Right.enable = false; }
public void OnSelect(BaseEventData data) { if (_luaFunc != null) { _luaFunc.call("onSelect", data); } }
private void OnPointerClick(BaseEventData data){ //if (PC.hasMainKey && PC.ap > 0) { if(PC.hasMainKey){ OpenDoor (); return; } }
// ####################################################################################################################################### Selection /// <summary> /// Select /// </summary> /// <param name="eventData"></param> public void OnSelect(BaseEventData eventData) { RectTransform frame_rec = highlight_frame.GetComponent<RectTransform>(); RectTransform rec = gameObject.GetComponent<RectTransform>(); frame_rec.position = rec.position; frame_rec.sizeDelta = rec.sizeDelta; }
public void OnSubmit(BaseEventData eventData) { // make purchase Debug.Log("Player " + (PlayerIndex + 1) + " bought " + nameElem.text); if(player.Cash >= PickupPrefab.Price) { // does player already own one of these var p = player.PickupStates.FirstOrDefault(x => x.Name == PickupPrefab.PickupName); if(p == null) { // add pickup to playerstate p = PickupState.FromPrefab(PickupPrefab); p.Ammo = 0; //<-- ammo gets set in a minute down player.PickupStates.Add(p); } if(p.Ammo < PickupPrefab.MaxAmmo) { // add ammo p.Ammo = Mathf.Clamp(p.Ammo + PickupPrefab.Ammo, 0, PickupPrefab.MaxAmmo); // pay! player.Cash -= PickupPrefab.Price; } UpdateItemText(); } }
public void OnDragEndBattleMember(BaseEventData bData) { PointerEventData pData = bData as PointerEventData; //Center of sprite is inside Battle Member Panel if (RectContainsPosition(battleRect, pData.position) && GetClickedImageNumber(clickedGameObject.name) == -1 && unitManager.GetBattleSquadCount() < unitManager.maxPlayers) { if (UnitManager.DEBUG) print("In BM"); //A reserve unit was dragged and battle members count is less than the max (4) unitManager.getReserves()[clickedGameObject.transform.GetSiblingIndex()].squad = 0; menuManager.renderData("Squad Panel"); } else if (RectContainsPosition(reservesRect, pData.position) && clickedGameObject.transform.parent.parent.GetSiblingIndex() < unitManager.GetBattleSquadCount()) { //Center of sprite is inside Reserves Panel if (UnitManager.DEBUG) print("In Reserves"); unitManager.getBattlingSquad()[clickedGameObject.transform.parent.parent.GetSiblingIndex()].squad = 1; menuManager.renderData("Squad Panel"); } //Return sprite to original location if (UnitManager.DEBUG) print("Return to initPos"); pData.lastPress.GetComponent<RectTransform>().anchoredPosition = Vector3.zero; }
public override void OnUpdateSelected(BaseEventData eventData) { if (!this.isFocused) { return; } bool consumedEvent = false; while (Event.PopEvent(processEvent)) { if (processEvent.rawType == EventType.KeyDown) { if (!CombinationPressed(processEvent)) { continue; } consumedEvent = true; EditState state = this.KeyPressed(processEvent); if (state == EditState.Finish) { DeactivateInputField(); } break; } } if (consumedEvent) { this.UpdateLabel(); } eventData.Use(); }
protected void DeselectIfSelectionChanged(GameObject currentOverGo, BaseEventData pointerEvent) { if (ExecuteEvents.GetEventHandler<ISelectHandler>(currentOverGo) != base.eventSystem.currentSelectedGameObject) { base.eventSystem.SetSelectedGameObject(null, pointerEvent); } }
public void OnClick(BaseEventData evnt) { switch (InteractionMode) { case MapInteractionNormal: InteractionMode=MapInteractionWriting; UWHUD.instance.CursorIcon=UWHUD.instance.MapQuillWriting; pos = Vector2.zero; RectTransform rect = this.GetComponent<RectTransform>(); PointerEventData pntr = (PointerEventData)evnt; CursorPos=UWHUD.instance.window.CursorPosition.center;//pntr.pressPosition; RectTransformUtility.ScreenPointToLocalPointInRectangle(rect,pntr.pressPosition,pntr.pressEventCamera, out pos); pos = pos + new Vector2 (150.0f, -4.0f); GameObject myObj = (GameObject)Instantiate(Resources.Load("Prefabs/_MapNoteTemplate")); mapNoteCurrent=myObj.GetComponent<Text>(); mapNoteCurrent.transform.parent=this.transform; mapNoteCurrent.GetComponent<RectTransform>().anchoredPosition=pos; myObj.GetComponent<RectTransform>().SetSiblingIndex(4); MapNoteInput.textComponent= mapNoteCurrent; MapNoteInput.text=""; MapNoteInput.Select(); break; case MapInteractionDelete: InteractionMode=MapInteractionNormal; UWHUD.instance.CursorIcon=UWHUD.instance.MapQuill; break; case MapInteractionWriting: OnNoteComplete(); break; } }
public void OnSelectRoomClick(BaseEventData data) { GamedoniaRT gd = GamedoniaRT.SharedInstance (); //Debug.Log ("Room Name Clicked: " + eventSystem.currentSelectedGameObject.name); Text roomLabel = eventSystem.currentSelectedGameObject.GetComponent<Text> (); string roomName = roomLabel.text.Substring (0, roomLabel.text.IndexOf ("(")); ChooseGameUI.selectedRoom = roomName; ChooseGameUI.spectator = spectatorToggle.isOn; Room room = gd.roomsManager.GetRoomByName (roomName); if (room.IsPasswordProtected ()) { Application.LoadLevel("EnterRoomPasswordGD"); } else { JoinRoomOperation jrop = new JoinRoomOperation (roomName); if (spectatorToggle.isOn) { jrop.JoinAsSpectator (); } gd.SendOp (jrop); } }
public void OnSubmit(BaseEventData eventData) { if (dropdown != null) { dropdown.Select(m_Index, true); } }
public void IsHighlighted( BaseEventData eventSystem) { if (m_button.interactable) { m_rawImage.texture = renderTexture; } }
public void attack4Pressed(BaseEventData data) { eventTriggered = true; usersChoice = InterSceneData.main.battle_friendly.attacks[3]; eventNo = 3; itemChosen = false; }
public void OnSelect(BaseEventData eventData) { // Debug.Log ("CLIQUEI"); //options.Activate(item, this.transform.position); //options.transform.SetParent (this.transform); }
public void onItemButtonPressed(BaseEventData data) { if (!controlsLocked) { separator.SetActive (true); item_menu.SetActive (true); } }
void IDeselectHandler.OnDeselect(BaseEventData eventData) { if(!pointer){ GUIManager.informUnhighlighted(gameObject); } selected = false; }
public override void OnDeselect(UnityEngine.EventSystems.BaseEventData eventData) { base.OnDeselect(eventData); LeftSelectorImage.gameObject.SetActive(false); RightSelectorImage.gameObject.SetActive(false); }
public void OnPointerEnter(BaseEventData eventData) { enable = true; Left.enable = false; Bot.enable = false; Right.enable = false; }
public void OnPointerUp(BaseEventData bed) { PointerEventData ped = (PointerEventData)bed; if (this.targetLB != null) { this.endPos = ped.position; Vector3 offset = Vector3.ClampMagnitude ((this.endPos - this.startPos), this.maxDistance); Vector3 startPos3 = this.targetCamera.ScreenToWorldPoint (new Vector3 (this.startPos.x, this.startPos.y, -this.targetCamera.transform.position.z)); Vector3 endPos3 = this.targetCamera.ScreenToWorldPoint (new Vector3 (this.endPos.x, this.endPos.y, -this.targetCamera.transform.position.z)); // Send LB in direction of drag. if (offset.magnitude >= this.minDistance && offset.magnitude <= this.maxDistance) { Vector2 velocity = new Vector2 (endPos3.x - startPos3.x, endPos3.y - startPos3.y); this.targetLB.SetVelocity (velocity); } // Stop LB from moving. else { this.targetLB.SetVelocity (Vector2.zero); } } this.targetLB = null; this.startPos = Vector2.zero; this.endPos = Vector2.zero; }
private void onPointerDrag(UnityEngine.EventSystems.BaseEventData baseEvent) { Vector2 curPos = Vector3.zero; if (Application.isEditor) { curPos = Input.mousePosition; } else { curPos = Input.touches[0].position; } float speedRot = lastPoint.y - curPos.y; if (Mathf.Abs(Mathf.Abs(startPoint.y) - Mathf.Abs(curPos.y)) > minMove) { isPointerMove = true; } deltaPos = speedRot / contentHeight; //move here if (isPointerMove) { moveScroll(deltaPos); } //spawnedModel.transform.Rotate(0f, speedRot, 0f); lastPoint = curPos; }
public void OnSubmit(BaseEventData eventData) { if (highlight) button.OnPointerEnter(new PointerEventData(_system)); button.OnPointerClick(new PointerEventData(_system)); if (highlight) Invoke("RemoveHighlight", highlightDuration); }
public void PointerUpEvent(UnityEngine.EventSystems.BaseEventData baseEvent) { if (m_playerCharacter != null) { m_playerCharacter.SendMessage("MobileShieldOff"); } }
public override void OnSelect(BaseEventData eventData) { if (this.Owner != null) { this.Owner.OnSelect(true); } }
public override void OnUpdateSelected(BaseEventData eventData) { if (!isFocused) return; bool consumedEvent = false; while (Event.PopEvent(m_ProcessingEvent)) { if (m_ProcessingEvent.rawType == EventType.KeyDown) { if (!IsAllowedCombination(m_ProcessingEvent)) { OnCharEntered(this, new EventArgs()); continue; } consumedEvent = true; var shouldContinue = KeyPressed(m_ProcessingEvent); if (shouldContinue == EditState.Finish) { DeactivateInputField(); break; } } } if (consumedEvent) { UpdateLabel(); } eventData.Use(); }
public void ButtonClick (GameObject gobh, BaseEventData data) { ContentManager.mIns.Push (MainViewType.U3View); }
public void SelectEventMethod(UnityEngine.EventSystems.BaseEventData baseEvent) { Debug.Log(baseEvent.selectedObject.name + " triggered an event!"); VerifyInputs(); //baseEvent.selectedObject is the GameObject that triggered the event, // so we can access its components, destroy it, or do whatever. }
/// <summary> /// 選択状態になると呼び出される /// </summary> void ISelectHandler.OnSelect(BaseEventData eventData) { foreach (TargetAndMessage targetAndMessage in targetsAndMessages) { targetAndMessage.target.text = targetAndMessage.message; } }
public override void OnUpdateSelected(BaseEventData eventData) { if (!isFocused) return; bool consumedEvent = false; while (Event.PopEvent(m_ProcessingEvent)) { if (m_ProcessingEvent.rawType == EventType.KeyDown) { if (ProcessKeyPress(m_ProcessingEvent)) { continue; } consumedEvent = true; var shouldContinue = KeyPressed(m_ProcessingEvent); if (shouldContinue == EditState.Finish) { DeactivateInputField(); break; } } } if (consumedEvent) UpdateLabel(); eventData.Use(); }
/* public void LockPuzzlePiece() { if (!pieceLocked) { GameObject[] puzzlePieces = GameObject.FindGameObjectsWithTag("PuzzlePiece"); GameObject pieceToLock = null; foreach (GameObject piece in puzzlePieces) { float dist = (Vector3.Distance(piece.transform.position, lockedPosition.position)); if (dist < lockPieceSensitivity) { pieceToLock = piece; break; } } if (pieceToLock != null) { pieceToLock.transform.DOKill(); pieceToLock.transform.DOMoveX(lockedPosition.position.x - 40f * .0025f, 1f * lockSpeed); pieceLocked = true; lockedPiece = pieceToLock; } } else { followMouse = true; } } public void BeginDrag() { screenPoint = Camera.main.WorldToScreenPoint(lockedPiece.transform.position); offset = lockedPiece.transform.position - Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenPoint.z)); } public void DragPiece() { Vector3 curScreenPoint = new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenPoint.z); Vector3 curPosition = Camera.main.ScreenToWorldPoint(curScreenPoint) + offset; lockedPiece.transform.position = curPosition; } public void EndDrag() { lockedPiece.transform.DOMove(new Vector3(lockedPosition.position.x - 40f * .0025f, lockedPosition.position.y, lockedPosition.position.z), .25f); }*/ public void PanelMouseEvent(BaseEventData bed) { PointerEventData ped = (PointerEventData)bed; GameObject[] puzzlePieces = GameObject.FindGameObjectsWithTag("PuzzlePiece"); GameObject pieceToLock = null; foreach (GameObject piece in puzzlePieces) { float dist = (Vector3.Distance(piece.transform.position, lockedPosition.position)); if (dist < lockPieceSensitivity) { pieceToLock = piece; break; } } if (pieceToLock != null) { switch (ped.pointerId) { case -1: PlaceTrackPiece(pieceToLock); break; case -2: PlacePuzzlePiece(pieceToLock); break; default: break; } } }
public void OnClick(BaseEventData evnt) { if (Dragging){return;} PointerEventData pntr = (PointerEventData)evnt; //Debug.Log (pnt.pointerId); ClickEvent(pntr.pointerId); }
public void TriggerOnMouseExit(UnityEngine.EventSystems.BaseEventData eventData) { if (_gizmo != null && eventData is PointerEventData) { _gizmo.SetMouseOverGizmo(false); } }
public virtual void OnDeselect (BaseEventData data) { // Only play the sound if the element is interactable. I disable that // when animations are playing in between menus. if(gameObject.GetComponent<Selectable>().IsInteractable()) Manager_Audio.PlaySound (transform.root.GetComponent<AudioSource>(), Manager_Audio.instance.sfxMenuMove, true); }
public void OnDrag(BaseEventData data) { Vector3 position = Camera.main.ScreenToWorldPoint((data as PointerEventData).position); if (m_rotatedObject == null) return; if(Input.touchCount==2) { Vector3 firstTouch=Camera.main.ScreenToWorldPoint(Input.GetTouch(0).position); Vector3 secondTouch = Camera.main.ScreenToWorldPoint(Input.GetTouch(1).position); float angle = Vector2.Angle(Vector2.right, secondTouch - firstTouch); Debug.Log(angle); position = (secondTouch + firstTouch) / 2; position.z = 10; if (secondTouch.y < firstTouch.y) angle = -angle; float scale = (firstTouch - secondTouch).magnitude / m_basicRenderSize; m_rotatedObject.SendMessage("SetAngleOnCreation", angle); m_rotatedObject.SendMessage("SetScaleOnCreation", scale); m_rotatedObject.SendMessage("DragOnCretaion", (Vector2)position); } else m_rotatedObject.SendMessage("DragOnCretaion", (Vector2)position); }
public void onAttackButtonPressed(BaseEventData data) { if (!controlsLocked) { separator.SetActive (true); attack_menu.SetActive (true); } }
public override void OnSelect(BaseEventData eventData) { base.OnSelect(eventData); this.CorrectCaret(); }
public void PointerUpEvent(UnityEngine.EventSystems.BaseEventData baseEvent) { if (m_playerCharacter != null) { m_playerCharacter.SendMessage("SetMobileSprinting", false); } }
private void OnDeselected(UnityEngine.EventSystems.BaseEventData baseEvent) { // if (isActive) { ShowError(false); // } else { // isActive = true; // ShowError (!IsValid ()); // } }
public override void OnSelect(UnityEngine.EventSystems.BaseEventData eventData) { base.OnSelect(eventData); if (OnOptionSelected != null) { OnOptionSelected.Invoke(); } }
static int OnDeselect(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 2); Toggle obj = LuaScriptMgr.GetNetObject <Toggle>(L, 1); EventSystems.BaseEventData arg0 = LuaScriptMgr.GetNetObject <EventSystems.BaseEventData>(L, 2); obj.OnDeselect(arg0); return(0); }
private void OnDeselected(UnityEngine.EventSystems.BaseEventData baseEvent) { ShowErrorText(false); if (!isOn) { isOn = true; } UpdateBorderColor(); }
/// <summary> /// Allows to dragg the module around the screen. /// </summary> public override void moveModule2(UnityEngine.EventSystems.BaseEventData eventData) { base.moveModule2(eventData); // We also need to move all the modules that have been included! foreach (GameObject module in containedModules) { module.GetComponent <ModuleController>().moveModule2(eventData); } }
static public int get_selectedObject(IntPtr l) { try { UnityEngine.EventSystems.BaseEventData self = (UnityEngine.EventSystems.BaseEventData)checkSelf(l); pushValue(l, self.selectedObject); return(1); } catch (Exception e) { return(error(l, e)); } }
static public int get_currentInputModule(IntPtr l) { try { UnityEngine.EventSystems.BaseEventData self = (UnityEngine.EventSystems.BaseEventData)checkSelf(l); pushValue(l, self.currentInputModule); return(1); } catch (Exception e) { return(error(l, e)); } }
static public int get_used(IntPtr l) { try { UnityEngine.EventSystems.BaseEventData self = (UnityEngine.EventSystems.BaseEventData)checkSelf(l); pushValue(l, self.used); return(1); } catch (Exception e) { LuaDLL.luaL_error(l, e.ToString()); return(0); } }
public void DestroyBlock(UnityEngine.EventSystems.BaseEventData baseEventData) { GameObject go = baseEventData.selectedObject; Player p = GameObject.FindGameObjectsWithTag("Player")[0].GetComponent <Player>(); p.doBehavior(go.name.Substring(8, go.name.Length - 15)); blocks.Remove(go); Destroy(go); ArrangeBlocks(); }
static public int Use(IntPtr l) { try{ UnityEngine.EventSystems.BaseEventData self = (UnityEngine.EventSystems.BaseEventData)checkSelf(l); self.Use(); return(0); } catch (Exception e) { LuaDLL.luaL_error(l, e.ToString()); return(0); } }
static public int Reset(IntPtr l) { try { UnityEngine.EventSystems.BaseEventData self = (UnityEngine.EventSystems.BaseEventData)checkSelf(l); self.Reset(); pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
private void itemClick(UnityEngine.EventSystems.BaseEventData baseEvent) { if (!isPointerMove) //Handle Click { CatalogItem item = getItemInParents(baseEvent.selectedObject); //baseEvent.selectedObject.GetComponentInParent<CatalogItem> ();//GetComponent<CatalogItem> (); //int num = (int)baseEvent.selectedObject.GetComponent<CatalogItem> ().num; Debug.Log("itemClick " + item.num.ToString()); } isPointerDown = false; isPointerMove = false; }
static public int get_used(IntPtr l) { try { UnityEngine.EventSystems.BaseEventData self = (UnityEngine.EventSystems.BaseEventData)checkSelf(l); pushValue(l, true); pushValue(l, self.used); return(2); } catch (Exception e) { return(error(l, e)); } }
public void OnSelect(UnityEngine.EventSystems.BaseEventData eventData) { SelectIndex = ItemIndex; if (gameObject.activeSelf) { ShowTip(); } else { HideTip(); } }
// Setting function: get music sound volume and save public void ChangeVolume(UnityEngine.EventSystems.BaseEventData evdata) { maxVolume = evdata.selectedObject.GetComponent <UnityEngine.UI.Slider>().value; audiosource.volume = maxVolume; if (maxVolume == 0) { audiosource.Pause(); } else if (!audiosource.isPlaying) { audiosource.Play(); } }
static public int set_selectedObject(IntPtr l) { try { UnityEngine.EventSystems.BaseEventData self = (UnityEngine.EventSystems.BaseEventData)checkSelf(l); UnityEngine.GameObject v; checkType(l, 2, out v); self.selectedObject = v; return(0); } catch (Exception e) { return(error(l, e)); } }
public void OnDrop(UnityEngine.EventSystems.BaseEventData eventData) { GameObject droppedObj = eventData.selectedObject; if (!droppedObjList.Contains(droppedObj)) { droppedObjList.Add(droppedObj); } else { droppedObjList = new List <GameObject> (); } }
static public int constructor(IntPtr l) { try { UnityEngine.EventSystems.BaseEventData o; UnityEngine.EventSystems.EventSystem a1; checkType(l, 2, out a1); o = new UnityEngine.EventSystems.BaseEventData(a1); pushValue(l, o); return(1); } catch (Exception e) { return(error(l, e)); } }
public void OnDrag(UnityEngine.EventSystems.BaseEventData eventData) { PointerEventData pointerData = eventData as PointerEventData; if (pointerData == null) { return; } Vector3 curPosition = rectTransform.position; curPosition.x += pointerData.delta.x; curPosition.y += pointerData.delta.y; rectTransform.position = curPosition; }
public void onPointerDown(UnityEngine.EventSystems.BaseEventData baseEvent) { isPointerDown = true; if (Application.isEditor) { startPoint = Input.mousePosition; } else { startPoint = Input.touches[0].position; } lastPoint = startPoint; }
static int QPYX_OnSubmit_YXQP(IntPtr L_YXQP) { try { ToLua.CheckArgsCount(L_YXQP, 2); UnityEngine.UI.Button QPYX_obj_YXQP = (UnityEngine.UI.Button)ToLua.CheckObject <UnityEngine.UI.Button>(L_YXQP, 1); UnityEngine.EventSystems.BaseEventData QPYX_arg0_YXQP = (UnityEngine.EventSystems.BaseEventData)ToLua.CheckObject <UnityEngine.EventSystems.BaseEventData>(L_YXQP, 2); QPYX_obj_YXQP.OnSubmit(QPYX_arg0_YXQP); return(0); } catch (Exception e_YXQP) { return(LuaDLL.toluaL_exception(L_YXQP, e_YXQP)); } }
static int OnDeselect(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); UnityEngine.UI.Selectable obj = (UnityEngine.UI.Selectable)ToLua.CheckObject(L, 1, typeof(UnityEngine.UI.Selectable)); UnityEngine.EventSystems.BaseEventData arg0 = (UnityEngine.EventSystems.BaseEventData)ToLua.CheckObject(L, 2, typeof(UnityEngine.EventSystems.BaseEventData)); obj.OnDeselect(arg0); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }