Exemplo n.º 1
0
    private static LabeledInformation CreateHitPoints()
    {
        LabeledInformation result = LabeledInformation.Create();

        result.gameObject.name = "panel_HitPoints";
        result.caption         = "Hit Points";
        SetRectTransformSize(result.gameObject, itemSize_HitPoints);
        return(result);
    }
Exemplo n.º 2
0
    private static LabeledInformation CreateScore()
    {
        LabeledInformation result = LabeledInformation.Create();

        result.gameObject.name = "panel_Score";
        result.caption         = "Score";
        SetRectTransformSize(result.gameObject, itemSize_Score);
        return(result);
    }
Exemplo n.º 3
0
    private static LabeledInformation CreateLabeledInformation(Buff buff)
    {
        LabeledInformation result = LabeledInformation.Create();

        result.gameObject.name = itemPrefix + buff.caption;
        result.caption         = buff.caption.Substring(0, shortCaptionLength);
        result.value           = buff.duration.ToString();

        return(result);
    }
Exemplo n.º 4
0
    public static void Test()
    {
        LabeledInformation Li = LabeledInformation.Create();

        Li.gameObject.AddComponent <AlignIterator> ();

        RectTransform rt = Li.gameObject.transform as RectTransform;

        rt.offsetMin = new Vector2(5, 1);
        rt.offsetMax = rt.offsetMin + new Vector2(2, 1);

        Li.caption = "caption";
        Li.value   = "value";
        Li.Rebuild();
    }
Exemplo n.º 5
0
    private void UpdateCaptions()       // place for optimization here
    {
        if (buffs == null || items == null)
        {
            return;
        }

        foreach (Buff buff in buffs)
        {
            if (buff == null)
            {
                continue;
            }

            GameObject item = items.Find(x => x.gameObject.name == itemPrefix + buff.caption);
            if (item == null)
            {
                continue;
            }

            LabeledInformation Li = item.GetComponent <LabeledInformation> ();
            if (Li == null)
            {
                continue;
            }

            if (buff.duration == Buff.unlimitedDuration)
            {
                Li.value = infinitySymbol;
            }
            else
            {
                Li.value = string.Format("{0:F2}", buff.timeLeft);
            }
        }
    }
Exemplo n.º 6
0
    public static new LabeledInformation Create()
    {
        LabeledInformation result = PanelWithChildren.Create <LabeledInformation>();

        result.gameObject.name = "panel_LabeledInformation";

        result.SetAligner_AdaptiveTile(2, 1);
        result.alignDirection = Aligner.AlignDirection.adTop;

        result.items = new List <GameObject> ();

        GameObject item = Instantiate(Prefab.textItem);

        item.name       = "text_Caption";
        result.fCaption = item.GetComponent <Text> ();
        result.items.Add(item);

        item          = Instantiate(Prefab.textItem);
        item.name     = "text_Value";
        result.fValue = item.GetComponent <Text> ();
        result.items.Add(item);

        return(result as LabeledInformation);
    }