Beispiel #1
0
    private void OnClickLv2(GameObject sender)
    {
        DamageCalItemLevel2 component = sender.get_transform().get_parent().get_parent().GetComponent <DamageCalItemLevel2>();

        component.treeItem.open = !component.treeItem.open;
        component.listView.Refresh();
    }
Beispiel #2
0
    public Cell CellForRow(ListView listView, int row)
    {
        string text;

        if (listView == this.ListViewLeft)
        {
            text = "cellLeft";
        }
        else
        {
            text = "cellRight";
        }
        Cell cell = listView.CellForReuseIndentify(text);

        if (cell == null)
        {
            cell          = new Cell(listView);
            cell.identify = text;
            string name;
            if (listView == this.ListViewLeft)
            {
                name = "InstanceDamageCalItemLeft";
            }
            else
            {
                name = "InstanceDamageCalItemRight";
            }
            GameObject instantiate2Prefab = ResourceManager.GetInstantiate2Prefab(name);
            cell.content = instantiate2Prefab;
            instantiate2Prefab.GetComponent <RectTransform>().set_localScale(new Vector3(1f, 1f, 1f));
        }
        InstanceDamageCalItem component = cell.content.GetComponent <InstanceDamageCalItem>();

        component.BtnOpenLevel1.onClickCustom = new ButtonCustom.VoidDelegateObj(this.OnClickLv1);
        List <DamageCalModel> list           = this.GetList(this.currentDamageCalMode, listView);
        DamageCalModel        damageCalModel = list.get_Item(row);

        component.treeItem = damageCalModel;
        component.listView = listView;
        float num      = 0f;
        float num2     = 135f;
        float totalNum = this.GetTotalNum(listView, this.currentDamageCalMode);

        component.ResetAll();
        component.SetUI(damageCalModel, totalNum);
        if (damageCalModel.open)
        {
            int leftOrRight;
            if (listView == this.ListViewLeft)
            {
                leftOrRight = 0;
            }
            else
            {
                leftOrRight = 1;
            }
            for (int i = 0; i < damageCalModel.listChildren.get_Count(); i++)
            {
                DamageCalItemLevel2 damageCalItemLevel = component.SetChild(component.Level2, -50f - num, leftOrRight);
                damageCalItemLevel.BtnOpenLevel2.onClickCustom = new ButtonCustom.VoidDelegateObj(this.OnClickLv2);
                damageCalItemLevel.ResetAll();
                num  += 100f;
                num2 += 100f;
                DamageCalModel damageCalModel2 = damageCalModel.listChildren.get_Item(i);
                damageCalItemLevel.SetUI(damageCalModel2, totalNum);
                damageCalItemLevel.treeItem = damageCalModel2;
                damageCalItemLevel.listView = listView;
                if (damageCalModel2.open)
                {
                    for (int j = 0; j < damageCalModel2.listChildren.get_Count(); j++)
                    {
                        num  += 85f;
                        num2 += 85f;
                        float y = -50f - 85f * (float)j;
                        DamageCalItemLevel3 damageCalItemLevel2 = damageCalItemLevel.SetChild(damageCalItemLevel.Level3, y, leftOrRight);
                        DamageCalModel      model = damageCalModel2.listChildren.get_Item(j);
                        damageCalItemLevel2.SetUI(model, totalNum);
                    }
                }
            }
        }
        return(cell);
    }