Пример #1
0
    public void Init(BattleFormationPanel battlePanel)
    {
        _formationHeroCategory = new UIHeroCategory(InstancePlayer.instance.model_User.model_heroGroup.heroesMap);

        _battleFormationPanel = battlePanel;

        GameObject container = UIHelper.FindChildInObject(gameObject, "HeroContainer");

        _scrollView = UIHelper.FindChildInObject(container, "hero_scView_0").GetComponent <UIScrollView>();
        _grid       = UIHelper.FindChildInObject(container, "ui_grid").GetComponent <UIGrid> ();

        dragDropRoot = _battleFormationPanel.dragDropRoot;
    }
Пример #2
0
    public override void Init()
    {
        base.Init();

        animationType = AnimationType.ALPHA;

        dragDropRoot        = UIHelper.FindChildInObject(gameObject, "UIDragDropRoot").GetComponent <UIDragDropRoot>();
        UIDragDropRootPanel = dragDropRoot.GetComponent <UIPanel>();

        _close_btn  = UIHelper.FindChildInObject(gameObject, "CloseBtn").GetComponent <UIButton> ();
        _battle_btn = UIHelper.FindChildInObject(gameObject, "BattleBtn").GetComponent <UIButton> ();

        UpdateBtnState(_battle_btn.gameObject);

        _attack_Label  = UIHelper.FindChildInObject(gameObject, "EnergyLabel").transform.Find("Label").GetComponent <UILabel> ();
        _replenish_btn = UIHelper.FindChildInObject(gameObject, "supplybtn").GetComponent <UIButton> ();

        formationUIController = gameObject.GetComponent <FormationUIController> ();


        for (int i = 0; i < TEAM_COUNT; ++i)
        {
            formation_team[i] = UIHelper.FindChildInObject(gameObject, "Formation_Team_" + i);
        }

        CreateScrollView();

        AddBtnClick();

        // 当前玩家拥有Unit分组
        formationUnitCategory = new FormationUnitCategory(InstancePlayer.instance.model_User.unlockUnits);

        // 阵型数据
        model_Formation = InstancePlayer.instance.model_User.model_Formation;

        // 初始化军官
        _heroPanel = this.GetComponent <UIHeroPanel>();
        _heroPanel.Init(this);

        // slot UI Manager
        slotUIManager = this.GetComponent <FormationSlotUIManager> ();

        // 初始化 slot 数据
        InitSlotUI();

        // 默认显示Team 1

        int teamId = InstancePlayer.instance.model_User.model_Formation.GetSelectTeamId();

        if (teamId <= 0)
        {
            teamId = 0;
        }
        else
        {
            teamId = teamId - 1;
        }
        UpdateTeamSlotUI(teamId);
        UpdateBottomBtnUI();

        // 更新底部 scrollView列表
        UpdateUnitList(0);

        //  默认显示unit
        UpdateState(STATE.UNIT);
    }