1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- using FairyGUI;
- using UnityEngine;
- using UI.Main;
- namespace GFGGame
- {
- public class StoryFightTargetView : BaseView
- {
- private UI_StoryFightTargetUI _ui;
- private GameObject _sceneObject;
- private GameObject _scenePrefab;
- public override void Dispose()
- {
- if (_sceneObject != null)
- {
- GameObject.Destroy(_sceneObject);
- _sceneObject = null;
- }
- if (_ui != null)
- {
- _ui.Dispose();
- _ui = null;
- }
- base.Dispose();
- }
- protected override void Init()
- {
- base.Init();
- _ui = UI_StoryFightTargetUI.Create();
- viewCom = _ui.target;
- isfullScreen = true;
- _scenePrefab = GFGAsset.Load<GameObject>(ResPathUtil.GetPrefabPath("SceneFightTarget"));
- }
- protected override void OnInit()
- {
- base.OnInit();
- }
- protected override void OnShown()
- {
- base.OnShown();
- if (_sceneObject == null)
- {
- _sceneObject = GameObject.Instantiate(_scenePrefab);
- }
- MyDressUpHelper.dressUpObj.setSceneObj(_sceneObject, true);
- MyDressUpHelper.dressUpObj.UpdateRoleView();
- StoryLevelCfg levelCfg = StoryLevelCfgArray.Instance.GetCfg(InstanceZonesDataManager.currentLevelCfgId);
- StoryFightCfg fightCfg = StoryFightCfgArray.Instance.GetCfg(levelCfg.fightID);
- SceneController.UpdateFightTarget(fightCfg.targetRes, _sceneObject);
- if (!string.IsNullOrEmpty(fightCfg.music))
- {
- MusicManager.Instance.Play(ResPathUtil.GetMusicPath(fightCfg.music, "mp3"));
- }
- _ui.m_roleName.m_txtName.text = RoleDataManager.roleName;
- _ui.m_targetName.m_txtName.text = fightCfg.targetName;
- Timers.inst.Add(1.1f, 1, (object param) =>
- {
- this.Hide();
- ViewManager.Show(ViewName.STORY_FIGHT_TARGET_SCORE_VIEW);
- });
- }
- protected override void OnHide()
- {
- base.OnHide();
- if (_sceneObject != null)
- {
- GameObject.Destroy(_sceneObject);
- _sceneObject = null;
- }
- }
- }
- }
|