Exemplo n.º 1
0
 private void StartTimer(FeaturePackage fp, FeatureMessage fm, Timer t)
 {
     fp.value = fm.value;
     if (fp.coroutine != null)
     {
         StopCoroutine(fp.coroutine);
     }
     fp.coroutine = StartCoroutine(t(fm.value, fm.time));
 }
Exemplo n.º 2
0
        public IActionResult Update(string id, [FromBody] FeaturePackage FeaturePackage)
        {
            var claims = User.Claims.Select(claim => new { claim.Type, claim.Value }).ToDictionary(t => t.Type, t => t.Value);

            if (claims.ContainsKey("name"))
            {
                if (claims["name"].Equals("ADMIN") || claims["name"].Equals("MANAGER"))
                {
                    return(Ok(_repository.Update(id, FeaturePackage)));
                }
            }
            else
            {
                return(Forbid());
            }
            return(Forbid());
        }
Exemplo n.º 3
0
        public IActionResult Create([FromBody] FeaturePackage FeaturePackage)
        {
            var claims = User.Claims.Select(claim => new { claim.Type, claim.Value }).ToDictionary(t => t.Type, t => t.Value);

            if (claims.ContainsKey("name"))
            {
                if (claims["name"].Equals("ADMIN") || claims["name"].Equals("MANAGER"))
                {
                    FeaturePackage.Id       = Guid.NewGuid() + "";
                    FeaturePackage.IsDelete = false;
                    return(Ok(_repository.Create(FeaturePackage)));
                }
            }
            else
            {
                return(Forbid());
            }
            return(Forbid());
        }
Exemplo n.º 4
0
 public IActionResult Update(string id, [FromBody] FeaturePackage FeaturePackage)
 {
     return(Ok(_repository.Update(id, FeaturePackage)));
 }
Exemplo n.º 5
0
 public IActionResult Create([FromBody] FeaturePackage FeaturePackage)
 {
     FeaturePackage.Id       = Guid.NewGuid() + "";
     FeaturePackage.IsDelete = false;
     return(Ok(_repository.Create(FeaturePackage)));
 }
Exemplo n.º 6
0
 /* 单纯受到效果影响而没有伤害  MonsterMonitor.cs调用
  */
 private void FeaturesWithoutHurt(FeatureMessage fm)
 {
     //新增效果
     if (fm.create)
     {
         //减速效果
         if ((fm.features & (int)Features.speeddown) > 0)
         {
             fm.value *= GameRunning.EnlargRatio;
             FeaturePackage fp;
             if (already_exists_features.ContainsKey(fm.features))
             {
                 fp = already_exists_features[fm.features];
                 if (((fp.value < 1 && fm.value < 1) || (fp.value >= 1 && fm.value >= 1)) &&
                     fp.value < fm.value)
                 {
                     StartTimer(fp, fm, DecelerateFeaturesTimer);
                 }
                 else if (fp.value < 1 && fm.value >= 1)
                 {
                     if (fp.value * origin.speed < fm.value)
                     {
                         StartTimer(fp, fm, DecelerateFeaturesTimer);
                     }
                 }
                 else if (fp.value >= 1 && fm.value < 1)
                 {
                     if (fp.value < fm.value * origin.speed)
                     {
                         StartTimer(fp, fm, DecelerateFeaturesTimer);
                     }
                 }
             }
             else
             {
                 fp       = new FeaturePackage();
                 fp.value = fm.value;
                 already_exists_features.Add(fm.features, fp);
                 fp.coroutine = StartCoroutine(DecelerateFeaturesTimer(fm.value, fm.time));
             }
         }
         //减防效果
         if ((fm.features & (int)Features.defense_break) > 0)
         {
             FeaturePackage fp;
             if (already_exists_features.ContainsKey(fm.features))
             {
                 fp = already_exists_features[fm.features];
                 if (((fp.value < 1 && fm.value < 1) || (fp.value >= 1 && fm.value >= 1)) &&
                     fp.value < fm.value)
                 {
                     StartTimer(fp, fm, DisruptingFeaturesTimer);
                 }
                 else if (fp.value < 1 && fm.value >= 1)
                 {
                     if (fp.value * origin.speed < fm.value)
                     {
                         StartTimer(fp, fm, DisruptingFeaturesTimer);
                     }
                 }
                 else if (fp.value >= 1 && fm.value < 1)
                 {
                     if (fp.value < fm.value * origin.speed)
                     {
                         StartTimer(fp, fm, DisruptingFeaturesTimer);
                     }
                 }
             }
             else
             {
                 fp       = new FeaturePackage();
                 fp.value = fm.value;
                 already_exists_features.Add(fm.features, fp);
                 fp.coroutine = StartCoroutine(DisruptingFeaturesTimer(fm.value, fm.time));
             }
         }
     }
     //移除效果
     else
     {
         if (!already_exists_features.ContainsKey(fm.features))
         {
             return;
         }
         FeaturePackage fp = already_exists_features[fm.features];
         if ((fm.features & (int)Features.speeddown) > 0)
         {
             current.speed = origin.speed;
             SendMessage("SetMoveSpeed", origin.speed);                //MoveRoute.cs
         }
         already_exists_features.Remove(fm.features);
     }
 }