Beispiel #1
0
    public void AllBuild(List <MonsterData> monsterDataList, Vector3 vScl, Action <MonsterData> actL = null, Action <MonsterData> actS = null, bool rebuild = false)
    {
        if (!rebuild)
        {
            this.actL_bak = actL;
            this.actS_bak = actS;
            foreach (MonsterData monsterData in monsterDataList)
            {
                GUIMonsterIcon icon = ClassSingleton <GUIMonsterIconList> .Instance.GetIcon(monsterData);

                icon.SetTouchAct_S(null);
            }
        }
        ClassSingleton <GUIMonsterIconList> .Instance.PushBackAllMonsterPrefab();

        base.InitScrollBar();
        base.SetSelectPanelParam();
        this.partsCount = monsterDataList.Count;
        this.partObjs   = new List <GUIListPartBS>();
        this.vScl_bak   = vScl;
        if (this.partsCount == 0)
        {
            base.height = 0f;
            base.InitMinMaxLocation(-1, 0f);
            return;
        }
        GUIMonsterIcon icon2 = ClassSingleton <GUIMonsterIconList> .Instance.GetIcon(monsterDataList[0]);

        int num = this.partsCount / this.PARTS_CT_MN;

        if (this.partsCount % this.PARTS_CT_MN > 0)
        {
            num++;
        }
        base.selectParts = icon2.gameObject;
        GUISelectPanelBSPartsUD.PanelBuildData panelBuildData = base.CalcBuildData(this.PARTS_CT_MN, num, vScl.x, vScl.y);
        float    num2      = panelBuildData.startY;
        float    startX    = panelBuildData.startX;
        int      num3      = 0;
        UIWidget component = base.gameObject.GetComponent <UIWidget>();

        foreach (MonsterData monsterData2 in monsterDataList)
        {
            GUIMonsterIcon icon3 = ClassSingleton <GUIMonsterIconList> .Instance.GetIcon(monsterData2);

            GameObject gameObject = icon3.gameObject;
            this.partObjs.Add(icon3);
            gameObject.SetActive(true);
            vScl.z = 1f;
            gameObject.transform.parent     = base.transform;
            gameObject.transform.localScale = vScl;
            float x = startX + panelBuildData.pitchW * (float)(num3 % this.PARTS_CT_MN);
            icon3.SetOriginalPos(new Vector3(x, num2, -5f));
            icon3.SetParent();
            if (component != null)
            {
                DepthController component2 = gameObject.GetComponent <DepthController>();
                UIWidget        component3 = gameObject.GetComponent <UIWidget>();
                if (component2 != null && component3 != null)
                {
                    component2.AddWidgetDepth(gameObject.transform, component.depth + 10 - component3.depth);
                }
            }
            icon3.SetTouchAct_L(actL);
            if (!rebuild || icon3.GetTouchAct_S() == null)
            {
                if (this.IsEnablePush(monsterData2))
                {
                    icon3.SetTouchAct_S(actS);
                }
                else
                {
                    icon3.SetTouchAct_S(null);
                }
            }
            num3++;
            if (num3 % this.PARTS_CT_MN == 0)
            {
                num2 -= panelBuildData.pitchH;
            }
        }
        base.height = panelBuildData.lenH;
        base.InitMinMaxLocation(-1, 0f);
        base.UpdateActive();
    }