public void RemoveActionEvent(ToolEvent eve) { if (mGather.mTActions != null) { mGather.mTActions.Remove(eve); } }
public override void LeftDrag(ToolEvent te) { if (GlobalData.IsInPlayMode() || !m_LeftBusy) { return; } PaintHelper(te, GlobalData.GetSelectedPrimaryTile()); }
public override void RightDrag(ToolEvent te) { if (GlobalData.IsInPlayMode() || !m_RightBusy) { return; } PaintHelper(te, GlobalData.GetSelectedSecondaryTile()); }
public override void LeftDrag(ToolEvent te) { if (GlobalData.IsInPlayMode() || !m_LeftBusy) { return; } DragHelper(te); }
public void UpdateRightDrag(ToolEvent te) { if (m_ActiveTool.m_ToolID == Tools.HAND) { return; } OnRightDrag(te); }
public override void RightPointerUp(ToolEvent te) { if (GlobalData.IsInPlayMode() || !m_RightBusy) { return; } m_RightBusy = false; PointerUpHelper(te.GridIndex, GlobalData.GetSelectedSecondaryTile()); }
public override void LeftPointerUp(ToolEvent te) { if (GlobalData.IsInPlayMode() || !m_LeftBusy) { return; } m_LeftBusy = false; EndBatch(); }
public void AddActionEvent(ToolEvent eve) { if (mGather.mTActions == null) { mGather.mTActions = eve; } else { mGather.mTActions.Add(eve); } }
public override void RightPointerDown(ToolEvent te) { if (GlobalData.IsInPlayMode() || m_LeftBusy || m_RightBusy) { return; } m_RightBusy = true; BeginBatch(); PaintHelper(te, GlobalData.GetSelectedSecondaryTile()); }
internal void RemoveEvent(ToolEvent call) { if (call != null) { HandleEvent he = null; string key = call.GetName(); if (mImEvents.TryGetValue(key, out he)) { he.RemoveActionEvent(call); } } }
void LeftHelper(ToolEvent te) { // if we're in play mode, scram if (GlobalData.IsInPlayMode()) { return; } var primaryTileType = GetTileTypeFromEvent(te); GlobalData.SetPrimarySelectedTile(primaryTileType); }
public override void LeftPointerDown(ToolEvent te) { // update the pointer down position -- // this will be used as the minBounds for the outliner m_vecPointerDownPosition = te.GridIndex; m_vecPointerDragEndPosition = te.GridIndex; SetOutlinerToDefaultColors(); Outline(); PrintStatusMessage(); }
private void _AddTEvent(ToolEvent eve) { string key = eve.GetName(); HandleEvent he = null; if (!mImEvents.TryGetValue(key, out he)) { he = new HandleEvent(); mImEvents.Add(key, he); } he.AddActionEvent(eve); }
//public override void RightDrag(ToolEvent te) //{ // var gridIndex = te.GridIndex; // if (m_State == State.Idle) // { // // This... cannot be....!!!!! // } // else if (m_State == State.SelectingForModification) // { // var shouldPrint = m_PointerDragEndPosition != gridIndex; // m_PointerDragEndPosition = gridIndex; // Outline(m_ModificationOutliner); // if (shouldPrint) // PrintBoxDimensionsMessage(); // } // else if (m_State == State.ReadyToModify) // { // m_PointerDragEndPosition = gridIndex; // var difference = m_PointerDragEndPosition - m_PointerDownPosition; // MoveAnchor(m_AnchorStartingIndex + difference); // } //} public override void LeftPointerUp(ToolEvent te) { var gridIndex = te.GridIndex; if (m_State == State.Idle) { // This... cannot be....!!!!! } else if (m_State == State.SelectingForCreation) { m_PointerDragEndPosition = gridIndex; Outline(m_CreationOutliner); GatherSelectedElements(); if (m_SelectedElements.Count == 0) { EnterIdle(); } else { EnterPlacingAnchorPoint(); } } else if (m_State == State.PlacingAnchorPoint) { m_AnchorIndex = gridIndex; EnterPlacingPathPoints(); } else if (m_State == State.PlacingPathPoints) { if (m_Path.Count == 0) { return; } var currentPathPoint = m_Path[m_Path.Count - 1] - m_AnchorIndex; UpdateCurrentPathPoint(gridIndex); if (currentPathPoint != gridIndex) { PrintPathPointPositionsMessage(); } } //else if (m_State == State.ModifyingPathPoint) //{ // // TODO: this is a terrible hack but I gotta go with it for now // foreach (var icon in m_NodeIcons) // Destroy(icon); // EnterReadyToModify(); //} }
void RightHelper(ToolEvent te) { // if we're in play mode, scram if (GlobalData.IsInPlayMode()) { return; } var secondaryTileType = GetTileTypeFromEvent(te); GlobalData.SetSecondarySelectedTile(secondaryTileType); }
public override void RightPointerDown(ToolEvent te) { if (GlobalData.IsInPlayMode() || m_LeftBusy || m_RightBusy) { return; } m_RightBusy = true; BeginBatch(); m_StartIndex = te.GridIndex; DragHelper(te); PrintStatusMessage(); }
void DragHelper(ToolEvent te) { // outline var shouldPrint = m_EndIndex != te.GridIndex; m_EndIndex = te.GridIndex; Outline(); if (shouldPrint) { PrintStatusMessage(); } }
public override void LeftDrag(ToolEvent te) { var shouldPrint = m_vecPointerDragEndPosition != te.GridIndex; // update the end position every drag m_vecPointerDragEndPosition = te.GridIndex; Outline(); if (shouldPrint) { PrintStatusMessage(); } }
private ToolEvent PrepareEvent(PointerEventData e) { var eventScreenPosition = e.position; var eventScreenPositionVector3 = new Vector3(e.position.x, e.position.y, 0); var eventWorldPosition = m_Camera.ScreenToWorldPoint(eventScreenPositionVector3); var xInt = Mathf.RoundToInt(eventWorldPosition.x); var yInt = Mathf.RoundToInt(eventWorldPosition.y); var gridIndex = new Vector2Int(xInt, yInt); var tileWorldPosition = new Vector3(gridIndex.x, gridIndex.y, 0); var te = new ToolEvent(); te.EventScreenPosition = eventScreenPosition; te.EventWorldPosition = eventWorldPosition; te.TileWorldPosition = tileWorldPosition; te.GridIndex = gridIndex; te.Button = e.button; te.EventCamera = m_Camera; return(te); }
// TODO: gotta fix this as ASAP as possible // but for now, it's borken, so I gotta comment // everything out //public override void RightPointerDown(ToolEvent te) //{ // var gridIndex = te.GridIndex; // if (m_State == State.Idle) // { // m_PointerDownPosition = gridIndex; // m_PointerDragEndPosition = gridIndex; // Outline(m_ModificationOutliner); // EnterSelectingForModification(); // PrintBoxDimensionsMessage(); // } // else if (m_State == State.ReadyToModify) // { // m_PointerDownPosition = gridIndex; // m_PointerDragEndPosition = gridIndex; // m_AnchorStartingIndex = m_AnchorIndex; // PrintAnchorPointPositionMessage(); // } //} public override void LeftDrag(ToolEvent te) { var gridIndex = te.GridIndex; if (m_State == State.Idle) { // This... cannot be....!!!!! } else if (m_State == State.SelectingForCreation) { var shouldPrint = m_PointerDragEndPosition != gridIndex; m_PointerDragEndPosition = gridIndex; Outline(m_CreationOutliner); if (shouldPrint) { PrintBoxDimensionsMessage(); } } else if (m_State == State.PlacingAnchorPoint) { MoveAnchor(gridIndex); } else if (m_State == State.PlacingPathPoints) { var currentPathPoint = m_Path[m_Path.Count - 1] - m_AnchorIndex; UpdateCurrentPathPoint(gridIndex); if (currentPathPoint != gridIndex) { PrintPathPointPositionsMessage(); } } //else if (m_State == State.ModifyingPathPoint) //{ // MovePathPoint(gridIndex); //} }
/** * FUNCTION NAME: UpdateActiveTool * DESCRIPTION : Update the active tool due to the camera moving in some way. * INPUTS : None * OUTPUTS : None **/ void UpdateActiveTool() { ToolEvent te = new ToolEvent(); //Button setting. if (Input.GetMouseButton((int)PointerEventData.InputButton.Left)) { te.Button = PointerEventData.InputButton.Left; } else if (Input.GetMouseButton((int)PointerEventData.InputButton.Right)) { te.Button = PointerEventData.InputButton.Right; } else { return; } te.EventScreenPosition = Input.mousePosition; Vector3 eventScreenPositionVector3 = new Vector3(Input.mousePosition.x, Input.mousePosition.y, 0); te.EventWorldPosition = m_Camera.ScreenToWorldPoint(eventScreenPositionVector3); int xInt = Mathf.RoundToInt(te.EventWorldPosition.x); int yInt = Mathf.RoundToInt(te.EventWorldPosition.y); te.GridIndex = new Vector2Int(xInt, yInt); te.TileWorldPosition = new Vector3(te.GridIndex.x, te.GridIndex.y, 0); if (te.Button == PointerEventData.InputButton.Left) { m_ToolsPalette.UpdateLeftDrag(te); } else if (te.Button == PointerEventData.InputButton.Right) { m_ToolsPalette.UpdateRightDrag(te); } }
public override void LeftPointerDown(ToolEvent te) { var gridIndex = te.GridIndex; if (m_State == State.Idle) { m_PointerDownPosition = gridIndex; m_PointerDragEndPosition = gridIndex; Outline(m_CreationOutliner); EnterSelectingForCreation(); PrintBoxDimensionsMessage(); } else if (m_State == State.SelectingForCreation) { // This... cannot be....!!!!! } else if (m_State == State.PlacingAnchorPoint) { SetAnchor(gridIndex); } else if (m_State == State.PlacingPathPoints) { AddNewPathPoint(gridIndex); } //else if (m_State == State.ReadyToModify) //{ // var index = GetPathIndexAtGridIndex(gridIndex); // if (index != null) // { // m_IndexBeingModified = index.Value; // EnterModifyingPathPoint(); // } //} }
public virtual void RightPointerUp(ToolEvent te) { }
void PaintHelper(ToolEvent te, TileType tileType) { AddRequest(te.GridIndex, tileType, cloning: false); }
public void Remove(ToolEvent eve) { mEvent -= (((TAction <T>)eve).mEvent); }
public void EraseTile(ToolEvent te, Element oldTile) { EraseTileHelper(te.GridIndex, oldTile.m_GameObject); }
public void Add(ToolEvent eve) { mEvent += (((TAction <T>)eve).mEvent); }
public virtual void LeftDrag(ToolEvent te) { }
public static void Send(object sender, ToolEventArgs e) { ToolEvent?.Invoke(sender, e); }
public virtual void RightDrag(ToolEvent te) { }