示例#1
0
        public LoadLevelMenuUIGrid(
            UIGridEvent onSelect,
            UIGridEvent onCancel,
            UIGridEvent onMoveLeft,
            UIGridEvent onMoveRight,
            string uiMode)
            : base(onSelect, onCancel, new Point(kWidth, 1), uiMode)
        {
            MovedLeft  += onMoveLeft;
            MovedRight += onMoveRight;

            RenderEndsIn       = true;  // In order to get the shadows layering correctly.
            IgnoreFocusChanged = true;  // No clicks on focus change.

            // Set up the blob for info common to all tiles.
            blob                  = new UIGridElement.ParamBlob();
            blob.width            = 2.0f;
            blob.height           = 2.0f;
            blob.edgeSize         = 0.2f;
            blob.selectedColor    = Color.Black;
            blob.unselectedColor  = Color.Black;
            blob.Font             = UI2D.Shared.GetGameFont15_75;
            blob.textColor        = Color.White;
            blob.dropShadowColor  = Color.Transparent;
            blob.useDropShadow    = true;
            blob.invertDropShadow = false;
            blob.normalMapName    = null;

            baseOrients = new Orientation[kWidth] {
                new Orientation(new Vector3(-8 * ELEMENT_SPACING_X, 0.0f, 0.0f), 0.2f, 0.36f),
                new Orientation(new Vector3(-7 * ELEMENT_SPACING_X, 0.0f, 0.0f), 0.3f, 0.32f),
                new Orientation(new Vector3(-6 * ELEMENT_SPACING_X, 0.0f, 0.0f), 0.4f, 0.28f),
                new Orientation(new Vector3(-5 * ELEMENT_SPACING_X, 0.0f, 0.0f), 0.5f, 0.24f),
                new Orientation(new Vector3(-4 * ELEMENT_SPACING_X, 0.0f, 0.0f), 0.6f, 0.2f),
                new Orientation(new Vector3(-3 * ELEMENT_SPACING_X, 0.0f, 0.0f), 0.7f, 0.16f),
                new Orientation(new Vector3(-2 * ELEMENT_SPACING_X, -0.2f, 0.0f), 0.75f, 0.14f),
                new Orientation(new Vector3(-1 * ELEMENT_SPACING_X, -0.18f, 0.0f), 0.79f, 0.08f),
                new Orientation(new Vector3(0, 0.0f, 0.0f), 1.2f, 0.0f),
                new Orientation(new Vector3(1 * ELEMENT_SPACING_X, 0.1f, 0.0f), 0.79f, -0.1f),
                new Orientation(new Vector3(2 * ELEMENT_SPACING_X, 0.25f, 0.0f), 0.7f, -0.15f),
                new Orientation(new Vector3(3 * ELEMENT_SPACING_X, 0.4f, 0.0f), 0.63f, -0.19f),
                new Orientation(new Vector3(4 * ELEMENT_SPACING_X, 0.5f, 0.0f), 0.58f, -0.25f),
                new Orientation(new Vector3(5 * ELEMENT_SPACING_X, 0.47f, 0.0f), 0.52f, -0.3f),
                new Orientation(new Vector3(6 * ELEMENT_SPACING_X, 0.4f, 0.0f), 0.47f, -0.35f),
                new Orientation(new Vector3(7 * ELEMENT_SPACING_X, 0.4f, 0.0f), 0.42f, -0.4f),
                new Orientation(new Vector3(8 * ELEMENT_SPACING_X, 0.4f, 0.0f), 0.35f, -0.45f),
                new Orientation(new Vector3(9 * ELEMENT_SPACING_X, 0.4f, 0.0f), 0.3f, -0.5f),
            };

            currentOrients = new Orientation[kWidth];
            for (int i = 0; i < kWidth; i++)
            {
                currentOrients[i] = new Orientation(baseOrients[i]);
            }
        }
示例#2
0
        public AuxMenuUIGrid(
            UIGridEvent onSelect,
            UIGridEvent onCancel,
            Point maxDimensions,
            string backgroundName,
            string uiMode)
            : base(onSelect, onCancel, maxDimensions, uiMode)
        {
            this.backgroundName = backgroundName;

            edgeSize = 64.0f / 96.0f;
            height   = (maxDimensions.Y * lineHeight) / 96.0f + 2.0f * edgeSize;
            float minWidth = 3.0f;

            width = Math.Max(2.0f * edgeSize, minWidth);

            geometry = new Base9Grid(width, height, edgeSize);
        }   // end of c'tor
示例#3
0
        public ToolMenuUIGrid(
            UIGridEvent onSelect,
            UIGridEvent onCancel,
            Point maxDimensions,
            string uiMode)
            : base(onSelect, onCancel, maxDimensions, uiMode)
        {
            positions = new Vector3[kMaxTiles];

            float theta = 0.0f;

            for (int i = 0; i < kMaxTiles; i++)
            {
                float s = (float)Math.Sin(theta);
                float c = (float)Math.Cos(theta);
                positions[i] = new Vector3(-s * kXRadius, 0.0f, kYRadius + c * kYRadius);

                theta += kDeltaTheta;
            }
        }
示例#4
0
        // c'tor
        public UIGrid(UIGridEvent onSelect, UIGridEvent onCancel, Point maxDimensions)
        {
            this.Select        = onSelect;
            this.Cancel        = onCancel;
            this.maxDimensions = maxDimensions;
            grid = new UIGridElement[maxDimensions.X, maxDimensions.Y];

            // Init to null.
            for (int j = 0; j < maxDimensions.Y; j++)
            {
                for (int i = 0; i < maxDimensions.X; i++)
                {
                    grid[i, j] = null;
                }
            }
            actualDimensions = new Point(0, 0);
            focusIndex       = new Point(0, 0); // TODO need to decide how to set this if not already set.  Should never point
                                                // to a null element?  Does this mean we can't have a row of diagonal elements?
                                                // Why bother about supporting something that's stupid, just limit it.

            this.commandMap = CommandMap.Deserialize(this, "UiGridControl.xml");
        }   // end of UIGrid c'tor