/*------------------------------------------------------------------------- * 海域名描画 * ---------------------------------------------------------------------------*/ private void draw_seaname_proc(Vector2 offset, LoopXImage image) { d3d_sprite_rects.rect _rect = m_lib.seainfonameimage.GetWindArrowIcon(); int color1 = (m_world.Season.now_season == gvo_season.season.summer)? -1: (96 << (8 * 3)) | 0x00ffffff; int color2 = (m_world.Season.now_season == gvo_season.season.winter)? -1: (96 << (8 * 3)) | 0x00ffffff; int index = 0; foreach (GvoWorldInfo.Info i in m_world.Seas) { Vector2 p = image.GlobalPos2LocalPos(transform.ToVector2(i.position), offset); // 海域名 m_lib.device.sprites.AddDrawSprites(new Vector3(p.X - 6, p.Y, 0.3f), m_lib.seainfonameimage.GetRect(index)); index++; // 風向き描画 if (i.SeaInfo == null) { continue; } p.X += i.SeaInfo.WindPos.X - i.position.X; p.Y += i.SeaInfo.WindPos.Y - i.position.Y; m_lib.device.sprites.AddDrawSpritesNC(new Vector3(p.X - 6, p.Y, 0.3f), _rect, i.SeaInfo.SummerAngle, color1); m_lib.device.sprites.AddDrawSpritesNC(new Vector3(p.X + 6, p.Y, 0.3f), _rect, i.SeaInfo.WinterAngle, color2); } }
private void draw_seaicon_proc(Vector2 offset, LoopXImage image) { if (m_lib.setting.map_draw_names == MapDrawNames.Hide) { return; } d3d_sprite_rects.rect _rect = m_lib.icons.GetIcon(icons.icon_index.wind_arrow); int index = 0; foreach (GvoWorldInfo.Info i in m_world.Seas) { // 풍향그리기 if (i.SeaInfo == null) { continue; } Vector2 p = image.GlobalPos2LocalPos(transform.ToVector2(i.position), offset); if (m_world.Season.now_season == gvo_season.season.summer) { m_lib.device.sprites.AddDrawSpritesNC(new Vector3(p.X - 3 - 1, p.Y + 3 + 1, 0.3f), _rect, i.SeaInfo.SummerAngle, -1); } else { m_lib.device.sprites.AddDrawSpritesNC(new Vector3(p.X - 3 - 1, p.Y + 3 + 1, 0.3f), _rect, i.SeaInfo.WinterAngle, -1); } index++; } }
/*------------------------------------------------------------------------- * 현재위치の그리기 * ついでに拡縮率も描く * ---------------------------------------------------------------------------*/ private void draw_gpos() { hittest ht = m_windows[(int)window_index.position]; Vector3 pos = new Vector3(ht.rect.X, ht.rect.Y, 0.1f); Vector2 size = new Vector2(ht.rect.Width, ht.rect.Height); m_lib.device.DrawFillRect(pos, size, m_back_color.ToArgb()); m_lib.device.DrawLineRect(pos, size, Color.Black.ToArgb()); int pos_y = (int)pos.Y + 2 + 1; // 拡縮率 배율 int scale = (int)Math.Round((double)m_lib.loop_image.ImageScale * 100); m_lib.device.systemfont.DrawTextR(String.Format("{0}%", scale), (int)pos.X + 75 + OFFSET_X, pos_y, Color.White); // 季節 m_lib.device.sprites.AddDrawSpritesNC(new Vector3(pos.X + 6, pos_y, 0.1f), m_lib.icons.GetIcon(icons.icon_index.string04)); // 지도 pos_y += 14 - 1; m_lib.device.sprites.AddDrawSpritesNC(new Vector3(pos.X + 6, pos_y, 0.1f), m_lib.icons.GetIcon(icons.icon_index.string03)); // 季節 d3d_sprite_rects.rect _rect = m_lib.icons.GetIcon((m_db.GvoSeason.now_season == gvo_season.season.summer) ? icons.icon_index.string06 : icons.icon_index.string05); m_lib.device.sprites.AddDrawSpritesNC(new Vector3(pos.X + 75 + OFFSET_X - 12, pos_y, 0.1f), _rect); // 본인の배の위치 pos_y += 14 - 1; string my_pos = "--- , ---"; Point tmp_p = game_pos_2_map_pos_for_debug(m_myship_info.pos); if (m_myship_info.is_analized_pos) { my_pos = String.Format("{0} , {1}", tmp_p.X, tmp_p.Y); } m_lib.device.systemfont.DrawTextR(my_pos, (int)pos.X + 75 + OFFSET_X, pos_y, Color.White); // 좌클릭した위치 pos_y += 14 - 1; tmp_p = game_pos_2_map_pos_for_debug(m_select_pos); m_lib.device.systemfont.DrawTextR(String.Format("{0} , {1}", tmp_p.X, tmp_p.Y), (int)pos.X + 75 + OFFSET_X, pos_y, Color.White); // 현재の마우스위치 pos_y += 14 - 1; Point gpos = transform.client_pos2_game_pos(m_mouse_pos, m_lib.loop_image); tmp_p = game_pos_2_map_pos_for_debug(gpos); m_lib.device.systemfont.DrawTextR(String.Format("{0} , {1}", tmp_p.X, tmp_p.Y), (int)pos.X + 75 + OFFSET_X, pos_y, Color.White); { // 좌클릭した위치にクロスカーソルの표시 // 지도좌표に변환 Vector2 p = m_lib.loop_image.GlobalPos2LocalPos(transform.game_pos2_map_pos(transform.ToVector2(m_select_pos), m_lib.loop_image)); // ループを考慮する p = m_lib.loop_image.AjustLocalPos(p); m_lib.device.sprites.AddDrawSpritesNC(new Vector3(p.X, p.Y, 0.3f), m_lib.icons.GetIcon(icons.icon_index.select_cross)); } }
/*------------------------------------------------------------------------- * 해역명と풍향のバッファ작성 * ---------------------------------------------------------------------------*/ private void create_sea_buffer() { m_sea_icons1_vb = create_buffer(m_world.Seas.Count * 3); m_sea_icons2_vb = create_buffer(m_world.Seas.Count * 3); m_sea_names_vb = create_buffer(m_world.Seas.Count * 3); sprite_vertex[] vbo1 = new sprite_vertex[(m_world.Seas.Count * 3) * 4]; sprite_vertex[] vbo2 = new sprite_vertex[(m_world.Seas.Count * 3) * 4]; sprite_vertex[] vbo3 = new sprite_vertex[(m_world.Seas.Count * 3) * 4]; int index = 0; float scale = this.GetDpiScaleRatio(); int diff = (int)(3 * scale); foreach (GvoWorldInfo.Info i in m_world.Seas) { // 문자 위치 var pos = new Point(i.position.X, i.position.Y); set_vbo(ref vbo3, index, pos, new Point(diff, -diff), m_lib.nameTexture.getRect(i.Name), i.angle, -1); index++; } d3d_sprite_rects.rect windRect = m_lib.icons.GetIcon(icons.icon_index.wind_arrow); foreach (GvoWorldInfo.Info i in m_world.Seas) { // 풍향 if (i.SeaInfo != null) { Point pos = new Point(i.position.X - 1, i.position.Y + 1); // 夏 set_vbo(ref vbo1, index, pos, new Point(-diff, diff), windRect, i.SeaInfo.SummerAngle, -1); index++; // 冬 set_vbo(ref vbo2, index, pos, new Point(-diff, diff), windRect, i.SeaInfo.WinterAngle, -1); index++; } } // 頂点を전送 m_sea_icons1_vb.SetData <sprite_vertex>(vbo1); m_sea_icons2_vb.SetData <sprite_vertex>(vbo2); m_sea_names_vb.SetData <sprite_vertex>(vbo3); }
/*------------------------------------------------------------------------- * 頂点情報を設定する * 1つのスプライト分 * 回転指定 * ---------------------------------------------------------------------------*/ private void set_vbo(ref sprite_vertex[] tbl, int index, Point position, Point offset, d3d_sprite_rects.rect _rect, float angle_rad, int color) { if (_rect == null) { return; } Vector3 pos = new Vector3(position.X, position.Y, 0.3f); Vector3 param = new Vector3(1, 1, angle_rad); Vector2 offset2 = new Vector2(offset.X, offset.Y); index *= 4; for (int i = 0; i < 4; i++) { tbl[index + i].color = color; tbl[index + i].Position = pos; tbl[index + i].offset1 = _rect.offset[i]; tbl[index + i].offset2 = offset2; tbl[index + i].param = param; tbl[index + i].uv = _rect.uv[i]; } }
/*------------------------------------------------------------------------- * 頂点情報を設定する * 1つのスプライト分 * ---------------------------------------------------------------------------*/ private void set_vbo(ref sprite_vertex[] tbl, int index, Point position, Point offset, d3d_sprite_rects.rect _rect, int color) { set_vbo(ref tbl, index, position, offset, _rect, 0f, color); }