// c'tor
        public WaterPicker(OnSetMaterial onSet, OnGetMaterial onGet)
            : base(onSet, onGet)
        {
            helpOverlay = @"WaterPicker";

            // Create material elements for the grid.
            // Start with a blob of common parameters.
            UIGridElement.ParamBlob blob = new UIGridElement.ParamBlob();
            blob.width         = 1.0f;
            blob.height        = 1.0f;
            blob.edgeSize      = 0.1f;
            blob.selectedColor = Color.White;
            Vector4 transparentWhite = new Vector4(1.0f, 1.0f, 1.0f, 0.5f);

            blob.unselectedColor = new Color(transparentWhite);
            blob.normalMapName   = @"QuarterRound4NormalMap";

            // Create and populate grid.
            int maxMaterials = Water.Types.Count;

            grid = new UIGrid(OnSelect, OnCancel, new Point(maxMaterials, 1), "TerrainEdit.WaterPicker");

            numMaterials = 0;

            UIGridWaterElement e = null;

            for (int i = 0; i < maxMaterials; i++)
            {
                e = new UIGridWaterElement(i);
                e.SelectedScale   = 0.8f;
                e.UnselectedScale = 0.5f;
                grid.Add(e, numMaterials++, 0);
            }

            // Set grid properties.
            grid.IgnoreInput = true;    // We'll control the grid selection from here instead of internally.
            grid.Spacing     = new Vector2(0.25f, 0.0f);
            grid.Scrolling   = true;
            grid.Wrap        = false;
            grid.LocalMatrix = Matrix.CreateTranslation(0.0f, -2.5f, 0.0f);

            OnSampleType = SampleType;
        }   // end of WaterPicker c'tor
示例#2
0
 // c'tor
 public BasePicker(OnSetMaterial onSet, OnGetMaterial onGet)
 {
     this.onSetType = onSet;
     this.onGetType = onGet;
 }   // end of BasePicker c'tor