/// <summary> /// Constructor. /// </summary> /// <param name="_odometer">current odometer to determine current mileage</param> public System_Status(Odometer _odometer) { this._odometer = _odometer; lastOilChange = _odometer.currentMileage(); }
public virtual void Awake() { IsFirstGameAfterLoading = true; IntroGary = null; m_minigame = MinigameManager.GetActive <mg_JetpackReboot>(); m_gameBalance = base.gameObject.AddComponent <mg_jr_GameData>(); ScrollingSpeed = base.gameObject.AddComponent <mg_jr_ScrollingSpeed>(); Odometer = base.gameObject.AddComponent <mg_jr_Odometer>(); Odometer.Init(m_gameBalance, m_minigame.GoalManager); m_timeToZoomCameraForTurbo = m_gameBalance.TurboCameraZoomRate * Mathf.Abs(1.1600001f); ScrollingSpeed.Init(m_gameBalance, Odometer); ScrollingSpeed.ScrollingEnabled = false; Player = m_minigame.Resources.GetPooledResourceByComponent <mg_jr_Penguin>(mg_jr_ResourceList.GAME_PREFAB_PENGUIN); Player.transform.parent = base.transform; GameObject pooledResource = m_minigame.Resources.GetPooledResource(mg_jr_ResourceList.GAME_PREFAB_EFFECT_TRANSITION); m_transition = pooledResource.GetComponent <mg_jr_Transition>(); m_transition.transform.parent = base.transform; GameObject gameObject = new GameObject("mg_jr_EnvironmentManager"); gameObject.transform.parent = base.transform; EnvironmentManager = gameObject.AddComponent <mg_jr_EnvironmentManager>(); GameObject gameObject2 = new GameObject("mg_jr_LevelContainer"); gameObject2.transform.parent = base.transform; m_levelManager = gameObject2.AddComponent <mg_jr_LevelManager>(); m_levelManager.Init(ScrollingSpeed, this); m_turboSpeedLines = m_minigame.Resources.GetPooledResourceByComponent <mg_jr_SpeedLineScreenFx>(mg_jr_ResourceList.PREFAB_TURBO_SPEEDLINES); m_turboSpeedLines.transform.parent = base.transform; m_turboSpeedLines.gameObject.SetActive(value: false); m_turboPlayArea = new Bounds(Vector3.zero, new Vector3(10f * Camera.main.aspect, 10f, 40f)); }
private void Awake() { Debug.Assert(explosionPrefab); odometer = GetComponent <Odometer>(); odometer.MaximumDistanceTravelled += OnMaximumDistanceTravelled; Debug.Assert(odometer.HasMaximumDistance); }
void Start() { respawn = GameObject.FindWithTag("Player").GetComponent <Respawn>(); deathScore = GameObject.FindWithTag("ScoreText").GetComponent <TMPro.TextMeshProUGUI>(); odometer = GameObject.FindWithTag("ScoreCanvas").GetComponent <Odometer>(); PlayerPrefs.SetFloat("HighScore", 0f); }
/// <summary> /// Get odometer with right sitance /// </summary> /// <param name="odometer"></param> /// <returns></returns> public static Double GetOdometerWithRightDistance(Odometer odometer) { if (odometer.Distance == currentDistance) { return odometer.Value; } var rate = GetExchangeDistanceFor(odometer.Distance, currentDistance); return Math.Round(odometer.Value * rate, 2); }
public void GetTheMeasurement() { // Arrange var od = new Odometer(new MilesMeasurement(100m, Units.Miles)); // Act var measurement = od.Measurement; // Assert measurement.Should().Be(new MilesMeasurement(100m, Units.Miles)); }
public void Odometers_WhenNotEqual_HashCodesNotEqual() { // Arrange var od1 = new Odometer(new MilesMeasurement(100m, Units.Miles)); var od2 = new Odometer(new MilesMeasurement(99m, Units.Miles)); // Act var hashCodesEqual = od1.GetHashCode() == od2.GetHashCode(); // Assert hashCodesEqual.Should().BeFalse(); }
public void Odometers_AreNotEqual() { // Arrange var od1 = new Odometer(new MilesMeasurement(100m, Units.Miles)); var od2 = new Odometer(new MilesMeasurement(99m, Units.Miles)); // Act var areEqual = od1 == od2; // Assert areEqual.Should().BeFalse(); }
private void Awake() { gameState = GameObject.FindWithTag("GameState").GetComponent <GameState>(); meter_start = GameObject.FindWithTag("StartingArea").GetComponent <Meter_Start>(); odometer = GameObject.FindWithTag("ScoreCanvas").GetComponent <Odometer>(); deathScreen = GameObject.FindWithTag("DeathScreen").GetComponent <DeathScreen>(); SpawnPoint = new Vector3(-4.77f, -2.365f, 0f); CameraResetPoint = new Vector3(1.17f, 1.19f, -1f); }
public Odometer GetOdometer(string VehicleId, string access_token) { var client = new RestClient("https://api.mercedes-benz.com/experimental/connectedvehicle/v1/vehicles/" + VehicleId + "/odometer"); var request = new RestRequest(Method.GET); request.AddHeader("Authorization", "Bearer " + access_token); request.AddHeader("Content-Type", "application/json"); request.AddHeader("Accept", "application/json"); IRestResponse response = client.Execute(request); Odometer JSONObj = JsonConvert.DeserializeObject <Odometer>(response.Content); return(JSONObj); }
public new void PrepareWPF() { try { dm = new Odometer(); dm.MeterMode = Odometer.Mode.Static; dm.InitialValue = 0; dm.FinalValue = (int)Math.Pow(10, Digits) - 1; dm.Loaded += Mc_Loaded; WPF.Child = dm; hideInfo(); } catch (XamlParseException ex) { } }
/// <summary> /// Increments the mileage. /// </summary> /// <param name="ode">odometer that contains the current mileage</param> public static void status(Odometer ode) { Odometer o = ode; try { Console.WriteLine("Press enter to increment the mileage by 1 mile."); if (Console.ReadKey().Key == ConsoleKey.Enter) { o.increment(); } } catch (Exception) { Console.Write("Press Enter to increment."); } }
private XElement GetOdometerElement(Odometer odometer) { var odometerElement = new XElement("odometer", odometer.Value); if (odometer.Status.HasValue) { odometerElement.Add(new XAttribute("status", odometer.Status.Value.ToString().ToLower())); } if (odometer.Unit.HasValue) { odometerElement.Add(new XAttribute("units", odometer.Unit.Value.ToString().ToLower())); } return(odometerElement); }
public async Task <bool> EnviarAsync([FromBody] Odometer odometer) { string connectionString = "Endpoint=sb://queuejess.servicebus.windows.net/;SharedAccessKeyName=Enviar;SharedAccessKey=sNf2UfOxLet90gXq03ChFxRaGL/cqy4avqGAVfKVSCk=;EntityPath=queueejercicios"; string queueName = "queueejercicios"; string mensaje = JsonConvert.SerializeObject(odometer); await using (ServiceBusClient client = new ServiceBusClient(connectionString)) { // create a sender for the queue ServiceBusSender sender = client.CreateSender(queueName); // create a message that we can send ServiceBusMessage message = new ServiceBusMessage(mensaje); // send the message await sender.SendMessageAsync(message); Console.WriteLine($"Sent a single message to the queue: {queueName}"); } return(true); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { try { VehicleInformation getVehicleInformation = new VehicleInformation(); TireStates getTireStates = new TireStates(); Location getLocation = new Location(); Odometer getOdometer = new Odometer(); FuelState getFuelState = new FuelState(); StateOfCharge getStateOfCharge = new StateOfCharge(); StateOfDoors getStateOfDoors = new StateOfDoors(); if (Request.QueryString["code"] != null) { string Access_token = VerifyAuthentication(Request.QueryString["code"]); string VehicleId = GetVehicleId(Access_token); getVehicleInformation = GetVehicleInformationById(VehicleId, Access_token); getTireStates = GetTireState(VehicleId, Access_token); getLocation = GetLocation(VehicleId, Access_token); getOdometer = GetOdometer(VehicleId, Access_token); getFuelState = GetFuelState(VehicleId, Access_token); getStateOfCharge = GetStateOfCharge(VehicleId, Access_token); getStateOfDoors = GetStateOfDoors(VehicleId, Access_token); string kapidurum = SetLockStateOfDoors(VehicleId, Access_token); if (kapidurum == "INITIATED") { } else { } } } catch (Exception ex) { Console.WriteLine(ex.Message); } } }
private static Vehicle Create( VehicleId id, Vin vin, Year year, Make make, Model model, Trim trim, Exterior exterior, Interior interior, Price price, Odometer odometer) { return(Vehicle.Create( id, vin, year, make, model, trim, exterior, interior, price, odometer)); }
static void Main() { //change the test file xml here and make sure it is in bin. string startingXMLFile = "ETRL_03_07.xml"; //string startingXMLFile = "FloorPlanTest.xml"; //string startingOpenFile = "Sloan46_FINAL.xml"; double compassToMapOffset = 72.0; // List of all the objects we'll be initializing. // Default to null, as some of them will only // be initialized conditionally e.g. // vehicle is only initialized if // there is a vehicle connected. SerialPort sp = null; IVehicle vehicle = null; IImageStream depthStream = null; IImageStream videoStream = null; IObstacleDetector obstacleDetector = null; ICartographer cartographer = null; IOdometer odometer = null; IInputDevice input = KeyboardInput.Instance; ObstacleMap obstacleMap = null; INavigator navigator = null; MainWindow mainWindow = null; Driver.Driver driver = null; VisualInputGridPresenter uiInputPresenter = null; ObstacleGridPresenter uiGridPresenter = null; PositioningSystem ips = null; OverlayRenderer overlayRenderer = null; SensorArray sensorArray = null; Pose pose = null; IDoorDetector doorDetector = null; ObstacleLocalizer obstacleLocalizer = null; SonarDetector sonarDetector = null; Config.Initialize(); Devices.Initialize(); //string wheelchair_com_port = Devices.IsWheelchairConnected(); string wheelchair_com_port = "COM3";//Devices.FindComPort("Arduino Uno"); bool WheelChairConnected = false; if (wheelchair_com_port != "") { WheelChairConnected = true; } //bool WheelChairConnected = true; bool EyeTribeConnected = true; // Devices.IsEyeTribeConnected(); bool ControllerConnected = true; //Devices.IsControllerConnected(); bool KinectConnected = true; //Devices.IsKinectConnected(); //Console.WriteLine("Kinect Connected: {0}", KinectConnected.ToString()); //Console.WriteLine("Eyetribe Connected: {0}", EyeTribeConnected.ToString()); //Console.WriteLine("Wheelchair Connected: {0}", WheelChairConnected.ToString()); //Console.WriteLine("Controller Connected: {0}", ControllerConnected.ToString()); // Initialize vehicle and serial connection if // there is a vehicle connected. if (WheelChairConnected) { //sp = new SerialPort(wheelchair_com_port, 9600); vehicle = Wheelchair.Instance(wheelchair_com_port); vehicle.initializeOffset(Properties.Settings.Default.CalibrationOffset); } else { vehicle = new MockVehicle(); MockVehicleWindow mockDisplay = new MockVehicleWindow((MockVehicle)vehicle); mockDisplay.Show(); } //initalize IPS here IByteReader sensorReader = null; try { //sensorReader = new SerialByteReader("Arduino Mega"); sensorReader = new SerialByteReader("COM4"); } catch (Exception e) { MessageBox.Show(e.Message); } if (sensorReader != null) { ILogger logger = new NullLogger(); sensorArray = new SensorArray(sensorReader, logger); sonarDetector = new SonarDetector(); } else { sensorReader = new NullByteReader(); ILogger logger = new NullLogger(); sensorArray = new SensorArray(sensorReader, logger); } IByteReader byteReader = null; try { //byteReader = new SerialByteReader(Devices.FindComPort("STMicroelectronics")); byteReader = new SerialByteReader("COM3"); } catch (Exception e) { MessageBox.Show(e.Message); } if (byteReader != null) { ILogger logger = new NullLogger(); ips = new MarvelMind(byteReader, logger); } else { //Setup Mock IPS //IByteReader mockByteReader = new FileByteReader(@"C:\Users\Dana\Documents\Visual Studio 2013\Projects\UITests\UITests\Mock_IPS_Data.txt"); //IByteReader mockByteReader = new XLineFixedYByteReader(800, 100, 200); IByteReader mockByteReader = new RandomByteReader(300, 299); ILogger mockLogger = new NullLogger(); ips = new MarvelMind(mockByteReader, mockLogger); } //wait for an iteration of the IPS system that way //we can get the starting location while (false == ips.XUpdated && false == ips.YUpdated) { continue; } //Tuple<double, double> t = new Tuple<double, double>((double)ips.X, (double)ips.Y); Tuple <double, double> t = new Tuple <double, double>((double)ips.Y, (double)ips.X); mPoint startingLocationInXY = new mPoint(t); // UI, input, object detection, navigation, and driver are initialized always, // as they are not directly dependent on external hardware. obstacleMap = new ObstacleMap(); //cartographer = new Cartographer(Directory.GetCurrentDirectory() + @"\FloorPlanTest.xml", ips); // might need to be changed later. If the location is not in the starting room. add staring room. //cartographer = new Cartographer(Directory.GetCurrentDirectory() + @"\FloorPlanTest.xml", startingLocationInXY); OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "XML | *.xml"; ofd.Title = "Open Map"; if (ofd.ShowDialog() == true) { startingXMLFile = ofd.FileName; Console.WriteLine(startingXMLFile); } cartographer = new Cartographer(startingXMLFile, startingLocationInXY); pose = new Pose(ips, cartographer.GetStartingRoom(), sensorArray.CompassDevice, compassToMapOffset); overlayRenderer = new OverlayRenderer(); if (KinectConnected) { depthStream = DepthStream.Instance; videoStream = VideoStream.Instance; // Initialize depthstream if kinect is connected. obstacleDetector = new ObstacleDetector(depthStream, false); obstacleDetector.Start(); obstacleLocalizer = new ObstacleLocalizer(pose); ObstaclesOverlay obstaclesOverlay = new ObstaclesOverlay(obstacleDetector); overlayRenderer.Overlays.Add(obstaclesOverlay); doorDetector = new DepthBasedDoorDetector(); doorDetector.RunAsync(depthStream); try { sonarDetector.RunAsync(sensorArray); } catch (Exception e) { } } // Obstacle detector and driver are only run // if both the vehicle and kinect are connected. if (vehicle != null && KinectConnected) { Vector startPoint = new Vector(7 / 0.75f, 43 / 0.75f); Vector startRotation = new Vector(-7, -43); startRotation.Normalize(); odometer = new Odometer(); navigator = new Navigator(obstacleMap, obstacleDetector, obstacleLocalizer, cartographer, doorDetector, pose, sonarDetector, sensorArray); driver = new Driver.Driver(input, vehicle, navigator); driver.Start(); } mainWindow = new MainWindow(pose, obstacleMap, cartographer, navigator, doorDetector, overlayRenderer, EyeTribeConnected, ControllerConnected, sensorArray); uiInputPresenter = new VisualInputGridPresenter(mainWindow.visualInputGrid); //This starts the program. Application app = new Application(); app.ShutdownMode = ShutdownMode.OnMainWindowClose; app.MainWindow = mainWindow; app.MainWindow.Show(); app.Run(); }
void ReleaseDesignerOutlets() { if (Back != null) { Back.Dispose(); Back = null; } if (Dashboard != null) { Dashboard.Dispose(); Dashboard = null; } if (Front != null) { Front.Dispose(); Front = null; } if (Left != null) { Left.Dispose(); Left = null; } if (Odometer != null) { Odometer.Dispose(); Odometer = null; } if (Right != null) { Right.Dispose(); Right = null; } if (Rim != null) { Rim.Dispose(); Rim = null; } if (Seat != null) { Seat.Dispose(); Seat = null; } if (Seats != null) { Seats.Dispose(); Seats = null; } if (VIN != null) { VIN.Dispose(); VIN = null; } }
private async void setPersistedImage() { UIImage rightImage = LoadImage("right"); if (rightImage != null) { Right.SetBackgroundImage(rightImage, UIControlState.Normal); Right.TintColor = UIColor.Clear; AppDelegate.appDelegate.RightCarImageUploaded = true; Right.Layer.BorderColor = UIColor.Black.CGColor; } else { await setPersistImageOnlineAsync("right"); rightImage = LoadImage("right"); if (rightImage != null) { rightImage = LoadImage("right"); Right.SetBackgroundImage(rightImage, UIControlState.Normal); Right.TintColor = UIColor.Clear; AppDelegate.appDelegate.RightCarImageUploaded = true; Right.Layer.BorderColor = UIColor.Black.CGColor; } } UIImage leftImage = LoadImage("left"); if (leftImage != null) { Left.TintColor = UIColor.Clear; Left.SetBackgroundImage(leftImage, UIControlState.Normal); AppDelegate.appDelegate.LeftCarImageUploaded = true; Left.Layer.BorderColor = UIColor.Black.CGColor; } else { await setPersistImageOnlineAsync("left"); leftImage = LoadImage("left"); if (leftImage != null) { leftImage = LoadImage("left"); Left.SetBackgroundImage(leftImage, UIControlState.Normal); Left.TintColor = UIColor.Clear; AppDelegate.appDelegate.LeftCarImageUploaded = true; Left.Layer.BorderColor = UIColor.Black.CGColor; } } UIImage frontImage = LoadImage("front"); if (frontImage != null) { Front.TintColor = UIColor.Clear; Front.SetBackgroundImage(frontImage, UIControlState.Normal); AppDelegate.appDelegate.FrontCarImageUploaded = true; Front.Layer.BorderColor = UIColor.Black.CGColor; } else { await setPersistImageOnlineAsync("front"); frontImage = LoadImage("front"); if (frontImage != null) { frontImage = LoadImage("front"); Front.SetBackgroundImage(frontImage, UIControlState.Normal); Front.TintColor = UIColor.Clear; AppDelegate.appDelegate.FrontCarImageUploaded = true; Front.Layer.BorderColor = UIColor.Black.CGColor; } } UIImage backImage = LoadImage("back"); if (backImage != null) { Back.TintColor = UIColor.Clear; Back.SetBackgroundImage(backImage, UIControlState.Normal); AppDelegate.appDelegate.BackCarImageUploaded = true; Back.Layer.BorderColor = UIColor.Black.CGColor; } else { await setPersistImageOnlineAsync("back"); backImage = LoadImage("back"); if (backImage != null) { backImage = LoadImage("back"); Back.SetBackgroundImage(backImage, UIControlState.Normal); Back.TintColor = UIColor.Clear; AppDelegate.appDelegate.BackCarImageUploaded = true; Back.Layer.BorderColor = UIColor.Black.CGColor; } } UIImage seatImage = LoadImage("seat"); if (seatImage != null) { Seat.TintColor = UIColor.Clear; Seat.SetBackgroundImage(seatImage, UIControlState.Normal); AppDelegate.appDelegate.SeatCarImageUploaded = true; Left.Layer.BorderColor = UIColor.Black.CGColor; } else { await setPersistImageOnlineAsync("seat"); seatImage = LoadImage("seat"); if (seatImage != null) { seatImage = LoadImage("seat"); Seat.SetBackgroundImage(seatImage, UIControlState.Normal); Seat.TintColor = UIColor.Clear; AppDelegate.appDelegate.SeatCarImageUploaded = true; Seat.Layer.BorderColor = UIColor.Black.CGColor; } } UIImage seatsImage = LoadImage("seats"); if (seatsImage != null) { Seats.TintColor = UIColor.Clear; Seats.SetBackgroundImage(seatsImage, UIControlState.Normal); AppDelegate.appDelegate.BackSeatImageUploaded = true; Seats.Layer.BorderColor = UIColor.Black.CGColor; } else { await setPersistImageOnlineAsync("seats"); seatsImage = LoadImage("seats"); if (seatsImage != null) { seatsImage = LoadImage("seats"); Seats.SetBackgroundImage(seatsImage, UIControlState.Normal); Seats.TintColor = UIColor.Clear; AppDelegate.appDelegate.BackSeatImageUploaded = true; Seats.Layer.BorderColor = UIColor.Black.CGColor; } } UIImage dashImage = LoadImage("dashboard"); if (dashImage != null) { Dashboard.TintColor = UIColor.Clear; Dashboard.SetBackgroundImage(dashImage, UIControlState.Normal); AppDelegate.appDelegate.DashBoardImageUploaded = true; Dashboard.Layer.BorderColor = UIColor.Black.CGColor; } else { await setPersistImageOnlineAsync("dashboard"); dashImage = LoadImage("dashboard"); if (dashImage != null) { dashImage = LoadImage("dashboard"); Dashboard.SetBackgroundImage(dashImage, UIControlState.Normal); Dashboard.TintColor = UIColor.Clear; AppDelegate.appDelegate.DashBoardImageUploaded = true; Dashboard.Layer.BorderColor = UIColor.Black.CGColor; } } UIImage odoImage = LoadImage("odometer"); if (odoImage != null) { Odometer.TintColor = UIColor.Clear; Odometer.SetBackgroundImage(odoImage, UIControlState.Normal); AppDelegate.appDelegate.OdometerImageUploaded = true; Odometer.Layer.BorderColor = UIColor.Black.CGColor; } else { await setPersistImageOnlineAsync("odometer"); odoImage = LoadImage("odometer"); if (odoImage != null) { odoImage = LoadImage("odometer"); Odometer.SetBackgroundImage(odoImage, UIControlState.Normal); Odometer.TintColor = UIColor.Clear; AppDelegate.appDelegate.OdometerImageUploaded = true; Odometer.Layer.BorderColor = UIColor.Black.CGColor; } } UIImage rimImage = LoadImage("rim"); if (rimImage != null) { Rim.TintColor = UIColor.Clear; Rim.SetBackgroundImage(rimImage, UIControlState.Normal); AppDelegate.appDelegate.RimImageUploaded = true; Rim.Layer.BorderColor = UIColor.Black.CGColor; } else { await setPersistImageOnlineAsync("rim"); rimImage = LoadImage("rim"); if (rimImage != null) { rimImage = LoadImage("rim"); Rim.SetBackgroundImage(rimImage, UIControlState.Normal); Rim.TintColor = UIColor.Clear; AppDelegate.appDelegate.RimImageUploaded = true; Rim.Layer.BorderColor = UIColor.Black.CGColor; } } UIImage vinImage = LoadImage("VIN"); if (vinImage != null) { VIN.TintColor = UIColor.Clear; VIN.SetBackgroundImage(vinImage, UIControlState.Normal); AppDelegate.appDelegate.VINImageUplaoded = true; VIN.Layer.BorderColor = UIColor.Black.CGColor; } else { await setPersistImageOnlineAsync("VIN"); vinImage = LoadImage("VIN"); if (vinImage != null) { vinImage = LoadImage("VIN"); VIN.SetBackgroundImage(vinImage, UIControlState.Normal); VIN.TintColor = UIColor.Clear; AppDelegate.appDelegate.VINImageUplaoded = true; VIN.Layer.BorderColor = UIColor.Black.CGColor; } } InvokeOnMainThread(() => { var splitViewController = (UISplitViewController)AppDelegate.appDelegate.Window.RootViewController; Utility.HideLoadingIndicator(splitViewController.View); }); }
public void setImage(UIImage Image) { switch (currentButton) { case "front": Front.TintColor = UIColor.Clear; Front.SetBackgroundImage(Image, UIControlState.Normal); AppDelegate.appDelegate.FrontCarImageUploaded = true; Front.Layer.BorderColor = UIColor.Black.CGColor; // Right_Image.SizeToFit(); break; case "back": Back.TintColor = UIColor.Clear; Back.SetBackgroundImage(Image, UIControlState.Normal); // Left_Image.SetBackgroundImage(Image, UIControlState.Normal); AppDelegate.appDelegate.BackCarImageUploaded = true; Back.Layer.BorderColor = UIColor.Black.CGColor; break; case "right": Right.TintColor = UIColor.Clear; Right.SetBackgroundImage(Image, UIControlState.Normal); AppDelegate.appDelegate.RightCarImageUploaded = true; Right.Layer.BorderColor = UIColor.Black.CGColor; /// Front.SetBackgroundImage(Image, UIControlState.Normal); break; case "left": Left.TintColor = UIColor.Clear; Left.SetBackgroundImage(Image, UIControlState.Normal); AppDelegate.appDelegate.LeftCarImageUploaded = true; Left.Layer.BorderColor = UIColor.Black.CGColor; /// Odometer.SetBackgroundImage(Image, UIControlState.Normal); break; case "seat": Seat.TintColor = UIColor.Clear; Seat.SetBackgroundImage(Image, UIControlState.Normal); ///Seat.SetBackgroundImage(Image, UIControlState.Normal); AppDelegate.appDelegate.SeatCarImageUploaded = true; Seat.Layer.BorderColor = UIColor.Black.CGColor; break; case "seats": Seats.TintColor = UIColor.Clear; Seats.SetBackgroundImage(Image, UIControlState.Normal); AppDelegate.appDelegate.BackSeatImageUploaded = true; Seats.Layer.BorderColor = UIColor.Black.CGColor; ///Seat.SetBackgroundImage(Image, UIControlState.Normal); break; case "dashboard": Dashboard.TintColor = UIColor.Clear; Dashboard.SetBackgroundImage(Image, UIControlState.Normal); AppDelegate.appDelegate.DashBoardImageUploaded = true; Dashboard.Layer.BorderColor = UIColor.Black.CGColor; break; case "odometer": Odometer.TintColor = UIColor.Clear; Odometer.SetBackgroundImage(Image, UIControlState.Normal); AppDelegate.appDelegate.OdometerImageUploaded = true; Odometer.Layer.BorderColor = UIColor.Black.CGColor; break; case "rim": Rim.TintColor = UIColor.Clear; Rim.SetBackgroundImage(Image, UIControlState.Normal); AppDelegate.appDelegate.RimImageUploaded = true; Rim.Layer.BorderColor = UIColor.Black.CGColor; break; case "VIN": VIN.TintColor = UIColor.Clear; VIN.SetBackgroundImage(Image, UIControlState.Normal); AppDelegate.appDelegate.VINImageUplaoded = true; VIN.Layer.BorderColor = UIColor.Black.CGColor; break; default: Console.WriteLine("Invalid selection. Please select 1, 2, or 3."); break; } }
IEnumerator SaveSkin() { SkinElement currentSkinElement = new SkinElement(); currentSkinElement.id = skinTagId; currentSkinElement.xCoord = transform.localPosition.x.ToString(); currentSkinElement.yCoord = transform.localPosition.y.ToString(); currentSkinElement.backsprite = ""; currentSkinElement.tagname = skinTag; currentSkinElement.foresprite = ""; if (gameObject.GetComponent <Odometer>() != null) { prizeODO = gameObject.GetComponent <Odometer>(); currentSkinElement.backcolor = ColorToHex(prizeODO.backBackgroundColor); currentSkinElement.forecolor = ColorToHex(prizeODO.backgroundColor); currentSkinElement.textcolor = ColorToHex(prizeODO.fontColor); } if (gameObject.GetComponent <OdometerDigit>() != null) { PrizeODODollarSign = gameObject.GetComponent <OdometerDigit>(); currentSkinElement.backcolor = ColorToHex(PrizeODODollarSign.backBackgroundColor); currentSkinElement.forecolor = ColorToHex(PrizeODODollarSign.backgroundColor); currentSkinElement.textcolor = ColorToHex(PrizeODODollarSign.fontColor); } if (gameObject.GetComponent <UILabel>() != null) { UILabel currentLabel = gameObject.GetComponent <UILabel>(); currentSkinElement.bordercolor = ColorToHex(currentLabel.effectColor); currentSkinElement.textcolor = ColorToHex(currentLabel.color); } if (gameObject.GetComponent <TextMeshPro>() != null) { TextMeshPro currentLabel = gameObject.GetComponent <TextMeshPro>(); //currentSkinElement.bordercolor = ColorToHex(currentLabel.effectColor); currentLabel.faceColor = currentLabel.color; } if (gameObject.name == ("Camera")) { currentSkinElement.backcolor = ColorToHex(gameObject.GetComponent <Camera>().backgroundColor); } if (bg != null) { currentSkinElement.backcolor = ColorToHex(bg.color); } if (bordercolor != null) { currentSkinElement.bordercolor = ColorToHex(bordercolor.color); } if (gameObject.GetComponent <UILabel>() != null) { } if (txtcolor != null) { currentSkinElement.textcolor = ColorToHex(txtcolor.color); } if (bgsprite != null) { currentSkinElement.width = bgsprite.width.ToString(); currentSkinElement.height = bgsprite.height.ToString(); } var form = new WWWForm(); form.AddField("action", "SaveSkinSettings"); form.AddField("appVersion", Application.version); form.AddField("macAddress", DisplayManager.displayManager.macAddress); form.AddField("skinData", JsonUtility.ToJson(currentSkinElement)); // Start a download of the given URL WWW www = new WWW(DisplayManager.displayManager.url, form); // Wait for download to complete yield return(www); Debug.Log(www.text); }
public void Skinit() { SkinElement SE = DisplayManager.displayManager.currentScene.sceneSkin.skinData.Find(se => (se.tagname.Equals(skinTag))); if (SE) { this.skinTagId = SE.id; this.skinId = DisplayManager.displayManager.currentScene.sceneSkin.skinID; this.skinName = DisplayManager.displayManager.currentScene.sceneSkin.skinName; if (SE != null) { if (fg != null) { fg.color = HexToColor(SE.forecolor); } if (gameObject.GetComponent <Odometer>() != null) { prizeODO = gameObject.GetComponent <Odometer>(); prizeODO.backBackgroundColor = HexToColor(SE.backcolor); prizeODO.backgroundColor = HexToColor(SE.forecolor); prizeODO.fontColor = HexToColor(SE.textcolor); } if (gameObject.GetComponent <OdometerDigit>() != null) { PrizeODODollarSign = gameObject.GetComponent <OdometerDigit>(); PrizeODODollarSign.backBackgroundColor = HexToColor(SE.backcolor); PrizeODODollarSign.backgroundColor = HexToColor(SE.forecolor); PrizeODODollarSign.fontColor = HexToColor(SE.textcolor); } if (gameObject.GetComponent <UILabel>() != null) { UILabel currentLabel = gameObject.GetComponent <UILabel>(); currentLabel.effectColor = HexToColor(SE.bordercolor); currentLabel.color = HexToColor(SE.textcolor); } if (gameObject.GetComponent <TextMeshPro>() != null) { TextMeshPro currentLabel = gameObject.GetComponent <TextMeshPro>(); currentLabel.color = HexToColor(SE.textcolor); } if (gameObject.name == ("Camera")) { gameObject.GetComponent <Camera>().backgroundColor = HexToColor(SE.backcolor); } if (bg != null) { bg.color = HexToColor(SE.backcolor); } if (bordercolor != null) { bordercolor.color = HexToColor(SE.bordercolor); } if (gameObject.GetComponent <UILabel>() != null) { if (bordercolor == null) { txtcolor.effectStyle = UILabel.Effect.Outline; txtcolor.effectColor = HexToColor(SE.bordercolor); } } if (txtcolor != null) { txtcolor.color = HexToColor(SE.textcolor); } if (txtColorTM) { txtColorTM.color = HexToColor(SE.textcolor); } if (bgsprite != null) { if (skinTag.Equals("Logo")) { bgsprite.atlas = GameObject.FindGameObjectWithTag("Skin").GetComponent <UIAtlas>(); } if (SE.backsprite.Equals("DefaultLogo")) { bgsprite.spriteName = DisplayManager.displayManager.displayData.DefaultLogo; } else { bgsprite.spriteName = SE.backsprite; } int number; bool result = Int32.TryParse(SE.width, out number); if (result) { bgsprite.width = int.Parse(SE.width); } else { Debug.Log("Couldn't parse bgsprite width:" + SE.tagname); } result = Int32.TryParse(SE.height, out number); if (result) { bgsprite.height = int.Parse(SE.height); } else { Debug.Log("Couldn't parse bgsprite height:" + SE.tagname); } } if (!string.IsNullOrEmpty(SE.xCoord) && !string.IsNullOrEmpty(SE.yCoord)) { Vector3 temp = new Vector3(float.Parse(SE.xCoord), float.Parse(SE.yCoord), 0); transform.localPosition = temp; } } else { //Debug.Log("Can't Find:" +skinTag); } } }
// Use this for initialization void Start() { startingPosition = new Vector3(-150, startingPosition.y - 450, startingPosition.z); theODO = gameObject.GetComponent <Odometer>(); }
/// <summary> /// Constructor. /// </summary> /// <param name="_odometer"></param> public TripInfo(Odometer _odometer) { this._odometer = _odometer; this._tripA = _odometer.currentMileage(); this._tripB = _odometer.currentMileage(); }