public override void Draw(Graphics drawer, Bitmap[] images, WatchState state) { if (state.Steps >= state.Goal) { Draw(drawer, images); } }
public void Draw(Graphics drawer, Bitmap[] resources, WatchState state) { if (state.Pulse != null) { Draw(drawer, resources, state.Pulse.Value); } }
public void Draw(Graphics drawer, Bitmap[] resources, WatchState state) { if (state.DayTemperature == null || state.NightTemperature == null) { return; } var images = new List <Bitmap>(); if (state.DayTemperature < 0) { images.Add(resources[MinusImageIndex]); } images.AddRange(Number.GetImagesForNumber(resources, Math.Abs(state.DayTemperature.Value))); if (AppendDegreesToBoth && DegreesImageIndex != null) { images.Add(resources[DegreesImageIndex.Value]); } images.Add(resources[DelimiterImageIndex]); if (state.NightTemperature < 0) { images.Add(resources[MinusImageIndex]); } images.AddRange(Number.GetImagesForNumber(resources, Math.Abs(state.NightTemperature.Value))); if (DegreesImageIndex != null) { images.Add(resources[DegreesImageIndex.Value]); } DrawerHelper.DrawImages(drawer, images, Number.Spacing, Number.Alignment, Number.GetBox()); }
public void Draw(Graphics drawer, Bitmap[] resources, WatchState state) { if (state.CurrentTemperature != null) { Draw(drawer, resources, state.CurrentTemperature.Value); } }
public virtual void Draw(Graphics drawer, Bitmap[] images, WatchState state) { foreach (var element in Children.OfType <IDrawable>()) { element.Draw(drawer, images, state); } }
public override void Draw(Graphics drawer, Bitmap[] images, WatchState state) { if (state.CurrentTemperature != null) { if (state.DayTemperature != null) { Day?.Draw(drawer, images, state.DayTemperature.Value); } if (state.NightTemperature != null) { Night?.Draw(drawer, images, state.NightTemperature.Value); } } else { if (state.DayTemperature != null) { Day?.Draw(drawer, images, state.DayTemperature.Value, DayAlt); } if (state.NightTemperature != null) { Night?.Draw(drawer, images, state.NightTemperature.Value, NightAlt); } } }
public override void Draw(Graphics drawer, Bitmap[] images, WatchState state) { AmPm?.Draw(drawer, images, state); var hours = AmPm == null ? state.Time.Hour : state.Time.Hour % 12; var drawingOrder = DrawingOrder ?? 0x1234; foreach (var position in DrawingOrderIterator.Iterate(drawingOrder)) { switch (position) { case DrawingOrderPosition.HourTens: Hours?.Tens?.Draw(drawer, images, hours % 100 / 10); break; case DrawingOrderPosition.HourOnes: Hours?.Ones?.Draw(drawer, images, hours % 10); break; case DrawingOrderPosition.MinuteTens: Minutes?.Tens?.Draw(drawer, images, state.Time.Minute % 100 / 10); break; case DrawingOrderPosition.MinuteOnes: Minutes?.Ones?.Draw(drawer, images, state.Time.Minute % 10); break; default: Logger.Warn("Not supported element {0} in DrawingOrder value", position); break; } } Seconds?.Draw(drawer, images, state.Time.Second); }
public void EnterPlanet() { watchState = WatchState.ENTER; CameraController.Instance.SetSize(currentPlanet.Radius); LookLandIndex = 0; LookBuilding(LookLandIndex); }
public void Draw(Graphics drawer, Bitmap[] resources, WatchState state) { if (state.AirQualityIndex != null) { Draw(drawer, resources, state.AirQualityIndex.Value); } }
public void Draw(Graphics drawer, Bitmap[] resources, WatchState state) { var monthAndDay = (MonthAndDayElement)_parent; Month?.Draw(drawer, resources, state.Time.Month, monthAndDay.TwoDigitsMonth ? 2 : 1); Day?.Draw(drawer, resources, state.Time.Day, monthAndDay.TwoDigitsDay ? 2 : 1); }
private static Image CreateFrame(IDrawable watchFace, Bitmap[] resources, WatchState state) { var preview = new Bitmap(176, 176); var graphics = Graphics.FromImage(preview); watchFace.Draw(graphics, resources, state); return(preview); }
public override void Draw(Graphics drawer, Bitmap[] resources, WatchState state) { if (!state.Pulse.HasValue) { return; } this.Draw(drawer, resources, state.Pulse.Value, state.PulseGoal); }
public override void Draw(Graphics drawer, Bitmap[] resources, WatchState state) { if ((long)this.indexPointer >= this.ImagesCount) { this.indexPointer = 0; } this.Draw(drawer, resources, this.indexPointer++); }
private static Image CreateFrame(IDrawable watchFace, Bitmap[] resources, WatchState state, Size size) { var preview = new Bitmap(size.Width, size.Height, format: System.Drawing.Imaging.PixelFormat.Format32bppArgb); var graphics = Graphics.FromImage(preview); watchFace.Draw(graphics, resources, state); return(preview); }
public override void Draw(Graphics drawer, Bitmap[] resources, WatchState state) { if (Steps != null && IconIndex != null && IconIndex.Value > 0) { Steps.Icon = resources[IconIndex.Value]; } base.Draw(drawer, resources, state); }
public void EnterPlanet() { watchState = WatchState.ENTER; CameraController.Instance.SetSize(currentPlanet.Radius); LookLandIndex = 0; LookBuilding(LookLandIndex); EventManager.Instance.PostEvent(GameEvent.ENTER_PLANET, CurrentPlanet); }
/// <summary> /// Enables or disables all FileSystemWatchers. /// </summary> private void setWatchState(WatchState state) { foreach (FileSystemWatcher w in fileSystemWatchers) { w.EnableRaisingEvents = (state == WatchState.Watching); } WatchState = state; }
private WatchState() { if (_instance != null) { return; } _instance = this; }
public void ExitPlanet() { watchState = WatchState.LOOK; currentBuildingName = "NULL"; currentBuilding = null; CameraController.Instance.SetSize(currentPlanet.Radius * 3); CameraController.Instance.LookAt(currentPlanet.transform); CameraController.Instance.SetRotation(Vector3.zero); }
public void ExitLooking(Transform objectToFollow) { watchState = WatchState.HALF_FREE; Instantiate <GameObject>(lookPlanetHUDPrefab, currentShip); CameraController.Instance.LookAt(objectToFollow); CameraController.Instance.SetRotation(Vector3.zero); CameraController.Instance.SetSize(CameraController.Instance.DefaultFreeSize); planetUI.CloseManager(); }
public override void Draw(Graphics drawer, Bitmap[] resources, WatchState state) { int steps = state.Steps; if (steps > state.Goal) { steps = state.Goal; } Draw(drawer, resources, steps, state.Goal); }
public void Draw(Graphics drawer, Bitmap[] images, WatchState state) { var imageIndex = SwitchState(state) ? ImageIndexOn : ImageIndexOff; if (imageIndex == null) { return; } drawer.DrawImage(images[imageIndex.Value], new Point((int)Coordinates.X, (int)Coordinates.Y)); }
public void OnSomethingEnterArea(GameEvent eventType, Component sender, object param = null) { Debug.Assert(eventType == GameEvent.ENTER_PLANET_AREA); currentPlanet = (Planet)param; Debug.Log(currentPlanet.gameObject.name); currentShip = sender.transform; watchState = WatchState.HALF_FREE; Instantiate <GameObject>(lookPlanetHUDPrefab, sender.transform); }
public override void Draw(Graphics drawer, Bitmap[] resources, WatchState state) { if (state.AirQuality == AirCondition.Unknown) { return; } var imageIndex = (int)state.AirQuality; Draw(drawer, resources, imageIndex); }
public void Draw(Graphics drawer, Bitmap[] resources, WatchState state) { var monthAndDay = (MonthAndDayElement)_parent; var images = Number.GetImagesForNumber(resources, state.Time.Month, monthAndDay.TwoDigitsMonth ? 2 : 1); images.Add(resources[DelimiterImageIndex]); images.AddRange(Number.GetImagesForNumber(resources, state.Time.Day, monthAndDay.TwoDigitsDay ? 2 : 1)); DrawerHelper.DrawImages(drawer, images, (int)Number.Spacing, Number.Alignment, Number.GetBox()); }
public void Draw(Graphics drawer, Bitmap[] resources, WatchState state) { var kilometers = state.Distance / 1000; var decimals = state.Distance % 1000 / 10; var images = Number.GetImagesForNumber(resources, kilometers); images.Add(resources[DecimalPointImageIndex]); images.AddRange(Number.GetImagesForNumber(resources, decimals)); images.Add(resources[KilometerImageIndex]); DrawerHelper.DrawImages(drawer, images, (int)Number.Spacing, Number.Alignment, Number.GetBox()); }
public void ExitPlanet() { watchState = WatchState.LOOK; currentBuildingName = "NULL"; currentBuilding = null; CameraController.Instance.SetSize(currentPlanet.Radius * 3); CameraController.Instance.LookAt(currentPlanet.transform); CameraController.Instance.SetRotation(Vector3.zero); EventManager.Instance.PostEvent(GameEvent.SHIP_RESTART_INPUT, this); EventManager.Instance.PostEvent(GameEvent.EXIT_PLANET, CurrentPlanet); }
/// <summary> /// 根据已有绑定, 进入总览模式 /// </summary> public void LookPlanet() { watchState = WatchState.LOOK; CameraController.Instance.LookAt(currentPlanet.transform); CameraController.Instance.SetSize(currentPlanet.Radius * 3); planetUI.gameObject.SetActive(true); // 总览星球事件! EventManager.Instance.PostEvent(GameEvent.LOOK_PLANET, CurrentPlanet); if (currentShip != null) { CheckColony(); } }
private static IEnumerable <WatchState> GenerateSampleStates() { var time = DateTime.Now; var states = new List <WatchState>(); for (var i = 0; i < 20; i++) { var num = i + 1; var watchState = new WatchState { BatteryLevel = 100 - i * 5, Pulse = 40 + num * 4, Steps = num * 500, Calories = num * 75, Distance = num * 350, Bluetooth = num > 2 && num < 12, Unlocked = num > 4 && num < 14, DoNotDisturb = num > 8 && num < 18, Alarm = num > 3 && num < 8, DayTemperature = i - 15, NightTemperature = i - 24, }; if (num < 3) { watchState.AirQuality = AirCondition.Unknown; watchState.AirQualityIndex = null; watchState.CurrentWeather = WeatherCondition.Unknown; watchState.CurrentTemperature = null; } else { var index = num - 2; watchState.AirQuality = (AirCondition)index; watchState.CurrentWeather = (WeatherCondition)index; watchState.AirQualityIndex = index * 50 - 25; watchState.CurrentTemperature = index * 6 - 10; } int month = num / 2 + 1; watchState.Time = new DateTime(time.Year, month, num + 5, i, i * 2, i); states.Add(watchState); } return(states); }
private static IEnumerable <WatchState> GenerateSampleStates() { var time = DateTime.Now; var states = new List <WatchState>(); for (var i = 0; i < 10; i++) { var num = i + 1; var watchState = new WatchState { BatteryLevel = 100 - i * 10, Pulse = 60 + num * 2, Steps = num * 1000, Calories = num * 75, Distance = num * 700, Bluetooth = num > 1 && num < 6, Unlocked = num > 2 && num < 7, Alarm = num > 3 && num < 8, DoNotDisturb = num > 4 && num < 9, DayTemperature = -15 + 2 * i, NightTemperature = -24 + i * 4, }; if (num < 3) { watchState.AirQuality = AirCondition.Unknown; watchState.AirQualityIndex = null; watchState.CurrentWeather = WeatherCondition.Unknown; watchState.CurrentTemperature = null; } else { var index = num - 2; watchState.AirQuality = (AirCondition)index; watchState.CurrentWeather = (WeatherCondition)index; watchState.AirQualityIndex = index * 50 - 25; watchState.CurrentTemperature = -10 + i * 6; } watchState.Time = new DateTime(time.Year, num, num * 2 + 5, i * 2, i * 6, i); states.Add(watchState); } return(states); }
public FileWatchEngine() { fileChangeList = new List<ChangeNotification>(); fileSystemWatchers = new List<FileSystemWatcher>(); WatchState = WatchState.Suspended; }