protected override void OnOpen(object userData) { base.OnOpen(userData); //开启事件监听 GameEntry.Event.Subscribe(GameChangeEventArgs.EventId, OnGameChange); GameEntry.Event.Subscribe(PlayerStateChangedEventArgs.EventId, OnPlayerStateChange); //引用初始化 // m_ProcedureMain = (ProcedureMain)userData; // if (m_SiteNameText!=null) // { // m_SiteNameText.gameObject.SetActive(false); // } //改变背景图 // GameEntry.Resource.LoadBackground(GameEntry.DataNode.GetNowSite().BGAssName); // m_BackgroundImage.sprite = s_BGImage; foreach (var sprite in m_BgImageList) { if (sprite.name == GameEntry.DataNode.GetNowSite().BGAssName) { m_BackgroundImage.sprite = sprite; } } if (m_BackgroundImage.sprite == null) { //显示文字 m_SiteNameText.gameObject.SetActive(true); m_SiteNameText.text = GameEntry.DataNode.GetNowSite().BGAssName; m_SiteNameText.gameObject.SetActive(false); } //改变音乐 //顶部信息显示 m_MoneyText.text = GameEntry.DataNode.GetPlayerInfo().Money.ToString(); m_TimeText.text = TimeUtility.TimeFormat(GameEntry.DataNode.GetNowTime()); // IDataTable<DRFunction> dtFunction = GameEntry.DataTable.GetDataTable<DRFunction>(); // int[] functionList = m_MainParams.FunctionList; // foreach (var function in functionList) // { // DRFunction drFunction = dtFunction.GetDataRow(function); // } // m_QuitButton.SetActive(Application.platform != RuntimePlatform.IPhonePlayer); }
//游戏信息改变事件响应函数 private void OnGameChange(object sender, GameEventArgs e) { GameChangeEventArgs ne = (GameChangeEventArgs)e; m_TimeText.text = TimeUtility.TimeFormat(ne.GameInfo.NowTime); }