protected void LayoutControl(UIControl control, Rectangle rect) { switch (control.HorizontalAlignment) { case HorizontalAlignment.Stretch: case HorizontalAlignment.Left: control.Left = rect.Left; break; case HorizontalAlignment.Center: control.Left = (rect.Left + rect.Right - control.Width) / 2; break; case HorizontalAlignment.Right: control.Left = rect.Right - control.Width; break; } switch (control.VerticalAlignment) { case VerticalAlignment.Stretch: case VerticalAlignment.Top: control.Top = rect.Top; break; case VerticalAlignment.Center: control.Top = (rect.Top + rect.Bottom - control.Height) / 2; break; case VerticalAlignment.Bottom: control.Top = rect.Bottom - control.Height; break; } }
public void SetStaticLabel(string labelText) { UILabel label = new UILabel(labelText); label.AddConstraint(Edge.Left, this, Edge.Left, 5); if (previousAnchor == null) { label.AddConstraint(Edge.Top, this, Edge.Top, 5 - nextYOffset); } else { label.AddConstraint(Edge.Top, previousAnchor, Edge.Bottom, nextYOffset); } nextYOffset = 0; previousAnchor = label; AddChild(label); if (!SuspendLayout) { label.DoLayout(); } }
private UIControl GetMenuEntry( UIControl parent, string label ) { var control = new UIButton(); control.InputReleased += control_InputPressed; //var uiImg = new UIImage( "graphics/arrow_down" ); //uiImg.AddConstraint( Edge.CenterXY, control, Edge.CenterXY ); //control.AddDecoration( uiImg ); var uiLabel = new UILabel( label ); uiLabel.AddConstraint( Edge.CenterXY, control, Edge.CenterXY ); control.AddDecoration( uiLabel ); control.AddConstraint( Edge.CenterX, parent, Edge.CenterX ); if( previousEntry == null ) { control.AddConstraint( Edge.CenterY, parent, Edge.CenterY, 0, ConstraintCategory.Initialization ); } else { control.AddConstraint( Edge.Top, previousEntry, Edge.Bottom, -20, ConstraintCategory.Initialization ); } previousEntry = control; return control; }
// Use this for initialization void Start() { this.touchControl = new TouchControl(isTouchDevice); this.playerControl = new PlayerControl(this); this.target = GameObject.FindGameObjectWithTag("Target"); this.UIControl = this.GetComponent<UIControl>(); }
public void HandleCalloutClick(UIControl control) { Console.WriteLine("TestView.HandleCalloutClick"); if (callout != null) { callout.RemoveFromSuperview(); callout = null; } }
public UIConstraint(Edge controlEdge, UIControl anchor, Edge anchorEdge, float distance = 0f, ConstraintCategory constraintCategory = ConstraintCategory.All) { ControlEdge = controlEdge; Anchor = anchor; AnchorEdge = anchorEdge; Distance = distance; Category = constraintCategory; }
public static UIControl getInstance () { if ( _meInstance == null ) { _meInstance = GameObject.Find ( "Camera" ).transform.Find ( "UI" ).GetComponent < UIControl > (); } return _meInstance; }
public override void CalloutAccessoryControlTapped(MKMapView mapView, MKAnnotationView view, UIControl control) { // make sure its the right annotation var ann = view.Annotation as HeritagePropertyAnnotation; // call the callback if (ann != null && this.CalloutTappedCallback != null) CalloutTappedCallback(ann.Property); }
public static IDisposable BindToTarget(this ICommand This, UIControl control, UIControlEvent events) { var ev = new EventHandler((o,e) => { if (!This.CanExecute(null)) return; This.Execute(null); }); control.AddTarget(ev, events); return Disposable.Create(() => control.RemoveTarget(ev, events)); }
public override void AddChild(UIControl child, string name) { UIMenu test1 = child as UIMenu; if (test1 != null) throw new Exception("unable to add menu in menu!!"); UIMenuItem test = child as UIMenuItem; if (test != null) base.AddChild(child, name); }
public FirstResponderResigner (UIView view, UIControl control) { this.control = control; var tap = new UITapGestureRecognizer (() => { control.ResignFirstResponder (); }); tap.NumberOfTapsRequired = 1; view.AddGestureRecognizer (tap); }
public TimeFliesView(RectangleF rect) : base(rect) { UserInteractionEnabled = true; _currentTouchPointSubject = new Subject<PointF>(); _currentTouchPointObserver = _currentTouchPointSubject.AsObservable(); var wholeCoverageView = new UIControl(rect) {UserInteractionEnabled = true}; AddSubview(wholeCoverageView); // add one covering the whole view so we get hits BecomeFirstResponder(); Reactive("Time flies like an arrow"); }
//private void SetMargin() //{ // if (MarginLeft != 0 || MarginRight != 0 || MarginTop != 0 || MarginBottom != 0) // { // DrawPosition += new Vector2(-MarginLeft, -MarginTop); // size += new Vector2(MarginRight + MarginLeft, MarginBottom + MarginTop); // UpdateTransformation = true; // //base.DoLayout(ConstraintCategory.Update); // } //} public override bool AddChild(UIControl control) { if (base.AddChild(control)) { if (AutoSize) { ResizeToContent(); } return true; } return false; }
public override void CalloutAccessoryControlTapped(MKMapView mapView, MKAnnotationView view, UIControl control) { var pinAnnotation = view.Annotation as UnifiedPointAnnotation; if (pinAnnotation != null) { var pinSelectedCommand = _renderer.Element.PinCalloutTappedCommand; if (pinSelectedCommand.CanExecute(pinAnnotation.Data)) { pinSelectedCommand.Execute(pinAnnotation.Data); } } }
private void KeepMe() { // UIButon var btn = new UIButton(); var title = btn.Title(UIControlState.Disabled); btn.SetTitle("foo", UIControlState.Disabled); btn.TitleLabel.Text = btn.TitleLabel.Text; // UISlider var slider = new UISlider(); slider.Value = slider.Value; // Get and set // UITextView var tv = new UITextView(); tv.Text = tv.Text; // UITextField var tf = new UITextField(); tv.Text = tf.Text; // var UIImageView var iv = new UIImageView(); iv.Image = iv.Image; // UI Label var lbl = new UILabel(); lbl.Text = lbl.Text; // UI Control var ctl = new UIControl(); ctl.Enabled = ctl.Enabled; ctl.Selected = ctl.Selected; EventHandler eh = (s, e) => { }; ctl.TouchUpInside += eh; ctl.TouchUpInside -= eh; // UIRefreshControl var rc = new UIRefreshControl(); rc.ValueChanged += eh; rc.ValueChanged -= eh; // UIBarButtonItem var bbi = new UIBarButtonItem(); bbi.Clicked += eh; bbi.Clicked -= eh; eh.Invoke(null, null); }
void UpdateButton (UIControl button) { var column = (int)button.Tag; button.Enabled = board.CanMoveInColumn (column); int row = Board.Height; var chip = Chip.None; while (chip == Chip.None && row > 0) chip = board.ChipInColumnRow (column, --row); if (chip != Chip.None) AddChipLayerAtColumnRowColor (column, row, Player.PlayerForChip (chip).Color); }
public MvxUIControlTouchUpInsideTargetBinding(UIControl control) : base(control) { if (control == null) { MvxBindingTrace.Trace(MvxTraceLevel.Error, "Error - UIControl is null in MvxUIControlTouchUpInsideTargetBinding"); } else { control.TouchUpInside += ControlOnTouchUpInside; } _canExecuteEventHandler = new EventHandler<EventArgs>(this.OnCanExecuteChanged); }
public MvxUIControlValueChangedTargetBinding(UIControl control) : base(control) { if (control == null) { MvxBindingTrace.Trace(MvxTraceLevel.Error, "Error - UIControl is null in MvxUIControlValueChangedTargetBinding"); } else { control.ValueChanged += OnValueChanged; } _canExecuteEventHandler = OnCanExecuteChanged; }
/// <summary> /// Adds a UI constraint to this control. /// </summary> /// <param name="controlEdge">Control edge to constraint.</param> /// <param name="anchor">Anchoring control on which the control edge is constrained. Setting this to 'null' the control is anchored relative to the screen.</param> /// <param name="anchorEdge">Anchor edge, on which the control edge is constrained relative to.</param> /// <param name="edgeDistance">Distance between control and anchor constraint edge.</param> internal void AddConstraint(Edge controlEdge, UIControl anchor, Edge anchorEdge, float edgeDistance, ConstraintCategory category) { // Separate edges into their basic flags. // E.g. 'Edge.BottomRight' is separated into 'Edge.Bottom' and 'Edge.Right', and added as individual edges. List<Edge> controlEdges = new List<Edge>(4); List<Edge> anchorEdges = new List<Edge>(4); foreach (Edge edgeType in EdgeTypes) { if (controlEdge.HasFlag(edgeType)) { controlEdges.Add(edgeType); } if (anchorEdge.HasFlag(edgeType)) { anchorEdges.Add(edgeType); } } if (controlEdges.Count != anchorEdges.Count) { throw new ArgumentException("There must be an equal amount of control and anchor edges."); } for (int i = 0; i < controlEdges.Count; i++) { var cEdge = controlEdges[i]; var aEdge = anchorEdges[i]; if (!OnSameAxis(cEdge, aEdge)) { throw new ArgumentException($"Control and anchor edge and must be on the same axis: {cEdge}, {aEdge}"); } foreach (var edge in Constraints.Select(c => c.ControlEdge)) { if (edge.Equals(cEdge)) { throw new ArgumentException($"Control edge already bound: {cEdge}"); } if (Edge.CenterXY.ContainsFlag(cEdge | edge) && OnSameAxis(cEdge, edge)) // Special case to check that no edge is bound to an axis along with a center edge. E.g.: CenterY and Top. { throw new ArgumentException($"Control axis already bound: {cEdge}, {edge}"); } } Constraints.Add(new UIConstraint(cEdge, anchor, aEdge, edgeDistance, category)); } }
private UIControl GetMenuEntry(UIControl parent, string label) { var btn = new UIButton(); btn.Tag = label; btn.AddDecoration(new UILabel(label)); btn.AddConstraint(Edge.CenterX, parent, Edge.CenterX, ConstraintCategory.All); if (previousEntry != null) { btn.AddConstraint(Edge.Top, previousEntry, Edge.Bottom, -20, ConstraintCategory.All); } previousEntry = btn; return btn; }
private static void Include() { var barButton = new UIBarButtonItem(); barButton.Clicked += (sender, args) => { }; barButton.Clicked -= (sender, args) => { }; barButton.Enabled = barButton.Enabled; var searchBar = new UISearchBar(); searchBar.Text = searchBar.Text; searchBar.TextChanged += (sender, args) => { }; searchBar.TextChanged -= (sender, args) => { }; var control = new UIControl(); control.ValueChanged += (sender, args) => { }; control.ValueChanged -= (sender, args) => { }; control.TouchUpInside += (sender, args) => { }; control.TouchUpInside -= (sender, args) => { }; }
public static IDisposable ValueChangedWeakSubscribe( [NotNull] this UIControl control, [NotNull] EventHandler valueChangedHandler) { if (control == null) { throw new ArgumentNullException(nameof(control)); } if (valueChangedHandler == null) { throw new ArgumentNullException(nameof(valueChangedHandler)); } return(new WeakEventSubscription <UIControl>( control, (eventSource, eventHandler) => eventSource.NotNull().ValueChanged += eventHandler, (eventSource, eventHandler) => eventSource.NotNull().ValueChanged -= eventHandler, valueChangedHandler)); }
public static IDisposable TouchUpInsideWeakSubscribe( [NotNull] this UIControl control, [NotNull] EventHandler touchUpInsideHandler) { if (control == null) { throw new ArgumentNullException(nameof(control)); } if (touchUpInsideHandler == null) { throw new ArgumentNullException(nameof(touchUpInsideHandler)); } return(new WeakEventSubscription <UIControl>( control, (eventSource, eventHandler) => eventSource.NotNull().TouchUpInside += eventHandler, (eventSource, eventHandler) => eventSource.NotNull().TouchUpInside -= eventHandler, touchUpInsideHandler)); }
/// <summary> /// Render ComboBox control. /// Return true if failed. /// </summary> /// <param name="r.Canvas">Parent r.Canvas</param> /// <param name="uiCtrl">UIControl</param> /// <returns>Success = false, Failure = true</returns> public static void RenderComboBox(RenderInfo r, UIControl uiCtrl) { Debug.Assert(uiCtrl.Info.GetType() == typeof(UIInfo_ComboBox)); UIInfo_ComboBox info = uiCtrl.Info as UIInfo_ComboBox; ComboBox comboBox = new ComboBox() { FontSize = CalcFontPointScale(), ItemsSource = info.Items, SelectedIndex = info.Index, VerticalContentAlignment = VerticalAlignment.Center, }; comboBox.LostFocus += (object sender, RoutedEventArgs e) => { ComboBox box = sender as ComboBox; if (info.Index != box.SelectedIndex) { info.Index = box.SelectedIndex; uiCtrl.Text = info.Items[box.SelectedIndex]; uiCtrl.Update(); } }; if (info.SectionName != null) { comboBox.SelectionChanged += (object sender, SelectionChangedEventArgs e) => { if (r.Script.Sections.ContainsKey(info.SectionName)) // Only if section exists { SectionAddress addr = new SectionAddress(r.Script, r.Script.Sections[info.SectionName]); UIRenderer.RunOneSection(addr, $"{r.Script.Title} - CheckBox [{uiCtrl.Key}]", info.HideProgress); } else { r.Logger.System_Write(new LogInfo(LogState.Error, $"Section [{info.SectionName}] does not exists")); } }; } SetToolTip(comboBox, info.ToolTip); DrawToCanvas(r, comboBox, uiCtrl.Rect); }
public void HandleEvent(UIControl control, int command, float wparam, float lparam) { if (control == m_YesButton) { m_EventHandler.Yes(); } else if (control == m_NoButton || control == m_CloseButton) { m_EventHandler.No(); } else if (control == m_BackgroundImg) { if (m_Mode == DialogMode.TAP_TO_DISMISS) { Hide(); m_EventHandler.Yes(); } } }
private static void checkEmptyElement(UIControl control, AutomationElement.AutomationElementInformation ElementInfo) { if (!string.IsNullOrEmpty(ElementInfo.AutomationId)) { control.SearchCriteria.SearchProperties.Add("AutomationID", ElementInfo.AutomationId); } if (!string.IsNullOrEmpty(ElementInfo.ClassName)) { control.SearchCriteria.SearchProperties.Add("ClassName", ElementInfo.ClassName); } if (!string.IsNullOrEmpty(ElementInfo.Name)) { control.SearchCriteria.SearchProperties.Add("Name", ElementInfo.Name); } if (!string.IsNullOrEmpty(ElementInfo.LocalizedControlType)) { control.SearchCriteria.SearchProperties.Add("ControlType", ElementInfo.LocalizedControlType); } }
public void HandleEvent(UIControl control, int command, float wparam, float lparam) { if (control == musicButtonOff) { musicButtonOn.Set(false); AudioListener.volume = 0; gameState.MusicOn = false; } else if (control == musicButtonOn) { musicButtonOff.Set(false); AudioListener.volume = 100; gameState.MusicOn = true; MapUI.GetInstance().GetAudioPlayer().PlayAudio("Button"); } else if (control == creditsButton) { MapUI.GetInstance().GetAudioPlayer().PlayAudio("Button"); creditsPanel.Show(); } else if (control == returnButton) { MapUI.GetInstance().GetAudioPlayer().PlayAudio("Button"); this.Hide(); ui.GetMapUI().Show(); } else if (control == shareButton) { string htm = GameApp.GetInstance().GetResourceConfig().shareHtm.text; Utils.ToSendMail("", "Call Of Mini: Zombies", htm); } else if (control == reviewButton) { Application.OpenURL("http://www.trinitigame.com/callofminizombies/review/"); } else if (control == supportButton) { Utils.ToSendMail("*****@*****.**", "Call Of Mini: Zombies", ""); } }
/// <summary> /// Gets the render callback that should be used to draw the control with the given style. /// </summary> private Action<UIControl, UIRenderContext> GetRenderCallback(UIControl control, ThemeStyle style) { // Try to find a render callback for the given style. If nothing is found, // try to find a callback for the parent style. Action<UIControl, UIRenderContext> callback = null; while (callback == null && style != null) { if (!string.IsNullOrEmpty(style.Name) && RenderCallbacks.TryGetValue(style.Name, out callback)) return callback; style = style.Inherits; } // Nothing found. Try with control.Style string (parameter 'style' can be null). Debug.Assert(!string.IsNullOrEmpty(control.Style), "UIControl.Style must not be null or an empty string."); if (RenderCallbacks.TryGetValue(control.Style, out callback)) return callback; return _renderUIControl; }
private UIControl GetMenuEntry(string label) { var btn = new UIButton(); btn.Tag = label; btn.AddDecoration(new UILabel(label)); if (previousEntry == null) { btn.AddConstraint(Edge.CenterXY, menuPanel, Edge.CenterXY, ConstraintCategory.Initialization); } else { btn.AddConstraint(Edge.CenterX, previousEntry, Edge.CenterX, ConstraintCategory.Initialization); btn.AddConstraint(Edge.Top, previousEntry, Edge.Bottom, -20, ConstraintCategory.Initialization); } previousEntry = btn; return(btn); }
// Start is called before the first frame update void Awake() { player = GameObject.FindGameObjectWithTag("Player"); //Access and store a reference to the player game object gameController = GameObject.Find("GameController"); //Access and store a reference to the player game object abilityController = player.GetComponent <AbilityController>(); movementController = player.GetComponent <MovementController>(); playerHealthControl = player.GetComponent <PlayerHealthControl>(); resourceAndUpgradeManager = gameController.GetComponent <ResourceAndUpgradeManager>(); mapManager = gameController.GetComponent <ManageMap>(); uiController = gameController.GetComponent <UIControl>(); gridLayout = GameObject.Find("Grid").GetComponent <GridLayout>(); //Access and store a reference to the grid layout turnManager = gameController.GetComponent <TurnManager>(); target = gridLayout.CellToWorld(player.GetComponent <AbilityController>().target); turnsAlive = 0; turnDelay = 1; alreadyUsed = false; rocketYield = resourceAndUpgradeManager.CurrentMaxRocketYield; SetRotation(); //Call the function that will orient this object in the direction of the target. Debug.Log("Rocket reporting in"); }
void Start() { movementState = true; gridLayout = GameObject.Find("Grid").GetComponent <GridLayout>(); //search for and save a reference to the grid layout component playerCellPosition = gridLayout.WorldToCell(transform.position); //get a reference to the player cell position in cell coordinates transform.position = gridLayout.CellToWorld(playerCellPosition); //center the player game object within it's nearest cell by converting the cell coordinates to world coordinates gameController = GameObject.Find("GameController"); mapManager = gameController.GetComponent <ManageMap>(); //get a reference to the map manager clickManager = gameController.GetComponent <ClickManager>(); //get a reference to the map manager resourceAndUpgradeManager = gameController.GetComponent <ResourceAndUpgradeManager>(); uiController = gameController.GetComponent <UIControl>(); turnManager = gameController.GetComponent <TurnManager>(); vision = resourceAndUpgradeManager.CurrentMaxSensorRange; mapManager.UpdateFogOfWar(vision, playerCellPosition); //run an update fog of war command from the map manager to clear the fog around the player character on scene start //rotTrack = 0; //set rotation tracking to 0 (this will likely be depreicated with a new rotation system abilityActive = false; //set the ability active flag to false cantMove = false; abilityController = GameObject.Find("Player").GetComponent <AbilityController>(); }
public void InitEvents () { fc = FlowControl.Instance; lc = LevelControl.Instance; sc = ScoreControl.Instance; uic = UIControl.Instance; dc = DataControl.Instance; shootC = GameObject.Find ("Player").GetComponent<ShootingController> (); lc.BallsChanged += OnBallsChanged; lc.LevelChanged += OnLevelChanged; lc.TargetsChanged += OnTargetsChanged; sc.ScoreChanged += OnScoreChanged; shootC.InitPowerSlider += OnInitPowerSlider; shootC.UpdatePowerSlider += OnUpdatePowerSlider; string levelKind = dc.GetLevel (fc.Level).Kind; if (levelKind.Equals ("T")) GameObject.Find ("Player").GetComponent<MoveOnTrails> ().TrailsEndReached += OnTrailsEndReached; }
private void fireToFocused(UIControl control, Game g, msgType type, object args) { control.fireEvent(g, type, args); //fire to every focused child in the control and recursively fire. int l = control.p_Children.Count; for (int c = 0; c < l; c++) { UIControl child = control.p_Children[c]; if (child.p_Focus) { fireToFocused( child, g, type, args); } } }
private void OnIntroLogoUIFinished(UIControl c) { bool has_language = SerializationManager.Instance.GetHasLanguage(); if (!has_language) { if (select_language_ui != null) { select_language_ui.UIBegin(); select_language_ui.SetBackgroundFade(true); } } else { LocManager.Language lan = SerializationManager.Instance.GetLanguage(); LocManager.Instance.SetLanguage(lan); StartPhase(LogicPhase.GAME_MENU); } }
private static void CreateXML(List <TreeNode> parents) { var fileName = @"C:\Temp\ObjectRepo.xml"; UIControl control; RepositoryUtility utility = new RepositoryUtility(); RepositoryNode nodeInfo = utility.ReadData(fileName); if (nodeInfo == null) { nodeInfo = new RepositoryNode(); } List <UIControl> childList = nodeInfo.ChildNodes; bool isChildAdded = false; foreach (var node in parents) { control = new UIControl(); control.ApplicationType = ApplicationTypes.Windows; control.TechnologyType = TechnologyTypes.White; var aeNode = (AutomationElementTreeNode)node.Tag; var ElementInfo = aeNode.AutomationElement.Current; control.Name = ElementInfo.Name; AddSearchProperties(control, ElementInfo); int index = -1; if (FindControl(childList, control, out index)) { childList = childList[index].ChildNodes; } else { childList = AddChild(childList, control); isChildAdded = true; } } if (!isChildAdded) { MessageBox.Show("Element already existing ..."); } utility.WriteData(nodeInfo, fileName); }
bool CursorIsInArea() { //control rectangle if (!(new Rectangle(Vector2.Zero, new Vector2(1, 1))).Contains(MousePosition)) { return(false); } UIControl cover = ParentContainer?.GetTopMouseCoversControl(false); if (cover != null) { //!!!!!strange if (!IsTheRoot(cover)) { return(false); } } return(true); }
public virtual void PerformRenderUI(UIControl playScreen, CanvasRenderer renderer) { if (Scene != null) { RenderObjectInteraction(playScreen, renderer); RenderTargetImage(renderer); } //if( DisplayHelpText ) //{ // var lines = new List<string>(); // lines.Add( "Game Mode" ); // if( CanChangeCameraTypeByKey ) // lines.Add( "Press F7 to change camera type." ); // var fontSize = renderer.DefaultFontSize; // var offset = new Vector2( fontSize * renderer.AspectRatioInv * 0.8, fontSize * 0.6 ); // CanvasRendererUtility.AddTextLinesWithShadow( renderer.ViewportForScreenCanvasRenderer, null, fontSize, lines, new Rectangle( offset.X, offset.Y, 1.0 - offset.X, 1.0 - offset.Y ), EHorizontalAlignment.Right, EVerticalAlignment.Top, new ColorValue( 1, 1, 1 ) ); //} }
public bool PerformKeyPress(KeyPressEvent e) { CheckCachedParameters(); UpdateTopMouseCoversControl(); if (capturedControl != null && capturedControl.ParentContainer == null) { capturedControl = null; } if (focusedControl != null && focusedControl.ParentContainer == null) { focusedControl = null; } if (focusedControl != null) { return(focusedControl.CallKeyPress(e)); } return(CallKeyPress(e)); }
// // This method is invoked when the application has loaded and is ready to run. In this // method you should instantiate the window, load the UI into it and then make the window // visible. // // You have 17 seconds to return from this method, or iOS will terminate your application. // public override bool FinishedLaunching(UIApplication app, NSDictionary options) { Forms.Init(); window = new UIWindow(UIScreen.MainScreen.Bounds); // window.RootViewController = App.GetMainPage().CreateViewController(); var page = App.GetMainPage(); window.RootViewController = page.CreateViewController(); window.MakeKeyAndVisible(); Disp(window.RootViewController); UIControl uc = SetNamePageToUIelement("textUserName", page); var obj = uc as UITextField; obj.AllTouchEvents += obj_AllTouchEvents; return(true); }
protected override UIControl GenerateContent(DayScheduleItemsArranger.EventItem item) { var container = new UIControl() { TranslatesAutoresizingMaskIntoConstraints = false, BackgroundColor = GetBackgroundColor(item.Item) }; var label = new UILabel() { TranslatesAutoresizingMaskIntoConstraints = false, Text = item.Item.Name.Length > 0 ? item.Item.Name.Substring(0, 1) : "", TextColor = UIColor.White, TextAlignment = UITextAlignment.Center }; container.Add(label); label.StretchWidthAndHeight(container, left: 6, top: 6, right: 9, bottom: 6); return(container); }
public bool PerformSpecialInputDeviceEvent(InputEvent e) { CheckCachedParameters(); UpdateCachedCoverControls(); if (capturedControl != null && capturedControl.ParentContainer == null) { capturedControl = null; } if (focusedControl != null && focusedControl.ParentContainer == null) { focusedControl = null; } if (capturedControl != null) { return(capturedControl.CallSpecialInputDeviceEvent(e)); } return(CallSpecialInputDeviceEvent(e)); }
public bool PerformTouch(TouchData e) { CheckCachedParameters(); UpdateCachedCoverControls(); if (capturedControl != null && capturedControl.ParentContainer == null) { capturedControl = null; } if (focusedControl != null && focusedControl.ParentContainer == null) { focusedControl = null; } if (capturedControl != null) { return(capturedControl.CallTouch(e)); } return(CallTouch(e)); }
public bool PerformMouseWheel(int delta) { CheckCachedParameters(); UpdateCachedCoverControls(); if (capturedControl != null && capturedControl.ParentContainer == null) { capturedControl = null; } if (focusedControl != null && focusedControl.ParentContainer == null) { focusedControl = null; } if (focusedControl != null) { return(focusedControl.CallMouseWheel(delta)); } return(CallMouseWheel(delta)); }
public bool PerformMouseDoubleClick(EMouseButtons button) { CheckCachedParameters(); UpdateCachedCoverControls(); if (capturedControl != null && capturedControl.ParentContainer == null) { capturedControl = null; } if (focusedControl != null && focusedControl.ParentContainer == null) { focusedControl = null; } if (capturedControl != null) { return(capturedControl.CallMouseDoubleClick(button)); } return(CallMouseDoubleClick(button)); }
public bool PerformKeyUp(KeyEvent e) { CheckCachedParameters(); UpdateCachedCoverControls(); if (capturedControl != null && capturedControl.ParentContainer == null) { capturedControl = null; } if (focusedControl != null && focusedControl.ParentContainer == null) { focusedControl = null; } if (focusedControl != null) { return(focusedControl.CallKeyUp(e)); } return(CallKeyUp(e)); }
/// <summary>卡牌合成</summary> private void CardSynthesis() { // 合成卡槽数量为3 if (CardDataManage.Instance.synthesisCard.Count == 3) { // 打开新卡牌合成效果面板 UIControl.OpenUI(UIPanelType.CardShowPanel); // 设置新卡牌S数据 普通S卡 CardDataManage.Instance.newCardData = CardDataManage.Instance.OrdinaryCardData["S"][0]; // 清除卡槽 foreach (var item in synthesisCardSlots) { item.ClearCard(); } // 合成卡槽数据置空 CardDataManage.Instance.synthesisCard = new List <CardData>(); } }
public bool PerformJoystickEvent(JoystickInputEvent e) { CheckCachedParameters(); UpdateTopMouseCoversControl(); if (capturedControl != null && capturedControl.ParentContainer == null) { capturedControl = null; } if (focusedControl != null && focusedControl.ParentContainer == null) { focusedControl = null; } if (capturedControl != null) { return(capturedControl.CallJoystickEvent(e)); } return(CallJoystickEvent(e)); }
/// Can't use Start() because splash screen means the game runs behind >:( public void StartAfterSplashscreen () { UIController = GetComponent<UIControl>(); SetupSlots(); UIController.SetupScoreText(); UIController.ShowTitle(); string nextMethod; if (PlayerPrefs.GetInt("HasCompletedARound", 0) == 0) { // if is first run go straight into a timed round gameMode = Mode.Timed; nextMethod = "StartRound"; } else { // otherwise allow the player to select timed or lives modes nextMethod = "ShowModeSelectScreen"; } Invoke(nextMethod, UIController.titleAnimateTime * 1.5f + UIController.titleDisplayTime + gameStartDelay); sfx = GetComponent<Sounds>(); LBHandler = GetComponent<LeaderboardHandler>(); }
/// <summary> /// RenderCallback for the style "ContentControl". /// </summary> private void RenderContentControl(UIControl control, UIRenderContext context) { var contentControl = control as ContentControl; if (contentControl == null || contentControl.Content == null || !contentControl.ClipContent) { // No content or no clipping - render as normal "UIControl". RenderUIControl(control, context); return; } // Background images. RenderImages(control, context, false); EndBatch(); // Render Content and clip with scissor rectangle. Rectangle originalScissorRectangle = GraphicsDevice.ScissorRectangle; Rectangle scissorRectangle = context.RenderTransform.Transform(contentControl.ContentBounds).ToRectangle(true); GraphicsDevice.ScissorRectangle = Rectangle.Intersect(scissorRectangle, originalScissorRectangle); #else GraphicsDevice.ScissorRectangle = RectangleIntersect(scissorRectangle, originalScissorRectangle); BeginBatch(); contentControl.Content.Render(context); EndBatch(); GraphicsDevice.ScissorRectangle = originalScissorRectangle; BeginBatch(); // Visual children except Content. foreach (var child in control.VisualChildren) if (contentControl.Content != child) child.Render(context); // Overlay images. RenderImages(control, context, true); }
public static IDisposable BindToTarget(this ICommand This, UIControl control, UIControlEvent events) { var ev = new EventHandler((o,e) => { if (!This.CanExecute(null)) return; This.Execute(null); }); var cech = new EventHandler((o, e) => { var canExecute = This.CanExecute(null); control.Enabled = canExecute; }); This.CanExecuteChanged += cech; control.AddTarget(ev, events); control.Enabled = This.CanExecute(null); return Disposable.Create(() => { control.RemoveTarget(ev, events); This.CanExecuteChanged -= cech; }); }
/// <summary> /// Adds a UI constraint to this control. /// </summary> /// <param name="control">Control instance.</param> /// <param name="controlEdge">Control edge to constraint.</param> /// <param name="anchor">Anchoring control on which the control edge is constrained. If 'null', the control is anchored relative to the viewport.</param> /// <param name="anchorEdge">Anchor edge on which the control edge is constrained relative to.</param> /// <param name="edgeDistance">Distance between control and anchor constraint edges.</param> /// <param name="category">The category this constraint belongs to.</param> public static void AddConstraint(this UIControl control, Edge controlEdge, UIControl anchor, Edge anchorEdge, float edgeDistance = 0, ConstraintCategory category = ConstraintCategory.All) { if (control == anchor) { throw new ArgumentException("Cannot anchor control to itself."); } //// Separate edges into their basic flags. //// E.g. 'Edge.BottomRight' is separated into 'Edge.Bottom' and 'Edge.Right', and added as individual edges. //List<Edge> controlEdges = new List<Edge>(4); //List<Edge> anchorEdges = new List<Edge>(4); //foreach (Edge edgeType in UIConstrainer.EdgeTypes) //{ // if (controlEdge.ContainsFlag(edgeType)) // { // controlEdges.Add(edgeType); // } // if (anchorEdge.ContainsFlag(edgeType)) // { // anchorEdges.Add(edgeType); // } //} //if (controlEdges.Count != anchorEdges.Count) //{ // throw new ArgumentException("There must be an equal amount of control and anchor edges."); //} if (control.Constrainer == null) { control.Constrainer = new UIConstrainer(); } control.Constrainer.AddConstraint(controlEdge, anchor, anchorEdge, edgeDistance, category); //for (int i = 0; i < controlEdges.Count; i++) //{ // control.Constrainer.AddConstraint(controlEdges[i], anchor, anchorEdges[i], edgeDistance, category); //} }
void Awake() { // preserve the old instance if one already exists if (instance != null && instance != this) { Destroy(this.gameObject); return; } else { instance = this; } // not used yet but gives easy access to the entire UI display UICanvas = GameObject.Find ("UICanvas"); // initialize the weapons array and [ammo count from PlayerPrefs] NOT USED RIGHT NOW // allWeapons = GameObject.FindGameObjectsWithTag("GunUI"); // get the current weapon selectedWeapon = 0; // not needed // else { // //selectedWeapon = gun1; // } // ChangeWeapon (0); only needed for dynamic array healthBar = GameObject.FindGameObjectWithTag ("HealthUI"); score = GameObject.FindGameObjectWithTag ("ScoreUI").gameObject.GetComponent<Text>(); if (PlayerPrefs.HasKey ("PlayerScore")) { score.text = PlayerPrefs.GetInt ("PlayerScore").ToString (); } else { score.text = "0000"; } //preserve the instance throughout scene change DontDestroyOnLoad(this.gameObject); }
/// <summary> /// Overload added to prevent implicit casting to ConstraintCategory when edgeDistance is set to 0. /// http://geekswithblogs.net/BlackRabbitCoder/archive/2012/01/26/c.net-little-pitfalls-implicit-zero-to-enum-conversion.aspx /// </summary> public static void AddConstraint(this UIControl control, Edge controlEdge, UIControl anchor, Edge anchorEdge, int edgeDistance) { control.AddConstraint(controlEdge, anchor, anchorEdge, edgeDistance, ConstraintCategory.All); }
private static void _UpdateDrawPosition(UIControl control) { if (control.HasParent) { control.DrawPosition = control.Parent.DrawPosition + control.Position; } else { control.DrawPosition = control.Position; } }
/// <summary> /// Adds a UI constraint to this control. /// </summary> /// <param name="control">Control instance.</param> /// <param name="controlEdge">Control edge to constraint.</param> /// <param name="anchor">Anchoring control on which the control edge is constrained. If 'null', the control is anchored relative to the viewport.</param> /// <param name="anchorEdge">Anchor edge on which the control edge is constrained relative to.</param> /// <param name="category">The category this constraint belongs to.</param> public static void AddConstraint(this UIControl control, Edge controlEdge, UIControl anchor, Edge anchorEdge, ConstraintCategory category) { control.AddConstraint(controlEdge, anchor, anchorEdge, 0f, category); }
/// <summary> /// This is the callback for when the detail disclosure is clicked /// </summary> public override void CalloutAccessoryControlTapped (MKMapView mapView, MKAnnotationView view, UIControl control) { var menuViewModel = ServiceContainer.Resolve<MenuViewModel>(); menuViewModel.MenuIndex = SectionIndex.Summary; assignmentViewModel.SelectedAssignment = GetAssignment (view.Annotation as MKPlacemark); controller.PerformSegue ("AssignmentDetails", controller); }