using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; using Microsoft.DirectX; using Microsoft.DirectX.Direct3D; using Rmake.Framework.Logging; using Rmake.Rendering.APIWrapper; using Rmake.Rendering.ComponentLayer; using Rmake.Model.Engine; using Rmake.API.Interfaces.UI; using Rmake.Model.Enums; using Rmake.API.Interfaces.Model; namespace Rmake.GameRendering { /// /// CharacterStatusView の概要の説明です。 /// public class CharacterStatusView : GameRenderingView, ICharacterStatusWindow { private IGame game = null; private ICharacter chara = null; private GameRenderingFactory factory = null; private WindowViewWrapper window = null; private ImageViewWrapper face = null; private TextWindowView nameText = null; private TextWindowView statusText = null; private TextWindowView equipmentText = null; private TextWindowView profileText = null; public CharacterStatusView(PlayingGame game, ICharacter chara, GameRenderingFactory factory) { try { this.game = game; this.chara = chara; this.factory = factory; // Define Texts String name = chara.Name + "(LV: " + chara.LV + ") " + Environment.NewLine + "HP: " + chara.HP + "/" + chara.CurrentStatus.MaxHP + " | " + "MP: " + chara.MP + "/" + chara.CurrentStatus.MaxMP; String status = "攻撃力 :" + chara.Status.Strength + "(" + chara.CurrentStatus.Strength + ")\n" + "防御力 :" + chara.Status.Defence + "(" + chara.CurrentStatus.Defence + ")\n" + "知力  :" + chara.Status.Intellect + "(" + chara.CurrentStatus.Intellect + ")\n" + "素早さ :" + chara.Status.Speed + "(" + chara.CurrentStatus.Speed + ")\n" + "経験値 :" + chara.Experience; String equipments = "武器  :" + "\n" + "盾   :" + "\n" + "鎧   :" + "\n" + "兜   :" + "\n" + "特殊  :" + "\n" + "特殊  :" + "\n"; // WindowViewWrapper の初期化 this.window = factory.CreateWindowViewWrapper( game.EditingGame.Materials.GetSystemImage(), false); window.Rect = new Rectangle(176, 64, 464, 416); // ImageViewWrapper String filename = Folders.GetMaterialFolder(MaterialTypes.FaceImage) + chara.FaceImage; this.face = factory.CreateImageViewWrapper(filename, false); face.SourceRectangle = new Rectangle(0, 0, 64, 64); face.DestinationPoint = new Point(192, 80); face.IsDependCamera = false; // nameText this.nameText = factory.CreateTextWindowView( game.EditingGame.Materials.GetSystemImage().GetFullName(), false); this.nameText.Rect = new Rectangle(256, 64, 384, 96); this.nameText.SetText(name); // statusText this.statusText = factory.CreateTextWindowView( game.EditingGame.Materials.GetSystemImage().GetFullName(), false); this.statusText.Rect = new Rectangle(176, 144, 288, 144); this.statusText.SetText(status); // equipmentText this.equipmentText = factory.CreateTextWindowView( game.EditingGame.Materials.GetSystemImage().GetFullName(), false); this.equipmentText.Rect = new Rectangle(176, 272, 288, 208); this.equipmentText.SetText(equipments); // profileText this.profileText = factory.CreateTextWindowView( game.EditingGame.Materials.GetSystemImage().GetFullName(), false); this.profileText.Rect = new Rectangle(448, 144, 192, 336); this.profileText.SetText(chara.Profile); } catch (Exception ex) { Logger.Fatal(ex); } } internal override void AddLayer(LayerView layer) { base.AddLayer(layer); } internal override void RemoveLayer(LayerView layer) { base.RemoveLayer(layer); } internal override int LayerIndex { get { return window.LayerIndex; } set { window.LayerIndex = value; face.LayerIndex = value + 1; nameText.LayerIndex = value + 1; statusText.LayerIndex = value + 2; equipmentText.LayerIndex = value + 2; profileText.LayerIndex = value + 1; } } internal override void Finalize(GameRenderingManager manager) { manager.DeleteRenderingView(window); manager.DeleteRenderingView(face); manager.DeleteRenderingView(nameText); manager.DeleteRenderingView(statusText); manager.DeleteRenderingView(equipmentText); manager.DeleteRenderingView(profileText); } internal override void SetVisible(bool visible) { window.Visible = visible; face.Visible = visible; nameText.Visible = visible; statusText.Visible = visible; equipmentText.Visible = visible; profileText.Visible = visible; } #region ICharacterStatusWindow メンバ public void Show() { Visible = true; } public void Close() { Visible = false; } #endregion } }