/// <summary> /// UIを生成する /// </summary> /// <param name="log"></param> /// <returns></returns> public IEnumerator CreateLogUi(MsgTalkLog log) { //ウインドウのプレハブからインスタンス生成 GameObject panel = Instantiate(this.PrefabLogNewsContent) as GameObject; //ウインドウ名設定 panel.name = "LiplisLog" + log.DATAKEY; //要素取得 Text TxtTitle = panel.transform.Find("TxtTitle").GetComponent <Text>(); Text TxtCat = panel.transform.Find("TxtCat").GetComponent <Text>(); Text TxtTime = panel.transform.Find("TxtTime").GetComponent <Text>(); Text TxtDataKey = panel.transform.Find("TxtDataKey").GetComponent <Text>(); Text TxtPanelKey = panel.transform.Find("TxtPanelKey").GetComponent <Text>(); Button BtnWeb = panel.transform.Find("BtnWeb").GetComponent <Button>(); RawImage ImgThumbnail = panel.transform.Find("ImgThumbnail").GetComponent <RawImage>(); //内容設定 TxtTitle.text = log.TITLE; TxtCat.text = ContentCategolyText.GetContentText(log.DATA_TYPE); TxtTime.text = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"); TxtDataKey.text = log.DATAKEY; TxtPanelKey.text = log.PANEL_KEY + DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"); //ポインターダウンイベントトリガー生成 RegisterEventOpenDescription(log, ImgThumbnail.gameObject, panel); BtnWeb.GetComponent <Button>().onClick.AddListener(() => OpneWeb(log.URL)); //イメージのロード CreateEmpty(); GlobalCoroutine.GoWWW(ImgThumbnail, empty, log.THUMBNAIL_URL); yield return(panel); }
/// <summary> /// クリック時処理 /// </summary> public void OnClick() { //自データをロードする var data = ScrollViewController.sc.NewsDataList[this.dataIndex]; //データキーから話題セット CtrlTalk.Instance.SetNextTopic(data.DATAKEY, ContentCategolyText.GetContentCategoly(data.DATA_TYPE)); }
/// <summary> /// この話題をもう一度おしゃべり /// </summary> public void Btn_BtnReTalk_Click() { //おしゃべり if (this.selectedLog != null) { //閉じるボタン実行 Btn_Log_Close_Click(); //おしゃべり実行 CtrlTalk.Instance.SetTopicTalkFromLastNewsList(selectedLog.DATAKEY, ContentCategolyText.GetContentCategoly(selectedLog.DATA_TYPE)); } }
/// <summary> /// 選択中の話題を再度しゃべるボタンを押したときの処理 /// </summary> public void Btn_ReTalk_Click() { //NULLチェック if (NowTopic == null) { return; } //次の話題に差し込む CtrlTalk.Instance.SetTopicTalkFromLastNewsList(NowTopic.DataKey, ContentCategolyText.GetContentCategoly(NowTopic.TopicClassification)); //画面を閉じる UiSetting.gameObject.SetActive(false); }
//==================================================================== // // ゲーミング処理 // //==================================================================== #region ゲーミング処理 /// <summary> /// モード変更時処理 /// </summary> /// <param name="mode"></param> private void ChangeMode(ContentCategoly mode) { try { //モードを設定 LiplisStatus.Instance.EnvironmentInfo.SelectMode = mode; //テキスト修正 TxtTopicMode.text = ContentCategolyText.GetContentText(mode); //モード別処理 CreateTbt(); } catch { } }
/// <summary> /// モード変更 /// </summary> private void ChangeMode(ContentCategoly nextContent) { TxtTalkMode.text = ContentCategolyText.GetContentText(nextContent); LiplisStatus.Instance.EnvironmentInfo.SelectMode = nextContent; }
//==================================================================== // // 更新処理 // //==================================================================== #region 更新処理 /// <summary> /// アイテム更新 /// </summary> /// <returns></returns> private IEnumerator updateItem() { if (this.dataIndex == -1) { yield break; } //ニュースデータNULLチェック if (ScrollViewControllerLog.sc.NewsDataList == null) { yield break; } //ニュースデータカウントチェック if (ScrollViewControllerLog.sc.NewsDataList.Count - 1 < this.dataIndex) { yield break; } //ニュースデータ取得 MsgBaseNewsData data = ScrollViewControllerLog.sc.NewsDataList[this.dataIndex]; //コンペアチェック if (CompareData(data)) { yield break; } //一個前のURL設定 prvData = data; //タイトル表示 this.txtNews.text = data.TITLE; //サムネイルURL取得 string thumbUrl = ThumbnailUrl.CreateListThumbnailUrl(data.THUMBNAIL_URL); //時刻表示 this.txtTime.text = LpsDatetimeUtil.dec(data.CREATE_TIME).ToString("yyyy/MM/dd HH:mm:ss"); //タイプ表示 this.txtType.text = ContentCategolyText.GetContentText(data.DATA_TYPE); //ファイルからサムネイル取得を試みる Texture2D texture = LiplisCache.Instance.ImagePath.GetWebTexutreFromFile(thumbUrl); //NULLならノーイメージ適用 if (texture == null) { texture = LiplisCache.Instance.ImagePath.GetNoImageTex(); } //NULLならWebからダウンロードする if (texture == null) { //からテクスチャ取得 texture = LiplisCache.Instance.ImagePath.GetNoImageTex(); //設定 icon.sprite = Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), Vector2.zero); //最新ニュースデータ取得 var Async = LiplisCache.Instance.ImagePath.GetWebTexutre(thumbUrl); //非同期実行 yield return(CoroutineHandler.StartStaticCoroutine(Async)); //再度データを取り直す data = ScrollViewControllerLog.sc.NewsDataList[this.dataIndex]; //データ取得 texture = (Texture2D)Async.Current; } //ボタンのテキスト変更 if (texture != null) { try { icon.sprite = Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), Vector2.zero); } catch { } } else { } }