コード例 #1
0
ファイル: PagingSystem.cs プロジェクト: tarsupin/Nexus
        // One of these values gets set as 0, the other is set to -1 or 1 to represent the direction of movement.
        public void MoveSelector(sbyte slotX, sbyte slotY)
        {
            // Determine Sizes
            byte cols     = (byte)Math.Ceiling((float)this.numOnPage / (float)this.PerRow);
            byte finalRow = (byte)(this.numOnPage - ((cols - 1) * this.PerRow));

            sbyte toRow = (sbyte)(this.selectX + slotX);
            sbyte toCol = (sbyte)(this.selectY + slotY);

            // Moving Down
            if (slotY == 1)
            {
                // Leaves Paging Section
                if (toCol >= cols)
                {
                    PagingExitRule exitRule = this.exits[DirCardinal.Down];
                    if (exitRule == PagingExitRule.Wrap)
                    {
                        this.selectY = 0;
                    }
                    else if (exitRule == PagingExitRule.NoWrap) /* No Change. Resists the Movement. */ } {
                    else if (exitRule == PagingExitRule.LeaveArea)
                    {
                        this.exitDir = DirCardinal.Down;
                    }
            }
コード例 #2
0
ファイル: PagingSystem.cs プロジェクト: tarsupin/Nexus
 // Assigns an exit rule to a particular direction.
 public void SetExitRule(DirCardinal dir, PagingExitRule exitRule)
 {
     this.exits[dir] = exitRule;
 }