Ejemplo n.º 1
0
    void executePerSecond()
    {
        if (totalFightItems.Count > 0 && index < totalFightItems.Count)
        {
            FightItemModel itemModel = totalFightItems [index];
            fightScrollList.AddFightItem(itemModel);
            if (itemModel.prop.Equals("win"))
            {
                resultText.text = "战斗胜利!";
            }
            if (itemModel.prop.Equals("lost"))
            {
                resultText.text = "战斗失败!";
            }
            if (itemModel.prop.Equals("tie"))
            {
                resultText.text = "战斗平局!";
            }
            index++;
        }
        else
        {
            if (index >= totalFightItems.Count)
            {
                isOver = true;
                CancelInvoke();

                durationText.gameObject.SetActive(false);
                resultText.gameObject.SetActive(true);
            }
        }
    }
Ejemplo n.º 2
0
    public void Bind(FightItemModel model, FightScrollList scrollList)
    {
        string result = "";

//		result += "<color=navy>【" + PrefDefine.SOLDIER_TYPE[model.fromHero.type] + "·" + model.fromHero.nickname + "】</color>";

        result = model.describ;

        txt.text = result;
    }
Ejemplo n.º 3
0
    void AddItems()
    {
        for (int i = 0; i < fightItems.Count; i++)
        {
            Text itemText = Instantiate(txt);
            itemText.transform.SetParent(transform, false);
            RectTransform rt = itemText.GetComponent <RectTransform> ();
            rt.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Top, i * 150, 150);

            FightItem      item  = itemText.GetComponent <FightItem> ();
            FightItemModel model = fightItems[i];
            item.Bind(model, this);
        }

        RectTransform rootRt = GetComponent <RectTransform> ();

        rootRt.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Top, 0, fightItems.Count * 150);

        scrollBar.value = 0.001f;
    }
Ejemplo n.º 4
0
 public void AddFightItem(FightItemModel item)
 {
     fightItems.Add(item);
     AddLastItem(item);
 }