public ActionResult Index()
        {
            Character character = this.HttpContext.Items["Character"] as Character;

            if (character == null)
            {
                return(HttpNotFound());
            }

            var query = from r1 in db.GeneratedItems
                        from r2 in db.Items
                        join r3 in db.Images on r2.ImageId equals r3.ID into R3
                        from r8 in R3.DefaultIfEmpty()
                        join r4 in db.Affixes on r1.PrefixId equals r4.Id into R4
                        from r5 in R4.DefaultIfEmpty()
                        join r6 in db.Affixes on r1.SuffixId equals r6.Id into R6
                        from r7 in R6.DefaultIfEmpty()
                        where r1.CharacterId == character.Id && r1.ItemId == r2.Id
                        select new ItemViewModel
            {
                GeneratedItem = r1,
                Item          = r2,
                Image         = r8 != null ? r8 : null,
                Prefix        = r5 != null ? r5 : null,
                Suffix        = r7 != null ? r7 : null
            };

            List <ItemViewModel> characterItems = query.ToList();

            return(View(characterItems));
        }
 public static R4 ToR4(R4 a)
 {
     // Note that the cast is intentional and NOT a no-op. It forces the JIT
     // to narrow to R4 when it might be tempted to keep intermediate
     // computations in larger precision.
     return((R4)a);
 }
示例#3
0
    // move components are 1->i, 1->j, 1->k
    // turn components are j->k, k->i, i->j
    public static Rot4 FromTangentStereographic(Vector3 move, Vector3 turn, float dt)
    {
        Vector4 left  = new R4((move + turn) / 2f * dt, 1f);
        Vector4 right = new R4((move - turn) / 2f * dt, 1f);

        return(new Rot4((R4)left.normalized, (R4)right.normalized));
    }
        public static R4 ToR4(TX a)
        {
            R4 res = default(R4);

            Conversions.DefaultInstance.Convert(in a, ref res);
            return(res);
        }
示例#5
0
 public RspRegisterMemory() : base(0xC0000, 0x40008, 0x04040000)
 {
     MemoryAddressReg = new R0(this, 0);
     ReadLengthReg    = new R2R3(this, 2);
     WriteLengthReg   = new R2R3(this, 3);
     StatusReg        = new R4(this, 4);
     IBistReg         = new R9(this, 9);
 }
示例#6
0
 internal R0Linker()
 {
     r0 = new R0();
     r1 = new R1();
     r2 = new R2();
     r3 = new R3();
     r4 = new R4();
 }
示例#7
0
 private void btnClear_Click(object sender, EventArgs e)
 {
     R1.ReadOnly = false;
     R1.Clear();
     R2.Clear();
     R3.Clear();
     R4.Clear();
     resultado.Clear();
 }
        public ActionResult Sell(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            Character character = this.HttpContext.Items["Character"] as Character;

            if (character == null)
            {
                return(HttpNotFound());
            }

            var query = from r1 in db.GeneratedItems
                        from r2 in db.Items
                        join r4 in db.Affixes on r1.PrefixId equals r4.Id into R4
                        from r5 in R4.DefaultIfEmpty()
                        join r6 in db.Affixes on r1.SuffixId equals r6.Id into R6
                        from r7 in R6.DefaultIfEmpty()
                        where r1.Id == id && r1.CharacterId == character.Id && r1.ItemId == r2.Id
                        select new ItemViewModel
            {
                GeneratedItem = r1,
                Item          = r2,
                Prefix        = r5 != null ? r5 : null,
                Suffix        = r7 != null ? r7 : null
            };

            var item = query.FirstOrDefault();

            if (item == null)
            {
                return(RedirectToAction("Index"));
            }

            int price = itemService.GetCalculatedPrice(item.Item != null ? item.Item.Price : 0,
                                                       item.Prefix != null ? item.Prefix.Price : 0,
                                                       item.Suffix != null ? item.Suffix.Price : 0,
                                                       item.GeneratedItem != null ? item.GeneratedItem.Durability : 0,
                                                       item.Item != null ? item.Item.Durability : 1);

            try
            {
                character.Gold           += price;
                db.Entry(character).State = EntityState.Modified;
                db.GeneratedItems.Remove(item.GeneratedItem);
                db.SaveChanges();
            }
            catch (Exception)
            {
                FlashMessageHelper.SetMessage(this, FlashMessageType.Danger, "Wystąpił nieoczekiwany błąd. Skontaktuj się z administratorem.");
            }

            return(RedirectToAction("Index"));
        }
示例#9
0
 private void Play_Click(object sender, EventArgs e)
 {
     R1.Show();
     R2.Show();
     R3.Show();
     R4.Show();
     Play.Hide();
     Sair.Hide();
     ExibeProximaQuestao();
 }
 public static R4 Atan2(R4 a, R4 b)
 {
     // According to the documentation of Math.Atan2: if x and y are either System.Double.PositiveInfinity
     // or System.Double.NegativeInfinity, the method returns System.Double.NaN, but this seems to not be the case.
     if (R4.IsInfinity(a) && R4.IsInfinity(b))
     {
         return(R4.NaN);
     }
     return((R4)Math.Atan2(a, b));
 }
示例#11
0
 private void Show(R4 x)
 {
     if (R4.IsNaN(x))
     {
         _wrt.Write("NA");
     }
     else
     {
         _wrt.Write("{0:R}", x);
     }
 }
示例#12
0
        private void ModifyR4(ITestableReplicationProviderInside provider)
        {
            object      commitObject = null;
            IEnumerator it           = provider.GetStoredObjects(typeof(R4)).GetEnumerator();

            while (it.MoveNext())
            {
                R4 r4 = (R4)it.Current;
                r4.SetName(r4.GetName() + "_");
                provider.Update(r4);
                commitObject = r4;
            }
            provider.Commit();
        }
        /// <summary>
        /// For testing variable-arg functions. This selects the element in c indicated by a.
        /// If b is true, it negates the result.
        /// </summary>
        public static R4 Var(I4 a, BL b, R4[] c)
        {
            if (a < 0 || a >= c.Length)
            {
                return(R4.NaN);
            }
            R4 res = c[a];

            if (b)
            {
                res = -res;
            }
            return(res);
        }
示例#14
0
 private void btnAcumula_Click(object sender, EventArgs e)
 {
     if (resultado.Text != "")
     {
         acumula     = double.Parse(resultado.Text);
         R1.ReadOnly = true;
         R1.Text     = acumula.ToString("0.00");
         R2.Clear();
         R3.Clear();
         R4.Clear();
     }
     else
     {
         MessageBox.Show("\"Resultado\" vazio");
     }
 }
        /// <summary>
        /// Returns whether the given object is non-null and an NA value for one of the standard types.
        /// </summary>
        public static bool IsNA(object v)
        {
            if (v == null)
            {
                return(false);
            }
            Type type = v.GetType();

            if (type == typeof(R4))
            {
                return(R4.IsNaN((R4)v));
            }
            if (type == typeof(R8))
            {
                return(R8.IsNaN((R8)v));
            }
            Contracts.Assert(type == typeof(BL) || type == typeof(I4) || type == typeof(I8) || type == typeof(TX),
                             "Unexpected constant value type!");
            return(false);
        }
示例#16
0
        public ActionResult Index()
        {
            Character character = this.HttpContext.Items["Character"] as Character;

            if (character == null)
            {
                return(HttpNotFound());
            }

            var query2 = from r1 in db.GeneratedItems
                         from r2 in db.Items
                         join r3 in db.Images on r2.ImageId equals r3.ID into R3
                         from r8 in R3.DefaultIfEmpty()
                         join r4 in db.Affixes on r1.PrefixId equals r4.Id into R4
                         from r5 in R4.DefaultIfEmpty()
                         join r6 in db.Affixes on r1.SuffixId equals r6.Id into R6
                         from r7 in R6.DefaultIfEmpty()
                         where r1.CharacterId == character.Id && r1.ItemId == r2.Id
                         select new ItemViewModel
            {
                GeneratedItem = r1,
                Item          = r2,
                Image         = r8 != null ? r8 : null,
                Prefix        = r5 != null ? r5 : null,
                Suffix        = r7 != null ? r7 : null
            };

            List <ItemViewModel> characterItems = query2.ToList();

            EquipmentViewModel equipmentViewModel = new EquipmentViewModel();

            equipmentViewModel.EquippedItems =
                characterItems.FindAll(i => i.GeneratedItem.Status == ItemStatus.Equipped);
            equipmentViewModel.BackpackItems =
                characterItems.FindAll(i => i.GeneratedItem.Status == ItemStatus.Bagpack);
            equipmentViewModel.ChestItems =
                characterItems.FindAll(i => i.GeneratedItem.Status == ItemStatus.Chest);

            return(View(equipmentViewModel));
        }
 public static BL IsNA(R4 a)
 {
     return(R4.IsNaN(a));
 }
 public static R4 Round(R4 a)
 {
     return((R4)Math.Round(a));
 }
 public static R4 Ceiling(R4 a)
 {
     return((R4)Math.Ceiling(a));
 }
 public static R4 Acos(R4 a)
 {
     return((R4)Math.Acos(a));
 }
示例#21
0
        /// <summary>
        /// Called on each bar update event (incoming tick)
        /// </summary>
        protected override void OnBarUpdate()
        {
            if (CurrentBars[0] < BarsRequired || CurrentBars[1] < BarsRequired)
            {
                return;
            }
            if (BarsInProgress == 1)
            {
                if (CurrentBar < 2 * period)
                {
                    return;
                }

                Bars.Session.GetNextBeginEnd(Times[1][0], out sessionBegin, out sessionEnd);

                //sessionDate = Date(sessionBegin);
                //sessionBegin =

                sessionBegin = Convert.ToDateTime(start);
                sessionEnd   = Convert.ToDateTime(start);

                Print("Session Start: " + sessionBegin + "Session End: " + sessionEnd);
                DateTime barTime          = Times[1][0];
                TimeSpan inSessionTime    = barTime.Subtract(sessionBegin);
                int      inSessionMinutes = 60 * inSessionTime.Hours + inSessionTime.Minutes;
                int      cutoff           = inSessionMinutes % period;
                DateTime cutoffTime       = barTime.Subtract(new TimeSpan(0, cutoff, 0));
                int      barsAgo          = CurrentBar - Bars.GetBar(cutoffTime);
                high  = MAX(Highs[1], period)[barsAgo];
                low   = MIN(Lows[1], period)[barsAgo];
                close = Closes[1][barsAgo];
                pp    = (high + low + close) / 3;
                range = high - low;
                r1    = 2 * pp - low;
                r2    = pp + range;
                r3    = r1 + range;
                r4    = r3 + (pp - low);
                s1    = 2 * pp - high;
                s2    = pp - range;
                s3    = s1 - range;
                s4    = s3 - (high - pp);
            }


            if (BarsInProgress == 0)
            {
                if (CurrentBar == 0)
                {
                    return;
                }
                if (pp != 0.0)
                {
                    PP.Set(pp);
                    R1.Set(r1);
                    R2.Set(r2);
                    R3.Set(r3);
                    R4.Set(r4);
                    S1.Set(s1);
                    S2.Set(s2);
                    S3.Set(s3);
                    S4.Set(s4);
                    if (pp != PP[1] || r1 != R1[1] || s1 != S1[1])
                    {
                        PlotColors[0][0] = Color.Transparent;
                        PlotColors[1][0] = Color.Transparent;
                        PlotColors[2][0] = Color.Transparent;
                        PlotColors[3][0] = Color.Transparent;
                        PlotColors[4][0] = Color.Transparent;
                        PlotColors[5][0] = Color.Transparent;
                        PlotColors[6][0] = Color.Transparent;
                        PlotColors[7][0] = Color.Transparent;
                        PlotColors[8][0] = Color.Transparent;
                    }
                }
            }
        }
 public static R4 Sqrt(R4 a)
 {
     return((R4)Math.Sqrt(a));
 }
 public static R4 Tanh(R4 a)
 {
     return((R4)Math.Tanh(a));
 }
 public static R4 Cosh(R4 a)
 {
     return((R4)Math.Cosh(a));
 }
 public static R4 Atan(R4 a)
 {
     return((R4)Math.Atan(a));
 }
 public static R8 ToR8(R4 a)
 {
     return((R8)a);
 }
 public static R4 Truncate(R4 a)
 {
     return((R4)Math.Truncate(a));
 }
 public static R4 Floor(R4 a)
 {
     return((R4)Math.Floor(a));
 }
 public static R4 Sinh(R4 a)
 {
     return((R4)Math.Sinh(a));
 }
 public static R4 Asin(R4 a)
 {
     return((R4)Math.Asin(a));
 }