/// <summary> /// Updates the <paramref name="spray"/>'s localized gamestrings to the currently selected <see cref="Localization"/>. /// </summary> /// <param name="spray">The data to be updated.</param> /// <exception cref="ArgumentNullException"><paramref name="spray"/> is <see langword="null"/>.</exception> public void UpdateGameStrings(Spray spray) { if (spray is null) { throw new ArgumentNullException(nameof(spray)); } JsonElement element = JsonGameStringDocument.RootElement; if (element.TryGetProperty("gamestrings", out JsonElement gameStringElement)) { if (gameStringElement.TryGetProperty("spray", out JsonElement keyValue)) { if (TryGetValueFromJsonElement(keyValue, "name", spray.Id, out JsonElement nameElement)) { spray.Name = nameElement.GetString(); } if (TryGetValueFromJsonElement(keyValue, "searchtext", spray.Id, out JsonElement searchTextElement)) { spray.SearchText = searchTextElement.GetString(); } if (TryGetValueFromJsonElement(keyValue, "sortname", spray.Id, out JsonElement sortNameElement)) { spray.SortName = sortNameElement.GetString(); } if (TryGetValueFromJsonElement(keyValue, "description", spray.Id, out JsonElement descriptionElement)) { spray.Description = SetTooltipDescription(descriptionElement.GetString()); } } } }
protected void AddLocalizedGameString(Spray spray) { GameStringWriter.AddSprayName(spray.Id, spray.Name); GameStringWriter.AddSpraySortName(spray.Id, spray.SortName); GameStringWriter.AddSprayDescription(spray.Id, GetTooltip(spray.Description, FileOutputOptions.DescriptionType)); GameStringWriter.AddSpraySearchText(spray.Id, spray.SearchText); }
public static Spray ReadSpray32(this BinaryReader br) { Spray spray = (Spray)br.ReadUInt32(); //Debug.Assert(Enum.IsDefined(typeof(Spray), spray)); return(spray); }
public ActionResult Publish(string id) { if (Request.IsAuthenticated) { Guid providedId; if (!Guid.TryParse(id, out providedId)) { return(View("Error")); } using (var db = new SprayContext()) { Spray spray = db.Sprays.Where(s => s.Id == providedId).FirstOrDefault(); if (spray != null) { long steamId64 = long.Parse(User.Identity.Name); /* CHANGEME - This is my Steam ID. If I logged in, I got extra admin options */ if ((spray.Creator.SteamId == steamId64 || User.Identity.Name == "76561197999489042") && spray.Status != Status.PUBLIC) // So we don't have to re-moderate { spray.Status = Status.UNMODERATED; db.SaveChanges(); } } return(RedirectToRoute("View Spray")); } } else { return(View("Error")); } }
public ActionResult Delete(string id) { if (Request.IsAuthenticated) { Guid providedId; if (!Guid.TryParse(id, out providedId)) { return(View("Error")); } using (var db = new SprayContext()) { Spray spray = db.Sprays.Where(s => s.Id == providedId).FirstOrDefault(); if (spray != null) { long steamId64 = long.Parse(User.Identity.Name); if (spray.Creator.SteamId == steamId64 || User.Identity.Name == "76561197999489042") /* CHANGEME - This is my Steam ID. If I logged in, I got extra admin options */ { spray.Status = Status.DELETED; db.SaveChanges(); } } return(RedirectToAction("Mine", "Browse")); } } else { return(View("Error")); } }
public ActionResult Save(string id) { if (Request.IsAuthenticated) { Guid providedId; if (!Guid.TryParse(id, out providedId)) { return(View("Error")); } using (var db = new SprayContext()) { Spray spray = db.Sprays.Where(s => s.Id == providedId).Where(s => s.Status != Status.DELETED).Where(s => s.DateExpires > DateTime.Now).ToList().FirstOrDefault(); if (spray != null) { long steamId64 = long.Parse(User.Identity.Name); User u = db.Users.FirstOrDefault(x => x.SteamId == steamId64); if (!u.Saved.Contains(spray)) { u.Saved.Add(spray); spray.Saves++; db.SaveChanges(); } } return(RedirectToRoute("View Spray")); } } else { return(View("Error")); } }
public override bool Interact(GameObject originator, Vector3 position, string hand) { if (UIManager.Hands.CurrentSlot.Item != gameObject) { return(base.Interact(originator, position, hand)); } var targetWorldPos = Camera.main.ScreenToWorldPoint(CommonInput.mousePosition); if (PlayerManager.PlayerScript.IsInReach(targetWorldPos) && extinguisher.isOn) { if (!isServer) { InteractMessage.Send(gameObject, hand); } else { //Play sound and call spray SoundManager.PlayNetworkedAtPos("Extinguish", targetWorldPos); ReagentContainer cleanerContainer = GetComponent <ReagentContainer>(); StartCoroutine(Spray.TriggerSpray(cleanerContainer, targetWorldPos, extinguish)); } } return(base.Interact(originator, position, hand)); }
public ActionResult ApproveSketchy(string id) { if (Request.IsAuthenticated && (User.Identity.Name == "76561197999489042")) /* CHANGEME - This is my Steam ID. If I logged in, I got extra admin options */ { Guid providedId; if (!Guid.TryParse(id, out providedId)) { return(View("Error")); } using (var db = new SprayContext()) { Spray spray = db.Sprays.Where(s => s.Id == providedId).FirstOrDefault(); if (spray != null) { spray.Status = Status.PUBLIC; spray.Safeness = Safeness.SKETCHY; db.SaveChanges(); } return(Json(true)); } } else { return(View("Error")); } }
protected override XElement GetAnimationObject(Spray spray) { return(new XElement( "Animation", new XElement("Texture", Path.ChangeExtension(spray.TextureSheet.Image?.ToLowerInvariant(), StaticImageExtension)), new XElement("Frames", spray.AnimationCount), new XElement("Duration", spray.AnimationDuration))); }
/// <summary> /// Updates the localized gamestrings to the selected <see cref="Localization"/>. /// </summary> /// <param name="spray">The data to be updated.</param> /// <param name="gameStringDocument">Instance of a <see cref="GameStringDocument"/>.</param> /// <exception cref="ArgumentNullException"><paramref name="gameStringDocument"/> is null.</exception> public static void UpdateGameStrings(this Spray spray, GameStringDocument gameStringDocument) { if (gameStringDocument is null) { throw new ArgumentNullException(nameof(gameStringDocument)); } gameStringDocument.UpdateGameStrings(spray); }
public void UpdateGameStringsThrowArgumentNullException() { Spray spray = new Spray { Id = "SprayAnimatedCarbotsAlarakDark", }; Assert.ThrowsException <ArgumentNullException>(() => spray.UpdateGameStrings(null !)); }
public static Spray[] ReadSpray32s(this BinaryReader br, int count) { Spray[] sprays = new Spray[count]; for (int i = 0; i < count; ++i) { sprays[i] = br.ReadSpray32(); } return(sprays); }
protected override JProperty GetAnimationObject(Spray spray) { return(new JProperty( "animation", new JObject( new JProperty("texture", Path.ChangeExtension(spray.TextureSheet.Image?.ToLowerInvariant(), StaticImageExtension)), new JProperty("frames", spray.AnimationCount), new JProperty("duration", spray.AnimationDuration)))); }
protected T AnimationObject(Spray spray) { if (spray.AnimationCount > 0) { return(GetAnimationObject(spray)); } return(null); }
static void Main(string[] args) { Draw pencil = new Draw(); Draw brush = new Brush(); Draw spray = new Spray(); pencil.StartDraw(); brush.StartDraw(); spray.StartDraw(); }
public void UpdateGameStringSprayTest() { using SprayDataDocument dataDocument = _heroesDataDirectory.SprayData(new HeroesDataVersion(2, 47, 3, 76124), true, Localization.KOKR); Spray data = dataDocument.GetSprayById("SprayAnimatedCookieAbathur"); Assert.AreEqual("과자 아바투르", data.Name); _heroesDataDirectory.UpdateGameString(data, new HeroesDataVersion(2, 48, 4, 77407), Localization.ENUS); Assert.AreEqual("sprayName", data.Name); }
/// <summary> /// Updates the gamestrings of <paramref name="spray"/>. /// </summary> /// <param name="spray">The data who's gamestrings will be updated.</param> /// <param name="version">The version directory to load the gamestrings from.</param> /// <param name="localization">The <see cref="Localization"/> of the gamestrings.</param> /// <exception cref="ArgumentNullException"><paramref name="spray"/> is null.</exception> /// <exception cref="ArgumentNullException"><paramref name="version"/> is null.</exception> public void UpdateGameString(Spray spray, HeroesDataVersion version, Localization localization) { ArgumentNullException.ThrowIfNull(spray, nameof(spray)); ArgumentNullException.ThrowIfNull(version, nameof(version)); (_, string gameStringPath) = GetDataAndGameStringPaths(version, true, localization, _sprayFileTemplateName, false, true); using GameStringDocument gameStringDocument = GameStringDocument.Parse(gameStringPath); spray.UpdateGameStrings(gameStringDocument); }
public void UpdateGameStringsTest() { using GameStringDocument gameStringDocument = GameStringDocument.Parse(LoadEnusLocalizedStringData()); Spray spray = new Spray { Id = "SprayAnimatedCarbotsAlarakDark", }; spray.UpdateGameStrings(gameStringDocument); Assert.AreEqual(string.Empty, spray.Description !.RawDescription); }
// Use this for initialization void Start() { GameObject Spray1 = transform.Find("Spray 1").gameObject; GameObject Spray2 = transform.Find("Spray 2").gameObject; spray1 = Spray1.GetComponent("Spray") as Spray; spray2 = Spray2.GetComponent("Spray") as Spray; rb = GetComponent <Rigidbody>(); direction = orbitCenter.transform.position - transform.position; initialTangent.Normalize(); binormal = Vector3.Cross(initialTangent, direction); }
// Use this for initialization public override void OnStart() { // Cargamos todos los efectos lightObject = ship.config.engineLight.GetComponent<Light>(); trailObject = ship.config.engineTrail.GetComponent<TrailRenderer>(); boosterColor = ship.config.boosterLeft.GetComponent<Renderer>().material.GetColor("_TintColor"); boosterLeft = ship.config.boosterLeft.GetComponent<Renderer>(); boosterRight = ship.config.boosterRight.GetComponent<Renderer>(); windLeft = ship.config.windTrailLeft.GetComponent<TrailRenderer>(); windRight = ship.config.windTrailRight.GetComponent<TrailRenderer>(); spray = ship.config.engineSpray.GetComponent<Spray>(); trailMaxStartSize = trailObject.startWidth; trailMaxEndSize = trailObject.endWidth; }
public IEnumerator SparayLeaves() { Debug.Log("start spray"); Spray sprayScript = leafEmitter.gameObject.GetComponent <Spray>(); yield return(new WaitForSeconds(1.2f)); leafEmitter.gameObject.SetActive(true); yield return(new WaitForSeconds(.2f)); sprayScript.throttle = 0; yield return(new WaitForSeconds(4f)); leafEmitter.SetActive(false); }
private void drawingCanvas_MouseMove(object sender, MouseEventArgs e) { new_x_pos = e.X; new_y_pos = e.Y; if (drawing) { // save eraser and basic pen (both are just lines, colors differ) if (current_control == eraser_pb || current_control == pen_pb) { GObject new_line = new Line( x_pos, y_pos, new_x_pos, new_y_pos, current_control == eraser_pb ? Color.White : pen.Color, pen.Width ); objects.Add(new_line); x_pos = new_x_pos; y_pos = new_y_pos; drawingCanvas.Invalidate(); } // save spray if (current_control == spray_pb) { int spray_radius = Convert.ToInt32(pen.Width); for (int i = 0; i < 100; ++i) { double theta = _rnd.NextDouble() * (Math.PI * 2); double r = _rnd.NextDouble() * spray_radius; double x = new_x_pos + Math.Cos(theta) * r; double y = new_y_pos + Math.Sin(theta) * r; GObject ellipse = new Spray((int)x - 1, (int)y - 1, 1, 1, pen.Color, 1); objects.Add(ellipse); } Region invalidate = new Region(new Rectangle(new_x_pos - spray_radius, new_y_pos - spray_radius, spray_radius * 2, spray_radius * 2)); drawingCanvas.Invalidate(invalidate); } // draw rectangle on mouse move if (current_control == rect_pb || current_control == circle_pb) { live_circle_rect_x = new_x_pos; live_circle_rect_y = new_y_pos; drawingCanvas.Invalidate(); } } }
private static void BasicSprayAnimatedCookieButcherAsserts(Spray spray) { Assert.AreEqual("SprayAnimatedCookieButcher", spray.Id); Assert.AreEqual("Gingerbread Butcher", spray.Name); Assert.AreEqual("GingerbreadButcher", spray.HyperlinkId); Assert.AreEqual("Sy02", spray.AttributeId); Assert.AreEqual(Rarity.Rare, spray.Rarity); Assert.AreEqual("SeasonalEvents", spray.CollectionCategory); Assert.AreEqual("WinterVeil", spray.EventName); Assert.AreEqual(new DateTime(2017, 12, 12), spray.ReleaseDate); Assert.AreEqual("4WinterA17Cookie", spray.SortName); Assert.IsNull(spray.Description?.RawDescription); Assert.IsNull(spray.SearchText); Assert.AreEqual(2, spray.AnimationCount); Assert.AreEqual(2000, spray.AnimationDuration); Assert.AreEqual("storm_lootspray_animated_cookie_butcher.png", spray.TextureSheet.Image); }
private Spray generateSprayObject(string shot) { List <int> valuePar = new List <int>(); for (int x = 1; x < shot.Length; x++) { string s = shot[x].ToString(); if (s == APOSTROPHE) { valuePar.Add(x); } } Spray spray = new Spray(convertTextToDouble(valuePar[0], valuePar[1], shot), convertTextToDouble(valuePar[2], valuePar[3], shot), convertTextToDouble(valuePar[4], valuePar[5], shot)); return(spray); }
private void Awake() { if (!string.IsNullOrEmpty(SprayDesignation)) { if (!ThingDesignator.Designations.ContainsKey(SprayDesignation)) { Debug.LogError("SprayWeapon \"" + gameObject.name + "\" spray designation \"" + SprayDesignation + "\" not found in designator"); return; } GameObject prefab = ThingDesignator.Designations[SprayDesignation]; SprayPrefab = prefab.GetComponent <Spray>(); if (SprayPrefab == null) { Debug.LogError("SprayWeapon \"" + gameObject.name + "\" spray designation \"" + SprayDesignation + "\" has no <Spray> component"); return; } } }
protected override XElement MainElement(Spray spray) { if (FileOutputOptions.IsLocalizedText) { AddLocalizedGameString(spray); } return(new XElement( XmlConvert.EncodeName(spray.Id), string.IsNullOrEmpty(spray.Name) || FileOutputOptions.IsLocalizedText ? null ! : new XAttribute("name", spray.Name), string.IsNullOrEmpty(spray.HyperlinkId) ? null ! : new XAttribute("hyperlinkId", spray.HyperlinkId), string.IsNullOrEmpty(spray.AttributeId) ? null ! : new XAttribute("attributeId", spray.AttributeId), new XAttribute("rarity", spray.Rarity), string.IsNullOrEmpty(spray.CollectionCategory) ? null ! : new XAttribute("category", spray.CollectionCategory), string.IsNullOrEmpty(spray.EventName) ? null ! : new XAttribute("event", spray.EventName), spray.ReleaseDate.HasValue ? new XAttribute("releaseDate", spray.ReleaseDate.Value.ToString("yyyy-MM-dd")) : null !, string.IsNullOrEmpty(spray.SortName) || FileOutputOptions.IsLocalizedText ? null ! : new XElement("SortName", spray.SortName), string.IsNullOrEmpty(spray.SearchText) || FileOutputOptions.IsLocalizedText ? null ! : new XElement("SearchText", spray.SearchText), string.IsNullOrEmpty(spray.Description?.RawDescription) || FileOutputOptions.IsLocalizedText ? null ! : new XElement("Description", GetTooltip(spray.Description, FileOutputOptions.DescriptionType)), string.IsNullOrEmpty(spray.TextureSheet.Image) ? null ! : new XElement("Image", spray.AnimationCount < 1 ? Path.ChangeExtension(spray.TextureSheet.Image.ToLowerInvariant(), StaticImageExtension) : Path.ChangeExtension(spray.TextureSheet.Image.ToLowerInvariant(), AnimatedImageExtension)), AnimationObject(spray) !)); }
void Start() { KSpray = GameObject.FindGameObjectWithTag("Spray").GetComponent <Spray>(); Correlation = GameObject.FindGameObjectWithTag("Correlation").GetComponent <Correlations>(); _particleCenter = KSpray.transform; _sprayMaterial = KSpray.material; _color = _sprayMaterial.color; //_emitter = GameObject.FindGameObjectWithTag("Emitter").transform; _rightHand = GameObject.FindGameObjectWithTag("RightHand").transform; _leftHand = GameObject.FindGameObjectWithTag("LeftHand").transform; _bodyCenter = GameObject.FindGameObjectWithTag("BodyCenter").transform; _rightFoot = GameObject.FindGameObjectWithTag("RightFoot").transform; _leftFoot = GameObject.FindGameObjectWithTag("LeftFoot").transform; _lastHandPos = Vector3.zero; //_particleCenter.position = _emitter.position; _tmpRightHandPos = transform.position; }
/// <summary> /// Updates the localized gamestrings to the selected <see cref="Localization"/>. /// </summary> /// <param name="spray">The data to be updated.</param> /// <param name="gameStringDocument">Instance of a <see cref="GameStringDocument"/>.</param> /// <exception cref="ArgumentNullException"><paramref name="gameStringDocument"/> is null.</exception> public static void UpdateGameStrings(this Spray spray, GameStringDocument gameStringDocument) { ArgumentNullException.ThrowIfNull(gameStringDocument, nameof(gameStringDocument)); gameStringDocument.UpdateGameStrings(spray); }
private void Parse() { SprayParser sprayParser = new SprayParser(XmlDataService); CarbotLiLi = sprayParser.Parse("SprayStaticCarbotsLili"); }
private bool Fire() { if (RaiseTimer > 0f) { return(false); } if (HolsterTimer > 0f) { return(false); } if (attackCooldownTimer <= 0f) { if (UsesAmmo >= 0) { if (character.ammunition[UsesAmmo] < AmmoUseAmount) { Messaging.GUI.ScreenMessage.Invoke("OUT OF AMMO", Color.red); Sounds.CreateSound(EmptySound); attackCooldownTimer = .4f; return(false); } character.ammunition[UsesAmmo] -= AmmoUseAmount; } attackCooldownTimer = attackCooldown; if (SprayPrefab != null) { Spray spray = Instantiate(SprayPrefab, LevelLoader.DynamicObjects); spray.owner = character; spray.Damage = SprayDamage; spray.damageType = SprayDamageType; spray.LifeTime = SprayLifeTime; spray.Force = SprayForce; spray.Speed = SpraySpeed; spray.BurnTotalDamage = SprayTotalDamage; spray.DamagePerBurn = DamagePerApplication; spray.RadiusOverLifetime = SprayRadius; //make a special raycasting move from character to barrel spray.transform.position = character.transform.position; spray.InitialMove((_weaponPrefab.transform.position + _weaponPrefab.transform.rotation * SprayPosition) - character.transform.position); if (AttackDirection == Vector2.zero) { spray.transform.rotation = character.LookDirection; } else { spray.transform.rotation = Quaternion.Euler(0, 0, Mathf.Atan2(AttackDirection.x, -AttackDirection.y) * Mathf.Rad2Deg); } //add spread float firstRoll = Random.Range(-spread, spread); float secondRoll = Random.Range(-spread, spread); spray.transform.rotation *= Quaternion.Euler(0, 0, Mathf.Abs(firstRoll) < Mathf.Abs(secondRoll) ? firstRoll : secondRoll); //inherit speed spray.Speed += InheritSpeed * Vector2.Dot(character.physicsBody.velocity, character.LookDirection * Vector3.right); spray.GetComponent <SaveGameObject>().SpawnName = SprayDesignation; } } if (UsesAmmo >= 0 && character.ammunition[UsesAmmo] < AmmoUseAmount) { return(false); } OnFire.Invoke(); return(true); }
protected override JProperty MainElement(Spray spray) { if (FileOutputOptions.IsLocalizedText) { AddLocalizedGameString(spray); } JObject sprayObject = new JObject(); if (!string.IsNullOrEmpty(spray.Name) && !FileOutputOptions.IsLocalizedText) { sprayObject.Add("name", spray.Name); } sprayObject.Add("hyperlinkId", spray.HyperlinkId); sprayObject.Add("attributeId", spray.AttributeId); sprayObject.Add("rarity", spray.Rarity.ToString()); if (!string.IsNullOrEmpty(spray.CollectionCategory)) { sprayObject.Add("category", spray.CollectionCategory); } if (!string.IsNullOrEmpty(spray.EventName)) { sprayObject.Add("event", spray.EventName); } if (spray.ReleaseDate.HasValue) { sprayObject.Add("releaseDate", spray.ReleaseDate.Value.ToString("yyyy-MM-dd")); } if (!string.IsNullOrEmpty(spray.SortName) && !FileOutputOptions.IsLocalizedText) { sprayObject.Add("sortName", spray.SortName); } if (!string.IsNullOrEmpty(spray.SearchText) && !FileOutputOptions.IsLocalizedText) { sprayObject.Add("searchText", spray.SearchText); } if (!string.IsNullOrEmpty(spray.Description?.RawDescription) && !FileOutputOptions.IsLocalizedText) { sprayObject.Add("description", GetTooltip(spray.Description, FileOutputOptions.DescriptionType)); } if (!string.IsNullOrEmpty(spray.TextureSheet.Image)) { if (spray.AnimationCount < 1) { sprayObject.Add("image", Path.ChangeExtension(spray.TextureSheet.Image.ToLowerInvariant(), StaticImageExtension)); } else { sprayObject.Add("image", Path.ChangeExtension(spray.TextureSheet.Image.ToLowerInvariant(), AnimatedImageExtension)); } } JProperty?animation = AnimationObject(spray); if (animation != null) { sprayObject.Add(animation); } return(new JProperty(spray.Id, sprayObject)); }