Example #1
0
 // constructor auto builds pie from a complete heirarchy
 public PieMenu(PieRecipeItem rootRecipe, Vector2 desiredLocation)
 {
     this.desiredLocation         = desiredLocation;
     this.rootRecipe              = rootRecipe; // remember this one....
     this.rootDisk                = new PieDisk(this, rootRecipe);
     this.rootDisk.ScreenPosition = desiredLocation;
 }
Example #2
0
            // builds either the sing disk or, if given the complete hierarchy
            public void BakePie(bool isVisible)
            {
                Visible = isVisible;
                if (rootRecipe.subList != null && (rootRecipe.subList.Count > 0))
                {
                    // build full pie!
                    for (int i = 0; i < rootRecipe.subList.Count; i++)
                    {
                        PieRecipeItem pieRecipeSlice = rootRecipe.subList[i];

                        PieMenuSlice slice = new PieMenuSlice(pieRecipeSlice);
                        AddSlice(slice);
                        if (pieRecipeSlice.subList != null && pieRecipeSlice.subList.Count > 0)
                        { // this is a "group node" with another pie structure below
                            PieDisk fullPie = new PieDisk(this, pieRecipeSlice);
                            slice.subDisk = fullPie;

                            subList.Add(fullPie);
                            fullPie.BakePie(false);
                            //subList[subList.Count - 1].BakePie(false);
                        }
                    }
                }
                else if (slices.Count == 0)
                {
                    // something whent wrong.. we have nothing to build!
                    return;
                }

                if (Visible)
                {
                    BuildSlices();
                }
            }
Example #3
0
 public PieMenuSlice(PieRecipeItem recipe)
 {
     this.menuItem = recipe.menuItem;
     this.texture  = recipe.texture;
     this.font     = recipe.font;
     this.label    = recipe.label;
     if (recipe.subList == null || recipe.subList.Count == 0)
     {
         this.sliceType = PieSelector.SliceType.single;
     }
     else
     {
         this.sliceType = PieSelector.SliceType.group;
     }
 }
Example #4
0
 // constructor from a complete hierarchy set
 public PieDisk(Object parentPie, PieRecipeItem recipe)
 {
     this.parent     = parentPie;
     this.rootRecipe = recipe;
 }