Ejemplo n.º 1
0
 void updateBandColors()
 {
     for (int i = 0; i < rings.Count; i++)
     {
         if (autoUpdateBandAlpha)
         {
             bandColors.SetValNoCb(i, new Color(bandColors[i].r, bandColors[i].g, bandColors[i].b, (i + 1f) / rings.Count), ref _bandColors);
         }
         colorChanger(rings[i].band, bandColors[i]);
     }
 }
Ejemplo n.º 2
0
    bool sortData()
    {
        bool       wasASwap   = false;
        bool       flag       = true;
        bool       shouldSwap = false;
        float      temp;
        string     tempL;
        GameObject tempGo;
        int        numLength = numSlices;

        for (int i = 1; (i <= numLength) && flag; i++)
        {
            flag = false;
            for (int j = 0; j < (numLength - 1); j++)
            {
                shouldSwap = false;
                if (sortBy == sortMethod.Largest_First)
                {
                    if (sliceValues[j + 1] > sliceValues[j])
                    {
                        shouldSwap = true;
                    }
                }
                else if (sortBy == sortMethod.Smallest_First)
                {
                    if (sliceValues[j + 1] < sliceValues[j])
                    {
                        shouldSwap = true;
                    }
                }
                else if (sortBy == sortMethod.Alphabetically)
                {
                    if (sliceLabels[j + 1].CompareTo(sliceLabels[j]) == -1)
                    {
                        shouldSwap = true;
                    }
                }
                else if (sortBy == sortMethod.Reverse_Alphabetically)
                {
                    if (sliceLabels[j + 1].CompareTo(sliceLabels[j]) == 1)
                    {
                        shouldSwap = true;
                    }
                }
                if (shouldSwap)
                {
                    // Swap values
                    temp = sliceValues[j];
                    sliceValues.SetValNoCb(j, sliceValues[j + 1], ref _sliceValues);
                    sliceValues.SetValNoCb(j + 1, temp, ref _sliceValues);
                    // Swap labels
                    tempL = sliceLabels[j];
                    sliceLabels.SetValNoCb(j, sliceLabels[j + 1], ref _sliceLabels);
                    sliceLabels.SetValNoCb(j + 1, tempL, ref _sliceLabels);
                    // Swap Slices
                    tempGo = slices[j];
                    slices[j].GetComponent <WMG_Pie_Graph_Slice>().sliceIndex = j + 1;
                    slices[j] = slices[j + 1];
                    slices[j + 1].GetComponent <WMG_Pie_Graph_Slice>().sliceIndex = j;
                    slices[j + 1] = tempGo;

                    // Swap Colors
                    if (swapColorsDuringSort)
                    {
                        Color tempC = sliceColors[j];
                        sliceColors.SetValNoCb(j, sliceColors[j + 1], ref _sliceColors);
                        sliceColors.SetValNoCb(j + 1, tempC, ref _sliceColors);
                    }
                    flag     = true;
                    wasASwap = true;
                }
            }
        }
        return(wasASwap);
    }