コード例 #1
0
        NumTable GetDiagonalDown(NumTable table)
        {
            var tableDiagonalDown = new NumTable();

            // get bottom-left triangle
            for (int row = 0; row < table.Height(); ++row)
            {
                var newList = new NumList();
                for (int col = 0; col + row < table.Width(); ++col)
                {
                    var diagOffset = col;
                    newList.Add(table[row + diagOffset][col]);
                }
                newList.TrimExcess();
                tableDiagonalDown.Add(newList);
            }

            // get top-right triangle
            // offset col by 1 because [0][0] was collected by last loop
            for (int col = 1; col < table.Width(); ++col)
            {
                var newList = new NumList();
                for (int row = 0; row + col < table.Width(); ++row)
                {
                    var diagOffset = col - 1;
                    newList.Add(table[row + diagOffset][col]);
                }
                newList.TrimExcess();
                tableDiagonalDown.Add(newList);
            }
            tableDiagonalDown.TrimExcess();
            return(tableDiagonalDown);
        }
コード例 #2
0
        // This is the "fast" method that cuts corners and assumes way too much about the data. I'll
        // document the assumptions as I make them, though they seem to be safe anyway.
        public static void fastOptimizeIndices(BSP me)
        {
            long largestIndex = 2;             // Assumption: Highest index will always be at least 2.

            for (int i = 0; i < me.Indices.Count / 3; i++)
            {
                if (me.Indices[(i * 3) + 2] > largestIndex)                // Assumption: Every third index will be greater than the previous two
                {
                    largestIndex = me.Indices[(i * 3) + 2];
                }
            }
            NumList newIndices = new NumList(NumList.dataType.UINT);

            for (int i = 0; i < largestIndex - 1; i++) // Assumption: If the highest index is N, there will be N-1 sets of three ints
            {
                newIndices.Add(0);                     // Assumption: The first index in a triple will always be 0
                newIndices.Add(i + 1);                 // Assumption: The second index is always the current set of three plus one
                newIndices.Add(i + 2);                 // Assumption: The third index is always the current set of three plus two
            }
            me.Indices = newIndices;
            for (int i = 0; i < me.Faces.Count; i++)
            {
                me.Faces[i].FirstIndex = 0;                 // Assumption: Every face starts at the beginning of the pattern, and will take what it needs
            }
            Console.WriteLine("Indices optimized to " + (newIndices.Count * 4) + " bytes.");
        }
コード例 #3
0
ファイル: World.cs プロジェクト: patrickHD/RPGConcept
        public void SpawnNum(Numoptions op, int dmg)
        {
            Label lbl = new Label
            {
                Content    = dmg,
                FontWeight = FontWeights.Bold,
                Margin     = new Thickness(583, 171, 0, 0),
                FontSize   = 28,
                Tag        = ControlTag.damagenum
            };

            if (op == Numoptions.normal)
            {
                lbl.Foreground = Brushes.LightGoldenrodYellow;
            }
            if (op == Numoptions.crit)
            {
                lbl.Foreground = Brushes.LightPink;
            }
            if (op == Numoptions.miss)
            {
                lbl.Content    = "MISS";
                lbl.Foreground = Brushes.White;
            }
            NumList.Add(lbl);
            BattleGrid.Children.Add(lbl);
        }
コード例 #4
0
ファイル: HomeController.cs プロジェクト: uan234G/StudyCards
        public IActionResult Chapter(int ChId)
        {
            NumList.Clear();
            Chapter CurrentChapter = dbContext.Chapters.Include(a => a.Book).Include(a => a.FlashCards).FirstOrDefault(a => a.ChapterId == ChId);

            ViewBag.ChapterId = CurrentChapter.ChapterId;
            return(View(CurrentChapter));
        }
コード例 #5
0
        /// <summary>
        /// 加入數據
        /// </summary>
        /// <param name="SrcNum"></param>
        public void Add(byte SrcNum)
        {
            if (SrcNum < 1 || SrcNum > 49)
            {
#if DEBUG
                Trace.WriteLine("Wrong SrcNum : " + SrcNum);
#endif
            }
            else
            {
                NumList.Add(SrcNum);
            }
        }
コード例 #6
0
        NumTable GetTopToBottom(NumTable table)
        {
            var tableTopToBottom = new NumTable();

            for (int i = 0; i < table.Width(); ++i)
            {
                NumList listTopToBottom = new NumList();
                for (int row = 0; row < table.Height(); ++row)
                {
                    listTopToBottom.Add(table[row][i]);
                }
                listTopToBottom.TrimExcess();
                tableTopToBottom.Add(listTopToBottom);
            }

            tableTopToBottom.TrimExcess();
            return(tableTopToBottom);
        }
コード例 #7
0
ファイル: World.cs プロジェクト: patrickHD/RPGConcept
        public void RemoveNum(Control control, bool removeAll)
        {
            Control    c = null;
            Object     x = null;
            bool       f1 = false, f2 = false;
            List <int> rmvList = new List <int>();

            if (removeAll == false)
            {
                NumList.Remove(control);
                BattleGrid.Children.Remove(control);
            }
            else
            {
                //foreach(object x in battleGrid.Children)
                for (int i = 0; i < BattleGrid.Children.Count; i++)
                {
                    if (BattleGrid.Children[i] is Control)
                    {
                        f1 = true;
                        c  = (Control)BattleGrid.Children[i];
                    }
                    if (c != null && c.Tag is ControlTag && (ControlTag)c.Tag == ControlTag.damagenum)
                    {
                        //rmvList.Add(i);
                        f2 = true;
                        BattleGrid.Children.Remove(c);
                    }
                }
                for (int j = 0; j < rmvList.Count; j++)
                {
                    //battleGrid.Children.RemoveAt(j);
                }
                for (int i = 0; i < NumList.Count; i++)
                {
                    NumList[i] = null;
                }
                if (f1 == f2 == true)
                {
                    BattleGrid.Children.Remove(BattleGrid.Children[BattleGrid.Children.Count - 1]);
                }
                NumList.Clear();
            }
        }
コード例 #8
0
        NumTable GetDiagonalUp(NumTable table)
        {
            var tableDiagonalUp = new NumTable();

            var maxIndexHeight = table.Height() - 1;
            var maxIndexWidth  = table.Width() - 1;

            // get top-left triangle
            for (int row = 0; row > table.Height(); ++row)
            {
                var newList = new NumList();
                for (int col = maxIndexWidth; col >= 0; --col)
                {
                    var diagOffset = col;
                    newList.Add(table[row + diagOffset][col]);
                }
                newList.TrimExcess();
                tableDiagonalUp.Add(newList);
            }

            // get bottom-right triangle
            // offset row by 1 because [0][0] was collected by last loop
            for (int row = 1; row < table.Height(); ++row)
            {
                var newList = new NumList();
                for (int col = maxIndexWidth; col <= maxIndexWidth - col; --col)
                {
                    var diagOffset = maxIndexWidth - col;
                    newList.Add(table[row + diagOffset][col]);
                }
                tableDiagonalUp.Add(newList);
            }

            tableDiagonalUp.TrimExcess();
            return(tableDiagonalUp);
        }
コード例 #9
0
 /// <summary>
 /// 排序 NumList
 /// </summary>
 public void Sort()
 {
     NumList.Sort();
 }