Exemplo n.º 1
0
	public void InitAudio()
	{
		gameVolume = GameObject.Find("2DAudio").GetComponent<Volume>();
		
		if (GameObject.Find("musicSlider") != null &&
		    GameObject.Find("soundFXSlider")!= null &&
		    GameObject.Find("dialogueSlider") != null)
		{
			musicSlider = GameObject.Find("musicSlider").GetComponent<UISlider>();
			soundFXSlider = GameObject.Find("soundFXSlider").GetComponent<UISlider>();
			dialogueSlider = GameObject.Find("dialogueSlider").GetComponent<UISlider>();


			if (!PlayerPrefs.HasKey("MusicVol"))
				gameVolume.MusicVolume = musicSlider.value;
			else
				musicSlider.value = PlayerPrefs.GetFloat("MusicVol");
			
			if (!PlayerPrefs.HasKey("SoundFXVol"))
				gameVolume.AmbienceVolume = soundFXSlider.value;
			else
				soundFXSlider.value = PlayerPrefs.GetFloat("SoundFXVol");
			
			if (!PlayerPrefs.HasKey("DialogueVol"))
				gameVolume.AIVolume = dialogueSlider.value;
			else
				dialogueSlider.value = PlayerPrefs.GetFloat("DialogueVol");

		}

	}
Exemplo n.º 2
0
 /// <summary>Iterates over all the blocks contained in a volume.</summary>
 public static void BlocksInVolume(Volume volume, Action<CoordinateInt> action)
 {
     for (int x = 0; x < volume.ScaleX; x++)
         for (int y = 0; y < volume.ScaleY; y++)
             for (int z = 0; z < volume.ScaleZ; z++)
                 action(volume.Coord.Offset(x, y, z));
 }
        public Volume GetVolume(string ComicVineVolumeRequestXMLResponse)
        {
            var volume = new Volume();
            var xDoc = XDocument.Parse(ComicVineVolumeRequestXMLResponse);
            volume.id = ParseHelper.ParseInt((string)xDoc.Descendants("id").Where(p => p.Parent.Name.LocalName == "results").FirstOrDefault() ?? "0");
            volume.name = (string)xDoc.Descendants("name").Where(p => p.Parent.Name.LocalName == "results").FirstOrDefault() ?? "";
            volume.description = (string)xDoc.Descendants("description").Where(p => p.Parent.Name.LocalName == "results").FirstOrDefault() ?? "";
            volume.dateAdded = ParseHelper.ParseDateTime((string)xDoc.Descendants("date_added").Where(p => p.Parent.Name.LocalName == "results").FirstOrDefault() ?? "");
            volume.dateLastUpdated = ParseHelper.ParseDateTime((string)xDoc.Descendants("date_last_updated").Where(p => p.Parent.Name.LocalName == "results").FirstOrDefault() ?? "");
            volume.countOfIssues = ParseHelper.ParseInt((string)xDoc.Descendants("count_of_issues").Where(p => p.Parent.Name.LocalName == "results").FirstOrDefault() ?? "0");
            volume.startYear = ParseHelper.ParseInt((string)xDoc.Descendants("start_year").Where(p => p.Parent.Name.LocalName == "results").FirstOrDefault() ?? "0");
            volume.publisherId = ParseHelper.ParseInt((string)xDoc.Descendants("id").Where(p => p.Parent.Name.LocalName == "publisher").FirstOrDefault() ?? "0");
            volume.collectable = true;

            if (volume.dateLastUpdated > DateTime.Now.AddMonths(-13))
            {
                volume.complete = false;
            }
            else
            {
                volume.complete = true;
            }

            reprintDetector.DetectReprint(volume);
            return volume;
        }
        public void analyzeAudio(byte[] audioBuffer, float[] energy)
        {
            this.audioBuffer = audioBuffer;
            this.energy = energy;
            this.averageVolume = 0;

            calcAverageVolume();
            calcIsSpeaking();
            if(isSpeaking)
            {
                TimeSpan speaking = new TimeSpan(startedSpeaking.Ticks);
                TimeSpan now = new TimeSpan(DateTime.Now.Ticks);
                if (now.TotalMilliseconds - speaking.TotalMilliseconds > ThresholdActuallySpeaking)
                {
                    assignSpeakingVolume();
                    calcSpeakingTime();
                }
                else
                {
                    voiceVolume = Volume.good;
                    calcPausingTime();
                }
            }
            else
            {
                voiceVolume = Volume.good;
                calcPausingTime();
            }

        }
 [Test] public void can_use_mass_volume_constructor() {
     Mass m = new Mass(10, MassUnit.Pounds);
     Volume v = new Volume(2, VolumeUnit.Gallons);
     var d = new Density(m, v);
     d.Mass.ShouldEqual(m);
     d.Volume.ShouldEqual(v);
 }
Exemplo n.º 6
0
 public void AdjustVolume(Volume volume)
 {
     switch (volume)
     {
         case Volume.low:
             MasterVolume = volume;
             break;
         case Volume.medium:
             MasterVolume = volume;
             break;
         case Volume.medium_high:
             MasterVolume = volume;
             break;
         case Volume.high:
             MasterVolume = volume;
             break;
         case Volume.mute:
             masterVolume = 0f;
             MasterVolume = volume;
             break;
         default:
             AdjustVolume(Volume.medium);
             break;
     }
 }
 public void VerifyAllEnums()
 {
     var acceleration = new Acceleration(1, AccelerationUnit.BaseUnit);
     var angle = new Angle(1, AngleUnit.BaseUnit);
     var angularAcceleration = new AngularAcceleration(1, AngularAccelerationUnit.BaseUnit);
     var area = new Area(1, AreaUnit.BaseUnit);
     var density = new MassDensity(1, MassDensityUnit.BaseUnit);
     var electricCurrent = new ElectricCurrent(1, ElectricCurrentUnit.BaseUnit);
     var electricResistance = new ElectricResistance(1, ElectricResistanceUnit.BaseUnit);
     var electricVoltage = new ElectricPotential(1, ElectricPotentialUnit.BaseUnit);
     var energy = new Energy(1, EnergyUnit.BaseUnit);
     var force = new Force(1, ForceUnit.BaseUnit);
     var frequency = new Frequency(1, FrequencyUnit.BaseUnit);
     var jerk = new Jerk(1, JerkUnit.BaseUnit);
     var length = new Length(1, LengthUnit.BaseUnit);
     var mass = new Mass(1, MassUnit.BaseUnit);
     var massFlowRate = new MassFlowRate(1, MassFlowRateUnit.BaseUnit);
     var momentum = new Momentum(1, MomentumUnit.BaseUnit);
     var numeric = new Numeric(1, NumericUnit.BaseUnit);
     var power = new Power(1, PowerUnit.BaseUnit);
     var pressure = new Pressure(1, PressureUnit.BaseUnit);
     var speed = new Speed(1, SpeedUnit.BaseUnit);
     var temperature = new Temperature(1, TemperatureUnit.BaseUnit);
     var time = new Time(1, TimeUnit.BaseUnit);
     var torque = new Torque(1, TorqueUnit.BaseUnit);
     var volume = new Volume(1, VolumeUnit.BaseUnit);
     var volumetricFlowRate = new VolumetricFlowRate(1, VolumetricFlowRateUnit.BaseUnit);
 }
Exemplo n.º 8
0
    void detector_Collided(Volume collisonObject, Voxel voxel, Vector3 worldPosition)
    {
        // If the bullet hits an invader and is owned by the player, explode and destroy the invader - and deactivate the bullet
        if (collisonObject.name == "Invader" && Owner is InvadersPlayerShip)
        {
            collisonObject.Destruct(3f, true);
            Destroy(collisonObject.gameObject);
            gameObject.SetActive(false);
        }

        // If we hit a shield, just explode and deactivate the bullet
        if (collisonObject.name == "Shield")
        {
            exploder.ExplosionRadius = 1f;
            exploder.Explode();
            gameObject.SetActive(false);
        }

        // If we hit the player ship
        if (collisonObject.name == "Player Ship")
        {
            collisonObject.Destruct(3f, true);
            collisonObject.GetComponent<InvadersPlayerShip>().Die();
            gameObject.SetActive(false);
        }
    }
Exemplo n.º 9
0
 public void Power_LengthRaisedWith3_ReturnsVolume()
 {
     var expected = new Volume(1.0, Volume.CubicDeciMeter);
     var len = new Measure<Length>(1.0, Length.DeciMeter);
     Volume actual; ArithmeticOperations.Power(len, 3, out actual);
     MeasureAssert.AmountsAreEqual(expected, actual);
 }
Exemplo n.º 10
0
        public void VolumeCreate()
        {
            Configure();
            volume = new Volume
            {
                Properties = new VolumeProperties
                {
                    Size = 4,
                    Image = imageId,
                    Type = "HDD",
                    Name = ".Net V2 - Test " + DateTime.Now.ToShortTimeString(),
                    SshKeys = new System.Collections.Generic.List<string> { "hQGOEJeFL91EG3+l9TtRbWNjzhDVHeLuL3NWee6bekA=" }
                }
            };
            volume = volumeApi.Create(datacenter.Id, volume);

            bool isBusy = true;

            while (isBusy == true)
            {
                var dc = dcApi.FindById(datacenter.Id);
                if (dc.Metadata.State != "BUSY") isBusy = false;
                Thread.Sleep(1500);
            }

            Assert.IsNotNull(volume);
        }
 public void OpAddition()
 {
     var volume1 = new Volume(3600, VolumeUnit.Liters);
     var volume2 = new Volume(1, VolumeUnit.CubicMeters);
     var expected = new Volume(4600, VolumeUnit.Liters);
     (volume1 + volume2).ShouldEqual(expected);
     (volume2 + volume1).ShouldEqual(expected);
 }
Exemplo n.º 12
0
 public void Divide_DivideVolumeAndLength_ReturnsArea()
 {
     var expected = new Area(4.0);
     var numerator = new Volume(8.0);
     var denominator = new Length(200.0, Length.CentiMeter);
     Area actual; ArithmeticOperations.Divide(numerator, denominator, out actual);
     MeasureAssert.MeasuresAreEqual(expected, actual);
 }
Exemplo n.º 13
0
 public void Times_MultiplyAreaAndLength_ReturnsVolume()
 {
     var expected = new Volume(6.0);
     var lhs = new Area(2.0);
     var rhs = new Length(3.0);
     Volume actual; ArithmeticOperations.Times(lhs, rhs, out actual);
     MeasureAssert.MeasuresAreEqual(expected, actual);
 }
Exemplo n.º 14
0
 private Volume GetVolumeWithRangeCheck(Volume volume)
 {
     if (volume.CheckRange(shared.Vessel))
     {
         return volume;
     }
     throw new Exception("Volume is out of range");
 }
Exemplo n.º 15
0
 private void detector_Collided(Volume collisonObject, Voxel voxel, Vector3 worldPosition)
 {
     if (collisonObject.name.StartsWith("Plane") && Owner is ShmupChopper)
     {
         collisonObject.GetComponent<ShmupPlane>().Die();
         gameObject.SetActive(false);
     }
 }
Exemplo n.º 16
0
 public Shape(Point center, Volume volume, Contour contour, ConvexHull convexHull, IList<Point> points)
 {
     this.center = center;
     this.volume = volume;
     this.contour = contour;
     this.convexHull = convexHull;
     this.points = points;
 }
Exemplo n.º 17
0
        public bool Save(Volume volume)
        {
            if (VolumeExists(volume.id))
            {
                return Update(volume);
            }

            return Insert(volume);
        }
 public void OpInverseEquals()
 {
     var volume1 = new Volume(3600, VolumeUnit.Liters);
     var volume2 = new Volume(3.6, VolumeUnit.CubicMeters);
     var volume3 = new Volume(5, VolumeUnit.CubicMeters);
     (volume1 != volume2).ShouldBeFalse();
     (volume2 != volume1).ShouldBeFalse();
     (volume1 != volume3).ShouldBeTrue();
     (volume3 != volume1).ShouldBeTrue();
 }
        public void OpDivision()
        {
            var volume1 = new Volume(3600, VolumeUnit.Liters);
            var volume2 = new Volume(3.6, VolumeUnit.CubicMeters);
            (volume1 / volume2).ShouldBeWithinEpsilonOf(1);
            (volume2 / volume1).ShouldBeWithinEpsilonOf(1);

            (volume1 / 2).ShouldEqual(new Volume(1800, VolumeUnit.Liters));
            (volume2 / 2).ShouldEqual(new Volume(1.8, VolumeUnit.CubicMeters));
        }
Exemplo n.º 20
0
        public void Mute_and_unmute()
        {
            var volume = new Volume();

            volume.Mute();
            Assert.That(volume.Muted, Is.True);

            volume.Unmute();
            Assert.That(volume.Muted, Is.False);
        }
 public void OpGreaterThanOrEqual()
 {
     var volume1 = new Volume(3600, VolumeUnit.Liters);
     var volume2 = new Volume(3.6, VolumeUnit.CubicMeters);
     var volume3 = new Volume(5, VolumeUnit.CubicMeters);
     (volume1 >= volume3).ShouldBeFalse();
     (volume3 >= volume1).ShouldBeTrue();
     (volume1 >= volume2).ShouldBeTrue();
     (volume2 >= volume1).ShouldBeTrue();
 }
Exemplo n.º 22
0
 string GetPath(Volume volume)
 {
     var path = Path.Combine(DirectoryName, string.Join("\\", volume.Number.ToString(
         CultureInfo.InvariantCulture).Select(ch => ch.ToString()).ToArray()));
     if (!Directory.Exists(path)) {
         Log.Verbose("Creating {0}...", path);
         Directory.CreateDirectory(path);
     }
     return Path.Combine(path, PathUtility.GetChildName(volume.URL));
 }
Exemplo n.º 23
0
    public static void Main(string[] args)
    {
        int selection = 0;
        double length, height, radius, volume;
        Volume vol = new Volume();

        while (selection != 4)
        {
            selection = 0;
            while (selection < 1 || selection > 4)
            {
                Console.WriteLine("1. Cube Volume\n2. Cylinder Volume\n3. Sphere Volume\n4. Exit");
                Console.Write("Select from the menu: ");
                // Need to add exception handling here
                try
                {
                    selection = int.Parse(Console.ReadLine());
                }
                catch
                {
                    Console.WriteLine("Select a valid option!");
                    selection = 0;
                }
            }
            Console.WriteLine();

            switch (selection)
            {
                case 1:
                    Console.Write("Enter the length of a cube side: ");
                    length = Convert.ToDouble(Console.ReadLine());
                    volume = vol.cubeVolume(length);
                    Console.WriteLine("The volume of the Cube is {0:0.00}", volume);
                    break;
                case 2:
                    Console.Write("Enter the radius of the cylinder: ");
                    radius = Convert.ToDouble(Console.ReadLine());
                    Console.Write("Enter the height of the cylinder: ");
                    height = Convert.ToDouble(Console.ReadLine());
                    volume = vol.cylinderVolume(height, radius);
                    Console.WriteLine("The volume of the cylinder is {0:0.00}", volume);
                    break;
                case 3:
                    Console.Write("Enter the radius of the sphere: ");
                    radius = Convert.ToDouble(Console.ReadLine());
                    volume = vol.sphereVolume(radius);
                    Console.WriteLine("The volume of the sphere is {0:0.00}", volume);
                    break;
                default:
                    break;

            }
            Console.WriteLine();
        }
    }
Exemplo n.º 24
0
        public VoxelTerrain(IChunkFactory chunkFactory, Volume terrainSize, Volume chunkSize, uint chunkGeneratorCount,
            Vector3F pos)
        {
            _chunkFactory = chunkFactory;
            _terrainSize = terrainSize;
            _chunkSize = chunkSize;
            _previousPosition = GetFirstChunkWorldPosition(pos);

            InitializeChunkGenerators(chunkGeneratorCount);
            InitializeChunks();
        }
Exemplo n.º 25
0
 Encoding GetEncoding(Volume volume)
 {
     var charset = volume.Formats.FirstOrDefault(format =>
         format.StartsWithII("; charset=\""));
     if (charset != null) {
         charset = charset.Substring(charset.IndexOfII("; charset=\"")
                                     + 11).TrimEnd('"');
         return Encoding.GetEncoding(charset);
     }
     return Encoding.Default;
 }
Exemplo n.º 26
0
 public Stream Open(Volume volume, out Encoding encoding)
 {
     if (volume == null)
         throw new ArgumentNullException("volume");
     var path = GetPath(volume);
     if (!IsRecent(volume, path))
         Download(volume, path);
     Log.Verbose("Opening {0}...", path);
     encoding = GetEncoding(volume);
     return File.OpenRead(path);
 }
Exemplo n.º 27
0
        /// <summary>
        /// Standalone mode, use it for preview or something
        /// </summary>
        /// <param name="Vols"> The Volumes needed to be shown </param>
        /// <param name="SelectEvent"> EventHandler when an item is selected </param>
        private void Load( Volume[] Vols, SelectionChangedEventHandler SelectEvent = null )
        {
            TOC = new TOCPane( Vols );

            TOCContext.DataContext = TOC;

            if ( SelectEvent != null )
            {
                TOCList.SelectionChanged += SelectEvent;
            }
        }
Exemplo n.º 28
0
 void Download(Volume volume, string path)
 {
     var url = PathUtility.JoinPath(CatalogParser.ProjectUrl, volume.URL);
     try {
         Log.Verbose("Writing {0}...", path);
         EnsureDirectory();
         using (var output = File.OpenWrite(path))
             new Downloader(url) { Log = Log }.Transfer(output);
     } catch {
         IOUtility.DeleteTempFile(path);
         throw;
     }
 }
Exemplo n.º 29
0
    void ShmupChopper_Collided(Volume collisonObject, Voxel voxel, Vector3 worldPosition)
    {
        if (collisonObject.gameObject == gameObject) return;
        if(!(collisonObject.name.StartsWith("Playfield") || collisonObject.name.StartsWith("Plane"))) return;

        // Destruct the volume a few times with different velocities to make lots of particles!
        GetComponent<Volume>().Destruct(0f, false);
        GetComponent<Volume>().Destruct(5f, false);
        explodeParticleSystem.transform.position = transform.position;
        explodeParticleSystem.Emit(30);
        gameObject.SetActive(false);
        Invoke("Respawn", 3f);
    }
Exemplo n.º 30
0
        public static void GradientCheck(LayerBase layer, int inputWidth, int inputHeight, int inputDepth, double epsilon = 1e-4)
        {
            layer.Init(inputWidth, inputHeight, inputDepth);

            // Forward pass
            var input = new Volume(inputWidth, inputHeight, inputDepth);
            var output = layer.Forward(input, true);

            // Set output gradients to 1
            for (var n = 0; n < output.WeightGradients.Length; n++)
            {
                output.WeightGradients[n] = 1.0;
            }

            // Backward pass to retrieve gradients
            layer.Backward();
            var computedGradients = input;

            // Now let's approximate gradient using derivate definition
            for (var d = 0; d < inputDepth; d++)
            {
                for (var y = 0; y < inputHeight; y++)
                {
                    for (var x = 0; x < inputWidth; x++)
                    {
                        var oldValue = input.Get(x, y, d);

                        input.Set(x, y, d, oldValue + epsilon);
                        var output1 = layer.Forward(input);
                        input.Set(x, y, d, oldValue - epsilon);
                        var output2 = layer.Forward(input);

                        input.Set(x, y, d, oldValue);

                        output1.AddFromScaled(output2, -1.0); // output1 = output1 - output2

                        var grad = new double[output.WeightGradients.Length];
                        for (var j = 0; j < output.WeightGradients.Length; j++)
                        {
                            grad[j] = output1.Weights[j] / (2.0 * epsilon);
                        }

                        var gradient = grad.Sum(); // approximated gradient
                        var actual = computedGradients.GetGradient(x, y, d);
                        Assert.AreEqual(gradient, actual, 1e-4); // compare layer gradient to the approximated gradient
                    }
                }
            }
        }
Exemplo n.º 31
0
 public static string PrettyWrite(this Volume i) => i.WriteBps?.ToSpeed();
Exemplo n.º 32
0
 public bool TestIntersection(Volume <Vector3> volume)
 => TestIntersection(origin, radius, volume);
Exemplo n.º 33
0
 public static T?CubeMilesValue <T>(this Volume <Lengths.Uscs.Miles, T>?volume) where T : struct, IComparable, IFormattable, IComparable <T>, IEquatable <T> => volume?.VolumeValue;
Exemplo n.º 34
0
 public void Init()
 {
     volume = GetComponent <Volume>();
     InitVoxelData();
     InitConditionData();
 }
Exemplo n.º 35
0
 public static string PrettyRead(this Volume i) => i.ReadBps?.ToSpeed();
Exemplo n.º 36
0
        public Volume <T> Forward(Volume <T> input, bool isTraining = false)
        {
            this.InputLayers[0].DoForward(input, isTraining);

            return(this._lastLayer.Forward(isTraining));
        }
Exemplo n.º 37
0
 /// <summary>
 /// Signifies that the Order has been accepted successfully
 /// </summary>
 public void OnAccept(Order order, Price matchedPrice, Volume matchedVolume)
 {
     Log.Debug("Order Accepted by Exchange. " + order.ToString());
     // Note: the notification to the client can be sent back from here
 }
Exemplo n.º 38
0
    double[] forwardQ(double[] s)
    {
        Volume result = net.Forward(new Volume(s));

        return(result.Weights);
    }
Exemplo n.º 39
0
 public static string PercentFreeSpace(this Volume vol) => (100 - vol.PercentUsed)?.ToString("n0") + "% Free";
Exemplo n.º 40
0
 private void ChekBoxVolumeSimple_Checked(object sender, RoutedEventArgs e)
 {
     Volume.simpleVolume();
 }
 public object CalculateVolume(Volume quantity)
 {
     return(this._quantity.CalculateVolume(quantity));
 }
Exemplo n.º 42
0
 /// <summary>
 /// On init we initialize our values
 /// </summary>
 protected override void Initialization()
 {
     base.Initialization();
     _volume = this.gameObject.GetComponent <Volume>();
     _volume.profile.TryGet(out _whiteBalance);
 }
Exemplo n.º 43
0
 public string FormateVolumeFolder(Volume volume)
 {
     return(AppConfig.VolumePrefix + " " + volume.Number.ToString(CultureInfo.InvariantCulture).PadLeft(3, '0'));
 }
Exemplo n.º 44
0
 public static bool TestIntersection(Sphere sphere, Volume <Vector3> volume)
 => TestIntersection(sphere.origin, sphere.radius, volume);
Exemplo n.º 45
0
 public override Task <List <DoubleGraphPoint> > GetPerformanceUtilizationAsync(Volume volume, DateTime?start, DateTime?end, int?pointCount = null)
 {
     return(Task.FromResult(new List <DoubleGraphPoint>()));
 }
Exemplo n.º 46
0
 static protected int LightsToVolumes(ref Volume cellVolume, ref List <Volume> volumes, ref Dictionary <Scene, int> sceneRef)
 {
     // TODO
     return(0);
 }
 public object CalculateVolume(Volume quantity)
 {
     try
     {
         var commandText = "insert into QUANTITYMESURE.Volume(Liter ,Milliliter ,Gallon ,convertUnits ) values(:Liter,:Milliliter,:Gallon,:convertUnits)";
         using (var _db = new OracleConnection("User Id=system;Password=system;Data Source=localhost:1521/xe"))
             using (OracleCommand cmd = new OracleCommand(commandText, _db))
             {
                 if (quantity.convertUnits == convertUnit.MililiterToLiter.ToString())
                 {
                     quantity.Liter = quantity.Milliliter / 1000;
                     cmd.Connection = _db;
                     cmd.Parameters.Add("Liter", quantity.Liter);
                     cmd.Parameters.Add("Milliliter", quantity.Milliliter);
                     cmd.Parameters.Add("Gallon", quantity.Gallon);
                     cmd.Parameters.Add("convertUnits", quantity.convertUnits);
                     _db.Open();
                     cmd.ExecuteNonQuery();
                     _db.Close();
                     return(quantity.Liter);
                 }
                 else if (quantity.convertUnits == convertUnit.LiterToMiliter.ToString())
                 {
                     quantity.Milliliter = quantity.Liter * 1000;
                     cmd.Connection      = _db;
                     cmd.Parameters.Add("Liter", quantity.Liter);
                     cmd.Parameters.Add("Milliliter", quantity.Milliliter);
                     cmd.Parameters.Add("Gallon", quantity.Gallon);
                     cmd.Parameters.Add("convertUnits", quantity.convertUnits);
                     _db.Open();
                     cmd.ExecuteNonQuery();
                     _db.Close();
                     return(quantity.Milliliter);
                 }
                 else if (quantity.convertUnits == convertUnit.LiterToGallon.ToString())
                 {
                     quantity.Gallon = quantity.Liter / 3.785;
                     cmd.Connection  = _db;
                     cmd.Parameters.Add("Liter", quantity.Liter);
                     cmd.Parameters.Add("Milliliter", quantity.Milliliter);
                     cmd.Parameters.Add("Gallon", quantity.Gallon);
                     cmd.Parameters.Add("convertUnits", quantity.convertUnits);
                     _db.Open();
                     cmd.ExecuteNonQuery();
                     _db.Close();
                     return(quantity.Gallon);
                 }
                 else if (quantity.convertUnits == convertUnit.GallonToLiter.ToString())
                 {
                     quantity.Liter = quantity.Gallon * 3.785;
                     cmd.Connection = _db;
                     cmd.Parameters.Add("Liter", quantity.Liter);
                     cmd.Parameters.Add("Milliliter", quantity.Milliliter);
                     cmd.Parameters.Add("Gallon", quantity.Gallon);
                     cmd.Parameters.Add("convertUnits", quantity.convertUnits);
                     _db.Open();
                     cmd.ExecuteNonQuery();
                     _db.Close();
                     return(quantity.Liter);
                 }
                 else
                 {
                     throw new CustomException("Options not matched", CustomException.ExceptionType.OPTIONS_NOT_MATCH);
                 }
             }
     }
     catch (CustomException e)
     {
         throw new CustomException(e.Message, CustomException.ExceptionType.NULL_EXCEPTION);
     }
 }
Exemplo n.º 48
0
 public abstract Task ApplyImage(Volume volume, string imagePath, int imageIndex = 1,
                                 IObserver <double> progressObserver             = null);
Exemplo n.º 49
0
        private void Load(LargeTextureStore store)
        {
            cachedMap.Map = Songs.GetRandomMap();
            cachedMap.LoadTrackFile();

            InternalChildren = new Drawable[]
            {
                Background = new Sprite
                {
                    Depth            = 2,
                    Anchor           = Anchor.Centre,
                    Origin           = Anchor.Centre,
                    Alpha            = 1f,
                    Texture          = store.Get("Skin/menu-background.png"),
                    RelativeSizeAxes = Axes.Both,
                    Size             = new Vector2(1.1f),
                },
                new Box
                {
                    Depth = Background.Depth - 0.1f,
                    RelativePositionAxes = Axes.Both,
                    Anchor           = Anchor.CentreLeft,
                    Origin           = Anchor.CentreLeft,
                    RelativeSizeAxes = Axes.Both,
                    Size             = new Vector2(0.15f, 1.1f),
                    Position         = new Vector2(0.05f, 0f),
                    Shear            = new Vector2(.15f, 0f),
                    EdgeSmoothness   = new Vector2(2f)
                },
                new MusicVisualizationLinear(3f, 120, 0f, cachedMap.BindableTrack)
                {
                    Depth  = Background.Depth - 0.2f,
                    Anchor = Anchor.Centre,
                    Origin = Anchor.CentreLeft,
                    RelativePositionAxes = Axes.Both,
                    RelativeSizeAxes     = Axes.Both,
                    Size = new Vector2(.25f, 0f),
                },
                GetMainMenuBox("Play", -0.2f, -0.25f, 0),
                GetMainMenuBox("Settings", -0.21f, -0.05f, 1),
                GetMainMenuBox("Editor", -0.25f, 0.15f, 2),
                GetMainMenuBox("Exit", -0.3f, 0.35f, 3),

                CurrentPlaying = new SpriteText
                {
                    Anchor = Anchor.TopCentre,
                    Origin = Anchor.Centre,
                    Alpha  = 1f,
                    RelativePositionAxes = Axes.Both,
                    Y = 0.1f,
                },
                volume = new Volume(cachedMap.BindableTrack)
                {
                    Anchor               = Anchor.Centre,
                    Origin               = Anchor.Centre,
                    RelativeSizeAxes     = Axes.Both,
                    RelativePositionAxes = Axes.Both,
                    Size  = new Vector2(1f, 0.3f),
                    X     = 0.4f,
                    Y     = 0.2f,
                    Alpha = 0f,
                },
            };

            AddInternal(box = new Box
            {
                Depth = float.MinValue + 1,
                RelativePositionAxes = Axes.Both,
                Anchor           = Anchor.Centre,
                Origin           = Anchor.Centre,
                Colour           = Color4.Black.Opacity(0.8f),
                RelativeSizeAxes = Axes.Both,
                Size             = new Vector2(1f),
                Alpha            = 0f,
            });

            var updater = new Update();

            AddInternal(_overlay = new NotificationOverlay
            {
                Depth = float.MinValue,
                RelativePositionAxes = Axes.Both,
                Anchor           = Anchor.Centre,
                Origin           = Anchor.Centre,
                RelativeSizeAxes = Axes.Both,
                Size             = new Vector2(0.3f),
                typeOfOverlay    = NotificationOverlay.TypeOfOverlay.YesNo,
                ActionYes        = () =>
                {
                    if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
                    {
                        updater.DownloadUpdate();
                        updater.ApplyUpdate();
                    }
                    else
                    {
                        //TODO:
                    }
                }
            });

            bool newUpdate = false; //await updater.SearchAsyncForUpdates();

            if (newUpdate)
            {
                //TODO:
                _overlay._text.Text = "A new update is available!                                      " +
                                      "Do you want to install it now?";

                box.Size = new Vector2(3f);
                box.FadeIn(0d, Easing.OutCirc);
                _overlay.State.Value         = Visibility.Visible;
                _overlay.State.ValueChanged += (e) => box.FadeOut(250d);
            }
        }