Пример #1
0
    public void SetMax(int max)
    {
        GLoader lo = null;

        if (list != null)
        {
            for (int j = 1; j < list.Count; j++)
            {
                lo = list [j];
                lo.Dispose();
                lo.RemoveFromParent();
            }
            list.Clear();
            list = null;
        }
        list = new List <GLoader> ();
        list.Add(bar0);
        if (max > 7)
        {
            oneWidth = Convert.ToInt32(41 * 7 / max);
        }
        else
        {
            oneWidth = 41;
        }
        bar0.width     = oneWidth;
        bar0.height    = 24;
        bar0.pivot     = new Vector2(0.5f, 0.5f);
        bar0.y         = 2;
        bar0.x         = 6;
        this.max       = max;
        this.viewWidth = max * (oneWidth + 1) + 12;

        for (int i = 1; i < max; i++)
        {
            lo        = new GLoader();
            lo.url    = bar0.resourceURL;
            lo.fill   = FillType.ScaleFree;
            lo.width  = oneWidth;
            lo.height = 24;
            lo.pivot  = new Vector2(0.5f, 0.5f);
            lo.y      = 2;
            lo.x      = i * (oneWidth + 1) + 6;
            list.Add(lo);
            this.AddChildAt(lo, 1);
        }
    }
Пример #2
0
    public override void Clear()
    {
        base.Clear();
        GLoader lo = null;

        if (list != null && list.Count > 0)
        {
            for (int j = 1; j < list.Count; j++)
            {
                lo = list [j];
                lo.Dispose();
                lo.RemoveFromParent();
            }
            list.Clear();
            list = null;
        }
    }