/** スプライトインデックス。計算。 */ public void CalcTextIndex(TextList a_textlist) { //リセット。 for (int ii = 0; ii < this.list.Length; ii++) { this.list[ii].ResetTextIndex(); } //テキスト。 { int t_calc_mode = 0; int t_calc_layer = 0; int t_calc_index = 0; LayerItem t_calc_layeritem = this.list[t_calc_layer]; while (t_calc_index < a_textlist.GetListMax()) { Fee.Render2D.Text2D t_text = a_textlist.GetItem(t_calc_index); int t_layerindex = this.CalcLayerIndexFromDrawPriority(t_text.GetDrawPriority()); if (t_calc_layer < this.list.Length) { if (t_calc_mode == 0) { //開始インデックス。 if (t_layerindex < 0) { //除外。 t_calc_index++; } else { if (t_calc_layer == t_layerindex) { //開始位置発見。 t_calc_layeritem.text_index_start = t_calc_index; t_calc_layeritem.text_index_last = t_calc_index; t_calc_index++; t_calc_mode = 1; } else { //再チェック。 t_calc_layeritem.text_index_start = -1; t_calc_layeritem.text_index_last = -1; t_calc_layer++; t_calc_layeritem = this.list[t_calc_layer]; t_calc_mode = 0; } } } else { //終了インデックス。 if (t_calc_layer == t_layerindex) { //終了インデックス候補。 t_calc_layeritem.text_index_last = t_calc_index; t_calc_index++; } else { //再チェック。 t_calc_layer++; t_calc_layeritem = this.list[t_calc_layer]; t_calc_mode = 0; } } } } } }
/** constructor */ public JsonViewer_Item(string a_label, JsonViewer a_viewer, int a_layer, Fee.JsonItem.JsonItem a_jsonitem) { //deleter this.deleter = new Fee.Deleter.Deleter(); //viewer this.viewer = a_viewer; //layer this.layer = a_layer; //jsonitem this.jsonitem = a_jsonitem; string t_text; UnityEngine.Color t_color = UnityEngine.Color.black; { if (a_jsonitem == null) { t_text = a_label; } else { //親がインデックス配列ならインデックス、連想配列ならキー名。 t_text = "label = " + a_label + "\n"; //データタイプ名。 t_text += a_jsonitem.GetValueType().ToString() + "\n"; //データ。 switch (a_jsonitem.GetValueType()) { case Fee.JsonItem.ValueType.AssociativeArray: { t_text += "count = " + a_jsonitem.GetListMax().ToString() + "\n"; t_color = new UnityEngine.Color(0.2f, 0.3f, 0.2f, 1.0f); } break; case Fee.JsonItem.ValueType.IndexArray: { t_text += "count = " + a_jsonitem.GetListMax().ToString() + "\n"; t_color = new UnityEngine.Color(0.4f, 0.2f, 0.5f, 1.0f); } break; case Fee.JsonItem.ValueType.BoolData: { t_text += "value = " + a_jsonitem.GetBoolData().ToString() + "\n"; t_color = new UnityEngine.Color(0.1f, 0.2f, 0.4f, 1.0f); } break; case Fee.JsonItem.ValueType.SignedNumber: { t_text += "value = " + a_jsonitem.GetSignedNumber().ToString() + "\n"; t_color = new UnityEngine.Color(0.5f, 0.2f, 0.8f, 1.0f); } break; case Fee.JsonItem.ValueType.UnsignedNumber: { t_text += "value = " + a_jsonitem.GetUnsignedNumber().ToString() + "\n"; t_color = new UnityEngine.Color(0.4f, 0.6f, 0.3f, 1.0f); } break; case Fee.JsonItem.ValueType.FloatingNumber: { t_text += "value = " + a_jsonitem.GetFloatingNumber().ToString() + "\n"; t_color = new UnityEngine.Color(0.2f, 0.2f, 0.5f, 1.0f); } break; case Fee.JsonItem.ValueType.DecimalNumber: { t_text += "value = " + a_jsonitem.GetDecimalNumber().ToString() + "\n"; t_color = new UnityEngine.Color(0.1f, 0.1f, 0.1f, 1.0f); } break; case Fee.JsonItem.ValueType.StringData: { t_text += "value = " + a_jsonitem.GetStringData() + "\n"; t_color = new UnityEngine.Color(0.5f, 0.2f, 0.2f, 1.0f); } break; } } } //text this.text = Fee.Render2D.Text2D.Create(this.deleter, 0); this.text.SetText(t_text); this.text.SetAlignmentType(Fee.Render2D.Text2D_HorizontalAlignmentType.Left, Fee.Render2D.Text2D_VerticalAlignmentType.Top); this.text.SetColor(in t_color); this.text.SetClip(true); this.text.SetVisible(false); //button this.button = Fee.Ui.Button.Create(this.deleter, 0); this.button.SetNormalTexture(UnityEngine.Texture2D.whiteTexture); this.button.SetOnTexture(UnityEngine.Texture2D.whiteTexture); this.button.SetDownTexture(UnityEngine.Texture2D.whiteTexture); this.button.SetLockTexture(UnityEngine.Texture2D.whiteTexture); this.button.SetNormalColor(0.8f, 0.8f, 0.8f, 1.0f); this.button.SetOnColor(0.7f, 0.7f, 0.7f, 1.0f); this.button.SetDownColor(0.6f, 0.6f, 0.6f, 1.0f); this.button.SetLockColor(0.5f, 0.5f, 0.5f, 1.0f); this.button.SetOnButtonClick(this, -1); this.button.SetClip(true); this.button.SetVisible(false); this.button.SetDragCancelFlag(true); }