private void OnEnable() { this.OnTriggerEnter2DAsObservable() .Where(otherCollider2D => ((TagUtil.IsTagPlayer(otherCollider2D.gameObject.tag)) && !isConsumed)) .Subscribe(_ => ConsumeItem()) .AddTo(this); }
public async Task <JsonResult> EditTag(string TagToAdd, int[] TagToDel, int BlogID) { var TagsToAdd = TagUtil.SplitTags(TagToAdd); if (TagsToAdd.Any(t => t.Length > 20)) { return(Json(new { errmsg = "标签不得超过20字符" })); } else { Blog b = _db.Blogs.Find(BlogID); if (b == null || BlogID <= 0 || (b.option != null && b.option.LockTags)) { return(Json(new { errmsg = "无效id,请刷新重试" })); } var tibs = await _db.TagsInBlogs.Include(tib => tib.tag).Where(t => t.BlogID == BlogID).ToListAsync(); // Remove TagToAdd items from TagsToDel var TagsToDel = TagToDel == null ? new TagsInBlog[0] : tibs.Where(tib => TagToDel.Contains(tib.TagID) && !TagsToAdd.Contains(tib.tag.TagName, SqlStringComparer.Instance)).ToArray(); // Remove already exist tags from TagsToAdd TagsToAdd = TagsToAdd.Where(s => tibs.All(tib => !SqlStringComparer.Instance.Equals(tib.tag.TagName, s))).ToArray(); if (tibs.Any(tib => !tib.IsRemovable(b.Author, User.Identity.Name, _blogUtil.CheckAdmin(), HarmonySettings.BlacklistTags) && TagToDel.Contains(tib.TagID))) { return(Json(new { errmsg = "您不能删除作者添加的或黑名单标签" })); } if (tibs.Count + TagsToAdd.Length - TagsToDel.Length > 10) { return(Json(new { errmsg = "标签不得超过10个" })); } else if (tibs.Count + TagsToAdd.Length - TagsToDel.Length < 1) { return(Json(new { errmsg = "请至少添加一个标签" })); } List <Tag> AddedTags = _tagUtil.AddTagsForBlog(BlogID, TagsToAdd, User.Identity.Name); _db.TagHistories.AddRange(TagsToDel.Select(tib => new TagHistory { AddBy = tib.AddBy, BlogID = BlogID, DeleteBy = User.Identity.Name, TagName = tib.tag.TagName, Time = DateTime.Now })); _db.TagsInBlogs.RemoveRange(TagsToDel); bool isHarmony = BlogHelper.BlogIsHarmony(_db, b, HarmonySettings); if (isHarmony != b.isHarmony) { b.isHarmony = isHarmony; _cacheService.ClearHPCache(this, null); } await _db.SaveChangesAsync(); var currentTags = tibs.Except(TagsToDel).Select(tib => tib.tag).Concat(AddedTags).OrderBy(t => t.TagName); TriggerEditTags(b, currentTags); return(Json(AddedTags.ToDictionary(t => t.TagID.ToString(), t => t.TagName))); } }
//this is where the logic of the command is defined protected override Result RunCommand(RhinoDoc doc, RunMode mode) { string filterStr; using (GetString getter = new GetString()) { getter.AcceptString(true); getter.SetCommandPrompt("Enter the boolean filter statement (in quotes)"); if (getter.Get() != GetResult.String) { RhinoApp.WriteLine("Invalid Input for tag"); return(getter.CommandResult()); } filterStr = getter.StringResult(); } Stopwatch watch = new Stopwatch(); watch.Start(); List <Guid> filtered = TagUtil.Evaluate(filterStr, ref doc); Debug.WriteLine(watch.ElapsedMilliseconds, "Time"); watch.Stop(); doc.Objects.UnselectAll(); doc.Objects.Select(filtered); doc.Views.Redraw(); return(Result.Success); }
// Token: 0x06002009 RID: 8201 RVA: 0x000993A8 File Offset: 0x000975A8 public override void Shoot(Ray ray, out CmunePairList <BaseGameProp, ShotPoint> hits) { hits = null; Vector3 direction = WeaponDataManager.ApplyDispersion(ray.direction, this._view, this._supportIronSight); int projectileId = base.Controller.NextProjectileId(); RaycastHit raycastHit; if (Physics.Raycast(ray.origin, direction, out raycastHit, 1000f, (!base.Controller.IsLocal) ? UberstrikeLayerMasks.ShootMaskRemotePlayer : UberstrikeLayerMasks.ShootMask)) { HitPoint point = new HitPoint(raycastHit.point, TagUtil.GetTag(raycastHit.collider)); BaseGameProp component = raycastHit.collider.GetComponent <BaseGameProp>(); if (component) { hits = new CmunePairList <BaseGameProp, ShotPoint>(1); hits.Add(component, new ShotPoint(raycastHit.point, projectileId)); } this.Decorator.PlayImpactSoundAt(point); } else { raycastHit.point = ray.origin + ray.direction * 1000f; } if (this.Decorator) { this.Decorator.ShowShootEffect(new RaycastHit[] { raycastHit }); } base.OnHits(hits); }
private void Start() { if (toFinishOnTriggerExit) { this.OnTriggerExit2DAsObservable() .Subscribe(otherCollider2D => { if (TagUtil.IsTagPlayer(otherCollider2D.tag, true) && !dialogueGetter.IsDialogueDone().Value) { dialogueSetter.StopDialogue(); } }) .AddTo(this); } dialogueGetter.IsDialogueDone().Where(done => done && isTriggered) .Subscribe(_ => OnFinishDialogue()) .AddTo(this); this.OnTriggerEnter2DAsObservable() .Subscribe(otherCollider2D => { if (TagUtil.IsTagPlayer(otherCollider2D.tag, true) && dialogueGetter.IsDialogueDone().Value) { OnStartDialogue(); } }) .AddTo(this); }
public void Insert(string sessionId, string key, object value, bool enableRetry) { //int retry = _operationRetry; //do{ // try // { _cache.Insert(key, TagUtil.CreateTaggedCacheItem(value)); // break; // } // catch (Exception ex) // { // string message = ex.Message; // if (message != null && !(message.ToLower().Contains("connection with server") || // message.ToLower().Contains("no server is available")) || !enableRetry) // { // throw; // } // if (retry <= 0) // throw ex; // retry--; // if (_operationRetryDelayInterval > 0) // Thread.Sleep(_operationRetryDelayInterval); // } //} //while (retry >= 0); }
private void DestroyItem() { if (prefabTakenEffect != null) { GameObject takenEffect = Instantiate(prefabTakenEffect, this.gameObject.transform.position, this.gameObject.transform.rotation); instantiator.InjectPrefab(takenEffect); if (TagUtil.IsTagItemMultiValue(this.gameObject.tag)) { TextMeshOutliner textOutliner = takenEffect.GetComponent <TextMeshOutliner>(); if (textOutliner != null) { textOutliner.SetText("+" + itemValue.ToString()); } else { LogUtil.PrintWarning(gameObject, GetType(), "No TextMeshOutliner in the prefab."); } } } Destroy(this.gameObject); }
private void Start() { this.OnTriggerEnter2DAsObservable() .Where(otherCollider2D => TagUtil.IsTagPlayer(otherCollider2D.tag)) .Subscribe(_ => TriggerMindLight()) .AddTo(this); }
private void OnEnable() { this.OnTriggerEnter2DAsObservable() .Where(otherCollider2D => TagUtil.IsTagPlayer(otherCollider2D.gameObject.tag)) .Subscribe(_ => EndLevel()) .AddTo(this); }
public BlogController( IOptions <AppSettingsModel> appSettings, IOptionsSnapshot <DataSettingsModel> dataSettings, BlogContext db, UsersContext udb, AdminUtil adminUtil, BlogUtil blogUtil, CategoryUtil catUtil, MessageUtil msgUtil, TagUtil tagUtil, UserManager <UserProfile> userManager, UploadUtil uploadUtil, RatingUtil ratingUtil, IRecommendationProvider recommendationProvider, CacheService cacheService, IMemoryCache cache) { _db = db; _udb = udb; _adminUtil = adminUtil; _catUtil = catUtil; _blogUtil = blogUtil; _msgUtil = msgUtil; _appSettings = appSettings.Value; _dataSettings = dataSettings.Value; _userManager = userManager; _cache = cache; _uploadUtil = uploadUtil; _tagUtil = tagUtil; _ratingUtil = ratingUtil; _recommendationProvider = recommendationProvider; _cacheService = cacheService; }
public void Add(string key, object value) { Alachisoft.NCache.Web.Caching.Cache cache = (Alachisoft.NCache.Web.Caching.Cache)_caches[_primaryCache]; if (cache != null) { cache.Add(key, TagUtil.CreateTaggedCacheItem(value)); } }
private void OnTriggerEnter2D(Collider2D otherCollider2D) { if (TagUtil.IsTagPlayer(otherCollider2D.tag, true)) { StopAllCoroutines(); StartCoroutine(CorPlayLevelState()); } }
private bool IsGroundSideMet(Collider2D collider) { if (type == GROUND_SIDE.BOTTOM || type == GROUND_SIDE.TOP) { return(TagUtil.IsTagWalkable(collider.tag)); } return(TagUtil.IsTagSlideable(collider.tag)); }
private bool IsGroundTypeMet(Collider2D collider) { if (type == GroundType.FLOOR) { return(TagUtil.IsTagWalkable(collider.tag)); } return(TagUtil.IsTagSlideable(collider.tag)); }
public void SetUp() { _mockTagRepository = new Mock <ITagRepository>(); _tagUtil = new TagUtil(_mockTagRepository.Object); _fakeDbTags = new List <Tag>(); var tags = article.Tags = FakeTags.CreateTags(); _mockTagRepository.Setup(s => s.GetAll()).Returns(_fakeDbTags); }
private void Awake() { if (TagUtil.IsTagItemMultiValue(this.gameObject.tag)) { itemValue = Random.Range(itemValueMin, itemValueMax); } else { itemValue = 1; } }
public void InsertAsync(string sessionId, string key, object value, CacheDependency dependency, DateTime absoluteExpiration, TimeSpan slidingExpiration, CacheItemPriority priority) { Alachisoft.NCache.Web.Caching.Cache cache = null; object obj = null; GetCache(sessionId, key, out obj, "", "", out cache, false); if (cache != null) { cache.InsertAsync(key, TagUtil.CreateTaggedCacheItem(value, dependency, absoluteExpiration, slidingExpiration, priority), DSWriteOption.None, null); } }
public void InsertAsync(string sessionId, string key, object value) { Alachisoft.NCache.Web.Caching.Cache cache = null; object obj = null; GetCache(sessionId, key, out obj, "", "", out cache, false); if (cache != null) { cache.InsertAsync(key, TagUtil.CreateTaggedCacheItem(value), null, null, null); } }
public void AddArticle(CreateArticleDTO articleDto) { var article = Mapper.Map <CreateArticleDTO, Article>(articleDto); var tagUtil = new TagUtil(UnitOfWork.TagRepository); article.Tags = tagUtil.GetTags(article); UnitOfWork.ArticleRepository.Add(article); UnitOfWork.Commit(); }
private void OnTriggerEnter2D(Collider2D otherCollider2D) { if (TagUtil.IsTagPlayer(otherCollider2D.tag, false)) { checkSetter.SetCheckpoint(spawnPoint.position, this.gameObject.name); InstantiateFX(); DimAlpha(); Destroy(this); } }
private void Start() { this.OnCollisionEnter2DAsObservable() .Where(collision2D => TagUtil.IsTagPlayer(collision2D.gameObject.tag, camouflageCheck)) .Subscribe(collision2D => { ApplyForce(collision2D); ApplyDamage(); DeductLife(); PlaySFX(); }) .AddTo(this); }
// Token: 0x0600200C RID: 8204 RVA: 0x000994D4 File Offset: 0x000976D4 public override void Shoot(Ray ray, out CmunePairList <BaseGameProp, ShotPoint> hits) { Dictionary <BaseGameProp, ShotPoint> dictionary = new Dictionary <BaseGameProp, ShotPoint>(this.ShotgunGauge); HitPoint hitPoint = null; RaycastHit[] array = new RaycastHit[this.ShotgunGauge]; int projectileId = base.Controller.NextProjectileId(); int num = 1000; for (int i = 0; i < this.ShotgunGauge; i++) { Vector3 direction = WeaponDataManager.ApplyDispersion(ray.direction, this._view, false); RaycastHit raycastHit; if (Physics.Raycast(ray.origin, direction, out raycastHit, (float)num, (!base.Controller.IsLocal) ? UberstrikeLayerMasks.ShootMaskRemotePlayer : UberstrikeLayerMasks.ShootMask)) { if (hitPoint == null) { hitPoint = new HitPoint(raycastHit.point, TagUtil.GetTag(raycastHit.collider)); } BaseGameProp component = raycastHit.collider.GetComponent <BaseGameProp>(); if (component) { ShotPoint shotPoint; if (dictionary.TryGetValue(component, out shotPoint)) { shotPoint.AddPoint(raycastHit.point); } else { dictionary.Add(component, new ShotPoint(raycastHit.point, projectileId)); } } array[i] = raycastHit; } else { array[i].point = ray.origin + ray.direction * 1000f; array[i].normal = raycastHit.normal; } } this.Decorator.PlayImpactSoundAt(hitPoint); hits = new CmunePairList <BaseGameProp, ShotPoint>(dictionary.Count); foreach (KeyValuePair <BaseGameProp, ShotPoint> keyValuePair in dictionary) { hits.Add(keyValuePair.Key, keyValuePair.Value); } if (this.Decorator) { this.Decorator.ShowShootEffect(array); } base.OnHits(hits); }
protected override ValidationResult IsValid(object value, ValidationContext validationContext) { if (value != null) { int ret = TagUtil.CheckBlogTag(value.ToString()); if (ret != 0) { var err = ret > 0 ? string.Format(this.ErrorMessage, MaxCount) : "标签不得超过" + MaxLength + "个字符"; return(new ValidationResult(err)); } } return(null); }
// Token: 0x06001F39 RID: 7993 RVA: 0x00096438 File Offset: 0x00094638 protected override void OnCollisionEnter(Collision c) { if (!base.IsProjectileExploded && LayerUtil.IsLayerInMask(base.CollisionMask, c.gameObject.layer)) { if (c.contacts.Length > 0) { base.Explode(c.contacts[0].point, c.contacts[0].normal, TagUtil.GetTag(c.collider)); } else { this.Explode(); } } }
// Token: 0x06002011 RID: 8209 RVA: 0x00099898 File Offset: 0x00097A98 private IEnumerator StartShowingEffect(RaycastHit hit, Vector3 origin, float delay) { if (this._decorator) { this._decorator.ShowShootEffect(new RaycastHit[] { hit }); } yield return(new WaitForSeconds(delay)); this.Decorator.PlayImpactSoundAt(new HitPoint(hit.point, TagUtil.GetTag(hit.collider))); yield break; }
/// <summary> /// Applies the date to this builder, overwriting any existing date (year/month/day). /// </summary> /// <param name="date">The date. If not <c>null</c>, then this must be a string of the form YYYY, YYYY-MM, or YYYY-MM-DD.</param> public TagUniformResourceIdentifierBuilder WithDate(string date) { if (date == null) { _year = _month = _day = null; return(this); } if (!TagUtil.TryParseDate(date, 0, date.Length, out var year, out var month, out var day)) { throw new ArgumentException("Invalid date " + date, nameof(date)); } return(WithDateYear(year).WithDateMonth(month).WithDateDay(day)); }
public async Task <PartialViewResult> HPSetting(HPSettingsModel model) { string option, tagBlacklist = null; var allCategories = _catUtil.GetCategoryList(); var categories = model.GetCategoryOptions(); if (categories.SelectedIds.Count == 0 || (allCategories.Count == categories.SelectedIds.Count)) { option = string.Empty; } else { option = JsonConvert.SerializeObject(categories.SelectedIds); } if (!string.IsNullOrWhiteSpace(model.BlacklistTagNames)) { var taglist = TagUtil.SplitTags(model.BlacklistTagNames); if (taglist != null && taglist.Length > 0) { var tags = await _bdb.Tags.Where(t => taglist.Contains(t.TagName)).ToDictionaryAsync(t => t.TagName.ToLower(), t => t.TagID); var notfound = taglist.Where(n => !tags.ContainsKey(n.ToLower())); if (notfound.Any()) { ViewBag.NotFoundTags = string.Join(",", notfound); ViewBag.Success = false; return(PartialView("_HPSettingPartial", model)); } tagBlacklist = JsonConvert.SerializeObject(tags.Values.AsEnumerable()); } } UserProfile user = _db.Users.Include("option").SingleOrDefault(u => u.UserName == User.Identity.Name); if (user.option == null) { user.option = new UserOption(); } user.option.homepageCategories = option; user.option.homepageHideHarmony = model.HideHarmony; user.option.homepageTagBlacklist = tagBlacklist; _blogUtil.CacheUserOption(user.option, User.Identity.Name); await _db.SaveChangesAsync(); ViewBag.Success = true; return(PartialView("_HPSettingPartial", model)); }
// Token: 0x060011A8 RID: 4520 RVA: 0x00069A68 File Offset: 0x00067C68 public void OnTriggerEnterEvent(Collider c) { if (TagUtil.GetTag(c) == "Player") { this.behaviour.machine.PopState(true); GameState.Current.Player.MoveController.ApplyForce(this.behaviour._config.JumpDirection.normalized * (float)this.behaviour._config.Force, CharacterMoveController.ForceType.Additive); AutoMonoBehaviour <SfxManager> .Instance.PlayInGameAudioClip(this.behaviour.JumpSound, 0UL); Singleton <ProjectileManager> .Instance.RemoveProjectile(this.behaviour.ID, true); GameState.Current.Actions.RemoveProjectile(this.behaviour.ID, true); } else if (this.behaviour.collider.gameObject.layer == 20) { AutoMonoBehaviour <SfxManager> .Instance.Play3dAudioClip(GameAudio.JumpPad, this.behaviour.transform.position, 1f); } }
private void Start() { this.OnTriggerEnter2DAsObservable() .Where(otherCollider2D => TagUtil.IsTagPlayer(otherCollider2D.tag, false)) .Subscribe(_ => { AddItemToPlayerStats(this.gameObject.tag); DestroyItem(); }) .AddTo(this); this.OnCollisionEnter2DAsObservable() .Where(collision2D => TagUtil.IsTagPlayer(collision2D.gameObject.tag, false)) .Subscribe(_ => { AddItemToPlayerStats(this.gameObject.tag); DestroyItem(); }) .AddTo(this); }
//this is where the logic of the command is defined protected override Result RunCommand(RhinoDoc doc, RunMode mode) { foreach (var layer in doc.Layers) { RhinoObject[] objs = doc.Objects.FindByLayer(layer); if (objs.Length == 0) { continue; } if (!TagUtil.AddTag(objs, layer.Name, true)) { break; } } doc.Views.Redraw(); doc.Modified = true; return(Result.Success); }