public static ItemColors TranslateItemColor(string itemColor) { ItemColors colorResult; ItemColors.TryParse(itemColor, out colorResult); return(colorResult); }
public void GenerateShoesColor() { for (int i = 0; i < ColorButtonPanel.transform.childCount; i++) { Destroy(ColorButtonPanel.transform.GetChild(i).gameObject); } foreach (var obj in AllCustomData.CustomShoes) { if (obj.type == ButtonType.color && obj._gender == PlayerPrefs.GetString("CharacterType")) { foreach (var color in obj.AllColors) { var go = (GameObject)Instantiate(CustomColorButtonPrefab, Vector3.zero, Quaternion.identity); go.transform.SetParent(ColorButtonPanel.transform); go.transform.localScale = Vector3.one; go.GetComponent <Image> ().color = color.icon; var NewColor = new ItemColors(); var CharType = CharacterCustomizationAtStart.Instance.SelectedCharacter.GetComponent <CharacterProperties> ().PlayerType; if (CharType == "Brown") { NewColor.AllItems = color.BrownShoes; } else if (CharType == "White") { NewColor.AllItems = color.WhiteShoes; } else if (CharType == "Black") { NewColor.AllItems = color.BlackShoes; } NewColor.icon = color.icon; NewColor.name = color.name; var Component = go.AddComponent <CustomColorButton> (); Component.ThisColor = NewColor; Component.PartName = obj.PartName; // go.GetComponent<CharacterCustomButton>().Mytype = ButtonType.color; } } } }
/// <summary> /// Конструктор /// </summary> /// <param name="parName">Имя игрока</param> /// <param name="parItemColor">Цвет ячеек игрока</param> public Player(string parName, ItemColors parItemColor) { _name = parName; _itemColor = parItemColor; }
private static void BuildLinkVisual(ref Model3DGroup posLines, ref DiffuseMaterial posDiffuse, ref Model3DGroup negLines, ref DiffuseMaterial negDiffuse, Point3D from, Point3D to, double weight, double[] brainChemicals, ItemColors colors) { const double GAP = .05d; const double CHEMSPACE = .01d; double thickness = Math.Abs(weight) * .003d; #region Shorten Line // Leave a little bit of gap between the from node and the line so the user knows what direction the link is Vector3D line = from - to; double length = line.Length; double newLength = length - GAP; if (newLength > length * .75d) // don't shorten it if it's going to be too small { line = line.ToUnit() * newLength; } else { newLength = length; // doing this here so the logic below doesn't need an if statement } Point3D fromActual = to + line; #endregion GeometryModel3D geometry = null; #region Draw Line if (weight > 0) { if (posLines == null) { posLines = new Model3DGroup(); posDiffuse = new DiffuseMaterial(new SolidColorBrush(colors.Link_Positive)); } geometry = new GeometryModel3D(); geometry.Material = posDiffuse; geometry.BackMaterial = posDiffuse; geometry.Geometry = UtilityWPF.GetLine(fromActual, to, thickness); posLines.Children.Add(geometry); } else { if (negLines == null) { negLines = new Model3DGroup(); negDiffuse = new DiffuseMaterial(new SolidColorBrush(colors.Link_Negative)); } geometry = new GeometryModel3D(); geometry.Material = negDiffuse; geometry.BackMaterial = negDiffuse; geometry.Geometry = UtilityWPF.GetLine(fromActual, to, thickness); negLines.Children.Add(geometry); } #endregion if (brainChemicals != null) { #region Draw Brain Chemicals #region Calculations double workingLength = newLength - GAP; if (Math1D.IsNearValue(length, newLength)) { // Logic above didn't use a gap, so don't do one here either workingLength = length; } double totalChemSpace = (brainChemicals.Length - 1) * CHEMSPACE; double chemSpace = CHEMSPACE; if (totalChemSpace > workingLength) { chemSpace = workingLength / (brainChemicals.Length - 1); // shouldn't get divide by zero } Vector3D chemOffset = line.ToUnit() * (chemSpace * -1d); RotateTransform3D rotTrans = new RotateTransform3D(new QuaternionRotation3D(Math3D.GetRotation(new Vector3D(0, 0, 1), line))); #endregion // Place the chemicals for (int cntr = 0; cntr < brainChemicals.Length; cntr++) { Transform3DGroup transform = new Transform3DGroup(); transform.Children.Add(rotTrans); transform.Children.Add(new TranslateTransform3D((fromActual + (chemOffset * cntr)).ToVector())); double scale = .0062d * Math.Abs(brainChemicals[cntr]); ScaleTransform3D scaleTransform = new ScaleTransform3D(scale, scale, scale); if (brainChemicals[cntr] > 0) { if (posLines == null) { posLines = new Model3DGroup(); posDiffuse = new DiffuseMaterial(new SolidColorBrush(colors.Link_Positive)); } geometry = new GeometryModel3D(); geometry.Material = posDiffuse; geometry.BackMaterial = posDiffuse; geometry.Geometry = UtilityWPF.GetCircle2D(5, scaleTransform, Transform3D.Identity); geometry.Transform = transform; posLines.Children.Add(geometry); } else { if (negLines == null) { negLines = new Model3DGroup(); negDiffuse = new DiffuseMaterial(new SolidColorBrush(colors.Link_Negative)); } geometry = new GeometryModel3D(); geometry.Material = negDiffuse; geometry.BackMaterial = negDiffuse; geometry.Geometry = UtilityWPF.GetCircle2D(5, scaleTransform, Transform3D.Identity); geometry.Transform = transform; negLines.Children.Add(geometry); } } #endregion } }
private static void BuildNeuronVisuals(out List<Tuple<INeuron, SolidColorBrush>> outNeurons, out ModelVisual3D model, IEnumerable<INeuron> inNeurons, INeuronContainer container, ItemColors colors) { outNeurons = new List<Tuple<INeuron, SolidColorBrush>>(); Model3DGroup geometries = new Model3DGroup(); int neuronCount = inNeurons.Count(); double neuronRadius; if (neuronCount < 20) { neuronRadius = .03d; } else if (neuronCount > 100) { neuronRadius = .007d; } else { neuronRadius = UtilityCore.GetScaledValue(.03d, .007d, 20, 100, neuronCount); } foreach (INeuron neuron in inNeurons) { MaterialGroup material = new MaterialGroup(); SolidColorBrush brush = new SolidColorBrush(neuron.IsPositiveOnly ? colors.Neuron_Zero_ZerPos : colors.Neuron_Zero_NegPos); DiffuseMaterial diffuse = new DiffuseMaterial(brush); material.Children.Add(diffuse); material.Children.Add(new SpecularMaterial(new SolidColorBrush(UtilityWPF.ColorFromHex("80C0C0C0")), 50d)); GeometryModel3D geometry = new GeometryModel3D(); geometry.Material = material; geometry.BackMaterial = material; geometry.Geometry = UtilityWPF.GetSphere_LatLon(2, neuronRadius); geometry.Transform = new TranslateTransform3D(neuron.Position.ToVector()); geometries.Children.Add(geometry); outNeurons.Add(new Tuple<INeuron, SolidColorBrush>(neuron, brush)); } model = new ModelVisual3D(); model.Content = geometries; //model.Transform = new TranslateTransform3D(position.ToVector()); model.Transform = GetContainerTransform(new Dictionary<INeuronContainer, Transform3D>(), container); }
public static int NewArmor(CLRScriptBase script, int maxValue) { #region Calculate Armor Type List <int> possibleBaseItems = new List <int>(); foreach (int armorType in ArmorResRefs.Keys) { if (Pricing.ArmorRulesTypeValues[armorType] <= maxValue) { possibleBaseItems.Add(armorType); } } if (possibleBaseItems.Count == 0) { // Can't afford any armor. What are we doing here? return(0); } int selectedArmorType = possibleBaseItems[Generation.rand.Next(possibleBaseItems.Count)]; int armorValue = Pricing.ArmorRulesTypeValues[selectedArmorType]; maxValue -= armorValue; uint armor = script.CreateItemOnObject(ArmorResRefs[selectedArmorType], script.OBJECT_SELF, 1, "", FALSE); #endregion #region Armor Appearance Generation.Theme armorTheme = Generation.GetEnchantmentTheme(); if (script.GetBaseItemType(armor) == BASE_ITEM_ARMOR) { script.StoreCampaignObject(ACR_Items.ItemChangeDBName, ACR_Items.ModelChangeVarName, armor, script.OBJECT_SELF); ArmorSet set = null; switch (selectedArmorType) { case ARMOR_RULES_TYPE_BANDED: set = ACR_Items.ArmorSetLibrary[ACR_Items.ArmorSetTypes.Banded][Generation.rand.Next(ACR_Items.ArmorSetLibrary[ACR_Items.ArmorSetTypes.Banded].Count)]; break; case ARMOR_RULES_TYPE_BREASTPLATE: set = ACR_Items.ArmorSetLibrary[ACR_Items.ArmorSetTypes.Breastplate][Generation.rand.Next(ACR_Items.ArmorSetLibrary[ACR_Items.ArmorSetTypes.Breastplate].Count)]; break; case ARMOR_RULES_TYPE_CHAIN_SHIRT: set = ACR_Items.ArmorSetLibrary[ACR_Items.ArmorSetTypes.ChainShirt][Generation.rand.Next(ACR_Items.ArmorSetLibrary[ACR_Items.ArmorSetTypes.ChainShirt].Count)]; break; case ARMOR_RULES_TYPE_CHAINMAIL: set = ACR_Items.ArmorSetLibrary[ACR_Items.ArmorSetTypes.Chainmail][Generation.rand.Next(ACR_Items.ArmorSetLibrary[ACR_Items.ArmorSetTypes.Chainmail].Count)]; break; case ARMOR_RULES_TYPE_CLOTH: set = ACR_Items.ArmorSetLibrary[ACR_Items.ArmorSetTypes.Cloth][Generation.rand.Next(ACR_Items.ArmorSetLibrary[ACR_Items.ArmorSetTypes.Cloth].Count)]; break; case ARMOR_RULES_TYPE_FULL_PLATE: set = ACR_Items.ArmorSetLibrary[ACR_Items.ArmorSetTypes.FullPlate][Generation.rand.Next(ACR_Items.ArmorSetLibrary[ACR_Items.ArmorSetTypes.FullPlate].Count)]; break; case ARMOR_RULES_TYPE_HALF_PLATE: set = ACR_Items.ArmorSetLibrary[ACR_Items.ArmorSetTypes.HalfPlate][Generation.rand.Next(ACR_Items.ArmorSetLibrary[ACR_Items.ArmorSetTypes.HalfPlate].Count)]; break; case ARMOR_RULES_TYPE_HIDE: set = ACR_Items.ArmorSetLibrary[ACR_Items.ArmorSetTypes.Hide][Generation.rand.Next(ACR_Items.ArmorSetLibrary[ACR_Items.ArmorSetTypes.Hide].Count)]; break; case ARMOR_RULES_TYPE_LEATHER: set = ACR_Items.ArmorSetLibrary[ACR_Items.ArmorSetTypes.Leather][Generation.rand.Next(ACR_Items.ArmorSetLibrary[ACR_Items.ArmorSetTypes.Leather].Count)]; break; case ARMOR_RULES_TYPE_PADDED: set = ACR_Items.ArmorSetLibrary[ACR_Items.ArmorSetTypes.Padded][Generation.rand.Next(ACR_Items.ArmorSetLibrary[ACR_Items.ArmorSetTypes.Padded].Count)]; break; case ARMOR_RULES_TYPE_SCALE: set = ACR_Items.ArmorSetLibrary[ACR_Items.ArmorSetTypes.Scale][Generation.rand.Next(ACR_Items.ArmorSetLibrary[ACR_Items.ArmorSetTypes.Scale].Count)]; break; case ARMOR_RULES_TYPE_STUDDED_LEATHER: set = ACR_Items.ArmorSetLibrary[ACR_Items.ArmorSetTypes.StuddedLeather][Generation.rand.Next(ACR_Items.ArmorSetLibrary[ACR_Items.ArmorSetTypes.StuddedLeather].Count)]; break; } if (set != null) { ItemModels.TakeArmorStyle(ALFA.Shared.Modules.InfoStore.ModifiedGff[ACR_Items.ModelChangeVarName], set); } ColorPair color = GeneratedColors.ColorPairs[armorTheme][Generation.rand.Next(GeneratedColors.ColorPairs[armorTheme].Count)]; ItemColors.SetColorThemes(ALFA.Shared.Modules.InfoStore.ModifiedGff[ACR_Items.ModelChangeVarName], color.Primary, color.Accent); script.DestroyObject(armor, 0.0f, TRUE); armor = script.RetrieveCampaignObject(ACR_Items.ItemChangeDBName, ACR_Items.ModelChangeVarName, script.GetLocation(script.OBJECT_SELF), script.OBJECT_SELF, script.OBJECT_SELF); } #endregion #region See if We Want This to be Masterwork if (maxValue >= 150) { switch (selectedArmorType) { case ARMOR_RULES_TYPE_BANDED: script.SetArmorRulesType(armor, ARMOR_RULES_TYPE_BANDED_MASTERWORK); armorValue += 150; maxValue -= 150; break; case ARMOR_RULES_TYPE_BREASTPLATE: script.SetArmorRulesType(armor, ARMOR_RULES_TYPE_BREASTPLATE_MASTERWORK); armorValue += 150; maxValue -= 150; break; case ARMOR_RULES_TYPE_CHAIN_SHIRT: script.SetArmorRulesType(armor, ARMOR_RULES_TYPE_CHAIN_SHIRT_MASTERWORK); armorValue += 150; maxValue -= 150; break; case ARMOR_RULES_TYPE_CHAINMAIL: script.SetArmorRulesType(armor, ARMOR_RULES_TYPE_CHAINMAIL_MASTERWORK); armorValue += 150; maxValue -= 150; break; case ARMOR_RULES_TYPE_FULL_PLATE: script.SetArmorRulesType(armor, ARMOR_RULES_TYPE_FULL_PLATE_MASTERWORK); armorValue += 150; maxValue -= 150; break; case ARMOR_RULES_TYPE_HALF_PLATE: script.SetArmorRulesType(armor, ARMOR_RULES_TYPE_HALF_PLATE_MASTERWORK); armorValue += 150; maxValue -= 150; break; case ARMOR_RULES_TYPE_HIDE: script.SetArmorRulesType(armor, ARMOR_RULES_TYPE_HIDE_MASTERWORK); armorValue += 150; maxValue -= 150; break; case ARMOR_RULES_TYPE_LEATHER: script.SetArmorRulesType(armor, ARMOR_RULES_TYPE_LEATHER_MASTERWORK); armorValue += 150; maxValue -= 150; break; case ARMOR_RULES_TYPE_PADDED: script.SetArmorRulesType(armor, ARMOR_RULES_TYPE_PADDED_MASTERWORK); armorValue += 150; maxValue -= 150; break; case ARMOR_RULES_TYPE_SCALE: script.SetArmorRulesType(armor, ARMOR_RULES_TYPE_SCALE_MASTERWORK); armorValue += 150; maxValue -= 150; break; case ARMOR_RULES_TYPE_SHIELD_HEAVY: script.SetArmorRulesType(armor, ARMOR_RULES_TYPE_SHIELD_HEAVY_MASTERWORK); armorValue += 150; maxValue -= 150; break; case ARMOR_RULES_TYPE_SHIELD_LIGHT: script.SetArmorRulesType(armor, ARMOR_RULES_TYPE_SHIELD_LIGHT_MASTERWORK); armorValue += 150; maxValue -= 150; break; case ARMOR_RULES_TYPE_SHIELD_TOWER: script.SetArmorRulesType(armor, ARMOR_RULES_TYPE_SHIELD_TOWER_MASTERWORK); armorValue += 150; maxValue -= 150; break; case ARMOR_RULES_TYPE_SPLINT: script.SetArmorRulesType(armor, ARMOR_RULES_TYPE_SPLINT_MASTERWORK); armorValue += 150; maxValue -= 150; break; case ARMOR_RULES_TYPE_STUDDED_LEATHER: script.SetArmorRulesType(armor, ARMOR_RULES_TYPE_STUDDED_LEATHER_MASTERWORK); armorValue += 150; maxValue -= 150; break; } } else { // We can't even afford masterwork. Carry on. return(armorValue); } #endregion #region Calculate Effective Plus double effectivePlusRemaining = Math.Sqrt((double)(maxValue / 1000)); // we cast after the division because we're going to turn this into an int later. double currentEffectivePlus = 0.0; #endregion #region Set Base Properties int enhancementBonus = 0; if (effectivePlusRemaining >= 1.0) { enhancementBonus = 1; effectivePlusRemaining -= 1; currentEffectivePlus = 1; bool quirkAdded = false; while (effectivePlusRemaining >= 1) { if (Generation.rand.Next(100) > 95) { // The remainder of the enchantment will // be personality heavy. break; } if (!quirkAdded && Generation.rand.Next(100) < 75) { enhancementBonus += 1; effectivePlusRemaining -= 1; currentEffectivePlus += 1; } else { List <EnhancementTypes> quirks = BuildBaseEnchantmentPossibilities(script.GetBaseItemType(armor), effectivePlusRemaining); if (quirks.Count > 0) { EnhancementTypes quirk = quirks[Generation.rand.Next(quirks.Count)]; if (selectedArmorType == ARMOR_RULES_TYPE_CLOTH && quirk == EnhancementTypes.Twilight) { quirk = EnhancementTypes.SpellFocus; } switch (quirk) { case EnhancementTypes.CombatCasting: script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusFeat(IP_CONST_FEAT_COMBAT_CASTING), armor, 0.0f); script.SetFirstName(armor, String.Format("Battlemage's {0}", script.GetName(armor))); effectivePlusRemaining -= 1; currentEffectivePlus += 1; break; case EnhancementTypes.DeflectArrows: script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusFeat(IP_CONST_FEAT_DEFLECT_ARROWS), armor, 0.0f); script.SetFirstName(armor, String.Format("Arrowcatching {0}", script.GetName(armor))); effectivePlusRemaining -= 2; currentEffectivePlus += 2; break; case EnhancementTypes.Dodge: script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusFeat(IP_CONST_FEAT_DODGE), armor, 0.0f); script.SetFirstName(armor, String.Format("Nimble {0}", script.GetName(armor))); effectivePlusRemaining -= 1; currentEffectivePlus += 1; break; case EnhancementTypes.ExtraTurning: script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusFeat(IP_CONST_FEAT_EXTRA_TURNING), armor, 0.0f); script.SetFirstName(armor, String.Format("Turning {0}", script.GetName(armor))); effectivePlusRemaining -= 1; currentEffectivePlus += 1; break; case EnhancementTypes.SpellFocus: int primarySchool = Generation.SpellSchoolFocus[Generation.rand.Next(Generation.SpellSchoolFocus.Count)]; script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusFeat(primarySchool), armor, 0.0f); script.SetFirstName(armor, String.Format("Mage's {0}", script.GetName(armor))); effectivePlusRemaining -= 1; currentEffectivePlus += 1; if (effectivePlusRemaining >= 0.5) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusFeat(Generation.SpellFocusLeft[primarySchool]), armor, 0.0f); effectivePlusRemaining -= 0.5; currentEffectivePlus += 0.5; } if (effectivePlusRemaining >= 0.5) { script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusFeat(Generation.SpellFocusRight[primarySchool]), armor, 0.0f); effectivePlusRemaining -= 0.5; currentEffectivePlus += 0.5; } break; case EnhancementTypes.SpellPenetration: script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusFeat(IP_CONST_FEAT_SPELLPENETRATION), armor, 0.0f); script.SetFirstName(armor, String.Format("Mage's {0}", script.GetName(armor))); effectivePlusRemaining -= 1.5; currentEffectivePlus += 1.5; break; case EnhancementTypes.SR12: script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSpellResistance(IP_CONST_SPELLRESISTANCEBONUS_12), armor, 0.0f); script.SetFirstName(armor, String.Format("Spellsoaking {0}", script.GetName(armor))); effectivePlusRemaining -= 2; currentEffectivePlus += 2; break; case EnhancementTypes.SR14: script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSpellResistance(IP_CONST_SPELLRESISTANCEBONUS_14), armor, 0.0f); script.SetFirstName(armor, String.Format("Spellsoaking {0}", script.GetName(armor))); effectivePlusRemaining -= 3; currentEffectivePlus += 3; break; case EnhancementTypes.SR16: script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSpellResistance(IP_CONST_SPELLRESISTANCEBONUS_16), armor, 0.0f); script.SetFirstName(armor, String.Format("Spellsoaking {0}", script.GetName(armor))); effectivePlusRemaining -= 4; currentEffectivePlus += 4; break; case EnhancementTypes.SR18: script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSpellResistance(IP_CONST_SPELLRESISTANCEBONUS_18), armor, 0.0f); script.SetFirstName(armor, String.Format("Spellsoaking {0}", script.GetName(armor))); effectivePlusRemaining -= 5; currentEffectivePlus += 5; break; case EnhancementTypes.Twilight: script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyArcaneSpellFailure(IP_CONST_ARCANE_SPELL_FAILURE_MINUS_10_PERCENT), armor, 0.0f); script.SetFirstName(armor, String.Format("Twilight {0}", script.GetName(armor))); effectivePlusRemaining -= 1; currentEffectivePlus += 1; break; } } quirkAdded = true; } } script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyACBonus(enhancementBonus), armor, 0.0f); script.SetFirstName(armor, String.Format("{0} +{1}", script.GetName(armor), enhancementBonus)); } #endregion #region Armor Personality SetPersonalityProperties(script, armor, armorTheme, enhancementBonus, ref effectivePlusRemaining, ref currentEffectivePlus); armorValue += (int)(currentEffectivePlus * currentEffectivePlus * 1000); Pricing.CalculatePrice(script, armor); return(armorValue); #endregion }
/// <summary> /// Отрисовывает игровую ячейку /// </summary> /// <param name="parX">Координата X</param> /// <param name="parY">Координата Y</param> /// <param name="parScore">Число очков ячейки</param> /// <param name="parColor">Цвет ячейки</param> /// <param name="parDecorativity">Выделение ячейки</param> public abstract void DrawHexagonWithScore(float parX, float parY, int parScore, ItemColors parColor, bool parDecorativity);
private bool LoadItemsCriteria(ItemEntity i, ItemColors itemColor, ItemTypes itemType) => i.IsSold == false && i.ItemColor == itemColor && i.ItemType == itemType;
public static string TranslateItemColor(ItemColors itemColor) => itemColor.ToString();