//system.IsLangEN() // class ButtonNameTextJPEN{ public string jp;//日本語表記 public string en;//英語表記 public ButtonNameTextJPEN(){} } const string SAVED_EMOTE_INDICES="SavedEmoteIndices";//クッキー保存用の文字列(非サーバ用) ActionDataModel g_actionDataModel; component EmoteActionList { private string action_list_layer;//レイヤー名(エモートリスト) private string action_palette_layer; private const int emote_limit_count_by_a_page=12;//1ページに表示できるエモート数 private int currentPageNo_;//現在のページ番号 private list buttonNameText_;//ボタン名のリスト(日本語&英語) private list selectedEmoteIndices_;//パレット側のコピー:中身は現在のリスト全体のうちのインデックスでありIDではない事に注意 private string paletteClassName_; //コンストラクタ public EmoteActionList() { action_list_layer = "action_list"; action_palette_layer = "action_palette";//レイヤー名(エモートリスト) if(hsSystemIsVRMode()) action_palette_layer = "mainmenu_webxr"; // WebXRモード用のパレットレイヤー g_actionDataModel = new ActionDataModel(); currentPageNo_=0; buttonNameText_ = new list(emote_limit_count_by_a_page); paletteClassName_ = g_UseServerForEmote ? "ActionPaletteWithServer" : "ActionPalette"; InitDefaultButtonText(); RefreshActionToggle(); string ParamXShare = hsWebGetQueryParam("xshare"); bool IsXShare = (ParamXShare == "1"); // Xで開いているのでGUIをX用にリサイズする if(IsXShare) Resize(false); } //ボタンテキストをデフォルトで初期化 //何かしらの原因でサーバから情報を取得できなかったり、非サーバの時に使用される private void InitDefaultButtonText(){ selectedEmoteIndices_=new list(); for(int i=0;i emoteDataList=GetEmoteDataList();//palette.GetEmoteDataList(); if(emoteDataList===null){ // hsSystemOutputLog("emoteDataList is null\n"); return; } //else{ // hsSystemOutputLog("emoteDataList is not null\n"); // } if(count > emoteDataList.Count()){ return; } //固定エモートは無視する for(int i=0;i GetEmoteDataList(){ if(!g_UseServerForEmote){ return null; } return g_actionDataModel.GetEmoteDataList(); } private int GetEmoteDataListCount(){ LayerBundle layer = GetEmotePaletteLayer(); if(layer===null){ return 0; } Func func = system.Layer_GetComponentMethod< int >(layer.GetCurrent()._GetInstanceID(),paletteClassName_,"GetEmoteDataListCount"); if(func.IsEmpty()){ hsSystemOutputLog("エモートデータ数取得に失敗しました\n"); return 0; } return func(); } //インデックスからエモートIDを取得する //ありえないインデックスの場合は-1を返す private int GetIDFromIndex(int index){ if(!g_UseServerForEmote){//非サーバの時はインデックスと同一 return index; } list emoteList = GetEmoteDataList(); if(index<0 || emoteList.Count() emoteList=GetEmoteDataList(); for(int index=0;index func = system.Layer_GetComponentMethod< int >(layer.GetCurrent()._GetInstanceID(),paletteClassName_,"GetEmoteDataListCount"); if(func.IsEmpty()){ hsSystemOutputLog("エモートデータ数取得に失敗しました\n"); return 0; }else{ return func(); } } LayerBundle layer = GetEmotePaletteLayer(); Func func = system.Layer_GetComponentMethod< int >(layer.GetCurrent()._GetInstanceID(),paletteClassName_,"GetEmoteDataListCount"); if(func.IsEmpty()){ hsSystemOutputLog("エモートデータ数取得に失敗しました\n"); return 0; } return func(); } private int Max(int lval,int rval){ if(lval>rval){ return lval; } return rval; } //エモートのリストページサイズ private int GetPageSize(){ return Max((GetEmotesSize()-1),0)/emote_limit_count_by_a_page; } //代入されたページ番号でリスト表示を更新する private void RedrawCurrentPageList(){ ShowListButtonText(currentPageNo_); ShowListIcons(currentPageNo_); } //現在のページ番業を表示する private void ShowCurrentPageNo(){ string pageNo = "%d" % (currentPageNo_+1); hsCanvasSetGUIText(action_list_layer,"action_page_num",pageNo); } //現在のページ番号でリスト表示を更新する private void RefreshCurrentPage(){ ShowCurrentPageNo(); RedrawCurrentPageList(); ShowSelectedToggle(currentPageNo_); //使えないリストだけ暗くする AllEmoteEnabled(); DarkenDisableEmote(); } //右ページクリック public void OnRightPageClick(){ if(currentPageNo_0){ currentPageNo_--; } RefreshCurrentPage(); } //リスト内の指定インデックスに対して「緑ポチ」を着けたり外したりする //※入ってくるインデックスはあくまでもUI上のインデックスであることに注意 private void ToggleEmoteIndex(int index){ //もし現在ページのエモート数を超えていたら処理を行わない int emoteCountCurrentPage=GetEmoteCountInCurrentPage(); if(emoteCountCurrentPage<=index) { return; } list emoteIndices=selectedEmoteIndices_; if(emoteIndices===null){ return; } //ページ番号もなんもかんも計算に入れた実インデックスを計算 int trueIndex = index+emote_limit_count_by_a_page*currentPageNo_;//実インデックス int idx=emoteIndices.IndexOf(0,emoteIndices.Count(),trueIndex);//既にパレットに登録されていたら(選択済みなら) if(idx==-1){//非選択状態 if(emoteIndices.Count() GetEmoteIndices(){ if(g_UseServerForEmote){ LayerBundle layer = GetEmotePaletteLayer(); Func< list > delGetEmoteIdx = system.Layer_GetComponentMethod< list >(layer.GetCurrent()._GetInstanceID(),paletteClassName_,"GetEmoteIndicesOnActionPalette"); if(delGetEmoteIdx.IsEmpty()){ return null; }else{ list ret = delGetEmoteIdx(); return ret; } }else{ LayerBundle layer = GetEmotePaletteLayer(); Func< list > delGetEmoteIdx = system.Layer_GetComponentMethod< list >(layer.GetCurrent()._GetInstanceID(),paletteClassName_,"GetEmoteIndicesOnActionPalette"); if(delGetEmoteIdx.IsEmpty()){ return null; }else{ list ret = delGetEmoteIdx(); return ret; } } return null; } //エモートアイコンのパスリストを取得 //アイコンのパスをリストで受け取る。非サーバ版は相対パス、サーバ版はURLが入っている //非サーバ版との互換性のためにあるようなもの private list GetEmoteIconPaths(){ if(g_UseServerForEmote){ LayerBundle layer = GetEmotePaletteLayer(); Func< list > func = system.Layer_GetComponentMethod< list >(layer.GetCurrent()._GetInstanceID(),paletteClassName_,"GetEmoteIconPathTable"); if(func.IsEmpty()){ hsSystemOutputLog("アイコンパスリスト取得に失敗しました\n"); return null; }else{ return func(); } }else{ LayerBundle layer = GetEmotePaletteLayer(); Func< list > func = system.Layer_GetComponentMethod< list >(layer.GetCurrent()._GetInstanceID(),paletteClassName_,"GetEmoteIconPathTable"); if(func.IsEmpty()){ hsSystemOutputLog("アイコンパスリスト取得に失敗しました\n"); return null; }else{ return func(); } } return null; } ///指定したインデックスが選択済みのものであるか? private bool IsSelectedIndex(int idx){ for(int i=0;i func = system.Layer_GetComponentMethod(layer.GetCurrent()._GetInstanceID(),paletteClassName_,"GetEmoteDataListCount"); if(func.IsEmpty()){ return 0; } int count = func(); int offset=currentPageNo_ *emote_limit_count_by_a_page; count = (count - offset); count = count > emote_limit_count_by_a_page ? emote_limit_count_by_a_page : count; return count; } //現在のページ番号に合わせて緑ポチを表示する private void ShowSelectedToggle(int pageNo){ //selectedEmoteIndices_内のインデックスを回しつつ、 //そのインデックスと合致するものをリストから探す //リストから探す方法だが、現在のページ番号でリスト番号が異なるためそことの整合性を //図りつつループを回す。どちらかが尽きたらループを抜ける //一旦全部の選択を初期化 for(int i=0;i emote_limit_count_by_a_page ? emote_limit_count_by_a_page : count; for(int i=0;i emoteIndices = GetEmoteIndices();//actionPalette.GetEmoteIndicesToActionPalette(); if(emoteIndices===null){ return; } int emoteIdxCount = emoteIndices.Count(); for(int i=0;i emoteDataList = GetEmoteDataList(); buttonNameText_.Clear(); if(emoteDataList===null){ hsSystemOutputLog("EmoteDataList is null button name text initialize failed\n"); return; } int count = emoteDataList.Count(); buttonNameText_.Resize(count); for(int i=0;i emoteIconPathTable=GetEmoteIconPaths(); int offset = emote_limit_count_by_a_page*pageNo; int count = emoteIconPathTable.Count(); count = count - offset; for(int i=0;i emoteIndices){ LayerBundle layer = GetEmotePaletteLayer(); Func > delSetEmoteIdx = system.Layer_GetComponentMethod >(layer.GetCurrent()._GetInstanceID(),paletteClassName_,"SetEmoteIndicesOnActionPalette"); if(delSetEmoteIdx.IsEmpty()){ return ; }else{ delSetEmoteIdx(emoteIndices); } } //サーバ版のエモートパレットに選択済みのインデックスを書き込む private void SetEmoteIndicesWithServer(list emoteIndices){ LayerBundle layer = GetEmotePaletteLayer(); Func > delSetEmoteIdx = system.Layer_GetComponentMethod >(layer.GetCurrent()._GetInstanceID(),paletteClassName_,"SetEmoteIndicesOnActionPalette"); if(delSetEmoteIdx.IsEmpty()){ return ; }else{ delSetEmoteIdx(emoteIndices); } } //アクションパレットの更新を行う(サーバ版) public void RefreshActionPaletteWithServer(){ SetEmoteIndicesWithServer(selectedEmoteIndices_); // emoteIndices.Clear(); // emoteIndices.Resize(selectedEmoteIndices_.Count()); // emoteIndices.CopyFrom(0,selectedEmoteIndices_,0,selectedEmoteIndices_.Count()); LayerBundle layer = GetEmotePaletteLayer(); layer.CallComponentMethod(paletteClassName_, "OnShowActionPalette", ""); //actionPalette.OnShowActionPalette(); } //現在の選択済みエモート(緑ポチ)をクッキーに保存する private void SaveEmoteIndices(){ list emoteIndices = GetEmoteIndices();//actionPalette.GetEmoteIndicesToActionPalette(); if(emoteIndices===null){ return; } list emoteIconPathTable=GetEmoteIconPaths(); if(emoteIconPathTable===null){ return; } string strIndices=""; for(int i=0 ; i