class NotificationWindowView { string m_NotificationWindowLayerName; string m_NotificationWindowDescriptionLayerName; public NotificationWindowView() { } public void ShowDialog(string LayoutName, bool show) { hsCanvasSetLayerShow(LayoutName, show); } public void ToggleCheckbox() { hsCanvasToggleChange("Toggle_Notification_Window_Checkbox"); } public void DrawNotification(string title, string description, string ImageUrl, bool IsDisplay) { //layer mask pos Y float lmpy; if (!ImageUrl.IsEmpty()) { lmpy = 75.0; //画像あり m_NotificationWindowLayerName = "notification_window_with_image"; m_NotificationWindowDescriptionLayerName = "notification_window_with_image_description"; }else{ lmpy = -27.0; //画像なし m_NotificationWindowLayerName = "notification_window_with_no_image"; m_NotificationWindowDescriptionLayerName = "notification_window_with_no_image_description"; } hsCanvasSetLayerShow(m_NotificationWindowLayerName, true); hsCanvasSetLayerShow(m_NotificationWindowDescriptionLayerName, true); hsCanvasSetGUIText(m_NotificationWindowLayerName , "notification_title_text" , title); hsCanvasSetGUIText(m_NotificationWindowDescriptionLayerName , "notification_description_text" , description); if (!ImageUrl.IsEmpty()) { hsCanvasSetGUIImage(m_NotificationWindowLayerName , "notification_thumbnail" , ImageUrl); } //スクロール範囲の設定 { {//Landscape int fs = 12; //現状データを引っ張ってこれないので決め打ち(notification_description_textのフォントサイズ) int ls = 7; //現状データを引っ張ってこれないので決め打ち(notification_description_textのLineSpace) int cs = 0; //現状データを引っ張ってこれないので決め打ち(notification_description_textのCharaSpace) float w, h; system.Canvas_GetGUISize(m_NotificationWindowDescriptionLayerName, false, "notification_description_text", w, h); //行数計算用のデータを用意する JsVal val = makeJsObj(); val.AddProperty("data").SetType(JS_OBJ).AddProperty("w").SetNum(w); val.GetProperty("data").AddProperty("fs").SetNum(fs); val.GetProperty("data").AddProperty("ls").SetNum(ls); val.GetProperty("data").AddProperty("cs").SetNum(cs); val.GetProperty("data").AddProperty("str").SetStr(description); // 行数計算結果を受け取る float rh = _getSizeTextarea(val); // Notification画面の更新 AdaptTextAreaProperties(lmpy,rh, false); } {//Portrait int fs = 36; //現状データを引っ張ってこれないので決め打ち(notification_description_textのフォントサイズ) int ls = 21; //現状データを引っ張ってこれないので決め打ち(notification_description_textのLineSpace) int cs = 0; //現状データを引っ張ってこれないので決め打ち(notification_description_textのCharaSpace) float w, h; system.Canvas_GetGUISize(m_NotificationWindowDescriptionLayerName, true, "notification_description_text", w, h); //行数計算用のデータを用意する JsVal val = makeJsObj(); val.AddProperty("data").SetType(JS_OBJ).AddProperty("w").SetNum(w); val.GetProperty("data").AddProperty("fs").SetNum(fs); val.GetProperty("data").AddProperty("ls").SetNum(ls); val.GetProperty("data").AddProperty("cs").SetNum(cs); val.GetProperty("data").AddProperty("str").SetStr(description); // 行数計算結果を受け取る float rh = _getSizeTextarea(val); // Notification画面の更新 AdaptTextAreaProperties(lmpy,rh, true); } } } //一旦固定値を返す float _getSizeTextarea(JsVal val){ return 640; } void AdaptTextAreaProperties(float lmpy,float textAreaH, bool isPortrait){ //layer mask size H float lmsh = 145.0; //calc actual y float sety = 0; if(isPortrait){ lmpy *= 3; lmsh *= 3; } //change size float tasw,tash; system.Canvas_GetGUISize(m_NotificationWindowDescriptionLayerName,isPortrait,"notification_description_text",tasw,tash); tash = textAreaH; system.Canvas_SetGUISize(m_NotificationWindowDescriptionLayerName,isPortrait,"notification_description_text",tasw,tash); system.Canvas_SetGUISize(m_NotificationWindowDescriptionLayerName,isPortrait,"grab_bg",tasw,tash); //change pos float tapx,tapy; system.Canvas_GetGUIPos(m_NotificationWindowDescriptionLayerName,isPortrait,"notification_description_text",tapx,tapy); sety = (tash / 2.0) - ((lmsh / 2.0) - lmpy); tapy = sety; system.Canvas_SetGUIPos(m_NotificationWindowDescriptionLayerName,isPortrait,"notification_description_text",tapx,tapy); system.Canvas_SetGUIPos(m_NotificationWindowDescriptionLayerName,isPortrait,"grab_bg",tapx,tapy); } }