public void OnMouseMove( dfControl control, dfMouseEventArgs args ) { if( animating || !dragging ) return; this.momentum = ( momentum + args.MoveDelta.Scale( 1, -1 ) ) * 0.5f; args.Use(); if( args.Buttons.IsSet( dfMouseButtons.Left ) ) { var ray = args.Ray; var distance = 0f; var direction = Camera.main.transform.TransformDirection( Vector3.back ); var plane = new Plane( direction, lastPosition ); plane.Raycast( ray, out distance ); var pos = ( ray.origin + ray.direction * distance ).Quantize( control.PixelsToUnits() ); var offset = pos - lastPosition; var transformPos = ( control.transform.position + offset ).Quantize( control.PixelsToUnits() ); control.transform.position = transformPos; lastPosition = pos; } }
void Awake() { ss = this; control = GetComponent<dfControl>(); sprite = GetComponent<dfSprite>(); }
public void OnTextChanged( dfControl control, string value ) { if( value != promptText ) { _textbox.TextColor = textColor; } }
public static void CreateScript( dfControl control ) { if( control == null ) return; if( string.IsNullOrEmpty( EditorApplication.currentScene ) ) { EditorUtility.DisplayDialog( "Please save your scene", "Please save your scene before using the Script Wizard", "OK" ); return; } var events = control .GetType() .GetAllFields() .Where( x => typeof( Delegate ).IsAssignableFrom( x.FieldType ) ) .Select( x => new EventInfo( x ) ) .OrderBy( x => x.Category + "." + x.Field.Name ) .ToList(); var path = buildGameObjectPath( control ); var dialog = GetWindow<dfScriptWizard>( true, "Create Script - " + path ); dialog.target = control; dialog.events = events; dialog.minSize = new Vector2( 640, 480 ); dialog.className = control.name.Replace( " ", "" ) + "Events"; }
protected void OnMouseDown( dfControl source, dfMouseEventArgs args ) { StartPosition = CurrentPosition = args.Position; State = dfGestureState.Possible; StartTime = Time.realtimeSinceStartup; hoverTime = Time.realtimeSinceStartup; }
private void Awake() { bb = this; control = GetComponent<dfControl>(); tabcontainer = MenuTabContainer.tab; Hide(); }
public void Initialize () { if (control == null) control = GetComponent<dfControl>(); s = GetComponent<dfProgressBar>(); s.MinValue = 0; bvl = GetComponentInChildren<barValueLabel>(); switch (owner) { case spawnBars.hudOwner.Player: shields = Target.GetComponentInChildren<Shield>(); break; case spawnBars.hudOwner.Enemy: shields = Target.GetComponentInChildren<Shield>(); break; } if (isGUITarget) { GUIReciever.shields = shields; GUIReciever.GUITarget = this; GUIReciever2.shields = shields; GUIReciever2.GUITarget = this; } if (owner != spawnBars.hudOwner.GUI) { shields.sBar = this; setValue(); } }
public void OnMouseDown( dfControl control, dfMouseEventArgs args ) { if( !args.Used && args.Buttons == dfMouseButtons.Middle ) { if( contextMenu.IsOpen ) { contextMenu.Close(); return; } args.Use(); var hitPosition = control.GetHitPosition( args ); var host = contextMenu.host; host.RelativePosition = hitPosition - host.Size * 0.5f; host.BringToFront(); host.Show(); host.Focus(); contextMenu.Open(); } }
void OnClick( dfControl sender, dfMouseEventArgs args ) { if( SelectOnClick != null ) { SelectOnClick.Focus(); } }
void Awake() { mSprite = GetComponent<dfTextureSprite>(); if (mSprite == null) { mSprite = GetComponent<dfSlicedSprite>(); } }
public void OnMouseHover( dfControl control, dfMouseEventArgs mouseEvent ) { if( isTooltipVisible ) return; var isSpellSlot = actionBar.Controls.Contains( mouseEvent.Source ); if( isSpellSlot ) { target = mouseEvent.Source; if( target == lastTarget ) return; lastTarget = target; isTooltipVisible = true; var slot = target.GetComponentInChildren<SpellSlot>(); if( string.IsNullOrEmpty( slot.Spell ) ) return; var spell = SpellDefinition.FindByName( slot.Spell ); if( spell == null ) return; ActionbarsTooltip.Show( spell ); } else { lastTarget = null; } }
public void OnDragStart( dfControl control, dfDragEventArgs dragEvent ) { isDragging = true; dragEvent.Data = control.Color; dragEvent.State = dfDragDropState.Dragging; dragEvent.Use(); }
void OnEnable() { if( mainCamera == null ) { mainCamera = Camera.main; if( mainCamera == null ) { Debug.LogError( "dfFollowObject component is unable to determine which camera is the MainCamera", gameObject ); this.enabled = false; return; } } myControl = GetComponent<dfControl>(); if( myControl == null ) { Debug.LogError( "No dfControl component on this GameObject: " + gameObject.name, gameObject ); this.enabled = false; } if( myControl == null || attach == null ) { Debug.LogWarning( "Configuration incomplete: " + this.name ); this.enabled = false; return; } controlTransform = myControl.transform; followTransform = attach.transform; // Obtain a reference to the dfGUIManager rendering the control manager = myControl.GetManager(); dfFollowObjectSorter.Register( this ); }
public void OnMouseDown( dfControl source, dfMouseEventArgs args ) { StartPosition = CurrentPosition = args.Position; State = dfGestureState.Possible; StartTime = Time.realtimeSinceStartup; Delta = Vector2.zero; }
void Awake () { cp = this; tween1 = GetComponent<dfTweenVector3>(); tween2 = GetComponent<dfTweenFloat>(); control = GetComponent<dfControl>(); crewslots = FindObjectsOfType<CrewSlot>(); }
// Use this for initialization void Start () { radar = GetComponent<dfRadarMain>(); RC = this; myControl = GetComponent<dfControl>(); myControl.IsVisible = false; tween1 = GetComponent<dfTweenFloat>(); }
void OnKeyDown( dfControl sender, dfKeyEventArgs args ) { switch( args.KeyCode ) { case KeyCode.Tab: if( args.Shift ) { if( SelectOnShiftTab != null ) { SelectOnShiftTab.Focus(); args.Use(); } } else if( SelectOnTab != null ) { SelectOnTab.Focus(); args.Use(); } break; case KeyCode.LeftArrow: if( SelectOnLeft != null ) { SelectOnLeft.Focus(); args.Use(); } break; case KeyCode.RightArrow: if( SelectOnRight != null ) { SelectOnRight.Focus(); args.Use(); } break; case KeyCode.UpArrow: if( SelectOnUp != null ) { SelectOnUp.Focus(); args.Use(); } break; case KeyCode.DownArrow: if( SelectOnDown != null ) { SelectOnDown.Focus(); args.Use(); } break; default: break; } }
public void OnMouseMove( dfControl control, dfMouseEventArgs mouseEvent ) { if( mouseEvent.Buttons == dfMouseButtons.Left ) { updateHotspot( mouseEvent ); } }
private void Start() { MenuCamera.mc.showShipManagement += initialize; slot = GetComponent<DraggableSpecialization>(); control = dimmer.GetComponent<dfControl>(); sdp = GetComponentInChildren<SpecializationDescriptionPanel>(); }
public void OnMouseDown( dfControl source, dfMouseEventArgs args ) { if( State == dfGestureState.Possible ) { var elapsed = Time.realtimeSinceStartup - StartTime; if( elapsed <= timeout && Vector2.Distance( args.Position, StartPosition ) <= maxDistance ) { StartPosition = CurrentPosition = args.Position; State = dfGestureState.Began; if( DoubleTapGesture != null ) DoubleTapGesture( this ); gameObject.Signal( "OnDoubleTapGesture", this ); endGesture(); return; } } StartPosition = CurrentPosition = args.Position; State = dfGestureState.Possible; StartTime = Time.realtimeSinceStartup; }
public void OnMouseDown() { isTooltipVisible = false; ActionbarsTooltip.Hide(); target = null; }
// Use this for initialization void Awake () { mtc = this; rm = GetComponent<dfRadialMenu>(); myControl = GetComponent<dfControl>(); cb = transform.parent.GetComponentInChildren<closeButton>(); }
public void OnClick( dfControl sender, dfMouseEventArgs args ) { // No need to do anything unless an actual item was clicked if( args.Source == container ) return; // Do not process click event if the user was scrolling by // dragging the mouse. Not needed for mobile. if( Vector2.Distance( args.Position, touchStartPosition ) > 20 ) return; // Find highest-level control containing the click var source = args.Source; while( source != null && !controls.Contains( source ) ) { source = source.Parent; } // If an item in the scroller was clicked, select it if( source != null ) { // Select the clicked item lastSelected = -1; setSelectedIndex( controls.IndexOf( source ) ); // Do not need to try to select "most centered" item isMouseDown = false; } }
public void OnClick(dfControl control, dfMouseEventArgs mouseEvent) { Ship.PlayerController.pHull hull; switch(shipSelect.selectedIndex) { case 0: hull = Ship.PlayerController.pHull.Viper; GameManager.Instance.initializeShip(hull); break; case 1: hull = Ship.PlayerController.pHull.Anvil; GameManager.Instance.initializeShip(hull); break; case 2: hull = Ship.PlayerController.pHull.Shark; GameManager.Instance.initializeShip(hull); break; case 3: hull = Ship.PlayerController.pHull.Marauder; GameManager.Instance.initializeShip(hull); break; case 4: hull = Ship.PlayerController.pHull.Vulture; GameManager.Instance.initializeShip(hull); break; } Application.LoadLevel("CustomizeShip"); }
public void OnMultiTouch( dfControl control, dfTouchEventArgs touchData ) { this.momentum = Vector2.zero; control.Color = Color.yellow; // Determine movement for each finger var touch1 = touchData.Touches[ 0 ]; var touch2 = touchData.Touches[ 1 ]; var dir1 = ( touch1.deltaPosition * ( Time.deltaTime / touch1.deltaTime ) ).Scale( 1, -1 ); var dir2 = ( touch2.deltaPosition * ( Time.deltaTime / touch2.deltaTime ) ).Scale( 1, -1 ); // Calculate size delta var pos1 = screenToGUI( touch1.position ); var pos2 = screenToGUI( touch2.position ); var currDist = pos1 - pos2; var prevDist = ( pos1 - dir1 ) - ( pos2 - dir2 ); var delta = currDist.magnitude - prevDist.magnitude; if( Mathf.Abs( delta ) > float.Epsilon ) { // Save relative position to restore after control's Size has changed var min = Vector3.Min( pos1, pos2 ); var offset = min - control.RelativePosition; // Adjust the control's size according to the touch delta control.Size += Vector2.one * delta; // Put control back in relative position control.RelativePosition = min + offset; } }
public void Initialize() { if (control == null) control = GetComponent<dfControl>(); s = gameObject.GetComponent<dfProgressBar>(); s.MinValue = 0; bvl = GetComponentInChildren<barValueLabel>(); switch (owner) { case spawnBars.hudOwner.Player: hull = Target.GetComponentInChildren<Hull>(); break; case spawnBars.hudOwner.Enemy: hull = Target.GetComponentInChildren<Hull>(); if (Target.layer == LayerMask.NameToLayer("NonPlayer")) { Target.GetComponent<NPCController>().setBars(transform.parent.gameObject);//Redundant because it is also in Shieldbar script } else Target.GetComponent<EnemyController>().setBars(transform.parent.gameObject);//Redundant because it is also in Shieldbar script break; } if (isGUITarget) { GUIReciever.hull = hull; GUIReciever.GUITarget = this; } if (owner != spawnBars.hudOwner.GUI) { hull.hBar = this; setValue(); } }
public void OnMouseMove( dfControl source, dfMouseEventArgs args ) { if( State == dfGestureState.Possible ) { if( Vector2.Distance( args.Position, StartPosition ) >= minDistance ) { State = dfGestureState.Began; CurrentPosition = args.Position; Delta = args.Position - StartPosition; if( PanGestureStart != null ) PanGestureStart( this ); gameObject.Signal( "OnPanGestureStart", this ); } } else if( State == dfGestureState.Began || State == dfGestureState.Changed ) { State = dfGestureState.Changed; Delta = args.Position - CurrentPosition; CurrentPosition = args.Position; if( PanGestureMove != null ) PanGestureMove( this ); gameObject.Signal( "OnPanGestureMove", this ); } }
public void HelpClicked(dfControl control, dfMouseEventArgs args) { args.Use(); TextAsset description = Resources.Load<TextAsset>("Descriptions/" + bi.className); GameObject prefab = (GameObject)Resources.Load("Prefabs/Buildings/" + bi.className); Dialog.Instance.SetDialog(bi.buildingName, description.text, "Continue", true, false,prefab); }
public void OnDragDrop( dfControl control, dfDragEventArgs dragEvent ) { var data = ( dragEvent.Data == null ) ? "(null)" : dragEvent.Data.ToString(); display( "DragDrop: " + data ); dragEvent.State = dfDragDropState.Dropped; dragEvent.Use(); }
void Start() { control = GetComponent<dfControl>(); if( control == null ) { this.enabled = false; } }
public static dfTriangleClippingRegion Obtain(dfTriangleClippingRegion parent, dfControl control) { var clip = (pool.Count > 0) ? pool.Dequeue() : new dfTriangleClippingRegion(); clip.planes.AddRange(control.GetClippingPlanes()); if (parent != null) { clip.planes.AddRange(parent.planes); } return(clip); }
/// <summary> /// Invalidates (marks as needing to be rendered again) the dfRenderGroup instance, if any, /// that is responsible for rendering the indicated control /// </summary> /// <param name="control"></param> internal static void InvalidateGroupForControl(dfControl control) { var controlTransform = control.transform; for (int i = 0; i < activeInstances.Count; i++) { var instance = activeInstances[i]; if (controlTransform.IsChildOf(instance.transform)) { instance.isDirty = true; } } }
public void OnPlayAgainClick(dfControl control, dfMouseEventArgs mouseEvent) { foreach (var playlistController in PlaylistController.Instances) { var localPlaylist = playlistController; localPlaylist.FadeToVolume(0f, 1f, () => { localPlaylist.StopPlaylist(); //Debug.Log("Playlist " + localPlaylist.PlaylistName + " has been stopped."); localPlaylist.PlaylistVolume = 1f; }); } CameraFade.StartAlphaFade(Color.white, false, 1f, 0f, () => { PersistentUtility.Instance.GoToScene("GameScene"); /*Debug.Log("Transitioning scenes.");*/ }); }
public void FitToContents() { if (base.controls.Count != 0) { Vector2 zero = Vector2.zero; for (int i = 0; i < base.controls.Count; i++) { dfControl control = base.controls[i]; Vector2 rhs = control.RelativePosition + control.Size; zero = Vector2.Max(zero, rhs); } base.Size = zero + new Vector2((float)this.scrollPadding.right, (float)this.scrollPadding.bottom); } }
public void OnMouseUp(dfControl control, dfMouseEventArgs args) { if (isMouseDown) { isMouseDown = false; var selectedControl = findClosestItemToCenter(); if (selectedControl != null) { lastSelected = -1; setSelectedIndex(controls.IndexOf(selectedControl)); } } }
void BackButton_Click(dfControl control, dfMouseEventArgs mouseEvent) { switch (PlayerPrefs.GetString(CameFromScript.CAME_FROM)) { case CameFromScript.BOOTCAMP: Application.LoadLevel("Bootcamp"); break; case CameFromScript.CHAMPIONS_ARENA: Application.LoadLevel("Champions arena"); break; } // Application.LoadLevel("Bootcamp"); }
void actionButtonPin_Click(dfControl control, dfMouseEventArgs mouseEvent) { mouseEvent.Use(); ListItemExtras parent = control.transform.parent.gameObject.GetComponent <ListItemExtras>(); pinnedPlayers.Add(parent.Player); SavePinnedPlayers(pinnedPlayers); FilterText = false; FilterTextbox.Text = "Filter users..."; FilterText = true; GenerateList(""); }
void CreateButton_Click(dfControl control, dfMouseEventArgs mouseEvent) { string arena = ArenaDropdown.SelectedValue; if (arena.Equals("Random")) { switch (Random.Range(0, 2)) { case 0: arena = "Arena 1"; break; case 1: arena = "Arena 2"; break; } } //switch (ArenaDropdown.SelectedValue) //{ // case "Arena 1": // arena = "Arena1"; // break; // case "Arena 2": // arena = "Arena2"; // print("Arena2"); // break; // case "Random": // if (Random.Range(0, 1) == 0) // { // arena = "Arena2"; // } // break; // default: // arena = "Arena1"; // break; //} string mode = GameModeDropdown.SelectedValue; string[] roomPropsInLobby = { "map", "mode", "name", "level" }; Hashtable customRoomProperties = new Hashtable() { { "map", arena }, { "mode", mode }, { "name", Player.CurrentUser.Username }, { "level", Player.Level } }; if (TestOK()) { PhotonNetwork.CreateRoom(Player.CurrentUser.Username + GenerateRandomTag(), true, true, 2, customRoomProperties, roomPropsInLobby); } }
public void OnMultiTouch(dfControl sender, dfTouchEventArgs args) { var touches = args.Touches; if (State == dfGestureState.None || State == dfGestureState.Cancelled || State == dfGestureState.Ended) { State = dfGestureState.Possible; accumulatedDelta = 0f; } else if (State == dfGestureState.Possible) { if (isRotateMovement(args.Touches)) { var angleDelta = getAngleDelta(touches) + accumulatedDelta; if (Mathf.Abs(angleDelta) < thresholdAngle) { accumulatedDelta = angleDelta; return; } State = dfGestureState.Began; StartPosition = CurrentPosition = getCenter(touches); AngleDelta = angleDelta; if (RotateGestureStart != null) { RotateGestureStart(this); } gameObject.Signal("OnRotateGestureStart", this); } } else if (State == dfGestureState.Began || State == dfGestureState.Changed) { var angleDelta = getAngleDelta(touches); if (Mathf.Abs(angleDelta) <= float.Epsilon || Mathf.Abs(angleDelta) > 22.5f) { return; } State = dfGestureState.Changed; AngleDelta = angleDelta; CurrentPosition = getCenter(touches); if (RotateGestureUpdate != null) { RotateGestureUpdate(this); } gameObject.Signal("OnRotateGestureUpdate", this); } }
private void eventSource_KeyDown(dfControl control, dfKeyEventArgs args) { if (args.KeyCode != this.keyCode) { return; } if ((args.Shift != this.shiftPressed || args.Control != this.controlPressed ? true : args.Alt != this.altPressed)) { return; } MethodInfo method = this.target.GetMethod(); method.Invoke(this.target.Component, null); }
public void Update() { // Find out if there is currently a control under the mouse. // Note: Always returns the top-most control. var control = dfInputManager.ControlUnderMouse; // If there is no control then hide the tooltip if (control == null) { _tooltip.Hide(); } // If there is a control under the mouse then display its tooltip else if (control != lastControl) { // Keep track of when the mouse started hovering over the control tooltipDelayStart = Time.realtimeSinceStartup; // If the control does not have tooltip data, hide the label if (string.IsNullOrEmpty(control.Tooltip)) { _tooltip.Hide(); } else { // Set the label's Text to match the control's tooltip _tooltip.Text = control.Tooltip; } } else if (lastControl != null && !string.IsNullOrEmpty(lastControl.Tooltip)) { if (Time.realtimeSinceStartup - tooltipDelayStart > tooltipDelay) { // Show the tooltip and make sure it's the topmost control on the screen _tooltip.Show(); _tooltip.BringToFront(); } } // If the tooltip is currently visible, then display it near the // current mouse position if (_tooltip.IsVisible) { setPosition(Input.mousePosition); } // Keep track of the last control so that we know when to change // the tooltip lastControl = control; }
public void OnSliderChanged(dfControl control, float value) { if (legit) { legit = false; } else { return; } dfSlider[] sliders = new dfSlider[5]; int currIndex = 0; int sum = 0; //get the sum for (int i = 0; i < sliders.Length; i++) { sliders [i] = GameObject.Find("Slider" + (i + 1)).GetComponent <dfSlider> (); if (sliders [i] == control) { currIndex = i; } sum += (int)sliders [i].Value; } //check if sum adds up to one hunnered if (sum < 100) { int adjustIndex = (currIndex + 1) % sliders.Length; sliders [adjustIndex].Value += 100 - sum; } else if (sum > 100) { int adjustIndex = (currIndex + 1) % sliders.Length; do { print("sum:" + sum); int adjustmentNeeded = sum - 100; sum = (int)(sum - sliders [adjustIndex].Value); int adjustmentAvailable = (int)sliders [adjustIndex].Value; print("Slider preadjusted val:" + sliders [adjustIndex].Value); sliders [adjustIndex].Value -= Mathf.Min(adjustmentNeeded, adjustmentAvailable); print("Slider adjusted val:" + sliders [adjustIndex].Value); sum = (int)(sum + sliders [adjustIndex].Value); adjustIndex = (adjustIndex + 1) % sliders.Length; } while (sum > 100); } legit = true; }
public void Setup(int iPages, int iCurrentPage) { if ((this.pageCount != iPages) || (this.pageCurrent != iCurrentPage)) { this.pageCount = iPages; this.pageCurrent = iCurrentPage; foreach (dfControl control in base.gameObject.GetComponentsInChildren <dfControl>()) { if (control.gameObject != base.gameObject) { Object.Destroy(control.gameObject); } } if (this.pageCount > 1) { dfControl component = base.GetComponent <dfControl>(); bool flag = true; Vector3 vPos = new Vector3(0f, 0f, 0f); for (int i = 0; i < this.pageCount; i++) { if ((((this.buttonGroups - i) <= 0) && (i < (this.pageCount - this.buttonGroups))) && (Math.Abs((int)(i - this.pageCurrent)) > (this.buttonGroups / 2))) { if (flag) { this.DropSpacer(ref vPos); } flag = false; } else { dfButton child = ((GameObject)Object.Instantiate(this.clickableButton)).GetComponent <dfButton>(); component.AddControl(child); child.Tooltip = i.ToString(); child.MouseDown += new MouseEventHandler(this.OnButtonClicked); child.Text = (i + 1).ToString(); child.Invalidate(); if (i == this.pageCurrent) { child.Disable(); } child.Position = vPos; vPos.x += child.Width + 5f; flag = true; } } component.Width = vPos.x; } } }
public void OnDragDrop(dfControl source, dfDragEventArgs args) { if (this.Count == 0 && args.Data is DndExample_InventoryItem) { var item = (DndExample_InventoryItem)args.Data; this.ItemName = item.ItemName; this.Icon = item.Icon; this.Count = item.Count; args.State = dfDragDropState.Dropped; args.Use(); } Refresh(); }
public void ChangeLanguage(dfControl control, dfMouseEventArgs mouseEvent) { var button = (dfButton)control; if (control.name == "Spanish Button") { LocalizationManager.CurrentLanguage = "Español"; PlayerPrefs.SetString("Language", "Español"); } else if (control.name == "English Button") { LocalizationManager.CurrentLanguage = "English"; PlayerPrefs.SetString("Language", "English"); } }
public void OnMouseMove(dfControl control, dfMouseEventArgs args) { if (!(args is dfTouchEventArgs) && !isMouseDown) { return; } if (args.Used || !((args.Position - touchStartPosition).magnitude > 5)) { return; } currentX += args.MoveDelta.x; args.Use(); }
void QuitButton_Click(dfControl control, dfMouseEventArgs mouseEvent) { switch (PlayerPrefs.GetString(CameFromScript.CAME_FROM)) { case CameFromScript.BOOTCAMP: Application.LoadLevel("Bootcamp"); break; case CameFromScript.CHAMPIONS_ARENA: PhotonNetwork.Disconnect(); Application.LoadLevel("Champions arena"); break; } Time.timeScale = 1; }
public void OnMouseUp(dfControl source, dfMouseEventArgs args) { if (State == dfGestureState.Began) { CurrentPosition = args.Position; State = dfGestureState.Ended; if (HoldGestureEnd != null) { HoldGestureEnd(this); } gameObject.Signal("OnHoldGestureEnd", this); } State = dfGestureState.None; }
private bool canShowControlUnclipped(dfControl control) { if (this.hideClippedControls) { Vector3 relativePosition = control.RelativePosition; if ((relativePosition.x + control.Width) >= (this.panel.Width - this.borderPadding.right)) { return(false); } if ((relativePosition.y + control.Height) >= (this.panel.Height - this.borderPadding.bottom)) { return(false); } } return(true); }
public void FitToContents() { if (this.controls.Count == 0) { return; } Vector2 vector2 = Vector2.zero; for (int i = 0; i < this.controls.Count; i++) { dfControl item = this.controls[i]; Vector2 relativePosition = item.RelativePosition + item.Size; vector2 = Vector2.Max(vector2, relativePosition); } base.Size = vector2 + new Vector2((float)this.padding.right, (float)this.padding.bottom); }
public void OnMultiTouch(dfControl source, dfTouchEventArgs args) { if (State == dfGestureState.Began) { State = dfGestureState.Cancelled; if (HoldGestureEnd != null) { HoldGestureEnd(this); } gameObject.Signal("OnHoldGestureEnd", this); } else { State = dfGestureState.Failed; } }
void trigger_Click(dfControl control, dfMouseEventArgs mouseEvent) { if (mouseEvent.Source == triggerButton && !mouseEvent.Used) { mouseEvent.Use(); if (popup == null) { OpenPopup(); } else { ClosePopup(); } } }
public static Patches.BraveOptionsMenuItem CreateMenuEntryOption(dfControl parent, string text, string[] entries, bool localize = false) { var ent = parent.AddPrefab(CachedOptionMenuEntry.gameObject) as dfPanel; var label = ent.transform.GetChild(0).GetChild(0).gameObject.GetComponent <dfLabel>(); label.Text = text; label.IsLocalized = localize; var menu_item = ent.GetComponent <BraveOptionsMenuItem>(); menu_item.labelOptions = entries; menu_item.optionType = BraveOptionsMenuItem.BraveOptionsOptionType.NONE; return((Patches.BraveOptionsMenuItem)menu_item); }
public static Patches.BraveOptionsMenuItem CreateMenuEntryCheckbox(dfControl parent, string text, bool localize = false) { var ent = parent.AddPrefab(CachedCheckboxMenuEntry.gameObject) as dfPanel; var checkbox = (Patches.dfCheckbox)ent.transform.GetChild(0).GetChild(1).gameObject.GetComponent <dfCheckbox>(); checkbox.Label.Text = text; checkbox.Label.IsLocalized = localize; var menu_item = ent.GetComponent <BraveOptionsMenuItem>(); menu_item.optionType = BraveOptionsMenuItem.BraveOptionsOptionType.NONE; return((Patches.BraveOptionsMenuItem)menu_item); }
protected internal override void OnControlRemoved(dfControl child) { base.OnControlRemoved(child); if (child != null) { this.detachEvents(child); } if (!this.autoLayout) { this.updateScrollbars(); } else { this.AutoArrange(); } }
void OnDragEnd(dfControl source, dfDragEventArgs args) { ActionbarsDragCursor.Hide(); if (!this.isActionSlot) { return; } if (args.State == dfDragDropState.CancelledNoTarget) { Spell = ""; } refresh(); }
private void trigger_Click(dfControl control, dfMouseEventArgs mouseEvent) { if (mouseEvent.Source == this.triggerButton && !mouseEvent.Used) { mouseEvent.Use(); if (this.popup != null) { Debug.Log("Close popup"); this.closePopup(true); } else { this.openPopup(); } } }
void listItem_Click(dfControl control, dfMouseEventArgs mouseEvent) { if (currentlySelected != null) { currentlySelected.BackgroundColor = new Color32(255, 255, 255, 255); currentlySelected.Find("Selected Indicator").GetComponent <dfSprite>().Hide(); } dfPanel item = control as dfPanel; RoomData data = item.GetComponent <RoomData>(); data.Selected = true; item.BackgroundColor = new Color32(0, 0, 0, 255); currentlySelected = item; currentlySelected.Find("Selected Indicator").GetComponent <dfSprite>().Show(); }
private void scrollChildControls(Vector3 delta) { try { this.scrolling = true; delta = delta.Scale(1f, -1f, 1f); for (int i = 0; i < this.controls.Count; i++) { dfControl item = this.controls[i]; item.Position = (item.Position - delta).RoundToInt(); } } finally { this.scrolling = false; } }
protected void DoOnDisconnected() { base.gameObject.SetActive(this.disableWhenConnected); dfControl component = base.gameObject.GetComponent <dfControl>(); if (component) { if (this.disableWhenConnected) { component.Show(); } else { component.Hide(); } } }