public void Free()
    {
        _dataCampaign    = null;
        _campaign        = null;
        _selectTileIndex = -1;

        if (_skeletonAnim != null)
        {
            MonoBehaviour.DestroyImmediate(_skeletonAnim.gameObject);
            _skeletonAnim = null;
        }

        if (_boundingBox != null)
        {
            MonoBehaviour.DestroyImmediate(_boundingBox.gameObject);
            _boundingBox = null;

            _boundingBoxLineRender = null;
        }

        FreeArrow();

        if (_tankIconRoot != null)
        {
            MonoBehaviour.DestroyImmediate(_tankIconRoot);
            _tankIconRoot = null;
        }

        FreeStar();
    }
    public CampaignMapControl(DataMissionGroup.DataCampaign dataCampaign, int startTileIndex = 0)
    {
        _dataCampaign = dataCampaign;
        _campaign     = InstancePlayer.instance.model_User.model_level.GetCampaign(dataCampaign.difficulty, dataCampaign.stageId);

        LoadSpine();
        UpdateTileState();

        SelectTile(startTileIndex);
    }
Esempio n. 3
0
    //  更新Mission列表
    public void UpdateMissionList()
    {
        List <Model_Mission> model_missions;

        Model_User model_User = InstancePlayer.instance.model_User;

        Model_Level model_level = InstancePlayer.instance.model_User.model_level;

        DataConfig.MISSION_DIFFICULTY difficulty = DataMission.GetDifficulty(_missionMagicId);
        int stageId = DataMission.GetStageId(_missionMagicId);

        Model_Level.Campaign campaign = model_level.GetCampaign(difficulty, stageId);
        model_missions = campaign.list;

        int n = model_missions.Count;
        int currentSelectId = 0;

        GameObject cell_prefab = Resources.Load(MISSION_CELL_PATH) as GameObject;

        for (int i = 0; i < n; ++i)
        {
            GameObject cell = NGUITools.AddChild(grid_Mission.gameObject, cell_prefab);
            grid_Mission.AddChild(cell.transform);
            cell.name = UIHelper.GetItemSuffix(i);

            Model_Mission model_Mission = model_missions [i];

            MissionCellUI cellUI = cell.GetComponent <MissionCellUI> ();
            cellUI.missionDetialUI = missionDetialUI;
            cellUI.missionPanel    = this;

            cellUI.isUnlock = model_Mission.actived;

            //  当前关卡选中项
            if (_missionMagicId == model_Mission.magicId)
            {
                cellUI.isSelected = true;
            }

            // Boss
            if (i == n - 1)
            {
                cellUI.isBoss = true;
            }

            cellUI.UpdateUI(model_Mission);
            mission_cell_list.Add(cellUI);
        }

        grid_Mission.animateSmoothly = false;
        grid_Mission.repositionNow   = true;
    }