// Use this for initialization public void Init() { m_earthPrefab = GameObject.Instantiate(Resources.Load("Map/Earth_16K_linear") as GameObject); //m_chinaPrefab = GameObject.Instantiate(Resources.Load("Map/zhongguo") as GameObject); m_earthCopy = GameObject.Instantiate(Resources.Load("Map/EarthControl") as GameObject); m_cameraEarth = m_earthCopy.transform.Find("Main_Camera1").gameObject; m_earthCopy.SetActive(false); m_earthPrefab.gameObject.SetActive(false); //m_chinaPrefab.gameObject.SetActive(false); m_hitParent = GameObject.Find("HitCubeParent"); UGUIManager.GetInstance().GetUGUILogic <UI_EarthPanel>().InitPanel(); m_camera = GameObject.Find("CameraParent/Main Camera").GetComponent <Camera>(); //m_biaojiAni = m_earthPrefab.GetComponentInChildren<Animator>(); //m_biaojiAni.SetBool("biaoji", false); //EventCenter.Regist(UI_EVENT.SUN_ROTATE.ToString(), RotateSun); //m_biaoji.gameObject.SetActive(false); m_sunEarth = m_earthPrefab.transform.Find("Sun"); for (int i = 0; i < 3; i++) { string dot = "dot" + i.ToString(); Transform a = m_earthPrefab.transform.Find(dot); dotList.Add(a); } m_light = GameObject.Find("Directional light"); m_generatePlanes = GameObject.Find("GeneratePlanes").GetComponent <UnityARGeneratePlane>(); EventCenter.Regist(UI_EVENT.SHOW_EARTHTWO.ToString(), ShowEarthTwo); //EventCenter.Regist(UI_EVENT.SHOW_EARTHDISAPPEARFINISH.ToString(), ShowChina); }
private void Awake() { uguiManager = this; uguiIsWorking = false; }
public bool isStart = false;//用于切换开头视频 private void Awake() { //主渲染摄像机 _mainCamera = GetComponent <Camera>(); //主场景播放器 _mainScenePlayers = this.transform.GetChild(0); //其他播放器 _otherPlayers = this.transform.GetChild(1); //加载游戏播放器组 _gameVideoPlayers = this.transform.GetChild(2); //加载哄睡播放器组 _CoaxSleepPlayers = this.transform.GetChild(3); _otherPlayer = _otherPlayers.GetComponent <VideoPlayer>(); //加载多用途播放器 _audioSource = _otherPlayers.GetComponent <AudioSource>(); //加载多用途播放器声音组件 /* * foreach (var item in _mainVideoPlayers.GetComponentsInChildren<VideoPlayer>()) * { * * m_VideoPlayers.Add(item); * * * } * * _leveUpPlayer = m_VideoPlayers[4]; * * _leveUpPlayer.clip = Resources.Load<VideoClip>("Movies/levelUpVideo/Uplevel"); * _leveUpPlayer.SetTargetAudioSource(0, _leveUpPlayer.transform.GetComponent<AudioSource>()); * _leveUpPlayer.Play(); * _leveUpPlayer.Pause(); * */ MainCacheMovieMethod(false); //加载视频 //MainLoadMovie(false); // LoadingCoro = StartCoroutine( MainCacheMovieMethod(false, "load")); //UI管理器 _UIManager = GameObject.Find("Canvas").GetComponent <UGUIManager>(); #region 自动睡眠事件 播放打招呼视频或睡眠视频 if (m_InitLogInEvent == null) { m_InitLogInEvent = new InitLogInEvent(); m_InitLogInEvent.AddListener((bool isSleep) => { if (isSleep)// true: 播放睡眠视频 { //isWakeUp = isSleep; // movieCoro = StartCoroutine(MainPlay(_sleepVideoPlayer, "sleep"));//播放自动睡眠视频 StartCoroutine("MainLoopPlay", "sleep"); } else //false : 播放打招呼视频 { // isWakeUp = true; StartCoroutine("MainLoopPlay", "greet"); } }); } #endregion #region 自动睡眠结束后播放idle视频 if (m_PlayIdleEvent == null) { m_PlayIdleEvent = new UnityEvent(); m_PlayIdleEvent.AddListener(() => { isWakeUp = true; }); } #endregion #region 主界面按钮事件管理 //触摸头部事件 _UIManager._touchHeadBtn.onClick.AddListener(() => { //播放触摸头部视频 // movieCoro = StartCoroutine(MainPlay(_onHeadVideoPlayer, "head")); StartCoroutine("MainLoopPlay", "head"); }); //触摸身体事件 _UIManager._touchBodyBtn.onClick.AddListener(() => { //播放触摸身体视频 // movieCoro = StartCoroutine(MainPlay(_onBodyVideoPlayer, "body")); StartCoroutine("MainLoopPlay", "body"); }); //升级事件 _UIManager._levelUpBtn.onClick.AddListener(() => { //播放升级视频 // movieCoro = StartCoroutine(MainPlay(_levelUpVideoPlayer, "levelUp")); StartCoroutine("MainLoopPlay", "levelUp"); }); #endregion #region 游戏界面按钮事件 //按下玩耍按钮 进入猜拳小游戏界面 _UIManager._gameBtn.onClick.AddListener(() => { //调用加载页面 StartCoroutine("LoadingGame", true); }); //按下哄睡按钮, 进入猜拳小游戏界面 _UIManager._sleepBtn.onClick.AddListener(() => { /* * * //停止主界面视频播放,释放主界面视频空间 * _mainVideoPlayer.Stop(); * _mainVideoPlayer.targetCamera = null; * //释放主界面资源 * MainLoadMovie(true); * //调用淡入淡出方法 * // StartCoroutine("FadeInOut"); * //调用加载页面 * * /***开始预加载视频*** * //调用预加载视频方法 * PreLoadMovie(false); * * //播放idle视频 * * StartCoroutine("DealVideo", 0); */ }); //按下剪刀图标按钮事件 _UIManager._gameJBtn.onClick.AddListener(() => { StartCoroutine("DealVideo", 1); }); //按下包袱图标按钮事件 _UIManager._gameBBtn.onClick.AddListener(() => { StartCoroutine("DealVideo", 2); }); //按下拳头图标按钮事件 _UIManager._gameQBtn.onClick.AddListener(() => { StartCoroutine("DealVideo", 3); }); //按下游戏界面返回图标按钮事件 _UIManager._gameReturn.onClick.AddListener(() => { //调用加载页面 StartCoroutine("LoadingGame", false); }); #endregion // MainCacheMovieMethod2(false); }
public void ShowPanel(bool isShow) { UGUIManager.GetInstance().GetUGUILogic <UI_EarthPanel>().ShowUI(isShow); }