/// Initializes the audio system with the current audio configuration.
  /// @note This should only be called from the main Unity thread.
  public static void Initialize (CardboardAudioListener listener, Quality quality) {
    if (!initialized) {
      // Initialize the audio system.
#if UNITY_4_5 || UNITY_4_6 || UNITY_4_7
      sampleRate = AudioSettings.outputSampleRate;
      numChannels = (int)AudioSettings.speakerMode;
      int numBuffers = -1;
      AudioSettings.GetDSPBufferSize(out framesPerBuffer, out numBuffers);
#else
      AudioConfiguration config = AudioSettings.GetConfiguration();
      sampleRate = config.sampleRate;
      numChannels = (int)config.speakerMode;
      framesPerBuffer = config.dspBufferSize;
#endif
      if (numChannels != (int)AudioSpeakerMode.Stereo) {
        Debug.LogError("Only 'Stereo' speaker mode is supported by Cardboard.");
        return;
      }
      Initialize(quality, sampleRate, numChannels, framesPerBuffer);
      listenerTransform = listener.transform;
      initialized = true;

      Debug.Log("Cardboard audio system is initialized (Quality: " + quality + ", Sample Rate: " +
                sampleRate + ", Channels: " + numChannels + ", Frames Per Buffer: " +
                framesPerBuffer + ").");
    } else if (listener.transform != listenerTransform) {
      Debug.LogError("Only one CardboardAudioListener component is allowed in the scene.");
      CardboardAudioListener.Destroy(listener);
    }
  }
Example #2
0
        public void Icomparer_greater_proper()
        {
            var first = new Quality(QualityTypes.Bluray1080p, false);
            var second = new Quality(QualityTypes.Bluray1080p, true);

            second.Should().BeGreaterThan(first);
        }
Example #3
0
        public void opEquality_Quality_Quality()
        {
            var obj = new Quality();
            var comparand = new Quality();

            Assert.True(obj == comparand);
        }
Example #4
0
 /// <summary>
 /// Create a new Landing Bay
 /// </summary>
 /// <param name="name">name of the landing bay</param>
 /// <param name="hulls">class fo ship that can mount this weapon</param>
 /// <param name="slots">locatiosn where this weapon can be mounted</param>
 /// <param name="power">power used by this weapon</param>
 /// <param name="space">space used by this method</param>
 /// <param name="sp">cost of this weapon</param>
 /// <param name="str">strength of the weapon</param>
 /// <param name="capacity">total ammo capacity of the torpedo tube</param>
 /// <param name="origin">rulebook containing this weapon</param>
 /// <param name="page">page this weapon can be found on</param>
 /// <param name="quality">quality of this weapon</param>
 /// <param name="wq">enum declaring which qualities to be adjusted</param>
 /// <param name="special">special rules of this weapon</param>
 public LandingBay(string name, HullType hulls, WeaponSlot slots, int power, int space, int sp, int str,
     RuleBook origin, byte page, Quality quality = Quality.Common, WeaponQuality wq = WeaponQuality.None,
     string special = null, ComponentOrigin comp = ComponentOrigin.Standard, Condition cond = Condition.Intact)
     : base(name, WeaponType.LandingBay, hulls, slots, power, space, sp, str, default(DiceRoll), 0, 0, origin, page, quality, wq, special, Quality.None, comp, cond)
 {
     Squadrons = new List<Squadron>(Strength * 3);
 }
Example #5
0
 /// <summary>
 /// Create a new weapon
 /// </summary>
 /// <param name="name">name of the weapon</param>
 /// <param name="type">class of weapon</param>
 /// <param name="hulls">class fo ship that can mount this weapon</param>
 /// <param name="slots">locatiosn where this weapon can be mounted</param>
 /// <param name="power">power used by this weapon</param>
 /// <param name="space">space used by this method</param>
 /// <param name="sp">cost of this weapon</param>
 /// <param name="str">strength of the weapon</param>
 /// <param name="damage">damage of the weapon</param>
 /// <param name="crit">crit rating of the weapon</param>
 /// <param name="range">range of the weapon</param>
 /// <param name="origin">rulebook containing this weapon</param>
 /// <param name="page">page this weapon can be found on</param>
 /// <param name="quality">quality of this weapon</param>
 /// <param name="wq">enum declaring which qualities to be adjusted</param>
 /// <param name="special">special rules of this weapon</param>
 /// <param name="turbo">Quality of turboweapon battery upgrade if applicable</param>
 public Weapon(string name, WeaponType type, HullType hulls, WeaponSlot slots, int power, int space, 
     int sp, int str, string damage, int crit, int range, RuleBook origin, byte page, Quality quality = Quality.Common,
     WeaponQuality wq = WeaponQuality.None, string special = null, Quality turbo = Quality.None, ComponentOrigin comp = ComponentOrigin.Standard, Condition cond = Condition.Intact)
     : this(name, type, hulls, slots, power, space, sp, str, new DiceRoll(damage), crit, range, 
     origin, page, quality, wq, special, turbo, comp, cond)
 {
 }
Example #6
0
        public void opImplicit_Quality_string()
        {
            var expected = new Quality(0.234f);
            Quality actual = "0.234";

            Assert.Equal(expected, actual);
        }
Example #7
0
 /// <summary>
 /// Create a new Crew Quarters or Life Sustainer
 /// </summary>
 /// <param name="name">name of teh life sustainer of crew quarters</param>
 /// <param name="types">classes of ship which can use this component</param>
 /// <param name="power">power used by this component</param>
 /// <param name="space">space used by this component</param>
 /// <param name="morale">morale modifier of this component</param>
 /// <param name="origin">rulebook containing this component</param>
 /// <param name="page">page this component can be found on</param>
 /// <param name="special">special rules for this component</param>
 /// <param name="quality">quality of this component</param>
 /// <param name="sp">cost of this component</param>
 /// <param name="loss">modifier to morale loss granted by this component</param>
 public CrewSustainer(string name, HullType types, int power, int space, int morale, RuleBook origin, byte page,
     string special = null, Quality quality = Quality.Common, int sp = 0, int loss = 0, ComponentOrigin comp = ComponentOrigin.Standard, Condition cond = Condition.Intact)
     : base(name, sp, power, space, special, origin, page, types, quality, comp, cond)
 {
     this.Morale = morale;
     this.MoraleLoss = loss;
 }
Example #8
0
 public Point()
     : base("New point")
 {
     value = new object();
     timestamp = DateTime.Now;
     quality = Quality.Init;
 }
 public void ActivateFeedback(string feedback, Quality quality)
 {
     gameObject.SetActive(true);
     Feedback.text = feedback;
     setQualityOfLastResponse(quality);
     setFeedbackColor(quality);
 }
Example #10
0
        public void equal_operand_false_proper()
        {
            var first = new Quality(QualityTypes.Bluray1080p, true);
            var second = new Quality(QualityTypes.Bluray1080p, false);

            (first == second).Should().BeFalse();
        }
Example #11
0
        public void opImplicit_Quality_float()
        {
            var expected = new Quality(0.62f);
            Quality actual = 0.62f;

            Assert.Equal(expected, actual);
        }
Example #12
0
        public void Icomparer_lesser_proper()
        {
            var first = new Quality(QualityTypes.DVD, false);
            var second = new Quality(QualityTypes.DVD, true);

            first.Should().BeLessThan(second);
        }
 public InvGameItem(int id, InvBaseItem bi)
 {
     this.quality = Quality.Sturdy;
     this.itemLevel = 1;
     this.mBaseItemID = id;
     this.mBaseItem = bi;
 }
Example #14
0
        public void Add(Quality input, ContextMenuStrip strip)
        {
            TreeNode newNode = new TreeNode();
            newNode.Text = input.DisplayName;
            newNode.Tag = input.InternalId;
            newNode.ContextMenuStrip = strip;

            if (input.Notes != string.Empty)
                newNode.ForeColor = Color.SaddleBrown;
            else
            {
                if (input.OriginSource == QualitySource.Metatype || input.OriginSource == QualitySource.MetatypeRemovable)
                    newNode.ForeColor = SystemColors.GrayText;
                if (!input.Implemented)
                    newNode.ForeColor = Color.Red;
            }
            newNode.ToolTipText = CommonFunctions.WordWrap(input.Notes, 100);

            TreeNode nodeToAddTo = this.Nodes[(int)input.Type];
            if (!nodeToAddTo.Nodes.ContainsKey(newNode.Text))
            {
                nodeToAddTo.Nodes.Add(newNode);
                nodeToAddTo.Expand();
            }
        }
Example #15
0
 private static int ReturnPriceByQuality(Quality q, int defaultPrice)
 {
     int price;
     switch (q)
     {
         case Quality.Foul:
         case Quality.Horrifying:
         case Quality.Bad:
         case Quality.Putrid:
             price = defaultPrice;
             break;
         case Quality.Nice:
         case Quality.VeryNice:
             price = (int)(defaultPrice * 1.2f);
             break;
         case Quality.Great:
         case Quality.Outstanding:
         case Quality.Excellent:
             price = (int)(defaultPrice * 1.3f);
             break;
         case Quality.Perfect:
             price = (int)(defaultPrice * 1.4f);
             break;
         default:
             price = defaultPrice;
             break;
     }
     return price;
 }
Example #16
0
	public Equipment (string itemName, string description, ItemType itemType, Quality quality, string spriteNeutral, string spriteHighlighted, int maxSize, int intellect, int agility, int stamina, int strength) 
		: base(itemName,description,itemType,quality,spriteNeutral,spriteHighlighted,maxSize) {
		this.Intellect = intellect;
		this.Agility = agility;
		this.Stamina = stamina;
		this.Strength = strength;
	}	
Example #17
0
	public Blob()
	{
		gm = (GameManager)(GameObject.Find("GameManager")).GetComponent<GameManager>();
		quality = Quality.Standard;
		levelBoostForOffspring = 0f;
		onMission = false;
		birthday = new DateTime(0);
		hasHatched = false;
		hatchTime = new DateTime(0);
		breedReadyTime = new DateTime(0);
		goldProductionTime = new DateTime(0);
		unprocessedGenes = new List<Gene>();
		activeGenes = new List<Gene>();
		inactiveGenes = new List<Gene>();
		bodyPartSprites = new Dictionary<string, Texture>();
		momId = -1;
		dadId = -1;
		spouseId = -1;
		unfertilizedEggs = 99;
		color = new Color(0.863f, 0.863f, 0.863f, 1f);
		blobHatchDelay = gm.blobHatchDelay;
		breedReadyDelay = gm.breedReadyDelay;
		heartbrokenRecoverDelay = gm.heartbrokenRecoverDelay;
		mateFindDelay = gm.mateFindDelay;
		goldProduction = 0;
		sellValue = 1;
		level = 1;
	}
Example #18
0
        public static ObjectGuid CreateBookWrittenCallback(object customData, ref Simulator.ObjectInitParameters initData, Quality quality)
        {
            BookWrittenData data = customData as BookWrittenData;
            if (data == null) return ObjectGuid.InvalidObjectGuid;

            try
            {
                Notify(data.Title);

                BookWritten book = GlobalFunctions.CreateObjectOutOfWorld("BookWritten") as BookWritten;
                if (book == null)
                {
                    return ObjectGuid.InvalidObjectGuid;
                }

                book.InitBookCommon(data);

                return book.ObjectId;
            }
            catch(Exception e)
            {
                Common.Exception(data.ID, e);
                return ObjectGuid.InvalidObjectGuid;
            }
        }
Example #19
0
        public void opImplicit_float_Quality()
        {
            const float expected = 0.75f;
            float actual = new Quality(expected);

            Assert.Equal(expected, actual);
        }
Example #20
0
        public void not_equal_operand()
        {
            var first = new Quality(QualityTypes.Bluray1080p, true);
            var second = new Quality(QualityTypes.Bluray1080p, true);

            (first != second).Should().BeFalse();
        }
 public static string FilenameFromEpisode(Episode ep, Quality q, string template)
 {
     List<object> vars=new List<object>();
     MatchCollection m = _varRegex.Matches(template);
     int cnt = 0;
     foreach (Match match in m)
     {
         if (match.Success)
         {
             string t = match.Groups["variable"].Value.ToLower();
             int idx = t.IndexOf(":", StringComparison.InvariantCulture);
             if (idx > 0)
                 t = t.Substring(0, idx);
             if (Variables.Contains(t))
             {
                 TemplateVariables tv = (TemplateVariables) Enum.Parse(typeof (TemplateVariables), t);
                 switch (tv)
                 {
                     case TemplateVariables.show:
                         vars.Add(ep.ShowName);
                         break;
                     case TemplateVariables.episodealpha:
                         vars.Add(ep.EpisodeAlpha ?? string.Empty);
                         break;
                     case TemplateVariables.episodenumeric:
                         vars.Add(ep.EpisodeNumeric);
                         break;
                     case TemplateVariables.seasonalpha:
                         vars.Add(ep.SeasonAlpha ?? string.Empty);
                         break;
                     case TemplateVariables.seasonalphaorshow:
                         if (string.IsNullOrEmpty(ep.SeasonAlpha))
                             vars.Add(ep.ShowName ?? string.Empty);
                         else
                             vars.Add(ep.SeasonAlpha);
                         break;
                     case TemplateVariables.seasonnumeric:
                         vars.Add(ep.SeasonNumeric);
                         break;
                     case TemplateVariables.index:
                         vars.Add(ep.Index);
                         break;
                     case TemplateVariables.plugin:
                         vars.Add(ep.PluginName);
                         break;
                     case TemplateVariables.resolution:
                         vars.Add(q.ToText());
                         break;
                 }
                 template = template.Replace("{" + t, "{" + cnt);
                 cnt++;
             }
         }
     }
     string fname= string.Format(template, vars.ToArray());
     foreach (char c in System.IO.Path.GetInvalidFileNameChars())
         fname = fname.Replace(c.ToString(), string.Empty);
     return fname;
 }
        public static Price? PriceKillstreak(Item item, Quality quality, KillstreakType killstreak, bool australium)
        {
            if (item.PlainSlot != ItemSlotPlain.Weapon)
            {
                VersatileIO.Error("Item must be a weapon.");
                return null;
            }

            if (killstreak == KillstreakType.None)
            {
                VersatileIO.Warning("Killstreak type is None. Pricings from market data will not be" +
                    " as reliable as backpack.tf prices.");
            }

            List<MarketPricing> viable = DataManager.MarketPrices.Pricings.FindAll((p) => p.Item == item);

            List<MarketPricing> pricings = new List<MarketPricing>();
            foreach (MarketPricing p in viable)
            {
                if (p.Quality != quality)
                {
                    continue;
                }

                if (p.Killstreak != killstreak)
                {
                    continue;
                }

                pricings.Add(p);
                break;
            }

            if (pricings.Count == 0)
            {
                VersatileIO.Error("No killstreak prices found on community market for " +
                    item.ToString(quality, australium, killstreak));
                return null;
            }
            else if (pricings.Count == 1)
            {
                VersatileIO.Success("Pricing successful!");
                return pricings[0].Price;
            }
            else
            {
                VersatileIO.Warning("Multiple market pricings found for {0}. Returning the average price.",
                    item.ToString(quality, australium, killstreak));
                Price sum = Price.Zero;
                foreach (MarketPricing p in pricings)
                {
                    sum += p.Price;
                }

                Price avg = sum / pricings.Count;
                VersatileIO.Success("Pricing successful!");
                return avg;
            }
        }
 public static EpisodeWithDownloadSettings FromEpisode(Episode ep, Quality q, Format f)
 {
     EpisodeWithDownloadSettings e=new EpisodeWithDownloadSettings();
     ep.CopyTo(e);
     e.Quality = q;
     e.Format = f;
     return e;
 }
Example #24
0
 /// <summary>
 /// Create a new plasma drive
 /// </summary>
 /// <param name="name">name of the plasma drive</param>
 /// <param name="types">hull classes which can use this drive</param>
 /// <param name="power">power generated by this drive</param>
 /// <param name="space">space taken by this drive</param>
 /// <param name="special">special rules for this drive</param>
 /// <param name="origin">rulebook which contains this drive</param>
 /// <param name="page">page to find the drive on</param>
 /// <param name="sp">cost of this drive</param>
 /// <param name="quality">quality of this drive</param>
 /// <param name="speed">speed modifier of this drive</param>
 /// <param name="man">manoeuvrability modifier of this drive</param>
 public PlasmaDrive(string name, HullType types, int power, int space, string special, RuleBook origin, byte page, int sp = 0,
     Quality quality = Quality.Common, int speed = 0, int man = 0, ComponentOrigin comp = ComponentOrigin.Standard, bool modified = false, Condition cond = Condition.Intact)
     : base(name, sp, power, space, special, origin, page, types, quality, comp, cond)
 {
     this.Manoeuvrability = man;
     this.Speed = speed;
     Modified = modified;
 }
Example #25
0
 public static List<double> getPrices(string skinName, Quality quality)
 {
     return getPrices(
         string.Format(
             @"http://steamcommunity.com/market/listings/730/{0}%20%28{1}%29/render?currency=1",
             skinName,
             EnumUtil.qualityToString(quality)));
 }
        public override void InitCamera()
        {
            _prevCamQuality = CamQuality;
            _prevCamMode = CamMode;
            ImageProcessing.SetOvrCamera((int)CamQuality, (int)CamMode);

            UpdateCameraProperties(true);
        }
 void handlePhraseSelection(Quality quality)
 {
     if (quality == Quality.Great ||
         quality == Quality.Good) {
         playCelebrationAnimation();
     } else if (quality == Quality.Bad) {
         playSadAnimation();
     }
 }
Example #28
0
    public Weapon(string itemName, int itemid, string description, ItemType itemType, Quality quality, string spriteNeutral, string spriteHighlighted, int maxSize, int intellect, int agility, int stamina, int strength, int armor, float attackSpeed, int attackDamage, int magicDamage, string itemObject, WeaponType weaponType)
        : base(itemName, itemid, description, itemType, quality, spriteNeutral, spriteHighlighted, maxSize, intellect, agility, stamina, strength, armor, itemObject)
    {
        this.AttackSpeed = attackSpeed;
        this.AttackDamage = attackDamage;
        this.MagicDamage = magicDamage;

        this.WeaponType = weaponType;
    }
Example #29
0
        public void equal_operand()
        {
            var first = new Quality(QualityTypes.Bluray1080p, true);
            var second = new Quality(QualityTypes.Bluray1080p, true);

            (first == second).Should().BeTrue();
            (first >= second).Should().BeTrue();
            (first <= second).Should().BeTrue();
        }
Example #30
0
	public Item (string itemName, string description, ItemType itemType, Quality quality, string spriteNeutral, string spriteHighlighted, int maxSize) {
		this.ItemName 			= itemName;
		this.Description 		= description;
		this.ItemType			= itemType;
		this.Quality 			= quality;
		this.SpriteNeutral 		= spriteNeutral;
		this.SpriteHighlighted 	= spriteHighlighted;
		this.MaxSize 			= maxSize;
	}
Example #31
0
    //Eseguito all'apertura dell'App e quando si riapre il MainMenu (nel caso siano stati modificati i valori dal MiniMenu)
    public void GetSettingData()
    {
        if (!PrimoAvvio)
        {
            //Predo i dati salvati
            if (MusicVol_Slider)
            {
                MusicVol_Slider.value = PlayerPrefs.GetFloat(GameManager.Instance.AppName + "_MusicVolume");
            }
            if (SoundsVol_Slider)
            {
                SoundsVol_Slider.value = PlayerPrefs.GetFloat(GameManager.Instance.AppName + "_SoundsVolume");
            }
            // if (UIScale_Slider) UIScale_Slider.value = PlayerPrefs.GetFloat(GameManager.Instance.AppName + "_UIScale");
            CameraDistance     = PlayerPrefs.GetFloat(GameManager.Instance.AppName + "_CameraDistance");
            GetUIScale.UIAlpha = PlayerPrefs.GetFloat(GameManager.Instance.AppName + "_UITransparence");
            SelectSkin(PlayerPrefs.GetInt(GameManager.Instance.AppName + "_Skin"));
            if (PlayerPrefs.GetString(GameManager.Instance.AppName + "_autoQuality") == "true")
            {
                UseAutoQuality = true;
            }
            else
            {
                UseAutoQuality = false;
            }

            /*
             *  print("<color=green>Get saved SoundsVol:</color> " + PlayerPrefs.GetFloat(GameManager.Instance.AppName + "_MusicVolume"));
             *  print("<color=green>Get saved MusicVol:</color> " + PlayerPrefs.GetFloat(GameManager.Instance.AppName + "_SoundsVolume"));
             *  print("<color=green>Get saved _UIScale:</color> " + PlayerPrefs.GetFloat(GameManager.Instance.AppName + "_UIScale"));
             *  print("<color=green>Get saved Language:</color> " + PlayerPrefs.GetString(GameManager.Instance.AppName + "_Language"));
             *  print("<color=green>Get saved Quality:</color> " + PlayerPrefs.GetString(GameManager.Instance.AppName + "_Quality"));
             *  print("<color=green>Get saved CameraDistance:</color> " + PlayerPrefs.GetFloat(GameManager.Instance.AppName + "_CameraDistance"));
             *  print("<color=green>Get saved UITransparence:</color> " + PlayerPrefs.GetFloat(GameManager.Instance.AppName + "_UITransparence"));
             *  print("<color=green>Get saved SelectSkin:</color> " + PlayerPrefs.GetInt(GameManager.Instance.AppName + "_Skin"));
             */
        }
        else
        {
            if (MusicVol_Slider)
            {
                MusicVol_Slider.value = 10f;
            }
            if (SoundsVol_Slider)
            {
                SoundsVol_Slider.value = 10f;
            }
            CameraDistance     = 22.5f;
            UseAutoQuality     = false;
            quality            = Quality.Med;
            GetUIScale.UIAlpha = 1f;
            MainMenu.Instance._QualityDropDown.value = 1;
            SelectSkin(0);

            PlayerPrefs.SetFloat(GameManager.Instance.AppName + "_CameraDistance", CameraDistance);
            PlayerPrefs.SetFloat(GameManager.Instance.AppName + "_UITransparence", GetUIScale.UIAlpha);
        }


        //Assegno i volori deli slider alle variabili (al loading dei valori salvati)
        if (MasterMixer)
        {
            if (SoundsVol_Slider)
            {
                MasterMixer.SetFloat("SoundsVolume", (SoundsVol_Slider.value * AudioMultipler) - 20);
            }
            if (MusicVol_Slider)
            {
                MasterMixer.SetFloat("MusicVolume", (MusicVol_Slider.value * MusicManager.MusicAmplifer) - 20);
            }
        }
        // if (UIScale_Slider) ControlsUIScale = UIScale_Slider.value;



        ////Limito il suono
        if (SoundsVol_Slider)
        {
            if (SoundsVol_Slider.value <= -0.01f)
            {
                MasterMixer.SetFloat("SoundsVolume", -100);
            }
        }
        if (MusicVol_Slider)
        {
            if (MusicVol_Slider.value <= -0.01f)
            {
                MasterMixer.SetFloat("MusicVolume", -100);
            }
        }

        W_Language.CheckLang();
    }
 private void ConfigurationRecord_Load(object sender, EventArgs e)
 {
     txtFPS.Text     = FPS.ToString();
     txtQuality.Text = Quality.ToString();
     txtSaveAs.Text  = PathImage;
 }
Example #33
0
        public IList <VQT> GetValues(TimePeriod timePeriod, InitialValue initialValue, int maxCount)
        {
            var vqts = new List <VQT>();

            // get projected value count
            int projectedCount = CalculateProjectedCount(timePeriod, initialValue);

            // add initial value
            if (timePeriod.StartTime.Ticks % TimeSpan.TicksPerSecond == 0)
            {
                // start time is at whole second, generate Good/Raw value at this time
                var     value   = GetValueAtTime(timePeriod.StartTime);
                Quality quality = new Quality()
                {
                    Major = value == null ? MajorQuality.Bad : MajorQuality.Good
                };
                vqts.Add(new VQT(value, timePeriod.StartTime, quality));
            }
            else if (initialValue != InitialValue.None || (maxCount > 0 && projectedCount > maxCount))
            {
                // initial value requested or we need to interpolate (requires value at initial time)
                vqts.Add(InterpolateValueAt(timePeriod.StartTime, initialValue == InitialValue.SampleAndHold));
            }

            // add subsequent values
            DateTime startTime;
            long     stepTicks;

            if (maxCount == 0 || projectedCount <= maxCount)
            {
                // we need to generate raw values, start at next whole second
                long fractionTicks = timePeriod.StartTime.Ticks % TimeSpan.TicksPerSecond;
                startTime = timePeriod.StartTime.AddTicks(TimeSpan.TicksPerSecond - fractionTicks);

                // and generate one value per second
                stepTicks = TimeSpan.TicksPerSecond;
            }
            else
            {
                // we need to generate interpolated values, divide time span to generate maxCount values
                stepTicks = (timePeriod.EndTime - timePeriod.StartTime).Ticks / maxCount;

                // skip value at start if we already have one
                startTime = vqts.Count > 0 ? timePeriod.StartTime.AddTicks(stepTicks) : timePeriod.StartTime;
            }

            while (startTime < timePeriod.EndTime)
            {
                var value = GetValueAtTime(startTime);
                if (maxCount == 0 || projectedCount <= maxCount)
                {
                    // not interpolating, use raw value
                    Quality quality = new Quality()
                    {
                        Major = value == null ? MajorQuality.Bad : MajorQuality.Good
                    };
                    vqts.Add(new VQT(value, startTime, quality));
                }
                else if (value != null)
                {
                    // interpolating and we got a good value, use it
                    Quality quality = new Quality()
                    {
                        // if value at second boundary, mark it as a raw value
                        HDAQuality = startTime.Ticks % TimeSpan.TicksPerSecond == 0 ? HDAQuality.Raw : HDAQuality.Interpolated
                    };
                    vqts.Add(new VQT(value, startTime, quality));
                }
                else
                {
                    // interpolating and we got a bad value, interpolate non-bad
                    vqts.Add(InterpolateValueAt(startTime, initialValue == InitialValue.SampleAndHold));
                }

                // advance to next time boundary
                startTime = startTime.AddTicks(stepTicks);
            }

            return(vqts);
        }
Example #34
0
        // 根据给定的区域映射和质量参数,将源图片缩放到目标大小
        Bitmap Scale(Image source,
                     // 源屏幕大小
                     int srcWidth, int srcHeight,
                     // 目标屏幕大小
                     int destWidth, int destHeight,
                     // 转换质量
                     Quality q,
                     // 转换区域映射
                     Dictionary <Rectangle, Rectangle> rects)
        {
            // 忽略无效参数
            if (srcWidth <= 0 || srcHeight <= 0 || destWidth <= 0 || destHeight <= 0)
            {
                return(null);
            }

            int realWidth  = (source.Width * destWidth) / srcWidth;
            int realHeight = (source.Height * destHeight) / srcHeight;

            Bitmap dest = new Bitmap(realWidth, realHeight);

            using (Graphics g = Graphics.FromImage(dest))
            {
                // 根据质量参数决定缩放算法
                switch (q)
                {
                case Quality.LOW:
                    g.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.Default;
                    g.InterpolationMode  = System.Drawing.Drawing2D.InterpolationMode.Default;
                    g.SmoothingMode      = System.Drawing.Drawing2D.SmoothingMode.Default;
                    break;

                case Quality.NORMAL:
                    g.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.AssumeLinear;
                    g.InterpolationMode  = System.Drawing.Drawing2D.InterpolationMode.Bicubic;
                    g.SmoothingMode      = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
                    break;

                case Quality.HIGH:
                    g.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
                    g.InterpolationMode  = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
                    g.SmoothingMode      = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
                    break;
                }

                if (rects == null || rects.Count == 0)
                {
                    // 直接缩放到指定的大小
                    g.DrawImage(source, 0, 0, realWidth, realHeight);
                }
                else
                {
                    // 按照规划的区域缩放
                    foreach (KeyValuePair <Rectangle, Rectangle> kp in rects)
                    {
                        if (kp.Value.Left >= realWidth || kp.Value.Top >= realHeight)
                        {
                            // 忽略无效数据
                            continue;
                        }

                        g.DrawImage(source, kp.Value, kp.Key, GraphicsUnit.Pixel);
                    }
                }
            }

            return(dest);
        }
Example #35
0
 public void SetQuality(Quality quality)
 {
     nvttSetCompressionOptionsQuality(options, quality);
 }
Example #36
0
        public override IOperation Apply()
        {
            //code executed in the first call of analyzer
            if (qualitiesBeforeCoOp == null)
            {
                double[] trainingQuality;
                // sort is ascending and we take the first n% => order so that best solutions are smallest
                // sort order is determined by maximization parameter
                if (Maximization.Value)
                {
                    // largest values must be sorted first
                    trainingQuality = Quality.Select(x => - x.Value).ToArray();
                }
                else
                {
                    // smallest values must be sorted first
                    trainingQuality = Quality.Select(x => x.Value).ToArray();
                }
                // sort trees by training qualities
                int topN = (int)Math.Max(trainingQuality.Length * PercentageOfBestSolutions, 1);
                scopeIndexes = Enumerable.Range(0, trainingQuality.Length).ToArray();
                Array.Sort(trainingQuality, scopeIndexes);
                scopeIndexes        = scopeIndexes.Take(topN).ToArray();
                qualitiesBeforeCoOp = scopeIndexes.Select(x => Quality[x].Value).ToArray();

                OperationCollection operationCollection = new OperationCollection();
                operationCollection.Parallel = true;
                foreach (var scopeIndex in scopeIndexes)
                {
                    var childOperation = ExecutionContext.CreateChildOperation(ConstantOptimizationEvaluator, ExecutionContext.Scope.SubScopes[scopeIndex]);
                    operationCollection.Add(childOperation);
                }

                return(new OperationCollection {
                    operationCollection, ExecutionContext.CreateOperation(this)
                });
            }

            //code executed to analyze results of constant optimization
            double[] qualitiesAfterCoOp = scopeIndexes.Select(x => Quality[x].Value).ToArray();
            var      qualityImprovement = qualitiesBeforeCoOp.Zip(qualitiesAfterCoOp, (b, a) => a - b).ToArray();

            if (!ResultCollection.ContainsKey(DataTableNameConstantOptimizationImprovement))
            {
                var dataTable = new DataTable(DataTableNameConstantOptimizationImprovement);
                ResultCollection.Add(new Result(DataTableNameConstantOptimizationImprovement, dataTable));
                dataTable.VisualProperties.YAxisTitle = "R²";

                dataTable.Rows.Add(new DataRow(DataRowNameMinimumImprovement));
                MinimumImprovement.VisualProperties.StartIndexZero = true;

                dataTable.Rows.Add(new DataRow(DataRowNameMedianImprovement));
                MedianImprovement.VisualProperties.StartIndexZero = true;

                dataTable.Rows.Add(new DataRow(DataRowNameAverageImprovement));
                AverageImprovement.VisualProperties.StartIndexZero = true;

                dataTable.Rows.Add(new DataRow(DataRowNameMaximumImprovement));
                MaximumImprovement.VisualProperties.StartIndexZero = true;
            }

            MinimumImprovement.Values.Add(qualityImprovement.Min());
            MedianImprovement.Values.Add(qualityImprovement.Median());
            AverageImprovement.Values.Add(qualityImprovement.Average());
            MaximumImprovement.Values.Add(qualityImprovement.Max());

            qualitiesBeforeCoOp = null;
            scopeIndexes        = null;
            return(base.Apply());
        }
        protected override void AddSpecifiedAttributes()
        {
            AddAttribute(RoutingMode);

            if (Start != null) AddAttribute(Start);
            if (Destination != null) AddAttribute(Destination);

            AddAttribute(PropertyHelper.GetDescription(() => Ranges), string.Join(",", Ranges));
            AddAttribute(PropertyHelper.GetDescription(() => RangeType), EnumHelper.GetDescription(RangeType));

            if (JsonAttributes != null)
                AddAttribute(JsonAttributes);
            else
                AddAttribute(new JsonRepresentation(JsonAttribute.Include_TypeElement, JsonAttribute.UsePluralNamingForCollections, JsonAttribute.SupressJsonResponseObjectWrapper));

            if (ConsumptionModel != null) AddAttribute(ConsumptionModel);
            if (CustomConsumptionDetails != null) AddAttribute(CustomConsumptionDetails);

            if (RequestId != null) AddAttribute(PropertyHelper.GetDescription(() => RequestId), RequestId);

            if (SingleComponent != null) AddAttribute(PropertyHelper.GetDescription(() => SingleComponent), SingleComponent.ToString().ToLower());
            if (Resolution != null) AddAttribute(PropertyHelper.GetDescription(() => Resolution), Resolution.ToString());
            if (MaxPoints != null) AddAttribute(PropertyHelper.GetDescription(() => MaxPoints), MaxPoints.ToString());
            if (Quality != null) AddAttribute(PropertyHelper.GetDescription(() => Quality), Quality.ToString());

            if (Departure != null) AddAttribute(PropertyHelper.GetDescription(() => Departure), ((DateTime)Departure).ToString("s"));
            if (Arrival != null) AddAttribute(PropertyHelper.GetDescription(() => Arrival), ((DateTime)Arrival).ToString("s"));

            if (JsonCallback != null) AddAttribute(PropertyHelper.GetDescription(() => JsonCallback), JsonCallback);

            if (TruckType != null) AddAttribute(PropertyHelper.GetDescription(() => TruckType), EnumHelper.GetDescription(TruckType));
            if (TrailersCount != null) AddAttribute(PropertyHelper.GetDescription(() => TrailersCount), TrailersCount.ToString());

            if (ShippedHazardousGoods != null) AddAttribute(PropertyHelper.GetDescription(() => ShippedHazardousGoods), string.Join(",", ShippedHazardousGoods.Select(sg => EnumHelper.GetDescription(sg))));

            if (LimitedWeight != null) AddAttribute(PropertyHelper.GetDescription(() => LimitedWeight), LimitedWeight.Value.ToString(HereAPISession.Culture));
            if (WeightPerAxle != null) AddAttribute(PropertyHelper.GetDescription(() => WeightPerAxle), WeightPerAxle.Value.ToString(HereAPISession.Culture));
            if (Height != null) AddAttribute(PropertyHelper.GetDescription(() => Height), Height.Value.ToString(HereAPISession.Culture));
            if (Width != null) AddAttribute(PropertyHelper.GetDescription(() => Width), Width.Value.ToString(HereAPISession.Culture));
            if (Length != null) AddAttribute(PropertyHelper.GetDescription(() => Length), Length.Value.ToString(HereAPISession.Culture));

            if (TunnelCategory != null) AddAttribute(PropertyHelper.GetDescription(() => TunnelCategory), EnumHelper.GetDescription(TunnelCategory));
        }
Example #38
0
    public void Generate()
    {
        switch (Random.Range(0, 3))
        {
        case 0:
            objectColour = Colour.red;
            break;

        case 1:
            objectColour = Colour.yellow;
            break;

        case 2:
            objectColour = Colour.blue;
            break;

        case 3:
            objectColour = Colour.green;
            break;
        }

        switch (Random.Range(0, 3))
        {
        case 0:
            objectShape = Shape.square;
            break;

        case 1:
            objectShape = Shape.triangle;
            break;

        case 2:
            objectShape = Shape.circle;
            break;

        case 3:
            objectShape = Shape.freeform;
            break;
        }

        switch (Random.Range(0, 3))
        {
        case 0:
            objectQuality = Quality.shiny;
            break;

        case 1:
            objectQuality = Quality.rusty;
            break;

        case 2:
            objectQuality = Quality.broken;
            break;

        case 3:
            objectQuality = Quality.standard;
            break;
        }

        value = Random.Range(1, 5);
    }
Example #39
0
        private Control GetUserInputControl(SearchTag stag)
        {
            string          switchname = stag.TagName;
            string          typename   = stag.MyRuntimePropertyValue.GetType().ToString();
            FlowLayoutPanel flp        = new FlowLayoutPanel();;
            TextBox         tb         = null;
            Button          b          = null;
            NumericUpDown   nud        = null;
            ComboBox        cb         = null;

            switch (typename)
            {
            case "System.Boolean":
            {
                RadioButtonListItem itrue = new RadioButtonListItem
                {
                    Text = "true"
                };
                RadioButtonListItem ifalse = new RadioButtonListItem
                {
                    Text = "false"
                };
                RadioButtonList rdb = new RadioButtonList
                {
                    Text = stag.TagName
                };
                rdb.Items.Add(itrue);
                rdb.Items.Add(ifalse);
                rdb.SelectedIndexChanged += (sender, e) =>
                {
                    PropertyInfo info = stag.MyPropertyInfo;
                    info.SetValue(((SearchTag)stag.MyParentTag).MyRuntimePropertyValue, itrue.Checked);
                    MySetTags.Add(stag);
                    UpdateDialog();
                };
                return(rdb);
            }

            case "System.String":
            {
                tb = new TextBox();
                flp.Controls.Add(tb);
                b = new Button
                {
                    Text = "OK"
                };
                b.Click += (sender, e) =>
                {
                    PropertyInfo info = stag.MyPropertyInfo as PropertyInfo;
                    info.SetValue(((SearchTag)stag.MyParentTag).MyRuntimePropertyValue, tb.Text);
                    MySetTags.Add(stag);
                    UpdateDialog();
                };
                flp.Controls.Add(b);
                return(flp);
            }

            case "System.Int32":
            {
                nud = new NumericUpDown
                {
                    Minimum = int.MinValue,
                    Maximum = int.MaxValue
                };
                flp.Controls.Add(nud);
                b = new Button
                {
                    Text = "OK"
                };
                b.Click += (sender, e) =>
                {
                    PropertyInfo info = stag.MyPropertyInfo;
                    info.SetValue(((SearchTag)stag.MyParentTag).MyRuntimePropertyValue, (int)nud.Value);
                    MySetTags.Add(stag);
                    UpdateDialog();
                };
                flp.Controls.Add(b);
                return(flp);
            }

            case "Chummer.Backend.Uniques.Tradition":
            {
                var traditions = Chummer.Backend.Uniques.Tradition.GetTraditions(ucSINnersSearch.MySearchCharacter.MyCharacter);
                cb = new ComboBox
                {
                    DataSource    = traditions,
                    DropDownStyle = ComboBoxStyle.DropDownList,
                    FlatStyle     = FlatStyle.Standard,
                    DisplayMember = "Name"
                };
                cb.SelectedValueChanged += (sender, e) =>
                {
                    if (_loading)
                    {
                        return;
                    }
                    PropertyInfo info = stag.MyPropertyInfo;
                    info.SetValue(((SearchTag)stag.MyParentTag).MyRuntimePropertyValue, cb.SelectedValue);
                    stag.TagValue = (cb.SelectedValue as Chummer.Backend.Uniques.Tradition)?.Name ?? string.Empty;
                    MySetTags.Add(stag);
                    UpdateDialog();
                };
                flp.Controls.Add(cb);
                return(flp);
            }
            }
            object obj = stag.MyRuntimePropertyValue;

            if (!(obj is string))
            {
                if (obj is IList)
                {
                    Type listtype = StaticUtils.GetListType(obj);
                    if (listtype != null)
                    {
                        switchname = listtype.Name;
                    }
                }
            }

            switch (switchname)
            {
            ///these are sample implementations to get added one by one...
            case "Spell":
            {
                Button button = new Button
                {
                    Text = "select Spell"
                };
                button.Click += (sender, e) =>
                {
                    var frmPickSpell = new frmSelectSpell(MySearchCharacter.MyCharacter);
                    frmPickSpell.ShowDialog();
                    // Open the Spells XML file and locate the selected piece.
                    XmlDocument objXmlDocument = XmlManager.Load("spells.xml");
                    XmlNode     objXmlSpell    = objXmlDocument.SelectSingleNode("/chummer/spells/spell[id = \"" + frmPickSpell.SelectedSpell + "\"]");
                    Spell       objSpell       = new Spell(MySearchCharacter.MyCharacter);
                    if (string.IsNullOrEmpty(objSpell.Name))
                    {
                        return;
                    }
                    objSpell.Create(objXmlSpell, string.Empty, frmPickSpell.Limited, frmPickSpell.Extended, frmPickSpell.Alchemical);
                    MySearchCharacter.MyCharacter.Spells.Add(objSpell);
                    SearchTag spellsearch = new SearchTag(stag.MyPropertyInfo, stag.MyRuntimeHubClassTag)
                    {
                        MyRuntimePropertyValue = objSpell,
                        MyParentTag            = stag,
                        TagName        = objSpell.Name,
                        TagValue       = string.Empty,
                        SearchOperator = "exists"
                    };
                    MySetTags.Add(spellsearch);
                    UpdateDialog();
                };
                return(button);
            }

            case "Quality":
            {
                Button button = new Button
                {
                    Text = "select Quality"
                };
                button.Click += ((sender, e) =>
                    {
                        var frmPick = new frmSelectQuality(MySearchCharacter.MyCharacter);
                        frmPick.ShowDialog();
                        // Open the Spells XML file and locate the selected piece.
                        XmlDocument objXmlDocument = XmlManager.Load("qualities.xml");
                        XmlNode objXmlNode = objXmlDocument.SelectSingleNode("/chummer/qualities/quality[id = \"" + frmPick.SelectedQuality + "\"]");
                        Quality objQuality = new Quality(MySearchCharacter.MyCharacter);
                        List <Weapon> lstWeapons = new List <Weapon>();
                        objQuality.Create(objXmlNode, QualitySource.Selected, lstWeapons);
                        MySearchCharacter.MyCharacter.Qualities.Add(objQuality);
                        SearchTag newtag = new SearchTag(stag.MyPropertyInfo, stag.MyRuntimeHubClassTag)
                        {
                            MyRuntimePropertyValue = objQuality,
                            MyParentTag = stag,
                            TagName = objQuality.Name,
                            TagValue = string.Empty,
                            SearchOperator = "exists"
                        };
                        MySetTags.Add(newtag);
                        UpdateDialog();
                    });
                return(button);
            }
            }
            return(null);
        }
 // Token: 0x06001F8F RID: 8079 RVA: 0x00002ACE File Offset: 0x00000CCE
 internal virtual void RenderVectors(Camera camera, CommandBuffer renderCB, float scale, Quality quality)
 {
 }
Example #41
0
 public Driver(Quality quality)
 {
     Id      = Helpers.GenerateId();
     Quality = quality;
 }
Example #42
0
        public void CreateHtmlContent(XmlNode node, EnumWebElementPositionType positionType, int groupId)
        {
            bool b;

            XmlUtil.SetAttribute(node, "tabindex", this.TabIndex);
            WebPageCompilerUtility.SetWebControlAttributes(this, node);
            XmlUtil.SetAttribute(node, "classid", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000");
            XmlUtil.SetAttribute(node, "width", this.Width);
            XmlUtil.SetAttribute(node, "height", this.Height);
            XmlUtil.SetAttribute(node, "align", "middle");
            if (!string.IsNullOrEmpty(PlayerDownloadUrl))
            {
                XmlUtil.SetAttribute(node, "codebase", PlayerDownloadUrl);
            }
            _resourceFiles = new List <WebResourceFile>();
            WebResourceFile wf;
            string          swf = string.Empty;

            if (!string.IsNullOrEmpty(_swfFile))
            {
                if (File.Exists(_swfFile))
                {
                    wf = new WebResourceFile(_swfFile, WebResourceFile.WEBFOLDER_Images, out b);
                    _resourceFiles.Add(wf);
                    if (b)
                    {
                        _swfFile = wf.ResourceFile;
                    }
                    swf = string.Format(CultureInfo.InvariantCulture, "{0}/{1}", WebResourceFile.WEBFOLDER_Images, Path.GetFileName(_swfFile));
                }
            }
            string btimg = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "arrow.gif");

            if (File.Exists(btimg))
            {
                _resourceFiles.Add(new WebResourceFile(btimg, WebResourceFile.WEBFOLDER_Images, out b));
            }
            btimg = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "menusep.png");
            if (File.Exists(btimg))
            {
                _resourceFiles.Add(new WebResourceFile(btimg, WebResourceFile.WEBFOLDER_Images, out b));
            }
            setParam(node, "movie", swf);
            //
            setParam(node, "quality", Quality.ToString());
            //
            setParam(node, "bgcolor", ObjectCreationCodeGen.GetColorString(this.BackColor));
            if (!Play)
            {
                setParam(node, "play", "false");
            }
            if (!Loop)
            {
                setParam(node, "loop", "false");
            }
            if (Menu)
            {
                setParam(node, "menu", "true");
            }
            if (PlayScale != EnumFlashScale.@default)
            {
                setParam(node, "scale", PlayScale.ToString());
            }
            if (Align != EnumFlashAlign.Default)
            {
                setParam(node, "salign", Align.ToString());
            }
            if (WindowMode != EnumFlashWindowMode.window)
            {
                setParam(node, "wmode", WindowMode.ToString());
            }
            if (!string.IsNullOrEmpty(BaseUrl))
            {
                setParam(node, "base", BaseUrl);
            }
            if (AllowFullScreen)
            {
                setParam(node, "allowFullScreen", "true");
            }
            if (FullScreenAspectRatio != EnumFlashFullScreenAspectRatio.Default)
            {
                setParam(node, "fullScreenAspectRatio", FullScreenAspectRatio.ToString());
            }
            //
            XmlNode embedNode = node.OwnerDocument.CreateElement("embed");

            node.AppendChild(embedNode);
            XmlUtil.SetNameAttribute(embedNode, this.CodeName);
            XmlUtil.SetAttribute(embedNode, "src", swf);
            XmlUtil.SetAttribute(embedNode, "width", this.Width);
            XmlUtil.SetAttribute(embedNode, "height", this.Height);
            XmlUtil.SetAttribute(embedNode, "bgcolor", ObjectCreationCodeGen.GetColorString(this.BackColor));
            XmlUtil.SetAttribute(embedNode, "quality", this.Quality);
            XmlUtil.SetAttribute(embedNode, "name", Path.GetFileName(swf));
            XmlUtil.SetAttribute(embedNode, "type", "application/x-shockwave-flash");
            XmlUtil.SetAttribute(embedNode, "PLUGINSPAGE", "http://www.macromedia.com/go/getflashplayer");
            if (!Play)
            {
                XmlUtil.SetAttribute(embedNode, "play", "false");
            }
            if (!Loop)
            {
                XmlUtil.SetAttribute(embedNode, "loop", "false");
            }
            if (Menu)
            {
                XmlUtil.SetAttribute(embedNode, "menu", "true");
            }
            if (PlayScale != EnumFlashScale.@default)
            {
                XmlUtil.SetAttribute(embedNode, "scale", PlayScale.ToString());
            }
            if (Align != EnumFlashAlign.Default)
            {
                XmlUtil.SetAttribute(embedNode, "salign", Align.ToString());
            }
            if (WindowMode != EnumFlashWindowMode.window)
            {
                XmlUtil.SetAttribute(embedNode, "wmode", WindowMode.ToString());
            }
            if (!string.IsNullOrEmpty(BaseUrl))
            {
                XmlUtil.SetAttribute(embedNode, "base", BaseUrl);
            }
            if (AllowFullScreen)
            {
                XmlUtil.SetAttribute(embedNode, "allowFullScreen", "true");
            }
            if (FullScreenAspectRatio != EnumFlashFullScreenAspectRatio.Default)
            {
                XmlUtil.SetAttribute(embedNode, "fullScreenAspectRatio", FullScreenAspectRatio.ToString());
            }

            StringBuilder style = new StringBuilder();

            WebPageCompilerUtility.CreateWebElementZOrder(this.zOrder, style);
            WebPageCompilerUtility.CreateElementPosition(this, style, positionType);
            WebPageCompilerUtility.CreateWebElementCursor(cursor, style, false);

            XmlUtil.SetAttribute(node, "style", style.ToString());
            //
        }
Example #43
0
        public void should_be_able_to_convert_qualityTypes_to_int(Quality source, int expected)
        {
            var i = (int)source;

            i.Should().Be(expected);
        }
Example #44
0
        public void should_be_able_to_convert_int_to_qualityTypes(int source, Quality expected)
        {
            var quality = (Quality)source;

            quality.Should().Be(expected);
        }
 public Traspaso_Almacen(string conex)
 {
     con = new Quality(conex);
 }
Example #46
0
 public virtual Dictionary <string, string> getAdditionalSaveData()
 {
     return(new Dictionary <string, string>()
     {
         { "id", data.id }, { "tileLocation", TileLocation.X + "," + TileLocation.Y }, { "name", Name }, { "quality", Quality.ToString() }, { "price", Price.ToString() }, { "stack", Stack.ToString() }
     });
 }
Example #47
0
 internal override void RenderVectors(Camera camera, CommandBuffer renderCB, float scale, Quality quality)
 {
     if (this.m_initialized && !this.m_error && this.m_renderer.isVisible)
     {
         bool      flag     = (this.m_owner.Instance.CullingMask & 1 << this.m_obj.gameObject.layer) != 0;
         int       num      = (!flag) ? 255 : this.m_owner.Instance.GenerateObjectId(this.m_obj.gameObject);
         Vector3[] vertices = this.m_cloth.vertices;
         for (int i = 0; i < this.m_targetVertexCount; i++)
         {
             this.m_currVertices[i] = vertices[this.m_targetRemap[i]];
         }
         if (this.m_starting || !this.m_wasVisible)
         {
             Array.Copy(this.m_currVertices, this.m_prevVertices, this.m_targetVertexCount);
         }
         this.m_clonedMesh.vertices = this.m_currVertices;
         this.m_clonedMesh.normals  = this.m_prevVertices;
         Matrix4x4 value;
         if (this.m_obj.FixedStep)
         {
             value = this.m_owner.PrevViewProjMatrixRT * this.m_currLocalToWorld;
         }
         else
         {
             value = this.m_owner.PrevViewProjMatrixRT * this.m_prevLocalToWorld;
         }
         renderCB.SetGlobalMatrix("_AM_MATRIX_PREV_MVP", value);
         renderCB.SetGlobalFloat("_AM_OBJECT_ID", (float)num * 0.003921569f);
         renderCB.SetGlobalFloat("_AM_MOTION_SCALE", (!flag) ? 0f : scale);
         int num2 = (quality != Quality.Mobile) ? 2 : 0;
         for (int j = 0; j < this.m_sharedMaterials.Length; j++)
         {
             MotionState.MaterialDesc materialDesc = this.m_sharedMaterials[j];
             int shaderPass = num2 + ((!materialDesc.coverage) ? 0 : 1);
             if (materialDesc.coverage)
             {
                 Texture mainTexture = materialDesc.material.mainTexture;
                 if (mainTexture != null)
                 {
                     materialDesc.propertyBlock.SetTexture("_MainTex", mainTexture);
                 }
                 if (materialDesc.cutoff)
                 {
                     materialDesc.propertyBlock.SetFloat("_Cutoff", materialDesc.material.GetFloat("_Cutoff"));
                 }
             }
             renderCB.DrawMesh(this.m_clonedMesh, this.m_currLocalToWorld, this.m_owner.Instance.ClothVectorsMaterial, j, shaderPass, materialDesc.propertyBlock);
         }
     }
 }
Example #48
0
        public static string ExtractRecipeKeyFromSlot(CraftersConsignmentDisplay display, int num, Slot slot, out Quality quality)
        {
            GameObject containedObject = display.GetContainedObject(slot) as GameObject;

            if (containedObject != null)
            {
                if (containedObject is IFoodContainer) //|| containedObject is ServingContainer)
                {
                    ServingContainer container = containedObject as ServingContainer;
                    if (container != null)
                    {
                        CookingProcess containerConfig = container.CookingProcess;
                        if (containerConfig != null)
                        {
                            quality = containerConfig.Quality;
                            return(containerConfig.RecipeKey);
                        }
                        else
                        {
                            Common.Notify("Unable to find recipe for food in slot " + num + ". The catalog name was " + containedObject.CatalogName);
                        }
                    }
                    else
                    {
                        Common.Notify("Encountered food that was unidentifyable in slot " + num + ". The catalog name was " + containedObject.CatalogName);
                    }
                }
            }

            quality = Quality.Any;
            return(null);
        }
Example #49
0
 public virtual Dictionary <string, string> getAdditionalSaveData()
 {
     checkData();
     return(new Dictionary <string, string>()
     {
         { "id", data != null ? data.id : "na" }, { "tileLocation", TileLocation != null ? TileLocation.X + "," + TileLocation.Y : "0,0" }, { "name", Name != null ? Name : "Error" }, { "quality", Quality.ToString() != null?Quality.ToString() : "0" }, { "price", Price.ToString() != null?Price.ToString() : "0" }, { "stack", Stack.ToString() != null?Stack.ToString() : "1" }
     });
 }
Example #50
0
 public override int GetHashCode()
 {
     return(VideoId.GetHashCode() ^ Quality.GetHashCode());
 }
Example #51
0
        // 按照配置转换指定的资源
        public void Start( // 资源文件列表
            ResConfig config,
            // 目标路径
            string destFolder,
            // 源屏幕大小
            int srcWidth, int srcHeight,
            // 目标屏幕大小
            int destWidth, int destHeight)
        {
            // 忽略无效参数
            if (srcWidth <= 0 || srcHeight <= 0 || destWidth <= 0 || destHeight <= 0)
            {
                return;
            }

            if (srcWidth == destWidth && srcHeight == destHeight)
            {
                return;
            }

            int cur = 0;

            // 以root为根目录载入所有图片并缩放
            string baseDir = config.path;

            foreach (ResFile file in config.files)
            {
                OnNotifyProcess(file.path, ++cur, config.files.Count);

                string inputFile = Path.GetFullPath(Path.Combine(baseDir, file.path));
                string destFile  = Path.GetFullPath(Path.Combine(destFolder, file.path));

                // 选择质量参数
                Quality q = Quality.HIGH;
                if (file.quality.ToLower() == ResFile.QUALITY_LOW)
                {
                    q = Quality.LOW;
                }
                else if (file.quality.ToLower() == ResFile.QUALITY_NORMAL)
                {
                    q = Quality.NORMAL;
                }

                try
                {
                    Bitmap      dest   = null;
                    ImageFormat format = null;

                    // 读取源图片
                    using (Bitmap source = new Bitmap(inputFile))
                    {
                        // 根据策略计算区域映射(尚未实现)
                        Dictionary <Rectangle, Rectangle> rects =
                            CalcRects(source, srcWidth, srcHeight, destWidth, destHeight);

                        // 实施转换
                        dest = Scale(source, srcWidth, srcHeight, destWidth, destHeight, q, rects);

                        format = source.RawFormat;
                    }

                    if (dest != null)
                    {
                        dest.Save(destFile, format);
                    }

                    // 转换完毕
                }
                catch (System.Exception e)
                {
                    // 转换出现错误
                    Console.WriteLine(e.Message);
                }
            }
        }
 public override int GetHashCode()
 {
     return(Value.ToLowerInvariant().GetHashCode() ^ Quality.GetHashCode());
 }
Example #53
0
 private extern static void nvttSetCompressionOptionsQuality(IntPtr compressionOptions, Quality quality);
        public void IsUpgradeTest(Quality current, Int32 currentVersion, Quality newQuality, Int32 newVersion, Quality cutoff, Boolean expected)
        {
            GivenAutoDownloadPropers(true);

            var profile = new Profile {
                Items = Qualities.QualityFixture.GetDefaultQualities()
            };

            Subject.IsUpgradable(profile, new QualityModel(current, new Revision(version: currentVersion)), new QualityModel(newQuality, new Revision(version: newVersion)))
            .Should().Be(expected);
        }
Example #55
0
        public void EnsureTrackFile(ArtistResource artist, int albumId, int albumReleaseId, int trackId, Quality quality)
        {
            var result = Tracks.GetTracksInArtist(artist.Id).Single(v => v.Id == trackId);

            if (result.TrackFile == null)
            {
                var path = Path.Combine(ArtistRootFolder, artist.ArtistName, "Track.mp3");

                Directory.CreateDirectory(Path.GetDirectoryName(path));
                File.WriteAllText(path, "Fake Track");

                Commands.PostAndWait(new ManualImportCommand {
                    Files = new List <ManualImportFile> {
                        new ManualImportFile {
                            Path           = path,
                            ArtistId       = artist.Id,
                            AlbumId        = albumId,
                            AlbumReleaseId = albumReleaseId,
                            TrackIds       = new List <int> {
                                trackId
                            },
                            Quality = new QualityModel(quality)
                        }
                    }
                });
                Commands.WaitAll();

                var track = Tracks.GetTracksInArtist(artist.Id).Single(x => x.Id == trackId);

                track.TrackFileId.Should().NotBe(0);
            }
        }
Example #56
0
    public void ReadLanguage()
    {
        if (Level.Equals(1))//Se è il menu
        {
            print("Default System Language: <color=withe>" + Application.systemLanguage + "</color>");

            W_Language.AllTexts = FindObjectsOfType <W_Language>();


            //Se è IL PRIMO AVVIO DEL GIOCO su questo dispositivo, se è un nuovo utente
            if (PlayerPrefs.GetInt(GameManager.Instance.AppName + "_PrimoAvvio", 0) == 0)
            {
                print("Apply default language: <color=withe>" + Application.systemLanguage + "</color>");

                //Al primo avvio usa sempre la lingua di sistema
                if (Application.systemLanguage.ToString() == "English")
                {
                    lang = Lang.English;
                }
                else if (Application.systemLanguage.ToString() == "Italian")
                {
                    lang = Lang.Italian;
                }

                PlayerPrefs.SetString(GameManager.Instance.AppName + "_Language", lang.ToString());

                if (GameManager.Instance.lang == GameManager.Lang.English)
                {
                    MainMenu.LangDropDown.value = 0;
                }
                else if (GameManager.Instance.lang == GameManager.Lang.Italian)
                {
                    MainMenu.LangDropDown.value = 1;
                }

                PrimoAvvio = true;
            }
            else
            {
                //Se non è il primo avvio legge dal PlayerPref la lingua scelta
                if (PlayerPrefs.GetString(GameManager.Instance.AppName + "_Language") == "English")
                {
                    lang = Lang.English;
                    MainMenu.Instance._LangDropDown.value = 0;
                }
                else if (PlayerPrefs.GetString(GameManager.Instance.AppName + "_Language") == "Italian")
                {
                    lang = Lang.Italian;
                    MainMenu.Instance._LangDropDown.value = 1;
                }

                if (PlayerPrefs.GetString(GameManager.Instance.AppName + "_Quality") == "Low")
                {
                    quality = Quality.Low;
                    MainMenu.Instance._QualityDropDown.value = 0;
                }
                else if (PlayerPrefs.GetString(GameManager.Instance.AppName + "_Quality") == "Med")
                {
                    quality = Quality.Med;
                    MainMenu.Instance._QualityDropDown.value = 1;
                }
                else if (PlayerPrefs.GetString(GameManager.Instance.AppName + "_Quality") == "Hi")
                {
                    quality = Quality.Hi;
                    MainMenu.Instance._QualityDropDown.value = 2;
                }


                StartCoroutine(MainMenu.UpdateDataDelayed());
            }
            //Imposto _PrimoAvvio su true
            PlayerPrefs.SetInt(GameManager.Instance.AppName + "_PrimoAvvio", 1);
            PlayerPrefs.Save();

            Time.timeScale = 1 * TimeMultipler;

            print("PrimoAvvio:<color=#00FF00> " + PrimoAvvio + "</color>");

            return;
        }
        else
        {
            //Questo Else serve se si fa partire un livello non passando dal menu
            if (PlayerPrefs.GetString(GameManager.Instance.AppName + "_Language") == "English")
            {
                lang = Lang.English;
            }
            else if (PlayerPrefs.GetString(GameManager.Instance.AppName + "_Language") == "Italian")
            {
                lang = Lang.Italian;
            }

            print("PrimoAvvio: " + PrimoAvvio);
        }

        W_Language.CheckLang();
    }
Example #57
0
        protected sealed override IImageProvider PrepareGroup(IImageProvider groupSource)
        {
            m_mustGetNewSize = true;

            var blurCanBeApplied = TryPrepareLensBlurProperties();

            if (!blurCanBeApplied)
            {
                return(Source);
            }

            LensBlurEffect.Source           = groupSource;
            LensBlurEffect.KernelMap        = KernelMapSource;
            LensBlurEffect.BlendKernelWidth = LensBlurEffect.Kernels.Max(w => w.Size) / 2;

            switch (Quality)
            {
            case DepthOfFieldQuality.Preview:
                LensBlurEffect.Quality = GetQualityForPreview();
                break;

            case DepthOfFieldQuality.Full:
                LensBlurEffect.Quality = GetQualityForFull();
                break;

            default:
                throw new NotImplementedException(String.Format("Quality {0} currently unsupported", Quality.ToString()));
            }

            m_quality.Reset();

            return(LensBlurEffect);
        }
Example #58
0
 public int GetDriverUpkeep(Levels currentLevel, Quality quality)
 {
     return(Gamerules.DriverPrices.Find(x => x.Level == currentLevel && x.Quality == quality).Upkeep);
 }
Example #59
0
 public int GetVehicleUpkeep(Levels currentLevel, Quality quality)
 {
     return(Gamerules.VehiclePrices.Find(x => x.Level == currentLevel && x.Quality == quality).Upkeep);
 }
Example #60
0
 private void SuperiorDamageControlClick(Quality quality)
 {
     Starship.SuperiorDamageControl = quality;
     UpdateSuperiorDamageControl();
 }