void UpdateMouseCursor(GameTime time) { bool isOnHUD = isWaitingRBallSelect; if (miniMap.HitTest(MouseInput.X, MouseInput.Y)) { isOnHUD = true; } if (citySelectInfo.HitTest(MouseInput.X, MouseInput.Y)) { isOnHUD = true; } if (objSelectInfo.HitTest(MouseInput.X, MouseInput.Y)) { isOnHUD = true; } if (rankInfo.HitTest(MouseInput.X, MouseInput.Y)) { isOnHUD = true; } if (isOnHUD) { cursorState = MouseCursor.Normal; cursorColor = CursorColor.White; } else { UpdateScroll(time); UpdateMouseCursorScene(time); } }
public void ShowLayoutOverlay(WiiKeyMapper keyMapper) { if (this.hidden) { this.hidden = false; previousForegroundWindow = UIHelpers.GetForegroundWindow(); if (previousForegroundWindow == null) { previousForegroundWindow = IntPtr.Zero; } this.keyMapper = keyMapper; this.keyMapper.SwitchToDefault(); this.keyMapper.OnButtonDown += keyMapper_OnButtonDown; this.keyMapper.OnButtonUp += keyMapper_OnButtonUp; Dispatcher.BeginInvoke(new Action(delegate() { this.baseGrid.Opacity = 0.0; this.baseGrid.Visibility = Visibility.Visible; this.layoutChooserOverlay.Visibility = Visibility.Visible; this.Activate(); Color bordercolor = CursorColor.getColor(keyMapper.WiimoteID); //bordercolor.ScA = 0.5f; bordercolor.R = (byte)(bordercolor.R * 0.8); bordercolor.G = (byte)(bordercolor.G * 0.8); bordercolor.B = (byte)(bordercolor.B * 0.8); this.titleBorder.BorderBrush = new SolidColorBrush(bordercolor); this.title.Text = "Choose a layout for Wiimote " + keyMapper.WiimoteID; //this.title.Foreground = new SolidColorBrush(bordercolor); this.layoutList.Children.Clear(); foreach (LayoutChooserSetting config in this.keyMapper.GetLayoutList()) { string name = config.Title; string filename = config.Keymap; LayoutSelectionRow row = new LayoutSelectionRow(name, filename, bordercolor); //row.OnClick += row_OnClick; if (this.keyMapper.GetFallbackKeymap().Equals(filename)) { row.setSelected(true); } row.MouseDown += row_MouseDown; row.TouchDown += row_TouchDown; this.layoutList.Children.Add(row); } DoubleAnimation animation = UIHelpers.createDoubleAnimation(1.0, 200, false); animation.FillBehavior = FillBehavior.HoldEnd; animation.Completed += delegate(object sender, EventArgs pEvent) { }; this.baseGrid.BeginAnimation(FrameworkElement.OpacityProperty, animation, HandoffBehavior.SnapshotAndReplace); }), null); } }
public WiimoteStatusUC(int id) { InitializeComponent(); this.ID = id; this.lbId.Text = "" + id; this.setBattery(0); this.color.Stroke = new SolidColorBrush(CursorColor.getColor(id)); }
void Start() { cursor = GameObject.FindWithTag("Cursor"); basicCursor = cursor.GetComponent <HoloToolkit.Unity.BasicCursor> (); cursorColor = cursor.GetComponent <CursorColor>(); mainCam = GameObject.FindWithTag("MainCamera"); player = Player.Instance; }
private void Update() { if (m_Cursor == CursorColor.RED) { if (m_TimeInterval > 0) { m_TimeInterval -= Time.deltaTime; } else { m_Cursor = CursorColor.WHITE; m_TimeInterval = timeInterval; } } }
public OverlayNotice(string message, int wiimoteID, int timeout) { InitializeComponent(); this.noticeMessage.Text = "" + message; Color bordercolor = CursorColor.getColor(wiimoteID); bordercolor.ScA = 0.5f; this.noticeBorder.BorderBrush = new SolidColorBrush(bordercolor); this.hideTimer = new Timer(); this.hideTimer.Interval = timeout; this.hideTimer.AutoReset = true; this.hideTimer.Elapsed += hideTimer_Elapsed; this.hideTimer.Start(); }
protected internal override void OnDraw(SpriteBatch spriteBatch, Rect rect) { base.OnDraw(spriteBatch, rect); rect -= Padding; if (!IsFocused) { return; } if (ScreenSystem.TotalTime.Milliseconds > 500) { return; } var measuredText = Font.MeasureString(Text.Substring(0, CursorPosition)); var x = rect.Left + measuredText.X; var height = Font.MeasureString("|").Y; var top = (rect.Height - height) / 2 + rect.Top; CursorColor.Draw(spriteBatch, new Rect(x, top, 1, height)); }
public Faction(FactionName factionName) { this.factionName = factionName; switch (factionName) { case FactionName.Empire: cursorColor = CursorColor.Yellow; break; case FactionName.Coalition: cursorColor = CursorColor.Red; break; case FactionName.Ordre: cursorColor = CursorColor.Green; break; default: break; } }
public void ShowLayoutOverlay(WiiKeyMapper keyMapper) { if (this.hidden) { this.keyMapper = keyMapper; this.keyMapper.SwitchToDefault(); Dispatcher.BeginInvoke(new Action(delegate() { this.baseGrid.Opacity = 0.0; this.baseGrid.Visibility = Visibility.Visible; this.layoutChooserOverlay.Visibility = Visibility.Visible; this.Activate(); Color bordercolor = CursorColor.getColor(keyMapper.WiimoteID); bordercolor.ScA = 0.5f; this.titleBorder.BorderBrush = new SolidColorBrush(bordercolor); this.title.Text = "Choose a layout for Wiimote " + keyMapper.WiimoteID; this.layoutList.Children.Clear(); foreach (JObject config in this.keyMapper.GetLayoutList()) { string name = config.GetValue("Title").ToString(); string filename = config.GetValue("Keymap").ToString(); LayoutSelectionRow row = new LayoutSelectionRow(name, filename, bordercolor); row.OnClick += Select_Layout; this.layoutList.Children.Add(row); } DoubleAnimation animation = UIHelpers.createDoubleAnimation(1.0, 200, false); animation.FillBehavior = FillBehavior.HoldEnd; animation.Completed += delegate(object sender, EventArgs pEvent) { }; this.baseGrid.BeginAnimation(FrameworkElement.OpacityProperty, animation, HandoffBehavior.SnapshotAndReplace); this.hidden = false; }), null); } }
protected virtual void DrawCursor(Context gr, Rectangle _cursor) { CursorColor.SetAsSource(gr, _cursor); CairoHelpers.CairoRectangle(gr, _cursor, CornerRadius); gr.Fill(); }
void UpdateMouseCursorScene(GameTime time) { if (MouseInput.IsMouseUpLeft) { picker.SelectCurrentObject(); } cursorColor = CursorColor.White; if (selectionMarker.SelectedObject != null) { City selCity = selectionMarker.SelectedObject as City; City hoverCity = selectionMarker.MouseHoverObject as City; bool passed = false; if (selCity != null && hoverCity != null) { if (selCity != hoverCity) { if (selCity.IsCaptured && selCity.Owner == player) { #region 出击 cursorColor = getColor(hoverCity.Owner); // attack if (MouseInput.IsMouseUpRight && selectionMarker.HasPath) { if (selCity.NearbyOwnedBallCount > 0) { //if (selCity.HasMultipleTypeRBalls()) { isWaitingRBallSelect = true; sendBallSelect.Open(selCity, hoverCity); } //else //{ //selCity.Throw(hoverCity); //} } } if (selectionMarker.HasPath && selCity.NearbyOwnedBallCount > 0) { if (hoverCity.Owner != selCity.Owner) { cursorState = MouseCursor.Attack; } else { cursorState = MouseCursor.Move; } } else { cursorState = MouseCursor.Stop; } passed = true; #endregion } else { #region 漂流 if (selCity.HasOwnedBalls(player) && selCity.Owner != player && hoverCity.Owner == player) { if (selectionMarker.PathNodeLength == 2) { if (MouseInput.IsMouseUpRight) { for (int i = 0; i < selCity.NearbyEnemyBallCount; i++) { selCity.GetNearbyEnemyBall(i).Float(hoverCity); } } cursorState = MouseCursor.Move; cursorColor = getColor(hoverCity.Owner); passed = true; } } #endregion } } } if (!passed) { Harvester hoverHarv = selectionMarker.MouseHoverObject as Harvester; Harvester selectedHarv = selectionMarker.SelectedObject as Harvester; ForestObject naturalResource = selectionMarker.MouseHoverObject as ForestObject; if (selectionMarker.MouseHoverObject != null) { if (selectionMarker.SelectedObject != selectionMarker.MouseHoverObject) { WorldObject wo = selectionMarker.MouseHoverObject as WorldObject; if (wo != null && wo.IsInVisibleRange) { cursorState = MouseCursor.Selection; } if (hoverHarv != null && hoverHarv.IsInVisibleRange) { cursorColor = getColor(hoverHarv.Owner); cursorState = MouseCursor.Selection; } if (selectedHarv != null && naturalResource != null) { if (selectedHarv.Parent.IsResourceInRange(naturalResource)) { cursorState = MouseCursor.Attack; cursorColor = CursorColor.Yellow; if (MouseInput.IsMouseUpRight) { selectedHarv.Parent.Gather(naturalResource); } } else { // too far cursorState = MouseCursor.TooFar; } } } else { cursorState = MouseCursor.Normal; } } else { // command harv cursorState = MouseCursor.Normal; } } } else { City hoverCity = selectionMarker.MouseHoverObject as City; Harvester hoverHarv = selectionMarker.MouseHoverObject as Harvester; if (selectionMarker.MouseHoverObject != null) { WorldObject wo = selectionMarker.MouseHoverObject as WorldObject; if (wo != null && wo.IsInVisibleRange) { cursorState = MouseCursor.Selection; } if (hoverCity != null && hoverCity.IsInVisibleRange) { cursorColor = getColor(hoverCity.Owner); } if (hoverHarv != null && hoverHarv.IsInVisibleRange) { cursorColor = getColor(hoverHarv.Owner); cursorState = MouseCursor.Selection; } } else { cursorState = MouseCursor.Normal; } } }
void UpdateMouseCursor(GameTime time) { bool isOnHUD = isWaitingRBallSelect; if (miniMap.HitTest(MouseInput.X, MouseInput.Y)) isOnHUD = true; if (citySelectInfo.HitTest(MouseInput.X, MouseInput.Y)) isOnHUD = true; if (objSelectInfo.HitTest(MouseInput.X, MouseInput.Y)) isOnHUD = true; if (rankInfo.HitTest(MouseInput.X, MouseInput.Y)) isOnHUD = true; if (isOnHUD) { cursorState = MouseCursor.Normal; cursorColor = CursorColor.White; } else { UpdateScroll(time); UpdateMouseCursorScene(time); } }
public void Fire() { m_Cursor = CursorColor.RED; m_TimeInterval = timeInterval; }
public void Aim() { m_Cursor = CursorColor.WHITE; }