From 6d244bb77be713f9d98f09bc43f1855747133b93 Mon Sep 17 00:00:00 2001 From: milimoe Date: Sat, 21 Sep 2024 01:31:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=BA=E5=AE=9E=E4=BD=93=E7=BC=96=E5=8F=B7?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=9E=9A=E4=B8=BE=EF=BC=9B=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=AE=9E=E4=BD=93=E5=88=9B=E5=BB=BA=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Desktop/FunGame.Testing.Desktop.csproj | 9 + Desktop/Solutions/EntityCreator.cs | 388 ------------- .../{ => EntityCreator}/CharacterCreator.cs | 14 +- .../EntityCreator/CreateCharacter.Designer.cs | 539 ++++++++++++++++++ .../EntityCreator/CreateCharacter.cs | 205 +++++++ .../CreateCharacter.resx} | 0 .../EntityCreator/CreateItem.Designer.cs | 391 +++++++++++++ Desktop/Solutions/EntityCreator/CreateItem.cs | 199 +++++++ .../CreateItem.resx} | 0 .../EntityCreator/CreateSkill.Designer.cs | 171 ++++++ .../Solutions/EntityCreator/CreateSkill.cs | 104 ++++ .../CreateSkill.resx} | 0 .../EntityCreator.Designer.cs | 71 ++- .../Solutions/EntityCreator/EntityCreator.cs | 440 ++++++++++++++ .../EntityCreator/EntityCreator.resx | 120 ++++ .../{ => EntityCreator}/ItemCreator.cs | 10 +- .../EntityCreator/ShowDetail.Designer.cs | 130 +++++ Desktop/Solutions/EntityCreator/ShowDetail.cs | 199 +++++++ .../Solutions/EntityCreator/ShowDetail.resx | 120 ++++ .../ShowList.Designer.cs} | 7 +- .../ShowList.cs} | 5 +- Desktop/Solutions/EntityCreator/ShowList.resx | 120 ++++ .../{ => EntityCreator}/SkillCreator.cs | 10 +- Desktop/Solutions/ShowDetail.Designer.cs | 59 -- Desktop/Solutions/ShowDetail.cs | 15 - Library/Effects/ItemEffects/冷却缩减加成.cs | 6 +- .../Effects/ItemEffects/技能硬直时间减少.cs | 6 +- Library/Effects/ItemEffects/攻击力加成.cs | 6 +- .../Effects/ItemEffects/普攻硬直时间减少.cs | 6 +- Library/Effects/ItemEffects/物理护甲加成.cs | 6 +- Library/Items/Accessory/攻击之爪.cs | 11 +- Library/Items/ItemID.cs | 9 + Library/Skills/ColdBlue/嗜血本能.cs | 4 +- Library/Skills/ColdBlue/累积之压.cs | 4 +- Library/Skills/Mayor/精准打击.cs | 4 +- Library/Skills/Mayor/致命打击.cs | 4 +- Library/Skills/NanGanyu/三重叠加.cs | 4 +- Library/Skills/NanGanyu/灵能反射.cs | 4 +- Library/Skills/NiuNan/变幻之心.cs | 4 +- Library/Skills/NiuNan/智慧与力量.cs | 4 +- Library/Skills/Oshima/META马.cs | 4 +- Library/Skills/Oshima/力量爆发.cs | 4 +- Library/Skills/QWQAQW/玻璃大炮.cs | 4 +- Library/Skills/QWQAQW/迅捷之势.cs | 4 +- Library/Skills/QingXiang/枯竭打击.cs | 4 +- Library/Skills/QingXiang/能量毁灭.cs | 4 +- Library/Skills/QuDuoduo/弱者猎手.cs | 4 +- Library/Skills/QuDuoduo/血之狂欢.cs | 4 +- Library/Skills/SkillID.cs | 54 ++ Library/Skills/XinYin/天赐之力.cs | 4 +- Library/Skills/XinYin/心灵之火.cs | 4 +- Library/Skills/Yang/魔法涌流.cs | 4 +- Library/Skills/Yang/魔法震荡.cs | 4 +- Library/Skills/战技/疾风步.cs | 4 +- Library/Skills/绿拱门/平衡强化.cs | 4 +- Library/Skills/绿拱门/敏捷之刃.cs | 4 +- Library/Skills/马猴烧酒/毁灭之势.cs | 4 +- Library/Skills/马猴烧酒/绝对领域.cs | 4 +- Library/Skills/魔法/冰霜攻击.cs | 4 +- Library/Solutions/TestModule.cs | 169 ++++-- Library/Solutions/TestPlugin.cs | 2 + Library/Tests/FunGame.cs | 4 +- 62 files changed, 3101 insertions(+), 608 deletions(-) delete mode 100644 Desktop/Solutions/EntityCreator.cs rename Desktop/Solutions/{ => EntityCreator}/CharacterCreator.cs (64%) create mode 100644 Desktop/Solutions/EntityCreator/CreateCharacter.Designer.cs create mode 100644 Desktop/Solutions/EntityCreator/CreateCharacter.cs rename Desktop/Solutions/{EntityCreator.resx => EntityCreator/CreateCharacter.resx} (100%) create mode 100644 Desktop/Solutions/EntityCreator/CreateItem.Designer.cs create mode 100644 Desktop/Solutions/EntityCreator/CreateItem.cs rename Desktop/Solutions/{ShowDetail.resx => EntityCreator/CreateItem.resx} (100%) create mode 100644 Desktop/Solutions/EntityCreator/CreateSkill.Designer.cs create mode 100644 Desktop/Solutions/EntityCreator/CreateSkill.cs rename Desktop/Solutions/{Showlist.resx => EntityCreator/CreateSkill.resx} (100%) rename Desktop/Solutions/{ => EntityCreator}/EntityCreator.Designer.cs (82%) create mode 100644 Desktop/Solutions/EntityCreator/EntityCreator.cs create mode 100644 Desktop/Solutions/EntityCreator/EntityCreator.resx rename Desktop/Solutions/{ => EntityCreator}/ItemCreator.cs (71%) create mode 100644 Desktop/Solutions/EntityCreator/ShowDetail.Designer.cs create mode 100644 Desktop/Solutions/EntityCreator/ShowDetail.cs create mode 100644 Desktop/Solutions/EntityCreator/ShowDetail.resx rename Desktop/Solutions/{Showlist.Designer.cs => EntityCreator/ShowList.Designer.cs} (92%) rename Desktop/Solutions/{Showlist.cs => EntityCreator/ShowList.cs} (82%) create mode 100644 Desktop/Solutions/EntityCreator/ShowList.resx rename Desktop/Solutions/{ => EntityCreator}/SkillCreator.cs (71%) delete mode 100644 Desktop/Solutions/ShowDetail.Designer.cs delete mode 100644 Desktop/Solutions/ShowDetail.cs create mode 100644 Library/Items/ItemID.cs create mode 100644 Library/Skills/SkillID.cs diff --git a/Desktop/FunGame.Testing.Desktop.csproj b/Desktop/FunGame.Testing.Desktop.csproj index c224fef..e632b8e 100644 --- a/Desktop/FunGame.Testing.Desktop.csproj +++ b/Desktop/FunGame.Testing.Desktop.csproj @@ -24,4 +24,13 @@ + + + Form + + + Form + + + \ No newline at end of file diff --git a/Desktop/Solutions/EntityCreator.cs b/Desktop/Solutions/EntityCreator.cs deleted file mode 100644 index 883ddd3..0000000 --- a/Desktop/Solutions/EntityCreator.cs +++ /dev/null @@ -1,388 +0,0 @@ -using Microsoft.VisualBasic; -using Milimoe.FunGame.Core.Api.Utility; -using Milimoe.FunGame.Core.Entity; -using Milimoe.FunGame.Core.Interface.Entity; -using Milimoe.FunGame.Core.Library.Common.Addon; -using Milimoe.FunGame.Core.Library.Constant; - -namespace Milimoe.FunGame.Testing.Desktop.Solutions -{ - public partial class EntityCreator : Form - { - private CharacterCreator CharacterCreator { get; } = new(); - private SkillCreator SkillCreator { get; } = new(); - private ItemCreator ItemCreator { get; } = new(); - private GameModuleLoader GameModuleLoader { get; } - private bool CheckSelectedIndex => 实际列表.SelectedIndex != -1 && 实际列表.SelectedIndex < 实际列表.Items.Count; - private int nowClick = 0; - - public EntityCreator() - { - InitializeComponent(); - GameModuleLoader = LoadModules(); - CharacterCreator.Load(); - SkillCreator.Load(); - ItemCreator.Load(); - 查看现有技能方法(); - 查看现有物品方法(); - 查看现有角色方法(); - } - - private void 查看现有角色方法() - { - 实际列表.Items.Clear(); - foreach (string name in CharacterCreator.LoadedCharacters.Keys) - { - 实际列表.Items.Add(CharacterCreator.LoadedCharacters[name]); - } - nowClick = 0; - } - - private void 查看现有技能方法() - { - 实际列表.Items.Clear(); - foreach (string name in SkillCreator.LoadedSkills.Keys) - { - 实际列表.Items.Add(SkillCreator.LoadedSkills[name].GetIdName()); - } - nowClick = 1; - } - - private void 查看现有物品方法() - { - 实际列表.Items.Clear(); - foreach (string name in ItemCreator.LoadedItems.Keys) - { - 实际列表.Items.Add(ItemCreator.LoadedItems[name].GetIdName()); - } - nowClick = 2; - } - - private void 查看现有角色_Click(object sender, EventArgs e) - { - if (nowClick != 0) - { - 查看现有角色方法(); - } - } - - private void 查看现有技能_Click(object sender, EventArgs e) - { - if (nowClick != 1) - { - 查看现有技能方法(); - } - } - - private void 查看现有物品_Click(object sender, EventArgs e) - { - if (nowClick != 2) - { - 查看现有物品方法(); - } - } - - private void 全部保存_Click(object sender, EventArgs e) - { - CharacterCreator.Save(); - SkillCreator.Save(); - ItemCreator.Save(); - MessageBox.Show("保存成功!"); - } - - private void 保存角色_Click(object sender, EventArgs e) - { - CharacterCreator.Save(); - MessageBox.Show("保存成功!"); - } - - private void 保存技能_Click(object sender, EventArgs e) - { - SkillCreator.Save(); - MessageBox.Show("保存成功!"); - } - - private void 保存物品_Click(object sender, EventArgs e) - { - ItemCreator.Save(); - MessageBox.Show("保存成功!"); - } - - private Skill? 从模组加载器中获取技能(long id, string name) - { - foreach (SkillModule module in GameModuleLoader.Skills.Values) - { - Skill? s = module.GetSkill(id, name); - if (s != null) - { - return s; - } - } - return null; - } - - private Item? 从模组加载器中获取物品(long id, string name) - { - foreach (ItemModule module in GameModuleLoader.Items.Values) - { - Item? i = module.GetItem(id, name); - if (i != null) - { - return i; - } - } - return null; - } - - private void 实际列表_MouseDoubleClick(object sender, EventArgs e) - { - if (CheckSelectedIndex) - { - ShowDetail d = new(); - switch (nowClick) - { - case 0: - d.SetText(CharacterCreator.LoadedCharacters.Values.Where(c => c.ToString() == 实际列表.Items[实际列表.SelectedIndex].ToString()).FirstOrDefault()?.GetInfo() ?? ""); - d.ShowDialog(); - break; - case 1: - Skill? s = SkillCreator.LoadedSkills.Values.Where(c => c.GetIdName() == 实际列表.Items[实际列表.SelectedIndex].ToString()).FirstOrDefault(); - if (s != null) - { - s = 从模组加载器中获取技能(s.Id, s.Name); - if (s != null) - { - d.SetText(s.ToString() ?? ""); - d.ShowDialog(); - } - } - break; - case 2: - Item? i = ItemCreator.LoadedItems.Values.Where(c => c.GetIdName() == 实际列表.Items[实际列表.SelectedIndex].ToString()).FirstOrDefault(); - if (i != null) - { - i = 从模组加载器中获取物品(i.Id, i.Name); - if (i != null) - { - d.SetText(i.ToString() ?? ""); - d.ShowDialog(); - } - } - break; - default: - break; - } - d.Dispose(); - } - } - - private void 为角色添加技能_Click(object sender, EventArgs e) - { - if (CheckSelectedIndex && nowClick == 0) - { - if (SkillCreator.LoadedSkills.Count != 0) - { - Showlist l = new(); - l.AddListItem(SkillCreator.LoadedSkills.Values.Select(s => s.GetIdName()).ToArray()); - l.ShowDialog(); - string selected = l.SelectItem; - Character? c = CharacterCreator.LoadedCharacters.Values.Where(c => c.ToString() == 实际列表.Items[实际列表.SelectedIndex].ToString()).FirstOrDefault(); - Skill? s = SkillCreator.LoadedSkills.Values.Where(s => s.GetIdName() == selected).FirstOrDefault(); - if (c != null && s != null) - { - s = 从模组加载器中获取技能(s.Id, s.Name); - if (s != null) c.Skills.Add(s); - } - } - else - { - MessageBox.Show("技能列表为空!"); - } - } - } - - private void 为角色添加物品_Click(object sender, EventArgs e) - { - if (CheckSelectedIndex && nowClick == 0) - { - if (ItemCreator.LoadedItems.Count != 0) - { - Showlist l = new(); - l.AddListItem(ItemCreator.LoadedItems.Values.Select(i => i.GetIdName()).ToArray()); - l.ShowDialog(); - string selected = l.SelectItem; - Character? c = CharacterCreator.LoadedCharacters.Values.Where(c => c.ToString() == 实际列表.Items[实际列表.SelectedIndex].ToString()).FirstOrDefault(); - Item? i = ItemCreator.LoadedItems.Values.Where(i => i.GetIdName() == selected).FirstOrDefault(); - if (c != null && i != null) - { - i = 从模组加载器中获取物品(i.Id, i.Name); - if (i != null) c.Items.Add(i); - } - } - else - { - MessageBox.Show("物品列表为空!"); - } - } - } - - private void 创建角色_Click(object sender, EventArgs e) - { - Character c = Factory.GetCharacter(); - c.Name = Interaction.InputBox("输入姓", "姓", ""); - c.FirstName = Interaction.InputBox("输入名", "名", ""); - c.NickName = Interaction.InputBox("输入昵称", "昵称", ""); - - string primaryAttributeInput = Interaction.InputBox("输入核心属性 (STR, AGI, INT)", "核心属性", "None"); - c.PrimaryAttribute = Enum.TryParse(primaryAttributeInput, out PrimaryAttribute primaryAttribute) ? primaryAttribute : PrimaryAttribute.None; - - // 解析 double 类型的输入 - c.InitialATK = double.Parse(Interaction.InputBox("输入初始攻击力", "初始攻击力", "0.0")); - c.InitialHP = double.Parse(Interaction.InputBox("输入初始生命值", "初始生命值", "1.0")); - c.InitialMP = double.Parse(Interaction.InputBox("输入初始魔法值", "初始魔法值", "0.0")); - c.InitialSTR = double.Parse(Interaction.InputBox("输入初始力量", "初始力量", "0.0")); - c.STRGrowth = double.Parse(Interaction.InputBox("输入力量成长", "力量成长", "0.0")); - c.InitialAGI = double.Parse(Interaction.InputBox("输入初始敏捷", "初始敏捷", "0.0")); - c.AGIGrowth = double.Parse(Interaction.InputBox("输入敏捷成长", "敏捷成长", "0.0")); - c.InitialINT = double.Parse(Interaction.InputBox("输入初始智力", "初始智力", "0.0")); - c.INTGrowth = double.Parse(Interaction.InputBox("输入智力成长", "智力成长", "0.0")); - c.InitialSPD = double.Parse(Interaction.InputBox("输入初始行动速度", "初始行动速度", "0.0")); - c.InitialHR = double.Parse(Interaction.InputBox("输入初始生命回复", "初始生命回复", "0.0")); - c.InitialMR = double.Parse(Interaction.InputBox("输入初始魔法回复", "初始魔法回复", "0.0")); - - string name = Interaction.InputBox("输入角色代号以确认创建", "角色代号", ""); - if (name != "" && c.Name != "" && CharacterCreator.Add(name, c)) - { - MessageBox.Show("创建成功!"); - 查看现有角色方法(); - ShowDetail d = new(); - d.SetText(c.GetInfo()); - d.ShowDialog(); - d.Dispose(); - } - else - { - MessageBox.Show("创建已取消。"); - } - } - - private void 创建技能_Click(object sender, EventArgs e) - { - Skill s = Factory.GetSkill(); - s.Id = long.Parse(Interaction.InputBox("输入技能编号", "技能编号", "0")); - s.Name = Interaction.InputBox("输入技能名称", "技能名称", ""); - - string name = Interaction.InputBox("输入技能代号以确认创建", "技能代号", ""); - if (name != "" && s.Id != 0 && s.Name != "" && SkillCreator.Add(name, s)) - { - MessageBox.Show("创建成功!"); - 查看现有技能方法(); - ShowDetail d = new(); - d.SetText(s.ToString()); - d.ShowDialog(); - d.Dispose(); - } - else - { - MessageBox.Show("创建已取消。"); - } - } - - private void 创建物品_Click(object sender, EventArgs e) - { - Item i = Factory.GetItem(); - i.Id = long.Parse(Interaction.InputBox("输入物品编号", "物品编号", "0")); - i.Name = Interaction.InputBox("输入物品名称", "物品名称", ""); - - string name = Interaction.InputBox("输入物品代号以确认创建", "物品代号", ""); - if (name != "" && i.Id != 0 && i.Name != "" && ItemCreator.Add(name, i)) - { - MessageBox.Show("创建成功!"); - 查看现有物品方法(); - ShowDetail d = new(); - d.SetText(i.ToString()); - d.ShowDialog(); - d.Dispose(); - } - else - { - MessageBox.Show("创建已取消。"); - } - } - - private void 删除角色_Click(object sender, EventArgs e) - { - if (CheckSelectedIndex && MessageBox.Show("是否删除", "删除", MessageBoxButtons.YesNo) == DialogResult.Yes) - { - string name = CharacterCreator.LoadedCharacters.Where(ky => ky.Value.ToString() == 实际列表.Items[实际列表.SelectedIndex].ToString()).FirstOrDefault().Key ?? ""; - if (CharacterCreator.Remove(name)) - { - MessageBox.Show("删除成功!"); - 查看现有角色方法(); - } - else - { - MessageBox.Show("删除失败!"); - } - } - } - - private void 删除技能_Click(object sender, EventArgs e) - { - if (CheckSelectedIndex && MessageBox.Show("是否删除", "删除", MessageBoxButtons.YesNo) == DialogResult.Yes) - { - string name = SkillCreator.LoadedSkills.Where(ky => ky.Value.GetIdName() == 实际列表.Items[实际列表.SelectedIndex].ToString()).FirstOrDefault().Key ?? ""; - if (SkillCreator.Remove(name)) - { - MessageBox.Show("删除成功!"); - 查看现有技能方法(); - } - else - { - MessageBox.Show("删除失败!"); - } - } - } - - private void 删除物品_Click(object sender, EventArgs e) - { - if (CheckSelectedIndex && MessageBox.Show("是否删除", "删除", MessageBoxButtons.YesNo) == DialogResult.Yes) - { - string name = ItemCreator.LoadedItems.Where(ky => ky.Value.GetIdName() == 实际列表.Items[实际列表.SelectedIndex].ToString()).FirstOrDefault().Key ?? ""; - if (ItemCreator.Remove(name)) - { - MessageBox.Show("删除成功!"); - 查看现有物品方法(); - } - else - { - MessageBox.Show("删除失败!"); - } - } - } - - private void 重新读取全部_Click(object sender, EventArgs e) - { - if (MessageBox.Show("重新读取会丢失未保存的数据,是否确认重新读取全部?", "重新读取全部", MessageBoxButtons.YesNo) == DialogResult.Yes) - { - CharacterCreator.Load(); - SkillCreator.Load(); - ItemCreator.Load(); - 查看现有技能方法(); - 查看现有物品方法(); - 查看现有角色方法(); - } - } - - private static GameModuleLoader LoadModules() - { - PluginLoader plugins = PluginLoader.LoadPlugins([]); - foreach (string plugin in plugins.Plugins.Keys) - { - Console.WriteLine(plugin + " is loaded."); - } - - return GameModuleLoader.LoadGameModules(FunGameInfo.FunGame.FunGame_Desktop, []); - } - } -} diff --git a/Desktop/Solutions/CharacterCreator.cs b/Desktop/Solutions/EntityCreator/CharacterCreator.cs similarity index 64% rename from Desktop/Solutions/CharacterCreator.cs rename to Desktop/Solutions/EntityCreator/CharacterCreator.cs index 651607f..11ed26e 100644 --- a/Desktop/Solutions/CharacterCreator.cs +++ b/Desktop/Solutions/EntityCreator/CharacterCreator.cs @@ -9,9 +9,13 @@ namespace Milimoe.FunGame.Testing.Desktop.Solutions public void Load() { - EntityModuleConfig config = new("redbud.fun.entitycreator", "charactercreator"); + EntityModuleConfig config = new("EntityCreator", "character.creator"); config.LoadConfig(); LoadedCharacters = new(config); + foreach (Character c in LoadedCharacters.Values) + { + c.Recovery(); + } } public bool Add(string name, Character character) @@ -26,12 +30,18 @@ namespace Milimoe.FunGame.Testing.Desktop.Solutions public void Save() { - EntityModuleConfig config = new("redbud.fun.entitycreator", "charactercreator"); + EntityModuleConfig config = new("EntityCreator", "character.creator"); foreach (string key in LoadedCharacters.Keys) { config.Add(key, LoadedCharacters[key]); } config.SaveConfig(); } + + public void OpenCreator(Character? character = null) + { + CreateCharacter creator = new(this, character); + creator.ShowDialog(); + } } } diff --git a/Desktop/Solutions/EntityCreator/CreateCharacter.Designer.cs b/Desktop/Solutions/EntityCreator/CreateCharacter.Designer.cs new file mode 100644 index 0000000..17ebf67 --- /dev/null +++ b/Desktop/Solutions/EntityCreator/CreateCharacter.Designer.cs @@ -0,0 +1,539 @@ +namespace Milimoe.FunGame.Testing.Desktop.Solutions +{ + partial class CreateCharacter + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + LabelName = new Label(); + TextName = new TextBox(); + TextFirstName = new TextBox(); + TipName = new Label(); + TipFirstName = new Label(); + TextNickName = new TextBox(); + TipNickName = new Label(); + ComboPA = new ComboBox(); + LabelPA = new Label(); + LabelSTR = new Label(); + LabelAGI = new Label(); + LabelINT = new Label(); + TextSTR = new TextBox(); + TextAGI = new TextBox(); + TextINT = new TextBox(); + TextGrowthSTR = new TextBox(); + TextGrowthAGI = new TextBox(); + TextGrowthINT = new TextBox(); + LabelGrowth1 = new Label(); + LabelGrowth2 = new Label(); + LabelGrowth3 = new Label(); + LabelHR = new Label(); + TextHR = new TextBox(); + TextHP = new TextBox(); + LabelHP = new Label(); + LabelMR = new Label(); + TextMR = new TextBox(); + TextMP = new TextBox(); + LabelMP = new Label(); + TextATK = new TextBox(); + LabelATK = new Label(); + TextSPD = new TextBox(); + LabelSPD = new Label(); + BtnCreate = new Button(); + TextCode = new TextBox(); + LabelCode = new Label(); + SuspendLayout(); + // + // LabelName + // + LabelName.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + LabelName.Font = new Font("等线", 14.25F, FontStyle.Regular, GraphicsUnit.Point, 134); + LabelName.Location = new Point(47, 54); + LabelName.Name = "LabelName"; + LabelName.Size = new Size(129, 27); + LabelName.TabIndex = 0; + LabelName.Text = "角色姓名"; + LabelName.TextAlign = ContentAlignment.MiddleCenter; + // + // TextName + // + TextName.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + TextName.Font = new Font("等线", 14.25F); + TextName.Location = new Point(182, 54); + TextName.Name = "TextName"; + TextName.Size = new Size(94, 27); + TextName.TabIndex = 0; + TextName.WordWrap = false; + // + // TextFirstName + // + TextFirstName.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + TextFirstName.Font = new Font("等线", 14.25F); + TextFirstName.Location = new Point(282, 54); + TextFirstName.Name = "TextFirstName"; + TextFirstName.Size = new Size(171, 27); + TextFirstName.TabIndex = 1; + TextFirstName.WordWrap = false; + // + // TipName + // + TipName.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + TipName.Font = new Font("等线", 14.25F, FontStyle.Regular, GraphicsUnit.Point, 134); + TipName.Location = new Point(182, 24); + TipName.Name = "TipName"; + TipName.Size = new Size(94, 27); + TipName.TabIndex = 2; + TipName.Text = "姓"; + TipName.TextAlign = ContentAlignment.MiddleCenter; + // + // TipFirstName + // + TipFirstName.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + TipFirstName.Font = new Font("等线", 14.25F, FontStyle.Regular, GraphicsUnit.Point, 134); + TipFirstName.Location = new Point(282, 24); + TipFirstName.Name = "TipFirstName"; + TipFirstName.Size = new Size(171, 27); + TipFirstName.TabIndex = 4; + TipFirstName.Text = "名"; + TipFirstName.TextAlign = ContentAlignment.MiddleCenter; + // + // TextNickName + // + TextNickName.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + TextNickName.Font = new Font("等线", 14.25F); + TextNickName.Location = new Point(459, 54); + TextNickName.Name = "TextNickName"; + TextNickName.Size = new Size(171, 27); + TextNickName.TabIndex = 2; + TextNickName.WordWrap = false; + // + // TipNickName + // + TipNickName.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + TipNickName.Font = new Font("等线", 14.25F, FontStyle.Regular, GraphicsUnit.Point, 134); + TipNickName.Location = new Point(459, 24); + TipNickName.Name = "TipNickName"; + TipNickName.Size = new Size(171, 27); + TipNickName.TabIndex = 6; + TipNickName.Text = "昵称"; + TipNickName.TextAlign = ContentAlignment.MiddleCenter; + // + // ComboPA + // + ComboPA.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + ComboPA.Font = new Font("等线", 14.25F, FontStyle.Regular, GraphicsUnit.Point, 134); + ComboPA.FormattingEnabled = true; + ComboPA.Items.AddRange(new object[] { "力量", "敏捷", "智力" }); + ComboPA.Location = new Point(182, 188); + ComboPA.Name = "ComboPA"; + ComboPA.Size = new Size(133, 27); + ComboPA.TabIndex = 7; + // + // LabelPA + // + LabelPA.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + LabelPA.Font = new Font("等线", 14.25F, FontStyle.Regular, GraphicsUnit.Point, 134); + LabelPA.Location = new Point(47, 188); + LabelPA.Name = "LabelPA"; + LabelPA.Size = new Size(129, 27); + LabelPA.TabIndex = 8; + LabelPA.Text = "核心属性"; + LabelPA.TextAlign = ContentAlignment.MiddleCenter; + // + // LabelSTR + // + LabelSTR.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + LabelSTR.Font = new Font("等线", 14.25F, FontStyle.Regular, GraphicsUnit.Point, 134); + LabelSTR.Location = new Point(47, 238); + LabelSTR.Name = "LabelSTR"; + LabelSTR.Size = new Size(129, 27); + LabelSTR.TabIndex = 9; + LabelSTR.Text = "力量"; + LabelSTR.TextAlign = ContentAlignment.MiddleCenter; + // + // LabelAGI + // + LabelAGI.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + LabelAGI.Font = new Font("等线", 14.25F, FontStyle.Regular, GraphicsUnit.Point, 134); + LabelAGI.Location = new Point(47, 274); + LabelAGI.Name = "LabelAGI"; + LabelAGI.Size = new Size(129, 27); + LabelAGI.TabIndex = 10; + LabelAGI.Text = "敏捷"; + LabelAGI.TextAlign = ContentAlignment.MiddleCenter; + // + // LabelINT + // + LabelINT.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + LabelINT.Font = new Font("等线", 14.25F, FontStyle.Regular, GraphicsUnit.Point, 134); + LabelINT.Location = new Point(47, 310); + LabelINT.Name = "LabelINT"; + LabelINT.Size = new Size(129, 27); + LabelINT.TabIndex = 11; + LabelINT.Text = "智力"; + LabelINT.TextAlign = ContentAlignment.MiddleCenter; + // + // TextSTR + // + TextSTR.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + TextSTR.Font = new Font("等线", 14.25F); + TextSTR.Location = new Point(182, 238); + TextSTR.Name = "TextSTR"; + TextSTR.Size = new Size(133, 27); + TextSTR.TabIndex = 9; + TextSTR.WordWrap = false; + // + // TextAGI + // + TextAGI.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + TextAGI.Font = new Font("等线", 14.25F); + TextAGI.Location = new Point(182, 274); + TextAGI.Name = "TextAGI"; + TextAGI.Size = new Size(133, 27); + TextAGI.TabIndex = 11; + TextAGI.WordWrap = false; + // + // TextINT + // + TextINT.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + TextINT.Font = new Font("等线", 14.25F); + TextINT.Location = new Point(182, 310); + TextINT.Name = "TextINT"; + TextINT.Size = new Size(133, 27); + TextINT.TabIndex = 13; + TextINT.WordWrap = false; + // + // TextGrowthSTR + // + TextGrowthSTR.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + TextGrowthSTR.Font = new Font("等线", 14.25F); + TextGrowthSTR.Location = new Point(321, 238); + TextGrowthSTR.Name = "TextGrowthSTR"; + TextGrowthSTR.Size = new Size(94, 27); + TextGrowthSTR.TabIndex = 10; + TextGrowthSTR.WordWrap = false; + // + // TextGrowthAGI + // + TextGrowthAGI.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + TextGrowthAGI.Font = new Font("等线", 14.25F); + TextGrowthAGI.Location = new Point(321, 275); + TextGrowthAGI.Name = "TextGrowthAGI"; + TextGrowthAGI.Size = new Size(94, 27); + TextGrowthAGI.TabIndex = 12; + TextGrowthAGI.WordWrap = false; + // + // TextGrowthINT + // + TextGrowthINT.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + TextGrowthINT.Font = new Font("等线", 14.25F); + TextGrowthINT.Location = new Point(321, 311); + TextGrowthINT.Name = "TextGrowthINT"; + TextGrowthINT.Size = new Size(94, 27); + TextGrowthINT.TabIndex = 14; + TextGrowthINT.WordWrap = false; + // + // LabelGrowth1 + // + LabelGrowth1.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + LabelGrowth1.Font = new Font("等线", 14.25F, FontStyle.Regular, GraphicsUnit.Point, 134); + LabelGrowth1.Location = new Point(421, 238); + LabelGrowth1.Name = "LabelGrowth1"; + LabelGrowth1.Size = new Size(96, 27); + LabelGrowth1.TabIndex = 18; + LabelGrowth1.Text = "力量成长"; + LabelGrowth1.TextAlign = ContentAlignment.MiddleCenter; + // + // LabelGrowth2 + // + LabelGrowth2.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + LabelGrowth2.Font = new Font("等线", 14.25F, FontStyle.Regular, GraphicsUnit.Point, 134); + LabelGrowth2.Location = new Point(421, 275); + LabelGrowth2.Name = "LabelGrowth2"; + LabelGrowth2.Size = new Size(96, 27); + LabelGrowth2.TabIndex = 19; + LabelGrowth2.Text = "敏捷成长"; + LabelGrowth2.TextAlign = ContentAlignment.MiddleCenter; + // + // LabelGrowth3 + // + LabelGrowth3.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + LabelGrowth3.Font = new Font("等线", 14.25F, FontStyle.Regular, GraphicsUnit.Point, 134); + LabelGrowth3.Location = new Point(421, 311); + LabelGrowth3.Name = "LabelGrowth3"; + LabelGrowth3.Size = new Size(96, 27); + LabelGrowth3.TabIndex = 20; + LabelGrowth3.Text = "智力成长"; + LabelGrowth3.TextAlign = ContentAlignment.MiddleCenter; + // + // LabelHR + // + LabelHR.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + LabelHR.Font = new Font("等线", 14.25F, FontStyle.Regular, GraphicsUnit.Point, 134); + LabelHR.Location = new Point(421, 97); + LabelHR.Name = "LabelHR"; + LabelHR.Size = new Size(96, 27); + LabelHR.TabIndex = 24; + LabelHR.Text = "生命回复"; + LabelHR.TextAlign = ContentAlignment.MiddleCenter; + // + // TextHR + // + TextHR.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + TextHR.Font = new Font("等线", 14.25F); + TextHR.Location = new Point(321, 97); + TextHR.Name = "TextHR"; + TextHR.Size = new Size(94, 27); + TextHR.TabIndex = 4; + TextHR.WordWrap = false; + // + // TextHP + // + TextHP.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + TextHP.Font = new Font("等线", 14.25F); + TextHP.Location = new Point(182, 97); + TextHP.Name = "TextHP"; + TextHP.Size = new Size(133, 27); + TextHP.TabIndex = 3; + TextHP.WordWrap = false; + // + // LabelHP + // + LabelHP.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + LabelHP.Font = new Font("等线", 14.25F, FontStyle.Regular, GraphicsUnit.Point, 134); + LabelHP.Location = new Point(47, 97); + LabelHP.Name = "LabelHP"; + LabelHP.Size = new Size(129, 27); + LabelHP.TabIndex = 21; + LabelHP.Text = "初始生命值"; + LabelHP.TextAlign = ContentAlignment.MiddleCenter; + // + // LabelMR + // + LabelMR.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + LabelMR.Font = new Font("等线", 14.25F, FontStyle.Regular, GraphicsUnit.Point, 134); + LabelMR.Location = new Point(421, 137); + LabelMR.Name = "LabelMR"; + LabelMR.Size = new Size(96, 27); + LabelMR.TabIndex = 28; + LabelMR.Text = "魔法回复"; + LabelMR.TextAlign = ContentAlignment.MiddleCenter; + // + // TextMR + // + TextMR.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + TextMR.Font = new Font("等线", 14.25F); + TextMR.Location = new Point(321, 137); + TextMR.Name = "TextMR"; + TextMR.Size = new Size(94, 27); + TextMR.TabIndex = 6; + TextMR.WordWrap = false; + // + // TextMP + // + TextMP.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + TextMP.Font = new Font("等线", 14.25F); + TextMP.Location = new Point(182, 137); + TextMP.Name = "TextMP"; + TextMP.Size = new Size(133, 27); + TextMP.TabIndex = 5; + TextMP.WordWrap = false; + // + // LabelMP + // + LabelMP.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + LabelMP.Font = new Font("等线", 14.25F, FontStyle.Regular, GraphicsUnit.Point, 134); + LabelMP.Location = new Point(47, 137); + LabelMP.Name = "LabelMP"; + LabelMP.Size = new Size(129, 27); + LabelMP.TabIndex = 25; + LabelMP.Text = "初始魔法值"; + LabelMP.TextAlign = ContentAlignment.MiddleCenter; + // + // TextATK + // + TextATK.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + TextATK.Font = new Font("等线", 14.25F); + TextATK.Location = new Point(497, 188); + TextATK.Name = "TextATK"; + TextATK.Size = new Size(133, 27); + TextATK.TabIndex = 8; + TextATK.WordWrap = false; + // + // LabelATK + // + LabelATK.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + LabelATK.Font = new Font("等线", 14.25F, FontStyle.Regular, GraphicsUnit.Point, 134); + LabelATK.Location = new Point(362, 188); + LabelATK.Name = "LabelATK"; + LabelATK.Size = new Size(129, 27); + LabelATK.TabIndex = 29; + LabelATK.Text = "初始攻击力"; + LabelATK.TextAlign = ContentAlignment.MiddleCenter; + // + // TextSPD + // + TextSPD.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + TextSPD.Font = new Font("等线", 14.25F); + TextSPD.Location = new Point(182, 352); + TextSPD.Name = "TextSPD"; + TextSPD.ReadOnly = true; + TextSPD.Size = new Size(133, 27); + TextSPD.TabIndex = 15; + TextSPD.Text = "300"; + TextSPD.WordWrap = false; + // + // LabelSPD + // + LabelSPD.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + LabelSPD.Font = new Font("等线", 14.25F, FontStyle.Regular, GraphicsUnit.Point, 134); + LabelSPD.Location = new Point(47, 352); + LabelSPD.Name = "LabelSPD"; + LabelSPD.Size = new Size(129, 27); + LabelSPD.TabIndex = 31; + LabelSPD.Text = "行动速度"; + LabelSPD.TextAlign = ContentAlignment.MiddleCenter; + // + // BtnCreate + // + BtnCreate.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + BtnCreate.Font = new Font("等线", 14.25F, FontStyle.Regular, GraphicsUnit.Point, 134); + BtnCreate.Location = new Point(628, 412); + BtnCreate.Name = "BtnCreate"; + BtnCreate.Size = new Size(103, 45); + BtnCreate.TabIndex = 17; + BtnCreate.Text = "创建"; + BtnCreate.UseVisualStyleBackColor = true; + BtnCreate.Click += BtnCreate_Click; + // + // TextCode + // + TextCode.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + TextCode.Font = new Font("等线", 14.25F); + TextCode.Location = new Point(407, 422); + TextCode.Name = "TextCode"; + TextCode.Size = new Size(215, 27); + TextCode.TabIndex = 16; + TextCode.WordWrap = false; + // + // LabelCode + // + LabelCode.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + LabelCode.Font = new Font("等线", 14.25F, FontStyle.Regular, GraphicsUnit.Point, 134); + LabelCode.Location = new Point(231, 422); + LabelCode.Name = "LabelCode"; + LabelCode.Size = new Size(170, 27); + LabelCode.TabIndex = 34; + LabelCode.Text = "代号(存档标识)"; + LabelCode.TextAlign = ContentAlignment.MiddleCenter; + // + // CreateCharacter + // + AutoScaleDimensions = new SizeF(7F, 17F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(743, 469); + Controls.Add(TextCode); + Controls.Add(LabelCode); + Controls.Add(BtnCreate); + Controls.Add(TextSPD); + Controls.Add(LabelSPD); + Controls.Add(TextATK); + Controls.Add(LabelATK); + Controls.Add(LabelMR); + Controls.Add(TextMR); + Controls.Add(TextMP); + Controls.Add(LabelMP); + Controls.Add(LabelHR); + Controls.Add(TextHR); + Controls.Add(TextHP); + Controls.Add(LabelHP); + Controls.Add(LabelGrowth3); + Controls.Add(LabelGrowth2); + Controls.Add(LabelGrowth1); + Controls.Add(TextGrowthINT); + Controls.Add(TextGrowthAGI); + Controls.Add(TextGrowthSTR); + Controls.Add(TextINT); + Controls.Add(TextAGI); + Controls.Add(TextSTR); + Controls.Add(LabelINT); + Controls.Add(LabelAGI); + Controls.Add(LabelSTR); + Controls.Add(LabelPA); + Controls.Add(ComboPA); + Controls.Add(TipNickName); + Controls.Add(TextNickName); + Controls.Add(TipFirstName); + Controls.Add(TextFirstName); + Controls.Add(TipName); + Controls.Add(TextName); + Controls.Add(LabelName); + Name = "CreateCharacter"; + StartPosition = FormStartPosition.CenterScreen; + Text = "角色创建器"; + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private Label LabelName; + private TextBox TextName; + private TextBox TextFirstName; + private Label TipName; + private Label TipFirstName; + private TextBox TextNickName; + private Label TipNickName; + private ComboBox ComboPA; + private Label LabelPA; + private Label LabelSTR; + private Label LabelAGI; + private Label LabelINT; + private TextBox TextSTR; + private TextBox TextAGI; + private TextBox TextINT; + private TextBox TextGrowthSTR; + private TextBox TextGrowthAGI; + private TextBox TextGrowthINT; + private Label LabelGrowth1; + private Label LabelGrowth2; + private Label LabelGrowth3; + private Label LabelHR; + private TextBox TextHR; + private TextBox TextHP; + private Label LabelHP; + private Label LabelMR; + private TextBox TextMR; + private TextBox TextMP; + private Label LabelMP; + private TextBox TextATK; + private Label LabelATK; + private TextBox TextSPD; + private Label LabelSPD; + private Button BtnCreate; + private TextBox TextCode; + private Label LabelCode; + } +} \ No newline at end of file diff --git a/Desktop/Solutions/EntityCreator/CreateCharacter.cs b/Desktop/Solutions/EntityCreator/CreateCharacter.cs new file mode 100644 index 0000000..5c8c6f4 --- /dev/null +++ b/Desktop/Solutions/EntityCreator/CreateCharacter.cs @@ -0,0 +1,205 @@ +using Milimoe.FunGame.Core.Api.Utility; +using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Library.Constant; + +namespace Milimoe.FunGame.Testing.Desktop.Solutions +{ + public partial class CreateCharacter : Form + { + private CharacterCreator CharacterCreator { get; } + private Character? EditCharacter { get; } + + public CreateCharacter(CharacterCreator creator, Character? character = null) + { + InitializeComponent(); + CharacterCreator = creator; + if (character != null) + { + Text = "角色编辑器"; + BtnCreate.Text = "编辑"; + EditCharacter = character; + TextName.Text = character.Name; + TextCode.Text = creator.LoadedCharacters.Where(kv => kv.Value == character).Select(kv => kv.Key).FirstOrDefault() ?? ""; + TextFirstName.Text = character.FirstName; + TextNickName.Text = character.NickName; + TextATK.Text = character.InitialATK.ToString(); + TextHP.Text = character.InitialHP.ToString(); + TextMP.Text = character.InitialMP.ToString(); + TextHR.Text = character.InitialHR.ToString(); + TextMR.Text = character.InitialMR.ToString(); + ComboPA.Text = CharacterSet.GetPrimaryAttributeName(character.PrimaryAttribute); + TextSTR.Text = character.InitialSTR.ToString(); + TextGrowthSTR.Text = character.STRGrowth.ToString(); + TextAGI.Text = character.InitialAGI.ToString(); + TextGrowthAGI.Text = character.AGIGrowth.ToString(); + TextINT.Text = character.InitialINT.ToString(); + TextGrowthINT.Text = character.INTGrowth.ToString(); + } + } + + private void BtnCreate_Click(object sender, EventArgs e) + { + Character c; + if (EditCharacter != null) + { + c = EditCharacter; + } + else + { + c = Factory.GetCharacter(); + } + string name; + + if (TextName.Text.Trim() != "") + { + c.Name = TextName.Text.Trim(); + } + else + { + MessageBox.Show("姓不能为空。"); + return; + } + + if (TextCode.Text.Trim() != "") + { + name = TextCode.Text.Trim(); + } + else + { + MessageBox.Show("角色存档标识不能为空。"); + return; + } + + if (TextFirstName.Text.Trim() != "") + { + c.FirstName = TextFirstName.Text.Trim(); + } + + if (TextNickName.Text.Trim() != "") + { + c.NickName = TextNickName.Text.Trim(); + } + + if (TextATK.Text.Trim() != "" && double.TryParse(TextATK.Text.Trim(), out double atk)) + { + c.InitialATK = atk; + } + + if (TextHP.Text.Trim() != "" && double.TryParse(TextHP.Text.Trim(), out double hp)) + { + c.InitialHP = hp; + } + + if (TextMP.Text.Trim() != "" && double.TryParse(TextMP.Text.Trim(), out double mp)) + { + c.InitialMP = mp; + } + + if (TextHR.Text.Trim() != "" && double.TryParse(TextHR.Text.Trim(), out double hr)) + { + c.InitialHR = hr; + } + + if (TextMR.Text.Trim() != "" && double.TryParse(TextMR.Text.Trim(), out double mr)) + { + c.InitialMR = mr; + } + + if (ComboPA.Text.Trim() != "") + { + string pa = ComboPA.Text.Trim(); + if (pa == "敏捷") + { + c.PrimaryAttribute = PrimaryAttribute.AGI; + } + else if (pa == "智力") + { + c.PrimaryAttribute = PrimaryAttribute.INT; + } + else + { + c.PrimaryAttribute = PrimaryAttribute.STR; + } + } + + if (TextSTR.Text.Trim() != "" && double.TryParse(TextSTR.Text.Trim(), out double str)) + { + c.InitialSTR = str; + } + + if (TextGrowthSTR.Text.Trim() != "" && double.TryParse(TextGrowthSTR.Text.Trim(), out double strg)) + { + c.STRGrowth = strg; + } + + if (TextAGI.Text.Trim() != "" && double.TryParse(TextAGI.Text.Trim(), out double agi)) + { + c.InitialAGI = agi; + } + + if (TextGrowthAGI.Text.Trim() != "" && double.TryParse(TextGrowthAGI.Text.Trim(), out double agig)) + { + c.AGIGrowth = agig; + } + + if (TextINT.Text.Trim() != "" && double.TryParse(TextINT.Text.Trim(), out double @int)) + { + c.InitialINT = @int; + } + + if (TextGrowthINT.Text.Trim() != "" && double.TryParse(TextGrowthINT.Text.Trim(), out double intg)) + { + c.INTGrowth = intg; + } + + if (TextSPD.Text.Trim() != "" && double.TryParse(TextSPD.Text.Trim(), out double spd)) + { + c.InitialSPD = spd; + } + + if (EditCharacter != null) + { + MessageBox.Show("保存成功!"); + Dispose(); + return; + } + else + { + if (CharacterCreator.Add(name, c)) + { + ShowDetail d = new(CharacterCreator, null, null); + d.SetText(-1, c, c.GetInfo()); + d.Text = "预览模式"; + d.ShowDialog(); + d.Dispose(); + if (MessageBox.Show("添加成功!是否继续添加?", "提示", MessageBoxButtons.YesNo) == DialogResult.No) + { + Dispose(); + return; + } + } + else + { + MessageBox.Show("添加失败!"); + } + } + + TextName.Text = ""; + TextCode.Text = ""; + TextFirstName.Text = ""; + TextNickName.Text = ""; + TextATK.Text = ""; + TextHP.Text = ""; + TextMP.Text = ""; + TextHR.Text = ""; + TextMR.Text = ""; + ComboPA.Text = ""; + TextSTR.Text = ""; + TextGrowthSTR.Text = ""; + TextAGI.Text = ""; + TextGrowthAGI.Text = ""; + TextINT.Text = ""; + TextGrowthINT.Text = ""; + } + } +} diff --git a/Desktop/Solutions/EntityCreator.resx b/Desktop/Solutions/EntityCreator/CreateCharacter.resx similarity index 100% rename from Desktop/Solutions/EntityCreator.resx rename to Desktop/Solutions/EntityCreator/CreateCharacter.resx diff --git a/Desktop/Solutions/EntityCreator/CreateItem.Designer.cs b/Desktop/Solutions/EntityCreator/CreateItem.Designer.cs new file mode 100644 index 0000000..5a02e8f --- /dev/null +++ b/Desktop/Solutions/EntityCreator/CreateItem.Designer.cs @@ -0,0 +1,391 @@ +namespace Milimoe.FunGame.Testing.Desktop.Solutions +{ + partial class CreateItem + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + BtnCreate = new Button(); + TextCode = new TextBox(); + LabelCode = new Label(); + TipItemType = new Label(); + TextName = new TextBox(); + TipID = new Label(); + TextID = new TextBox(); + TipName = new Label(); + LabelWeaponType = new Label(); + CheckboxIsWeapon = new CheckBox(); + CheckboxIsEquip = new CheckBox(); + LabelEquip = new Label(); + CheckboxIsPurchasable = new CheckBox(); + TextPrice = new TextBox(); + LabelPrice = new Label(); + CheckboxIsSellable = new CheckBox(); + LabelNextSellTime = new Label(); + CheckboxIsTradable = new CheckBox(); + LabelNextTradeTime = new Label(); + DateTimePickerSell = new DateTimePicker(); + DateTimePickerTrade = new DateTimePicker(); + ComboWeapon = new ComboBox(); + ComboEquip = new ComboBox(); + ComboItemType = new ComboBox(); + SuspendLayout(); + // + // BtnCreate + // + BtnCreate.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + BtnCreate.Font = new Font("等线", 14.25F, FontStyle.Regular, GraphicsUnit.Point, 134); + BtnCreate.Location = new Point(628, 412); + BtnCreate.Name = "BtnCreate"; + BtnCreate.Size = new Size(103, 45); + BtnCreate.TabIndex = 14; + BtnCreate.Text = "创建"; + BtnCreate.UseVisualStyleBackColor = true; + BtnCreate.Click += BtnCreate_Click; + // + // TextCode + // + TextCode.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + TextCode.Font = new Font("等线", 14.25F); + TextCode.Location = new Point(407, 422); + TextCode.Name = "TextCode"; + TextCode.Size = new Size(215, 27); + TextCode.TabIndex = 13; + TextCode.WordWrap = false; + // + // LabelCode + // + LabelCode.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + LabelCode.Font = new Font("等线", 14.25F, FontStyle.Regular, GraphicsUnit.Point, 134); + LabelCode.Location = new Point(231, 422); + LabelCode.Name = "LabelCode"; + LabelCode.Size = new Size(170, 27); + LabelCode.TabIndex = 34; + LabelCode.Text = "代号(存档标识)"; + LabelCode.TextAlign = ContentAlignment.MiddleCenter; + // + // TipItemType + // + TipItemType.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + TipItemType.Font = new Font("等线", 14.25F, FontStyle.Regular, GraphicsUnit.Point, 134); + TipItemType.Location = new Point(214, 128); + TipItemType.Name = "TipItemType"; + TipItemType.Size = new Size(129, 27); + TipItemType.TabIndex = 41; + TipItemType.Text = "物品类型"; + TipItemType.TextAlign = ContentAlignment.MiddleCenter; + // + // TextName + // + TextName.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + TextName.Font = new Font("等线", 14.25F); + TextName.Location = new Point(349, 78); + TextName.Name = "TextName"; + TextName.Size = new Size(201, 27); + TextName.TabIndex = 1; + TextName.WordWrap = false; + // + // TipID + // + TipID.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + TipID.Font = new Font("等线", 14.25F, FontStyle.Regular, GraphicsUnit.Point, 134); + TipID.Location = new Point(214, 28); + TipID.Name = "TipID"; + TipID.Size = new Size(129, 27); + TipID.TabIndex = 40; + TipID.Text = "物品编号"; + TipID.TextAlign = ContentAlignment.MiddleCenter; + // + // TextID + // + TextID.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + TextID.Font = new Font("等线", 14.25F); + TextID.Location = new Point(349, 28); + TextID.Name = "TextID"; + TextID.Size = new Size(201, 27); + TextID.TabIndex = 0; + TextID.WordWrap = false; + // + // TipName + // + TipName.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + TipName.Font = new Font("等线", 14.25F, FontStyle.Regular, GraphicsUnit.Point, 134); + TipName.Location = new Point(214, 78); + TipName.Name = "TipName"; + TipName.Size = new Size(129, 27); + TipName.TabIndex = 38; + TipName.Text = "物品名称"; + TipName.TextAlign = ContentAlignment.MiddleCenter; + // + // LabelWeaponType + // + LabelWeaponType.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + LabelWeaponType.Font = new Font("等线", 14.25F, FontStyle.Regular, GraphicsUnit.Point, 134); + LabelWeaponType.Location = new Point(272, 192); + LabelWeaponType.Name = "LabelWeaponType"; + LabelWeaponType.Size = new Size(129, 27); + LabelWeaponType.TabIndex = 43; + LabelWeaponType.Text = "武器类型"; + LabelWeaponType.TextAlign = ContentAlignment.MiddleCenter; + // + // CheckboxIsWeapon + // + CheckboxIsWeapon.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + CheckboxIsWeapon.CheckAlign = ContentAlignment.MiddleRight; + CheckboxIsWeapon.Font = new Font("等线", 14.25F, FontStyle.Regular, GraphicsUnit.Point, 134); + CheckboxIsWeapon.ImageAlign = ContentAlignment.MiddleRight; + CheckboxIsWeapon.Location = new Point(121, 192); + CheckboxIsWeapon.Name = "CheckboxIsWeapon"; + CheckboxIsWeapon.Size = new Size(145, 27); + CheckboxIsWeapon.TabIndex = 3; + CheckboxIsWeapon.Text = "是武器"; + CheckboxIsWeapon.TextAlign = ContentAlignment.MiddleCenter; + CheckboxIsWeapon.UseVisualStyleBackColor = true; + CheckboxIsWeapon.CheckedChanged += CheckboxIsWeapon_CheckedChanged; + // + // CheckboxIsEquip + // + CheckboxIsEquip.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + CheckboxIsEquip.CheckAlign = ContentAlignment.MiddleRight; + CheckboxIsEquip.Font = new Font("等线", 14.25F, FontStyle.Regular, GraphicsUnit.Point, 134); + CheckboxIsEquip.ImageAlign = ContentAlignment.MiddleRight; + CheckboxIsEquip.Location = new Point(121, 232); + CheckboxIsEquip.Name = "CheckboxIsEquip"; + CheckboxIsEquip.Size = new Size(145, 27); + CheckboxIsEquip.TabIndex = 5; + CheckboxIsEquip.Text = "可被装备"; + CheckboxIsEquip.TextAlign = ContentAlignment.MiddleCenter; + CheckboxIsEquip.UseVisualStyleBackColor = true; + CheckboxIsEquip.CheckedChanged += CheckboxIsEquip_CheckedChanged; + // + // LabelEquip + // + LabelEquip.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + LabelEquip.Font = new Font("等线", 14.25F, FontStyle.Regular, GraphicsUnit.Point, 134); + LabelEquip.Location = new Point(272, 232); + LabelEquip.Name = "LabelEquip"; + LabelEquip.Size = new Size(129, 27); + LabelEquip.TabIndex = 46; + LabelEquip.Text = "装备类型"; + LabelEquip.TextAlign = ContentAlignment.MiddleCenter; + // + // CheckboxIsPurchasable + // + CheckboxIsPurchasable.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + CheckboxIsPurchasable.CheckAlign = ContentAlignment.MiddleRight; + CheckboxIsPurchasable.Font = new Font("等线", 14.25F, FontStyle.Regular, GraphicsUnit.Point, 134); + CheckboxIsPurchasable.ImageAlign = ContentAlignment.MiddleRight; + CheckboxIsPurchasable.Location = new Point(121, 272); + CheckboxIsPurchasable.Name = "CheckboxIsPurchasable"; + CheckboxIsPurchasable.Size = new Size(145, 27); + CheckboxIsPurchasable.TabIndex = 7; + CheckboxIsPurchasable.Text = "可供购买"; + CheckboxIsPurchasable.TextAlign = ContentAlignment.MiddleCenter; + CheckboxIsPurchasable.UseVisualStyleBackColor = true; + CheckboxIsPurchasable.CheckedChanged += CheckboxIsPurchasable_CheckedChanged; + // + // TextPrice + // + TextPrice.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + TextPrice.Font = new Font("等线", 14.25F); + TextPrice.Location = new Point(407, 272); + TextPrice.Name = "TextPrice"; + TextPrice.Size = new Size(201, 27); + TextPrice.TabIndex = 8; + TextPrice.WordWrap = false; + // + // LabelPrice + // + LabelPrice.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + LabelPrice.Font = new Font("等线", 14.25F, FontStyle.Regular, GraphicsUnit.Point, 134); + LabelPrice.Location = new Point(272, 272); + LabelPrice.Name = "LabelPrice"; + LabelPrice.Size = new Size(129, 27); + LabelPrice.TabIndex = 49; + LabelPrice.Text = "售价"; + LabelPrice.TextAlign = ContentAlignment.MiddleCenter; + // + // CheckboxIsSellable + // + CheckboxIsSellable.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + CheckboxIsSellable.CheckAlign = ContentAlignment.MiddleRight; + CheckboxIsSellable.Font = new Font("等线", 14.25F, FontStyle.Regular, GraphicsUnit.Point, 134); + CheckboxIsSellable.ImageAlign = ContentAlignment.MiddleRight; + CheckboxIsSellable.Location = new Point(121, 312); + CheckboxIsSellable.Name = "CheckboxIsSellable"; + CheckboxIsSellable.Size = new Size(145, 27); + CheckboxIsSellable.TabIndex = 9; + CheckboxIsSellable.Text = "允许出售"; + CheckboxIsSellable.TextAlign = ContentAlignment.MiddleCenter; + CheckboxIsSellable.UseVisualStyleBackColor = true; + CheckboxIsSellable.CheckedChanged += CheckboxIsSellable_CheckedChanged; + // + // LabelNextSellTime + // + LabelNextSellTime.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + LabelNextSellTime.Font = new Font("等线", 14.25F, FontStyle.Regular, GraphicsUnit.Point, 134); + LabelNextSellTime.Location = new Point(272, 312); + LabelNextSellTime.Name = "LabelNextSellTime"; + LabelNextSellTime.Size = new Size(160, 27); + LabelNextSellTime.TabIndex = 52; + LabelNextSellTime.Text = "下次可出售时间"; + LabelNextSellTime.TextAlign = ContentAlignment.MiddleCenter; + // + // CheckboxIsTradable + // + CheckboxIsTradable.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + CheckboxIsTradable.CheckAlign = ContentAlignment.MiddleRight; + CheckboxIsTradable.Font = new Font("等线", 14.25F, FontStyle.Regular, GraphicsUnit.Point, 134); + CheckboxIsTradable.ImageAlign = ContentAlignment.MiddleRight; + CheckboxIsTradable.Location = new Point(121, 352); + CheckboxIsTradable.Name = "CheckboxIsTradable"; + CheckboxIsTradable.Size = new Size(145, 27); + CheckboxIsTradable.TabIndex = 11; + CheckboxIsTradable.Text = "允许交易"; + CheckboxIsTradable.TextAlign = ContentAlignment.MiddleCenter; + CheckboxIsTradable.UseVisualStyleBackColor = true; + CheckboxIsTradable.CheckedChanged += CheckboxIsTradable_CheckedChanged; + // + // LabelNextTradeTime + // + LabelNextTradeTime.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + LabelNextTradeTime.Font = new Font("等线", 14.25F, FontStyle.Regular, GraphicsUnit.Point, 134); + LabelNextTradeTime.Location = new Point(272, 352); + LabelNextTradeTime.Name = "LabelNextTradeTime"; + LabelNextTradeTime.Size = new Size(160, 27); + LabelNextTradeTime.TabIndex = 55; + LabelNextTradeTime.Text = "下次可交易时间"; + LabelNextTradeTime.TextAlign = ContentAlignment.MiddleCenter; + // + // DateTimePickerSell + // + DateTimePickerSell.Font = new Font("等线", 14.25F, FontStyle.Regular, GraphicsUnit.Point, 134); + DateTimePickerSell.Location = new Point(438, 312); + DateTimePickerSell.Name = "DateTimePickerSell"; + DateTimePickerSell.Size = new Size(170, 27); + DateTimePickerSell.TabIndex = 10; + // + // DateTimePickerTrade + // + DateTimePickerTrade.Font = new Font("等线", 14.25F, FontStyle.Regular, GraphicsUnit.Point, 134); + DateTimePickerTrade.Location = new Point(438, 352); + DateTimePickerTrade.Name = "DateTimePickerTrade"; + DateTimePickerTrade.Size = new Size(170, 27); + DateTimePickerTrade.TabIndex = 12; + // + // ComboWeapon + // + ComboWeapon.Font = new Font("Microsoft YaHei UI", 14.25F, FontStyle.Regular, GraphicsUnit.Point, 134); + ComboWeapon.FormattingEnabled = true; + ComboWeapon.Items.AddRange(new object[] { "单手剑", "双手重剑", "弓", "手枪", "步枪", "双持短刀", "法器", "法杖", "长柄", "拳套", "暗器" }); + ComboWeapon.Location = new Point(407, 188); + ComboWeapon.Name = "ComboWeapon"; + ComboWeapon.Size = new Size(201, 33); + ComboWeapon.TabIndex = 4; + // + // ComboEquip + // + ComboEquip.Font = new Font("Microsoft YaHei UI", 14.25F, FontStyle.Regular, GraphicsUnit.Point, 134); + ComboEquip.FormattingEnabled = true; + ComboEquip.Items.AddRange(new object[] { "魔法卡包", "武器", "防具", "鞋子", "饰品" }); + ComboEquip.Location = new Point(407, 228); + ComboEquip.Name = "ComboEquip"; + ComboEquip.Size = new Size(201, 33); + ComboEquip.TabIndex = 6; + // + // ComboItemType + // + ComboItemType.Font = new Font("Microsoft YaHei UI", 14.25F, FontStyle.Regular, GraphicsUnit.Point, 134); + ComboItemType.FormattingEnabled = true; + ComboItemType.Items.AddRange(new object[] { "魔法卡包", "武器", "防具", "鞋子", "饰品", "消耗品", "魔法卡", "收藏品", "特殊物品", "任务物品", "礼包", "其他" }); + ComboItemType.Location = new Point(349, 125); + ComboItemType.Name = "ComboItemType"; + ComboItemType.Size = new Size(201, 33); + ComboItemType.TabIndex = 56; + // + // CreateItem + // + AutoScaleDimensions = new SizeF(7F, 17F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(743, 469); + Controls.Add(ComboItemType); + Controls.Add(ComboEquip); + Controls.Add(ComboWeapon); + Controls.Add(DateTimePickerTrade); + Controls.Add(DateTimePickerSell); + Controls.Add(CheckboxIsTradable); + Controls.Add(LabelNextTradeTime); + Controls.Add(CheckboxIsSellable); + Controls.Add(LabelNextSellTime); + Controls.Add(CheckboxIsPurchasable); + Controls.Add(TextPrice); + Controls.Add(LabelPrice); + Controls.Add(CheckboxIsEquip); + Controls.Add(LabelEquip); + Controls.Add(CheckboxIsWeapon); + Controls.Add(LabelWeaponType); + Controls.Add(TipItemType); + Controls.Add(TextName); + Controls.Add(TipID); + Controls.Add(TextID); + Controls.Add(TipName); + Controls.Add(TextCode); + Controls.Add(LabelCode); + Controls.Add(BtnCreate); + Name = "CreateItem"; + StartPosition = FormStartPosition.CenterScreen; + Text = "物品创建器"; + ResumeLayout(false); + PerformLayout(); + } + + #endregion + private Button BtnCreate; + private TextBox TextCode; + private Label LabelCode; + private Label TipItemType; + private TextBox TextName; + private Label TipID; + private TextBox TextID; + private Label TipName; + private Label LabelWeaponType; + private CheckBox CheckboxIsWeapon; + private CheckBox CheckboxIsEquip; + private Label LabelEquip; + private CheckBox CheckboxIsPurchasable; + private TextBox TextPrice; + private Label LabelPrice; + private CheckBox CheckboxIsSellable; + private Label LabelNextSellTime; + private CheckBox CheckboxIsTradable; + private Label LabelNextTradeTime; + private DateTimePicker DateTimePickerSell; + private DateTimePicker DateTimePickerTrade; + private ComboBox ComboWeapon; + private ComboBox ComboEquip; + private ComboBox ComboItemType; + } +} \ No newline at end of file diff --git a/Desktop/Solutions/EntityCreator/CreateItem.cs b/Desktop/Solutions/EntityCreator/CreateItem.cs new file mode 100644 index 0000000..45369e9 --- /dev/null +++ b/Desktop/Solutions/EntityCreator/CreateItem.cs @@ -0,0 +1,199 @@ +using Milimoe.FunGame.Core.Api.Utility; +using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Library.Constant; + +namespace Milimoe.FunGame.Testing.Desktop.Solutions +{ + public partial class CreateItem : Form + { + private ItemCreator ItemCreator { get; } + private Item? EditItem { get; } + + public CreateItem(ItemCreator creator, Item? item = null) + { + InitializeComponent(); + ItemCreator = creator; + if (item != null) + { + Text = "物品编辑器"; + BtnCreate.Text = "编辑"; + EditItem = item; + TextID.Text = item.Id.ToString(); + TextName.Text = item.Name; + TextCode.Text = creator.LoadedItems.Where(kv => kv.Value.Equals(item)).Select(kv => kv.Key).FirstOrDefault() ?? ""; + ComboItemType.Text = ItemSet.GetItemTypeName(item.ItemType); + CheckboxIsWeapon.Checked = item.ItemType == ItemType.Weapon; + ComboWeapon.Text = ItemSet.GetWeaponTypeName(item.WeaponType); + ComboWeapon.Enabled = item.ItemType == ItemType.Weapon; + CheckboxIsEquip.Checked = item.Equipable; + ComboEquip.Text = ItemSet.GetEquipSlotTypeName(item.EquipSlotType); + ComboEquip.Enabled = item.Equipable; + CheckboxIsPurchasable.Checked = item.IsPurchasable; + TextPrice.Text = item.Price.ToString(); + TextPrice.Enabled = item.IsPurchasable; + CheckboxIsSellable.Checked = item.IsSellable; + CheckboxIsTradable.Checked = item.IsTradable; + if (item.NextSellableTime > DateTime.Now && item.NextSellableTime < DateTime.MaxValue) DateTimePickerSell.Value = item.NextSellableTime; + DateTimePickerSell.Enabled = !item.IsSellable; + if (item.NextTradableTime > DateTime.Now && item.NextTradableTime < DateTime.MaxValue) DateTimePickerTrade.Value = item.NextTradableTime; + DateTimePickerTrade.Enabled = !item.IsTradable; + } + else + { + CheckboxIsWeapon.Checked = false; + ComboWeapon.Enabled = false; + CheckboxIsEquip.Checked = false; + ComboEquip.Enabled = false; + CheckboxIsPurchasable.Checked = false; + TextPrice.Enabled = false; + CheckboxIsSellable.Checked = true; + CheckboxIsTradable.Checked = true; + DateTimePickerSell.Value = DateTime.Now; + DateTimePickerSell.Enabled = false; + DateTimePickerTrade.Value = DateTime.Now; + DateTimePickerTrade.Enabled = false; + } + } + + private void BtnCreate_Click(object sender, EventArgs e) + { + Item i; + if (EditItem != null) + { + i = EditItem; + } + else + { + i = Factory.GetItem(); + } + string name; + + if (TextID.Text.Trim() != "" && long.TryParse(TextID.Text.Trim(), out long id)) + { + i.Id = id; + } + else + { + MessageBox.Show("ID不能为空。"); + return; + } + + if (TextName.Text.Trim() != "") + { + i.Name = TextName.Text.Trim(); + } + else + { + MessageBox.Show("名称不能为空。"); + return; + } + + if (TextCode.Text.Trim() != "") + { + name = TextCode.Text.Trim(); + } + else + { + MessageBox.Show("物品存档标识不能为空。"); + return; + } + + if (CheckboxIsWeapon.Checked && ComboWeapon.Text.Trim() != "") + { + i.WeaponType = ItemSet.GetWeaponTypeFromName(ComboWeapon.Text.Trim()); + } + + if (CheckboxIsEquip.Checked && ComboEquip.Text.Trim() != "") + { + i.EquipSlotType = ItemSet.GetEquipSlotTypeFromName(ComboEquip.Text.Trim()); + } + + if (CheckboxIsPurchasable.Checked && TextPrice.Text.Trim() != "" && double.TryParse(TextPrice.Text.Trim(), out double price)) + { + i.Price = price; + } + + if (!CheckboxIsSellable.Checked && DateTime.Now < DateTimePickerSell.Value) + { + i.NextSellableTime = DateTimePickerSell.Value; + } + + if (!CheckboxIsTradable.Checked && DateTime.Now < DateTimePickerTrade.Value) + { + i.NextTradableTime = DateTimePickerTrade.Value; + } + + if (EditItem != null) + { + MessageBox.Show("保存成功!"); + Dispose(); + return; + } + else + { + if (ItemCreator.Add(name, i)) + { + ShowDetail d = new(null, null, ItemCreator); + d.SetText(-1, i, i.ToString()); + d.Text = "预览模式"; + d.ShowDialog(); + d.Dispose(); + if (MessageBox.Show("添加成功!是否继续添加?", "提示", MessageBoxButtons.YesNo) == DialogResult.No) + { + Dispose(); + return; + } + } + else + { + MessageBox.Show("添加失败!"); + } + } + + TextID.Text = ""; + TextName.Text = ""; + TextCode.Text = ""; + ComboItemType.Text = ""; + CheckboxIsWeapon.Checked = false; + ComboWeapon.Text = ""; + ComboWeapon.Enabled = false; + CheckboxIsEquip.Checked = false; + ComboEquip.Text = ""; + ComboEquip.Enabled = false; + CheckboxIsPurchasable.Checked = false; + TextPrice.Text = ""; + TextPrice.Enabled = false; + CheckboxIsSellable.Checked = true; + CheckboxIsTradable.Checked = true; + DateTimePickerSell.Value = DateTime.Now; + DateTimePickerSell.Enabled = false; + DateTimePickerTrade.Value = DateTime.Now; + DateTimePickerTrade.Enabled = false; + } + + private void CheckboxIsWeapon_CheckedChanged(object sender, EventArgs e) + { + ComboWeapon.Enabled = CheckboxIsWeapon.Checked; + } + + private void CheckboxIsEquip_CheckedChanged(object sender, EventArgs e) + { + ComboEquip.Enabled = CheckboxIsEquip.Checked; + } + + private void CheckboxIsPurchasable_CheckedChanged(object sender, EventArgs e) + { + TextPrice.Enabled = CheckboxIsPurchasable.Checked; + } + + private void CheckboxIsSellable_CheckedChanged(object sender, EventArgs e) + { + DateTimePickerSell.Enabled = !CheckboxIsSellable.Checked; + } + + private void CheckboxIsTradable_CheckedChanged(object sender, EventArgs e) + { + DateTimePickerTrade.Enabled = !CheckboxIsTradable.Checked; + } + } +} diff --git a/Desktop/Solutions/ShowDetail.resx b/Desktop/Solutions/EntityCreator/CreateItem.resx similarity index 100% rename from Desktop/Solutions/ShowDetail.resx rename to Desktop/Solutions/EntityCreator/CreateItem.resx diff --git a/Desktop/Solutions/EntityCreator/CreateSkill.Designer.cs b/Desktop/Solutions/EntityCreator/CreateSkill.Designer.cs new file mode 100644 index 0000000..9f3624c --- /dev/null +++ b/Desktop/Solutions/EntityCreator/CreateSkill.Designer.cs @@ -0,0 +1,171 @@ +namespace Milimoe.FunGame.Testing.Desktop.Solutions +{ + partial class CreateSkill + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + TipName = new Label(); + TextID = new TextBox(); + TextName = new TextBox(); + TipID = new Label(); + BtnCreate = new Button(); + TextCode = new TextBox(); + LabelCode = new Label(); + TipSkillType = new Label(); + ComboSkillType = new ComboBox(); + SuspendLayout(); + // + // TipName + // + TipName.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + TipName.Font = new Font("等线", 14.25F, FontStyle.Regular, GraphicsUnit.Point, 134); + TipName.Location = new Point(78, 95); + TipName.Name = "TipName"; + TipName.Size = new Size(129, 27); + TipName.TabIndex = 0; + TipName.Text = "技能名称"; + TipName.TextAlign = ContentAlignment.MiddleCenter; + // + // TextID + // + TextID.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + TextID.Font = new Font("等线", 14.25F); + TextID.Location = new Point(213, 45); + TextID.Name = "TextID"; + TextID.Size = new Size(201, 27); + TextID.TabIndex = 0; + TextID.WordWrap = false; + // + // TextName + // + TextName.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + TextName.Font = new Font("等线", 14.25F); + TextName.Location = new Point(213, 95); + TextName.Name = "TextName"; + TextName.Size = new Size(201, 27); + TextName.TabIndex = 1; + TextName.WordWrap = false; + // + // TipID + // + TipID.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + TipID.Font = new Font("等线", 14.25F, FontStyle.Regular, GraphicsUnit.Point, 134); + TipID.Location = new Point(78, 45); + TipID.Name = "TipID"; + TipID.Size = new Size(129, 27); + TipID.TabIndex = 2; + TipID.Text = "技能编号"; + TipID.TextAlign = ContentAlignment.MiddleCenter; + // + // BtnCreate + // + BtnCreate.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + BtnCreate.Font = new Font("等线", 14.25F, FontStyle.Regular, GraphicsUnit.Point, 134); + BtnCreate.Location = new Point(420, 216); + BtnCreate.Name = "BtnCreate"; + BtnCreate.Size = new Size(103, 45); + BtnCreate.TabIndex = 4; + BtnCreate.Text = "创建"; + BtnCreate.UseVisualStyleBackColor = true; + BtnCreate.Click += BtnCreate_Click; + // + // TextCode + // + TextCode.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + TextCode.Font = new Font("等线", 14.25F); + TextCode.Location = new Point(199, 226); + TextCode.Name = "TextCode"; + TextCode.Size = new Size(215, 27); + TextCode.TabIndex = 3; + TextCode.WordWrap = false; + // + // LabelCode + // + LabelCode.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + LabelCode.Font = new Font("等线", 14.25F, FontStyle.Regular, GraphicsUnit.Point, 134); + LabelCode.Location = new Point(23, 226); + LabelCode.Name = "LabelCode"; + LabelCode.Size = new Size(170, 27); + LabelCode.TabIndex = 34; + LabelCode.Text = "代号(存档标识)"; + LabelCode.TextAlign = ContentAlignment.MiddleCenter; + // + // TipSkillType + // + TipSkillType.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + TipSkillType.Font = new Font("等线", 14.25F, FontStyle.Regular, GraphicsUnit.Point, 134); + TipSkillType.Location = new Point(78, 145); + TipSkillType.Name = "TipSkillType"; + TipSkillType.Size = new Size(129, 27); + TipSkillType.TabIndex = 35; + TipSkillType.Text = "技能类型"; + TipSkillType.TextAlign = ContentAlignment.MiddleCenter; + // + // ComboSkillType + // + ComboSkillType.Font = new Font("Microsoft YaHei UI", 14.25F, FontStyle.Regular, GraphicsUnit.Point, 134); + ComboSkillType.FormattingEnabled = true; + ComboSkillType.Items.AddRange(new object[] { "魔法", "战技", "爆发技", "被动", "物品" }); + ComboSkillType.Location = new Point(213, 141); + ComboSkillType.Name = "ComboSkillType"; + ComboSkillType.Size = new Size(201, 33); + ComboSkillType.TabIndex = 57; + // + // CreateSkill + // + AutoScaleDimensions = new SizeF(7F, 17F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(535, 273); + Controls.Add(ComboSkillType); + Controls.Add(TipSkillType); + Controls.Add(TextCode); + Controls.Add(LabelCode); + Controls.Add(BtnCreate); + Controls.Add(TextName); + Controls.Add(TipID); + Controls.Add(TextID); + Controls.Add(TipName); + Name = "CreateSkill"; + StartPosition = FormStartPosition.CenterScreen; + Text = "技能创建器"; + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private Label TipName; + private TextBox TextID; + private TextBox TextName; + private Label TipID; + private Button BtnCreate; + private TextBox TextCode; + private Label LabelCode; + private Label TipSkillType; + private ComboBox ComboSkillType; + } +} \ No newline at end of file diff --git a/Desktop/Solutions/EntityCreator/CreateSkill.cs b/Desktop/Solutions/EntityCreator/CreateSkill.cs new file mode 100644 index 0000000..c7b608f --- /dev/null +++ b/Desktop/Solutions/EntityCreator/CreateSkill.cs @@ -0,0 +1,104 @@ +using Milimoe.FunGame.Core.Api.Utility; +using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Library.Constant; + +namespace Milimoe.FunGame.Testing.Desktop.Solutions +{ + public partial class CreateSkill : Form + { + private SkillCreator SkillCreator { get; } + private Skill? EditSkill { get; } + + public CreateSkill(SkillCreator creator, Skill? skill = null) + { + InitializeComponent(); + SkillCreator = creator; + if (skill != null) + { + Text = "技能编辑器"; + BtnCreate.Text = "编辑"; + EditSkill = skill; + TextID.Text = skill.Id.ToString(); + TextCode.Text = creator.LoadedSkills.Where(kv => kv.Value.Equals(skill)).Select(kv => kv.Key).FirstOrDefault() ?? ""; + TextName.Text = skill.Name; + ComboSkillType.Text = SkillSet.GetSkillTypeName(skill.SkillType); + } + } + + private void BtnCreate_Click(object sender, EventArgs e) + { + Skill s; + if (EditSkill != null) + { + s = EditSkill; + } + else + { + s = Factory.GetSkill(); + } + string name; + + if (TextID.Text.Trim() != "" && long.TryParse(TextID.Text.Trim(), out long id)) + { + s.Id = id; + } + else + { + MessageBox.Show("ID不能为空。"); + return; + } + + if (TextName.Text.Trim() != "") + { + s.Name = TextName.Text.Trim(); + } + else + { + MessageBox.Show("名称不能为空。"); + return; + } + + if (TextCode.Text.Trim() != "") + { + name = TextCode.Text.Trim(); + } + else + { + MessageBox.Show("技能存档标识不能为空。"); + return; + } + + if (EditSkill != null) + { + MessageBox.Show("保存成功!"); + Dispose(); + return; + } + else + { + if (SkillCreator.Add(name, s)) + { + ShowDetail d = new(null, SkillCreator, null); + d.SetText(-1, s, s.ToString()); + d.Text = "预览模式"; + d.ShowDialog(); + d.Dispose(); + if (MessageBox.Show("添加成功!是否继续添加?", "提示", MessageBoxButtons.YesNo) == DialogResult.No) + { + Dispose(); + return; + } + } + else + { + MessageBox.Show("添加失败!"); + } + } + + TextID.Text = ""; + TextCode.Text = ""; + TextName.Text = ""; + ComboSkillType.Text = ""; + } + } +} diff --git a/Desktop/Solutions/Showlist.resx b/Desktop/Solutions/EntityCreator/CreateSkill.resx similarity index 100% rename from Desktop/Solutions/Showlist.resx rename to Desktop/Solutions/EntityCreator/CreateSkill.resx diff --git a/Desktop/Solutions/EntityCreator.Designer.cs b/Desktop/Solutions/EntityCreator/EntityCreator.Designer.cs similarity index 82% rename from Desktop/Solutions/EntityCreator.Designer.cs rename to Desktop/Solutions/EntityCreator/EntityCreator.Designer.cs index 494e187..7722432 100644 --- a/Desktop/Solutions/EntityCreator.Designer.cs +++ b/Desktop/Solutions/EntityCreator/EntityCreator.Designer.cs @@ -46,13 +46,15 @@ 为角色添加技能 = new Button(); 为角色添加物品 = new Button(); 重新读取全部 = new Button(); + 删除角色物品 = new Button(); + 删除角色技能 = new Button(); 列表.SuspendLayout(); SuspendLayout(); // // 查看现有角色 // 查看现有角色.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; - 查看现有角色.Location = new Point(460, 103); + 查看现有角色.Location = new Point(460, 22); 查看现有角色.Name = "查看现有角色"; 查看现有角色.Size = new Size(98, 35); 查看现有角色.TabIndex = 0; @@ -63,10 +65,10 @@ // 查看现有技能 // 查看现有技能.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; - 查看现有技能.Location = new Point(460, 144); + 查看现有技能.Location = new Point(460, 63); 查看现有技能.Name = "查看现有技能"; 查看现有技能.Size = new Size(98, 35); - 查看现有技能.TabIndex = 1; + 查看现有技能.TabIndex = 2; 查看现有技能.Text = "查看现有技能"; 查看现有技能.UseVisualStyleBackColor = true; 查看现有技能.Click += 查看现有技能_Click; @@ -74,10 +76,10 @@ // 查看现有物品 // 查看现有物品.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; - 查看现有物品.Location = new Point(460, 185); + 查看现有物品.Location = new Point(460, 104); 查看现有物品.Name = "查看现有物品"; 查看现有物品.Size = new Size(98, 35); - 查看现有物品.TabIndex = 2; + 查看现有物品.TabIndex = 4; 查看现有物品.Text = "查看现有物品"; 查看现有物品.UseVisualStyleBackColor = true; 查看现有物品.Click += 查看现有物品_Click; @@ -88,7 +90,7 @@ 创建角色.Location = new Point(564, 226); 创建角色.Name = "创建角色"; 创建角色.Size = new Size(98, 35); - 创建角色.TabIndex = 3; + 创建角色.TabIndex = 9; 创建角色.Text = "创建角色"; 创建角色.UseVisualStyleBackColor = true; 创建角色.Click += 创建角色_Click; @@ -99,7 +101,7 @@ 创建技能.Location = new Point(564, 267); 创建技能.Name = "创建技能"; 创建技能.Size = new Size(98, 35); - 创建技能.TabIndex = 4; + 创建技能.TabIndex = 11; 创建技能.Text = "创建技能"; 创建技能.UseVisualStyleBackColor = true; 创建技能.Click += 创建技能_Click; @@ -110,7 +112,7 @@ 创建物品.Location = new Point(564, 308); 创建物品.Name = "创建物品"; 创建物品.Size = new Size(98, 35); - 创建物品.TabIndex = 5; + 创建物品.TabIndex = 13; 创建物品.Text = "创建物品"; 创建物品.UseVisualStyleBackColor = true; 创建物品.Click += 创建物品_Click; @@ -121,7 +123,7 @@ 删除物品.Location = new Point(460, 308); 删除物品.Name = "删除物品"; 删除物品.Size = new Size(98, 35); - 删除物品.TabIndex = 8; + 删除物品.TabIndex = 12; 删除物品.Text = "删除物品"; 删除物品.UseVisualStyleBackColor = true; 删除物品.Click += 删除物品_Click; @@ -132,7 +134,7 @@ 删除技能.Location = new Point(460, 267); 删除技能.Name = "删除技能"; 删除技能.Size = new Size(98, 35); - 删除技能.TabIndex = 7; + 删除技能.TabIndex = 10; 删除技能.Text = "删除技能"; 删除技能.UseVisualStyleBackColor = true; 删除技能.Click += 删除技能_Click; @@ -143,7 +145,7 @@ 删除角色.Location = new Point(460, 226); 删除角色.Name = "删除角色"; 删除角色.Size = new Size(98, 35); - 删除角色.TabIndex = 6; + 删除角色.TabIndex = 8; 删除角色.Text = "删除角色"; 删除角色.UseVisualStyleBackColor = true; 删除角色.Click += 删除角色_Click; @@ -175,7 +177,7 @@ 全部保存.Location = new Point(460, 349); 全部保存.Name = "全部保存"; 全部保存.Size = new Size(98, 35); - 全部保存.TabIndex = 12; + 全部保存.TabIndex = 14; 全部保存.Text = "全部保存"; 全部保存.UseVisualStyleBackColor = true; 全部保存.Click += 全部保存_Click; @@ -186,7 +188,7 @@ 保存角色.Location = new Point(564, 349); 保存角色.Name = "保存角色"; 保存角色.Size = new Size(98, 35); - 保存角色.TabIndex = 11; + 保存角色.TabIndex = 15; 保存角色.Text = "保存角色"; 保存角色.UseVisualStyleBackColor = true; 保存角色.Click += 保存角色_Click; @@ -197,7 +199,7 @@ 保存技能.Location = new Point(460, 390); 保存技能.Name = "保存技能"; 保存技能.Size = new Size(98, 35); - 保存技能.TabIndex = 10; + 保存技能.TabIndex = 16; 保存技能.Text = "保存技能"; 保存技能.UseVisualStyleBackColor = true; 保存技能.Click += 保存技能_Click; @@ -208,7 +210,7 @@ 保存物品.Location = new Point(564, 390); 保存物品.Name = "保存物品"; 保存物品.Size = new Size(98, 35); - 保存物品.TabIndex = 13; + 保存物品.TabIndex = 17; 保存物品.Text = "保存物品"; 保存物品.UseVisualStyleBackColor = true; 保存物品.Click += 保存物品_Click; @@ -217,10 +219,10 @@ // 为角色添加技能.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; 为角色添加技能.Font = new Font("Microsoft YaHei UI", 8F); - 为角色添加技能.Location = new Point(564, 103); + 为角色添加技能.Location = new Point(564, 22); 为角色添加技能.Name = "为角色添加技能"; 为角色添加技能.Size = new Size(98, 35); - 为角色添加技能.TabIndex = 14; + 为角色添加技能.TabIndex = 1; 为角色添加技能.Text = "为角色添加技能"; 为角色添加技能.UseVisualStyleBackColor = true; 为角色添加技能.Click += 为角色添加技能_Click; @@ -229,10 +231,10 @@ // 为角色添加物品.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; 为角色添加物品.Font = new Font("Microsoft YaHei UI", 8F); - 为角色添加物品.Location = new Point(564, 144); + 为角色添加物品.Location = new Point(564, 63); 为角色添加物品.Name = "为角色添加物品"; 为角色添加物品.Size = new Size(98, 35); - 为角色添加物品.TabIndex = 15; + 为角色添加物品.TabIndex = 3; 为角色添加物品.Text = "为角色添加物品"; 为角色添加物品.UseVisualStyleBackColor = true; 为角色添加物品.Click += 为角色添加物品_Click; @@ -244,16 +246,42 @@ 重新读取全部.Location = new Point(564, 185); 重新读取全部.Name = "重新读取全部"; 重新读取全部.Size = new Size(98, 35); - 重新读取全部.TabIndex = 16; + 重新读取全部.TabIndex = 7; 重新读取全部.Text = "重新读取全部"; 重新读取全部.UseVisualStyleBackColor = true; 重新读取全部.Click += 重新读取全部_Click; // + // 删除角色物品 + // + 删除角色物品.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + 删除角色物品.Font = new Font("Microsoft YaHei UI", 8F); + 删除角色物品.Location = new Point(564, 145); + 删除角色物品.Name = "删除角色物品"; + 删除角色物品.Size = new Size(98, 35); + 删除角色物品.TabIndex = 6; + 删除角色物品.Text = "删除角色物品"; + 删除角色物品.UseVisualStyleBackColor = true; + 删除角色物品.Click += 删除角色物品_Click; + // + // 删除角色技能 + // + 删除角色技能.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + 删除角色技能.Font = new Font("Microsoft YaHei UI", 8F); + 删除角色技能.Location = new Point(564, 104); + 删除角色技能.Name = "删除角色技能"; + 删除角色技能.Size = new Size(98, 35); + 删除角色技能.TabIndex = 5; + 删除角色技能.Text = "删除角色技能"; + 删除角色技能.UseVisualStyleBackColor = true; + 删除角色技能.Click += 删除角色技能_Click; + // // EntityCreator // AutoScaleDimensions = new SizeF(7F, 17F); AutoScaleMode = AutoScaleMode.Font; ClientSize = new Size(674, 437); + Controls.Add(删除角色物品); + Controls.Add(删除角色技能); Controls.Add(重新读取全部); Controls.Add(为角色添加物品); Controls.Add(为角色添加技能); @@ -272,6 +300,7 @@ Controls.Add(查看现有技能); Controls.Add(查看现有角色); Name = "EntityCreator"; + StartPosition = FormStartPosition.CenterScreen; Text = "实体创建器"; 列表.ResumeLayout(false); ResumeLayout(false); @@ -297,5 +326,7 @@ private Button 为角色添加技能; private Button 为角色添加物品; private Button 重新读取全部; + private Button 删除角色物品; + private Button 删除角色技能; } } \ No newline at end of file diff --git a/Desktop/Solutions/EntityCreator/EntityCreator.cs b/Desktop/Solutions/EntityCreator/EntityCreator.cs new file mode 100644 index 0000000..055f79b --- /dev/null +++ b/Desktop/Solutions/EntityCreator/EntityCreator.cs @@ -0,0 +1,440 @@ +using Microsoft.VisualBasic; +using Milimoe.FunGame.Core.Api.Utility; +using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Library.Common.Addon; +using Milimoe.FunGame.Core.Library.Constant; + +namespace Milimoe.FunGame.Testing.Desktop.Solutions +{ + public partial class EntityCreator : Form + { + private static GameModuleLoader? GameModuleLoader { get; set; } = null; + private CharacterCreator CharacterCreator { get; } = new(); + private SkillCreator SkillCreator { get; } = new(); + private ItemCreator ItemCreator { get; } = new(); + private bool CheckSelectedIndex => 实际列表.SelectedIndex != -1 && 实际列表.SelectedIndex < 实际列表.Items.Count; + private int nowClick = 0; + + public EntityCreator() + { + InitializeComponent(); + GameModuleLoader = LoadModules(); + CharacterCreator.Load(); + SkillCreator.Load(); + ItemCreator.Load(); + 查看现有技能方法(); + 查看现有物品方法(); + 查看现有角色方法(); + } + + private void 查看现有角色方法() + { + 实际列表.Items.Clear(); + foreach (string name in CharacterCreator.LoadedCharacters.Keys) + { + 实际列表.Items.Add(CharacterCreator.LoadedCharacters[name]); + } + nowClick = 0; + } + + private void 查看现有技能方法() + { + 实际列表.Items.Clear(); + foreach (string name in SkillCreator.LoadedSkills.OrderBy(kv => kv.Value.Id).Select(kv => kv.Key)) + { + 实际列表.Items.Add(GetSkillDisplayName(SkillCreator, name)); + } + nowClick = 1; + } + + private void 查看现有物品方法() + { + 实际列表.Items.Clear(); + foreach (string name in ItemCreator.LoadedItems.OrderBy(kv => kv.Value.Id).Select(kv => kv.Key)) + { + 实际列表.Items.Add(GetItemDisplayName(ItemCreator, name)); + } + nowClick = 2; + } + + private void 查看现有角色_Click(object sender, EventArgs e) + { + if (nowClick != 0) + { + 查看现有角色方法(); + } + } + + private void 查看现有技能_Click(object sender, EventArgs e) + { + if (nowClick != 1) + { + 查看现有技能方法(); + } + } + + private void 查看现有物品_Click(object sender, EventArgs e) + { + if (nowClick != 2) + { + 查看现有物品方法(); + } + } + + private void 全部保存_Click(object sender, EventArgs e) + { + CharacterCreator.Save(); + SkillCreator.Save(); + ItemCreator.Save(); + MessageBox.Show("保存成功!"); + } + + private void 保存角色_Click(object sender, EventArgs e) + { + CharacterCreator.Save(); + MessageBox.Show("保存成功!"); + } + + private void 保存技能_Click(object sender, EventArgs e) + { + SkillCreator.Save(); + MessageBox.Show("保存成功!"); + } + + private void 保存物品_Click(object sender, EventArgs e) + { + ItemCreator.Save(); + MessageBox.Show("保存成功!"); + } + + public static Skill? 从模组加载器中获取技能(long id, string name, SkillType type) + { + if (GameModuleLoader != null) + { + foreach (SkillModule module in GameModuleLoader.Skills.Values) + { + Skill? s = module.GetSkill(id, name, type); + if (s != null) + { + return s; + } + } + } + return null; + } + + public static Item? 从模组加载器中获取物品(long id, string name, ItemType type) + { + if (GameModuleLoader != null) + { + foreach (ItemModule module in GameModuleLoader.Items.Values) + { + Item? i = module.GetItem(id, name, type); + if (i != null) + { + return i; + } + } + } + return null; + } + + private void 实际列表_MouseDoubleClick(object sender, EventArgs e) + { + if (CheckSelectedIndex) + { + ShowDetail d = new(CharacterCreator, SkillCreator, ItemCreator); + switch (nowClick) + { + case 0: + Character? character = CharacterCreator.LoadedCharacters.Values.Where(c => c.ToString() == 实际列表.Items[实际列表.SelectedIndex].ToString()).FirstOrDefault(); + d.SetText(nowClick, character, character?.GetInfo() ?? ""); + d.ShowDialog(); + break; + case 1: + Skill? s = SkillCreator.LoadedSkills.Where(kv => GetSkillDisplayName(SkillCreator, kv.Key) == 实际列表.Items[实际列表.SelectedIndex].ToString()).Select(kv => kv.Value).FirstOrDefault(); + if (s != null) + { + Skill? s2 = 从模组加载器中获取技能(s.Id, s.Name, s.SkillType); + if (s2 != null) + { + s = s2; + } + d.SetText(nowClick, s, s.ToString() ?? ""); + d.ShowDialog(); + } + break; + case 2: + Item? i = ItemCreator.LoadedItems.Where(kv => GetItemDisplayName(ItemCreator, kv.Key) == 实际列表.Items[实际列表.SelectedIndex].ToString()).Select(kv => kv.Value).FirstOrDefault(); + if (i != null) + { + Item? i2 = 从模组加载器中获取物品(i.Id, i.Name, i.ItemType); + if (i2 != null) + { + i.SetPropertyToItemModuleNew(i2); + i = i2; + } + d.SetText(nowClick, i, i.ToString() ?? ""); + d.ShowDialog(); + } + break; + default: + break; + } + d.Dispose(); + } + } + + private void 为角色添加技能方法() + { + if (SkillCreator.LoadedSkills.Count != 0) + { + ShowList l = new(); + l.AddListItem(SkillCreator.LoadedSkills.OrderBy(kv => kv.Value.Id).Where(kv => kv.Value.SkillType != SkillType.Item).Select(kv => GetSkillDisplayName(SkillCreator, kv.Key)).ToArray()); + l.ShowDialog(); + string selected = l.SelectItem; + Character? c = CharacterCreator.LoadedCharacters.Values.Where(c => c.ToString() == 实际列表.Items[实际列表.SelectedIndex].ToString()).FirstOrDefault(); + Skill? s = SkillCreator.LoadedSkills.Where(kv => GetSkillDisplayName(SkillCreator, kv.Key) == selected).Select(kv => kv.Value).FirstOrDefault(); + if (c != null && s != null) + { + Skill? s2 = 从模组加载器中获取技能(s.Id, s.Name, s.SkillType); + if (s2 != null) + { + s = s2; + } + s.Character = c; + c.Skills.Add(s); + } + } + else + { + MessageBox.Show("技能列表为空!"); + } + } + + private void 为角色添加物品方法() + { + if (ItemCreator.LoadedItems.Count != 0) + { + ShowList l = new(); + l.AddListItem(ItemCreator.LoadedItems.OrderBy(kv => kv.Value.Id).Select(kv => GetItemDisplayName(ItemCreator, kv.Key)).ToArray()); + l.ShowDialog(); + string selected = l.SelectItem; + Character? c = CharacterCreator.LoadedCharacters.Values.Where(c => c.ToString() == 实际列表.Items[实际列表.SelectedIndex].ToString()).FirstOrDefault(); + Item? i = ItemCreator.LoadedItems.Where(kv => GetItemDisplayName(ItemCreator, kv.Key) == selected).Select(kv => kv.Value).FirstOrDefault(); + if (c != null && i != null) + { + Item? i2 = 从模组加载器中获取物品(i.Id, i.Name, i.ItemType); + if (i2 != null) + { + i.SetPropertyToItemModuleNew(i2); + i = i2; + } + c.Equip(i); + } + } + else + { + MessageBox.Show("物品列表为空!"); + } + } + + private void 删除角色技能方法() + { + Character? c = CharacterCreator.LoadedCharacters.Values.Where(c => c.ToString() == 实际列表.Items[实际列表.SelectedIndex].ToString()).FirstOrDefault(); + if (c != null) + { + if (c.Skills.Count != 0) + { + ShowList l = new(); + l.AddListItem(c.Skills.Select(s => s.GetIdName()).ToArray()); + l.ShowDialog(); + string selected = l.SelectItem; + Skill? s = c.Skills.Where(s => s.GetIdName() == selected).FirstOrDefault(); + if (s != null) c.Skills.Remove(s); + } + else + { + MessageBox.Show("技能列表为空!"); + } + } + } + + private void 删除角色物品方法() + { + Character? c = CharacterCreator.LoadedCharacters.Values.Where(c => c.ToString() == 实际列表.Items[实际列表.SelectedIndex].ToString()).FirstOrDefault(); + if (c != null) + { + if (c.Items.Count != 0) + { + ShowList l = new(); + l.AddListItem(c.Items.Select(s => s.GetIdName()).ToArray()); + l.ShowDialog(); + string selected = l.SelectItem; + Item? i = c.Items.Where(i => i.GetIdName() == selected).FirstOrDefault(); + if (i != null) + { + c.UnEquip(c.EquipSlot.GetEquipItemToSlot(i)); + } + } + else + { + MessageBox.Show("物品列表为空!"); + } + } + } + + private void 为角色添加技能_Click(object sender, EventArgs e) + { + if (CheckSelectedIndex && nowClick == 0) + { + 为角色添加技能方法(); + } + } + + private void 为角色添加物品_Click(object sender, EventArgs e) + { + if (CheckSelectedIndex && nowClick == 0) + { + 为角色添加物品方法(); + } + } + + private void 删除角色技能_Click(object sender, EventArgs e) + { + if (CheckSelectedIndex && nowClick == 0) + { + 删除角色技能方法(); + } + } + + private void 删除角色物品_Click(object sender, EventArgs e) + { + if (CheckSelectedIndex && nowClick == 0) + { + 删除角色物品方法(); + } + } + + private void 创建角色_Click(object sender, EventArgs e) + { + CharacterCreator.OpenCreator(); + 查看现有角色方法(); + } + + private void 创建技能_Click(object sender, EventArgs e) + { + SkillCreator.OpenCreator(); + 查看现有技能方法(); + } + + private void 创建物品_Click(object sender, EventArgs e) + { + ItemCreator.OpenCreator(); + 查看现有物品方法(); + } + + private void 删除角色_Click(object sender, EventArgs e) + { + if (CheckSelectedIndex && nowClick == 0 && MessageBox.Show("是否删除", "删除", MessageBoxButtons.YesNo) == DialogResult.Yes) + { + string name = CharacterCreator.LoadedCharacters.Where(ky => ky.Value.ToString() == 实际列表.Items[实际列表.SelectedIndex].ToString()).FirstOrDefault().Key ?? ""; + if (CharacterCreator.Remove(name)) + { + MessageBox.Show("删除成功!"); + 查看现有角色方法(); + } + else + { + MessageBox.Show("删除失败!"); + } + } + } + + private void 删除技能_Click(object sender, EventArgs e) + { + if (CheckSelectedIndex && nowClick == 1 && MessageBox.Show("是否删除", "删除", MessageBoxButtons.YesNo) == DialogResult.Yes) + { + string name = SkillCreator.LoadedSkills.Where(kv => GetSkillDisplayName(SkillCreator, kv.Key) == 实际列表.Items[实际列表.SelectedIndex].ToString()).FirstOrDefault().Key ?? ""; + if (SkillCreator.Remove(name)) + { + MessageBox.Show("删除成功!"); + 查看现有技能方法(); + } + else + { + MessageBox.Show("删除失败!"); + } + } + } + + private void 删除物品_Click(object sender, EventArgs e) + { + if (CheckSelectedIndex && nowClick == 2 && MessageBox.Show("是否删除", "删除", MessageBoxButtons.YesNo) == DialogResult.Yes) + { + string name = ItemCreator.LoadedItems.Where(kv => GetItemDisplayName(ItemCreator, kv.Key) == 实际列表.Items[实际列表.SelectedIndex].ToString()).FirstOrDefault().Key ?? ""; + if (ItemCreator.Remove(name)) + { + MessageBox.Show("删除成功!"); + 查看现有物品方法(); + } + else + { + MessageBox.Show("删除失败!"); + } + } + } + + private void 重新读取全部_Click(object sender, EventArgs e) + { + if (MessageBox.Show("重新读取会丢失未保存的数据,是否确认重新读取全部?", "重新读取全部", MessageBoxButtons.YesNo) == DialogResult.Yes) + { + CharacterCreator.Load(); + SkillCreator.Load(); + ItemCreator.Load(); + 查看现有技能方法(); + 查看现有物品方法(); + 查看现有角色方法(); + } + } + + public static string GetSkillDisplayName(SkillCreator skillCreator, string name) + { + if (skillCreator.LoadedSkills.TryGetValue(name, out Skill? skill) && skill != null) + { + return $"[ {name} ] {skill.GetIdName()}"; + } + return ""; + } + + public static string GetItemDisplayName(ItemCreator itemCreator, string name) + { + if (itemCreator.LoadedItems.TryGetValue(name, out Item? item) && item != null) + { + return $"[ {name} ] {item.GetIdName()}"; + } + return ""; + } + + private static ItemType SelectItemType() + { + ShowList l = new(); + l.AddListItem([ItemType.MagicCardPack, ItemType.Weapon, ItemType.Armor, ItemType.Shoes, ItemType.Accessory, + ItemType.Consumable, ItemType.MagicCard, ItemType.Collectible, ItemType.SpecialItem, ItemType.QuestItem, ItemType.GiftBox, ItemType.Others]); + l.Text = "选择一个物品类型"; + l.ShowDialog(); + return Enum.TryParse(l.SelectItem, out ItemType type) ? type : ItemType.Others; + } + + private static GameModuleLoader LoadModules() + { + PluginLoader plugins = PluginLoader.LoadPlugins([]); + foreach (string plugin in plugins.Plugins.Keys) + { + Console.WriteLine(plugin + " is loaded."); + } + + return GameModuleLoader.LoadGameModules(FunGameInfo.FunGame.FunGame_Desktop, []); + } + } +} diff --git a/Desktop/Solutions/EntityCreator/EntityCreator.resx b/Desktop/Solutions/EntityCreator/EntityCreator.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/Desktop/Solutions/EntityCreator/EntityCreator.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Desktop/Solutions/ItemCreator.cs b/Desktop/Solutions/EntityCreator/ItemCreator.cs similarity index 71% rename from Desktop/Solutions/ItemCreator.cs rename to Desktop/Solutions/EntityCreator/ItemCreator.cs index 376de6e..115a8f8 100644 --- a/Desktop/Solutions/ItemCreator.cs +++ b/Desktop/Solutions/EntityCreator/ItemCreator.cs @@ -9,7 +9,7 @@ namespace Milimoe.FunGame.Testing.Desktop.Solutions public void Load() { - EntityModuleConfig config = new("redbud.fun.entitycreator", "itemcreator"); + EntityModuleConfig config = new("EntityCreator", "item.creator"); config.LoadConfig(); LoadedItems = new(config); } @@ -26,12 +26,18 @@ namespace Milimoe.FunGame.Testing.Desktop.Solutions public void Save() { - EntityModuleConfig config = new("redbud.fun.entitycreator", "itemcreator"); + EntityModuleConfig config = new("EntityCreator", "item.creator"); foreach (string key in LoadedItems.Keys) { config.Add(key, LoadedItems[key]); } config.SaveConfig(); } + + public void OpenCreator(Item? item = null) + { + CreateItem creator = new(this, item); + creator.ShowDialog(); + } } } diff --git a/Desktop/Solutions/EntityCreator/ShowDetail.Designer.cs b/Desktop/Solutions/EntityCreator/ShowDetail.Designer.cs new file mode 100644 index 0000000..3cd3e80 --- /dev/null +++ b/Desktop/Solutions/EntityCreator/ShowDetail.Designer.cs @@ -0,0 +1,130 @@ +namespace Milimoe.FunGame.Testing.Desktop.Solutions +{ + partial class ShowDetail + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + 详细内容 = new RichTextBox(); + 编辑 = new Button(); + 加技能 = new Button(); + 加物品 = new Button(); + 删物品 = new Button(); + 删技能 = new Button(); + SuspendLayout(); + // + // richTextBox1 + // + 详细内容.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; + 详细内容.Location = new Point(12, 12); + 详细内容.Name = "richTextBox1"; + 详细内容.ReadOnly = true; + 详细内容.Size = new Size(584, 513); + 详细内容.TabIndex = 0; + 详细内容.Text = ""; + // + // 编辑 + // + 编辑.Font = new Font("等线", 18F, FontStyle.Regular, GraphicsUnit.Point, 134); + 编辑.Location = new Point(602, 456); + 编辑.Name = "编辑"; + 编辑.Size = new Size(89, 69); + 编辑.TabIndex = 1; + 编辑.Text = "编辑"; + 编辑.UseVisualStyleBackColor = true; + 编辑.Click += 编辑_Click; + // + // 加技能 + // + 加技能.Font = new Font("等线", 15F, FontStyle.Regular, GraphicsUnit.Point, 134); + 加技能.Location = new Point(602, 306); + 加技能.Name = "加技能"; + 加技能.Size = new Size(89, 69); + 加技能.TabIndex = 2; + 加技能.Text = "加技能"; + 加技能.UseVisualStyleBackColor = true; + 加技能.Click += 加技能_Click; + // + // 加物品 + // + 加物品.Font = new Font("等线", 15F, FontStyle.Regular, GraphicsUnit.Point, 134); + 加物品.Location = new Point(602, 381); + 加物品.Name = "加物品"; + 加物品.Size = new Size(89, 69); + 加物品.TabIndex = 3; + 加物品.Text = "加物品"; + 加物品.UseVisualStyleBackColor = true; + 加物品.Click += 加物品_Click; + // + // 删物品 + // + 删物品.Font = new Font("等线", 15F, FontStyle.Regular, GraphicsUnit.Point, 134); + 删物品.Location = new Point(602, 231); + 删物品.Name = "删物品"; + 删物品.Size = new Size(89, 69); + 删物品.TabIndex = 5; + 删物品.Text = "删物品"; + 删物品.UseVisualStyleBackColor = true; + 删物品.Click += 删物品_Click; + // + // 删技能 + // + 删技能.Font = new Font("等线", 15F, FontStyle.Regular, GraphicsUnit.Point, 134); + 删技能.Location = new Point(602, 156); + 删技能.Name = "删技能"; + 删技能.Size = new Size(89, 69); + 删技能.TabIndex = 4; + 删技能.Text = "删技能"; + 删技能.UseVisualStyleBackColor = true; + 删技能.Click += 删技能_Click; + // + // ShowDetail + // + AutoScaleDimensions = new SizeF(7F, 17F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(697, 537); + Controls.Add(删物品); + Controls.Add(删技能); + Controls.Add(加物品); + Controls.Add(加技能); + Controls.Add(编辑); + Controls.Add(详细内容); + Name = "ShowDetail"; + StartPosition = FormStartPosition.CenterScreen; + Text = "ShowDetail"; + ResumeLayout(false); + } + + #endregion + + private RichTextBox 详细内容; + private Button 编辑; + private Button 加技能; + private Button 加物品; + private Button 删物品; + private Button 删技能; + } +} \ No newline at end of file diff --git a/Desktop/Solutions/EntityCreator/ShowDetail.cs b/Desktop/Solutions/EntityCreator/ShowDetail.cs new file mode 100644 index 0000000..99ec046 --- /dev/null +++ b/Desktop/Solutions/EntityCreator/ShowDetail.cs @@ -0,0 +1,199 @@ +using Milimoe.FunGame.Core.Entity; + +namespace Milimoe.FunGame.Testing.Desktop.Solutions +{ + public partial class ShowDetail : Form + { + private CharacterCreator? CharacterCreator { get; } + private SkillCreator? SkillCreator { get; } + private ItemCreator? ItemCreator { get; } + private int NowClick { get; set; } = -1; + private BaseEntity? BaseEntity { get; set; } + + public ShowDetail(CharacterCreator? characterCreator, SkillCreator? skillCreator, ItemCreator? itemCreator) + { + InitializeComponent(); + CharacterCreator = characterCreator; + SkillCreator = skillCreator; + ItemCreator = itemCreator; + Text = "详细信息查看"; + } + + public void SetText(int nowClick, BaseEntity? entity, string text) + { + NowClick = nowClick; + BaseEntity = entity; + if (nowClick == 0) + { + 删技能.Enabled = true; + 删物品.Enabled = true; + 加技能.Enabled = true; + 加物品.Enabled = true; + 编辑.Enabled = true; + } + else if (nowClick == 1) + { + 删技能.Enabled = false; + 删物品.Enabled = false; + 加技能.Enabled = false; + 加物品.Enabled = false; + 编辑.Enabled = true; + } + else if (nowClick == 2) + { + 删技能.Enabled = true; + 删物品.Enabled = false; + 加技能.Enabled = true; + 加物品.Enabled = false; + 编辑.Enabled = true; + } + else + { + 删技能.Enabled = false; + 删物品.Enabled = false; + 加技能.Enabled = false; + 加物品.Enabled = false; + 编辑.Enabled = false; + } + 详细内容.Text = text; + } + + private void 编辑_Click(object sender, EventArgs e) + { + if (NowClick == 0 && BaseEntity is Character c) + { + CharacterCreator?.OpenCreator(c); + } + else if (NowClick == 1 && BaseEntity is Skill s) + { + SkillCreator?.OpenCreator(s); + } + else if (NowClick == 2 && BaseEntity is Item i) + { + ItemCreator?.OpenCreator(i); + } + } + + private void 加物品_Click(object sender, EventArgs e) + { + if (NowClick == 0 && ItemCreator != null && BaseEntity is Character c) + { + if (ItemCreator.LoadedItems.Count != 0) + { + ShowList l = new(); + l.AddListItem(ItemCreator.LoadedItems.OrderBy(kv => kv.Value.Id).Select(kv => EntityCreator.GetItemDisplayName(ItemCreator, kv.Key)).ToArray()); + l.ShowDialog(); + string selected = l.SelectItem; + Item? i = ItemCreator.LoadedItems.Where(kv => EntityCreator.GetItemDisplayName(ItemCreator, kv.Key) == selected).Select(kv => kv.Value).FirstOrDefault(); + if (c != null && i != null) + { + Item? i2 = EntityCreator.从模组加载器中获取物品(i.Id, i.Name, i.ItemType); + if (i2 != null) + { + i.SetPropertyToItemModuleNew(i2); + i = i2; + } + c.Equip(i); + 详细内容.Text = c.GetInfo(); + } + } + else + { + MessageBox.Show("物品列表为空!"); + } + } + } + + private void 加技能_Click(object sender, EventArgs e) + { + if (NowClick == 0 && SkillCreator != null && BaseEntity is Character c) + { + if (SkillCreator.LoadedSkills.Count != 0) + { + ShowList l = new(); + l.AddListItem(SkillCreator.LoadedSkills.OrderBy(kv => kv.Value.Id).Where(kv => kv.Value.SkillType != Core.Library.Constant.SkillType.Item).Select(kv => EntityCreator.GetSkillDisplayName(SkillCreator, kv.Key)).ToArray()); + l.ShowDialog(); + string selected = l.SelectItem; + Skill? s = SkillCreator.LoadedSkills.Where(kv => EntityCreator.GetSkillDisplayName(SkillCreator, kv.Key) == selected).Select(kv => kv.Value).FirstOrDefault(); + if (c != null && s != null) + { + Skill? s2 = EntityCreator.从模组加载器中获取技能(s.Id, s.Name, s.SkillType); + if (s2 != null) + { + s = s2; + } + s.Character = c; + c.Skills.Add(s); + 详细内容.Text = c.GetInfo(); + } + } + else + { + MessageBox.Show("技能列表为空!"); + } + } + else if (NowClick == 2) + { + MessageBox.Show("再说吧,暂不支持。"); + } + } + + private void 删物品_Click(object sender, EventArgs e) + { + if (NowClick == 0 && BaseEntity is Character c) + { + if (c != null) + { + if (c.Items.Count != 0) + { + ShowList l = new(); + l.AddListItem(c.Items.OrderBy(i => i.Id).Select(i => i.GetIdName()).ToArray()); + l.ShowDialog(); + string selected = l.SelectItem; + Item? i = c.Items.Where(i => i.GetIdName() == selected).FirstOrDefault(); + if (i != null) + { + c.UnEquip(c.EquipSlot.GetEquipItemToSlot(i)); + 详细内容.Text = c.GetInfo(); + } + } + else + { + MessageBox.Show("物品列表为空!"); + } + } + } + } + + private void 删技能_Click(object sender, EventArgs e) + { + if (NowClick == 0 && BaseEntity is Character c) + { + if (c != null) + { + if (c.Skills.Count != 0) + { + ShowList l = new(); + l.AddListItem(c.Skills.OrderBy(s => s.Id).Select(s => s.GetIdName()).ToArray()); + l.ShowDialog(); + string selected = l.SelectItem; + Skill? s = c.Skills.Where(s => s.GetIdName() == selected).FirstOrDefault(); + if (s != null) + { + c.Skills.Remove(s); + 详细内容.Text = c.GetInfo(); + } + } + else + { + MessageBox.Show("技能列表为空!"); + } + } + } + else if (NowClick == 2) + { + MessageBox.Show("再说吧,暂不支持。"); + } + } + } +} diff --git a/Desktop/Solutions/EntityCreator/ShowDetail.resx b/Desktop/Solutions/EntityCreator/ShowDetail.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/Desktop/Solutions/EntityCreator/ShowDetail.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Desktop/Solutions/Showlist.Designer.cs b/Desktop/Solutions/EntityCreator/ShowList.Designer.cs similarity index 92% rename from Desktop/Solutions/Showlist.Designer.cs rename to Desktop/Solutions/EntityCreator/ShowList.Designer.cs index 4d60293..9ebf597 100644 --- a/Desktop/Solutions/Showlist.Designer.cs +++ b/Desktop/Solutions/EntityCreator/ShowList.Designer.cs @@ -1,6 +1,6 @@ namespace Milimoe.FunGame.Testing.Desktop.Solutions { - partial class Showlist + partial class ShowList { /// /// Required designer variable. @@ -48,8 +48,9 @@ AutoScaleMode = AutoScaleMode.Font; ClientSize = new Size(508, 450); Controls.Add(选择表); - Name = "Showlist"; - Text = "Showlist"; + Name = "ShowList"; + Text = "ShowList"; + StartPosition = FormStartPosition.CenterScreen; ResumeLayout(false); } diff --git a/Desktop/Solutions/Showlist.cs b/Desktop/Solutions/EntityCreator/ShowList.cs similarity index 82% rename from Desktop/Solutions/Showlist.cs rename to Desktop/Solutions/EntityCreator/ShowList.cs index ac10e31..2f753bd 100644 --- a/Desktop/Solutions/Showlist.cs +++ b/Desktop/Solutions/EntityCreator/ShowList.cs @@ -1,12 +1,13 @@ namespace Milimoe.FunGame.Testing.Desktop.Solutions { - public partial class Showlist : Form + public partial class ShowList : Form { public string SelectItem { get; set; } = ""; - public Showlist() + public ShowList() { InitializeComponent(); + Text = "双击选择一项"; } public void AddListItem(object[] items) diff --git a/Desktop/Solutions/EntityCreator/ShowList.resx b/Desktop/Solutions/EntityCreator/ShowList.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/Desktop/Solutions/EntityCreator/ShowList.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Desktop/Solutions/SkillCreator.cs b/Desktop/Solutions/EntityCreator/SkillCreator.cs similarity index 71% rename from Desktop/Solutions/SkillCreator.cs rename to Desktop/Solutions/EntityCreator/SkillCreator.cs index b31e6c7..cc6f487 100644 --- a/Desktop/Solutions/SkillCreator.cs +++ b/Desktop/Solutions/EntityCreator/SkillCreator.cs @@ -9,7 +9,7 @@ namespace Milimoe.FunGame.Testing.Desktop.Solutions public void Load() { - EntityModuleConfig config = new("redbud.fun.entitycreator", "skillcreator"); + EntityModuleConfig config = new("EntityCreator", "skill.creator"); config.LoadConfig(); LoadedSkills = new(config); } @@ -26,12 +26,18 @@ namespace Milimoe.FunGame.Testing.Desktop.Solutions public void Save() { - EntityModuleConfig config = new("redbud.fun.entitycreator", "skillcreator"); + EntityModuleConfig config = new("EntityCreator", "skill.creator"); foreach (string key in LoadedSkills.Keys) { config.Add(key, LoadedSkills[key]); } config.SaveConfig(); } + + public void OpenCreator(Skill? skill = null) + { + CreateSkill creator = new(this, skill); + creator.ShowDialog(); + } } } diff --git a/Desktop/Solutions/ShowDetail.Designer.cs b/Desktop/Solutions/ShowDetail.Designer.cs deleted file mode 100644 index 34dd5b8..0000000 --- a/Desktop/Solutions/ShowDetail.Designer.cs +++ /dev/null @@ -1,59 +0,0 @@ -namespace Milimoe.FunGame.Testing.Desktop.Solutions -{ - partial class ShowDetail - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - richTextBox1 = new RichTextBox(); - SuspendLayout(); - // - // richTextBox1 - // - richTextBox1.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; - richTextBox1.Location = new Point(12, 12); - richTextBox1.Name = "richTextBox1"; - richTextBox1.ReadOnly = true; - richTextBox1.Size = new Size(622, 453); - richTextBox1.TabIndex = 0; - richTextBox1.Text = ""; - // - // ShowDetail - // - AutoScaleDimensions = new SizeF(7F, 17F); - AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(646, 477); - Controls.Add(richTextBox1); - Name = "ShowDetail"; - Text = "ShowDetail"; - ResumeLayout(false); - } - - #endregion - - private RichTextBox richTextBox1; - } -} \ No newline at end of file diff --git a/Desktop/Solutions/ShowDetail.cs b/Desktop/Solutions/ShowDetail.cs deleted file mode 100644 index 07187fd..0000000 --- a/Desktop/Solutions/ShowDetail.cs +++ /dev/null @@ -1,15 +0,0 @@ -namespace Milimoe.FunGame.Testing.Desktop.Solutions -{ - public partial class ShowDetail : Form - { - public ShowDetail() - { - InitializeComponent(); - } - - public void SetText(string text) - { - richTextBox1.Text = text; - } - } -} diff --git a/Library/Effects/ItemEffects/冷却缩减加成.cs b/Library/Effects/ItemEffects/冷却缩减加成.cs index ce8155b..ac4d6c1 100644 --- a/Library/Effects/ItemEffects/冷却缩减加成.cs +++ b/Library/Effects/ItemEffects/冷却缩减加成.cs @@ -7,11 +7,11 @@ namespace Milimoe.FunGame.Testing.Effects { public override long Id => Skill.Id; public override string Name => Skill.Name; - public override string Description => $"增加角色 {实际冷却缩减加成 * 100:0.##}% 冷却缩减。" + (!TargetSelf ? $"来自:[ {Source} ] 的 [ {Item.Name} ]" : ""); + public override string Description => $"增加角色 {实际冷却缩减加成 * 100:0.##}% 冷却缩减。" + (!TargetSelf ? $"来自:[ {Source} ]" + (Item != null ? $" 的 [ {Item.Name} ]" : "") : ""); public override EffectType EffectType => EffectType.Item; public override bool TargetSelf => true; - public Item Item { get; } + public Item? Item { get; } private readonly double 实际冷却缩减加成 = 0; public override void OnEffectGained(Character character) @@ -24,7 +24,7 @@ namespace Milimoe.FunGame.Testing.Effects character.ExCDR -= 实际冷却缩减加成; } - public 冷却缩减加成(Skill skill, Character? source, Item item, double exCdr) : base(skill) + public 冷却缩减加成(Skill skill, Character? source, Item? item, double exCdr) : base(skill) { ActionQueue = skill.ActionQueue; Source = source; diff --git a/Library/Effects/ItemEffects/技能硬直时间减少.cs b/Library/Effects/ItemEffects/技能硬直时间减少.cs index 1a33ed3..59a11d0 100644 --- a/Library/Effects/ItemEffects/技能硬直时间减少.cs +++ b/Library/Effects/ItemEffects/技能硬直时间减少.cs @@ -8,11 +8,11 @@ namespace Milimoe.FunGame.Testing.Effects { public override long Id => Skill.Id; public override string Name => Skill.Name; - public override string Description => $"减少角色的所有主动技能 {实际硬直时间减少} 硬直时间。" + (!TargetSelf ? $"来自:[ {Source} ] 的 [ {Item.Name} ]" : ""); + public override string Description => $"减少角色的所有主动技能 {实际硬直时间减少} 硬直时间。" + (!TargetSelf ? $"来自:[ {Source} ]" + (Item != null ? $" 的 [ {Item.Name} ]" : "") : ""); public override EffectType EffectType => EffectType.Item; public override bool TargetSelf => true; - public Item Item { get; } + public Item? Item { get; } private readonly double 实际硬直时间减少 = 2; public override void OnEffectGained(Character character) @@ -41,7 +41,7 @@ namespace Milimoe.FunGame.Testing.Effects } } - public 技能硬直时间减少(Skill skill, Character? source, Item item, double reduce) : base(skill) + public 技能硬直时间减少(Skill skill, Character? source, Item? item, double reduce) : base(skill) { ActionQueue = skill.ActionQueue; Source = source; diff --git a/Library/Effects/ItemEffects/攻击力加成.cs b/Library/Effects/ItemEffects/攻击力加成.cs index d625d0e..d0e8b7c 100644 --- a/Library/Effects/ItemEffects/攻击力加成.cs +++ b/Library/Effects/ItemEffects/攻击力加成.cs @@ -7,11 +7,11 @@ namespace Milimoe.FunGame.Testing.Effects { public override long Id => Skill.Id; public override string Name => Skill.Name; - public override string Description => $"增加角色 {实际攻击力加成} 点攻击力。" + (!TargetSelf ? $"来自:[ {Source} ] 的 [ {Item.Name} ]" : ""); + public override string Description => $"增加角色 {实际攻击力加成} 点攻击力。" + (!TargetSelf ? $"来自:[ {Source} ]" + (Item != null ? $" 的 [ {Item.Name} ]" : "") : ""); public override EffectType EffectType => EffectType.Item; public override bool TargetSelf => true; - public Item Item { get; } + public Item? Item { get; } private readonly double 实际攻击力加成 = 0; public override void OnEffectGained(Character character) @@ -24,7 +24,7 @@ namespace Milimoe.FunGame.Testing.Effects character.ExATK2 -= 实际攻击力加成; } - public 攻击力加成(Skill skill, Character? source, Item item, double exATK) : base(skill) + public 攻击力加成(Skill skill, Character? source, Item? item, double exATK) : base(skill) { ActionQueue = skill.ActionQueue; Source = source; diff --git a/Library/Effects/ItemEffects/普攻硬直时间减少.cs b/Library/Effects/ItemEffects/普攻硬直时间减少.cs index fe5f96a..5c1e2e1 100644 --- a/Library/Effects/ItemEffects/普攻硬直时间减少.cs +++ b/Library/Effects/ItemEffects/普攻硬直时间减少.cs @@ -8,11 +8,11 @@ namespace Milimoe.FunGame.Testing.Effects { public override long Id => Skill.Id; public override string Name => Skill.Name; - public override string Description => $"减少角色的普通攻击 {实际硬直时间减少} 硬直时间。" + (!TargetSelf ? $"来自:[ {Source} ] 的 [ {Item.Name} ]" : ""); + public override string Description => $"减少角色的普通攻击 {实际硬直时间减少} 硬直时间。" + (!TargetSelf ? $"来自:[ {Source} ]" + (Item != null ? $" 的 [ {Item.Name} ]" : "") : ""); public override EffectType EffectType => EffectType.Item; public override bool TargetSelf => true; - public Item Item { get; } + public Item? Item { get; } private readonly double 实际硬直时间减少 = 2; public override void OnEffectGained(Character character) @@ -25,7 +25,7 @@ namespace Milimoe.FunGame.Testing.Effects character.NormalAttack.HardnessTime = Calculation.Round2Digits(character.NormalAttack.HardnessTime + 实际硬直时间减少); ; } - public 普攻硬直时间减少(Skill skill, Character? source, Item item, double reduce) : base(skill) + public 普攻硬直时间减少(Skill skill, Character? source, Item? item, double reduce) : base(skill) { ActionQueue = skill.ActionQueue; Source = source; diff --git a/Library/Effects/ItemEffects/物理护甲加成.cs b/Library/Effects/ItemEffects/物理护甲加成.cs index e6e4947..84c520e 100644 --- a/Library/Effects/ItemEffects/物理护甲加成.cs +++ b/Library/Effects/ItemEffects/物理护甲加成.cs @@ -7,11 +7,11 @@ namespace Milimoe.FunGame.Testing.Effects { public override long Id => Skill.Id; public override string Name => Skill.Name; - public override string Description => $"增加角色 {实际物理护甲加成} 点物理护甲。" + (!TargetSelf ? $"来自:[ {Source} ] 的 [ {Item.Name} ]" : ""); + public override string Description => $"增加角色 {实际物理护甲加成} 点物理护甲。" + (!TargetSelf ? $"来自:[ {Source} ]" + (Item != null ? $" 的 [ {Item.Name} ]" : "") : ""); public override EffectType EffectType => EffectType.Item; public override bool TargetSelf => true; - public Item Item { get; } + public Item? Item { get; } private readonly double 实际物理护甲加成 = 0; public override void OnEffectGained(Character character) @@ -24,7 +24,7 @@ namespace Milimoe.FunGame.Testing.Effects character.ExDEF2 -= 实际物理护甲加成; } - public 物理护甲加成(Skill skill, Character? source, Item item, double exDef) : base(skill) + public 物理护甲加成(Skill skill, Character? source, Item? item, double exDef) : base(skill) { ActionQueue = skill.ActionQueue; Source = source; diff --git a/Library/Items/Accessory/攻击之爪.cs b/Library/Items/Accessory/攻击之爪.cs index da4ec1e..170f2b7 100644 --- a/Library/Items/Accessory/攻击之爪.cs +++ b/Library/Items/Accessory/攻击之爪.cs @@ -1,12 +1,13 @@ using Milimoe.FunGame.Testing.Effects; using Milimoe.FunGame.Core.Entity; using Milimoe.FunGame.Core.Library.Constant; +using Milimoe.FunGame.Testing.Skills; namespace Milimoe.FunGame.Testing.Items { public class 攻击之爪10 : Item { - public override long Id => 14001; + public override long Id => (long)AccessoryID.攻击之爪10; public override string Name => "攻击之爪 +10"; public override string Description => Skills.Passives.Count > 0 ? Skills.Passives.First().Description : ""; @@ -18,6 +19,7 @@ namespace Milimoe.FunGame.Testing.Items public class 攻击之爪30 : Item { + public override long Id => (long)AccessoryID.攻击之爪30; public override string Name => "攻击之爪 +30"; public override string Description => Skills.Passives.Count > 0 ? Skills.Passives.First().Description : ""; @@ -29,6 +31,7 @@ namespace Milimoe.FunGame.Testing.Items public class 攻击之爪50 : Item { + public override long Id => (long)AccessoryID.攻击之爪50; public override string Name => "攻击之爪 +50"; public override string Description => Skills.Passives.Count > 0 ? Skills.Passives.First().Description : ""; @@ -40,12 +43,12 @@ namespace Milimoe.FunGame.Testing.Items public class 攻击之爪技能 : Skill { - public override long Id => 5001; + public override long Id => (long)ItemPassiveID.攻击之爪; public override string Name => "攻击之爪"; public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; - public Item Item { get; } + public Item? Item { get; } - public 攻击之爪技能(Character? character, Item item, double exATK) : base(SkillType.Passive, character) + public 攻击之爪技能(Character? character = null, Item? item = null, double exATK = 0) : base(SkillType.Passive, character) { Level = 1; Item = item; diff --git a/Library/Items/ItemID.cs b/Library/Items/ItemID.cs new file mode 100644 index 0000000..980ede9 --- /dev/null +++ b/Library/Items/ItemID.cs @@ -0,0 +1,9 @@ +namespace Milimoe.FunGame.Testing.Items +{ + public enum AccessoryID : long + { + 攻击之爪10 = 14001, + 攻击之爪30 = 14002, + 攻击之爪50 = 14003, + } +} diff --git a/Library/Skills/ColdBlue/嗜血本能.cs b/Library/Skills/ColdBlue/嗜血本能.cs index 9681eb9..13d8133 100644 --- a/Library/Skills/ColdBlue/嗜血本能.cs +++ b/Library/Skills/ColdBlue/嗜血本能.cs @@ -7,14 +7,14 @@ namespace Milimoe.FunGame.Testing.Skills { public class 嗜血本能 : Skill { - public override long Id => 3010; + public override long Id => (long)SuperSkillID.嗜血本能; public override string Name => "嗜血本能"; public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; public override double EPCost => 100; public override double CD => 42 - 1 * (Level - 1); public override double HardnessTime { get; set; } = 12; - public 嗜血本能(Character character) : base(SkillType.SuperSkill, character) + public 嗜血本能(Character? character = null) : base(SkillType.SuperSkill, character) { Effects.Add(new 嗜血本能特效(this)); } diff --git a/Library/Skills/ColdBlue/累积之压.cs b/Library/Skills/ColdBlue/累积之压.cs index cf64549..eab67cc 100644 --- a/Library/Skills/ColdBlue/累积之压.cs +++ b/Library/Skills/ColdBlue/累积之压.cs @@ -7,11 +7,11 @@ namespace Milimoe.FunGame.Testing.Skills { public class 累积之压 : Skill { - public override long Id => 4010; + public override long Id => (long)PassiveID.累积之压; public override string Name => "累积之压"; public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; - public 累积之压(Character character) : base(SkillType.Passive, character) + public 累积之压(Character? character = null) : base(SkillType.Passive, character) { Effects.Add(new 累积之压特效(this)); } diff --git a/Library/Skills/Mayor/精准打击.cs b/Library/Skills/Mayor/精准打击.cs index 2f591ec..ac2aff7 100644 --- a/Library/Skills/Mayor/精准打击.cs +++ b/Library/Skills/Mayor/精准打击.cs @@ -6,14 +6,14 @@ namespace Milimoe.FunGame.Testing.Skills { public class 精准打击 : Skill { - public override long Id => 3006; + public override long Id => (long)SuperSkillID.精准打击; public override string Name => "精准打击"; public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; public override double EPCost => 100; public override double CD => 40 - 1 * (Level - 1); public override double HardnessTime { get; set; } = 8; - public 精准打击(Character character) : base(SkillType.SuperSkill, character) + public 精准打击(Character? character = null) : base(SkillType.SuperSkill, character) { Effects.Add(new 精准打击特效(this)); } diff --git a/Library/Skills/Mayor/致命打击.cs b/Library/Skills/Mayor/致命打击.cs index 129d292..f5a8fc4 100644 --- a/Library/Skills/Mayor/致命打击.cs +++ b/Library/Skills/Mayor/致命打击.cs @@ -5,11 +5,11 @@ namespace Milimoe.FunGame.Testing.Skills { public class 致命打击 : Skill { - public override long Id => 4006; + public override long Id => (long)PassiveID.致命打击; public override string Name => "致命打击"; public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; - public 致命打击(Character character) : base(SkillType.Passive, character) + public 致命打击(Character? character = null) : base(SkillType.Passive, character) { Effects.Add(new 致命打击特效(this)); } diff --git a/Library/Skills/NanGanyu/三重叠加.cs b/Library/Skills/NanGanyu/三重叠加.cs index c99aeb5..d2bf8dc 100644 --- a/Library/Skills/NanGanyu/三重叠加.cs +++ b/Library/Skills/NanGanyu/三重叠加.cs @@ -5,14 +5,14 @@ namespace Milimoe.FunGame.Testing.Skills { public class 三重叠加 : Skill { - public override long Id => 3004; + public override long Id => (long)SuperSkillID.三重叠加; public override string Name => "三重叠加"; public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; public override double EPCost => 100; public override double CD => 35 - 2 * (Level - 1); public override double HardnessTime { get; set; } = 10; - public 三重叠加(Character character) : base(SkillType.SuperSkill, character) + public 三重叠加(Character? character = null) : base(SkillType.SuperSkill, character) { Effects.Add(new 三重叠加特效(this)); } diff --git a/Library/Skills/NanGanyu/灵能反射.cs b/Library/Skills/NanGanyu/灵能反射.cs index 5ad32f0..ac7bb56 100644 --- a/Library/Skills/NanGanyu/灵能反射.cs +++ b/Library/Skills/NanGanyu/灵能反射.cs @@ -6,11 +6,11 @@ namespace Milimoe.FunGame.Testing.Skills { public class 灵能反射 : Skill { - public override long Id => 4004; + public override long Id => (long)PassiveID.灵能反射; public override string Name => "灵能反射"; public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; - public 灵能反射(Character character) : base(SkillType.Passive, character) + public 灵能反射(Character? character = null) : base(SkillType.Passive, character) { Effects.Add(new 灵能反射特效(this)); } diff --git a/Library/Skills/NiuNan/变幻之心.cs b/Library/Skills/NiuNan/变幻之心.cs index ef81568..3e8f8e4 100644 --- a/Library/Skills/NiuNan/变幻之心.cs +++ b/Library/Skills/NiuNan/变幻之心.cs @@ -6,14 +6,14 @@ namespace Milimoe.FunGame.Testing.Skills { public class 变幻之心 : Skill { - public override long Id => 3005; + public override long Id => (long)SuperSkillID.变幻之心; public override string Name => "变幻之心"; public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; public override double EPCost => 100; public override double CD => 30; public override double HardnessTime { get; set; } = 10; - public 变幻之心(Character character) : base(SkillType.SuperSkill, character) + public 变幻之心(Character? character = null) : base(SkillType.SuperSkill, character) { Effects.Add(new 变幻之心特效(this)); } diff --git a/Library/Skills/NiuNan/智慧与力量.cs b/Library/Skills/NiuNan/智慧与力量.cs index b507681..0d5925a 100644 --- a/Library/Skills/NiuNan/智慧与力量.cs +++ b/Library/Skills/NiuNan/智慧与力量.cs @@ -5,11 +5,11 @@ namespace Milimoe.FunGame.Testing.Skills { public class 智慧与力量 : Skill { - public override long Id => 4005; + public override long Id => (long)PassiveID.智慧与力量; public override string Name => "智慧与力量"; public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; - public 智慧与力量(Character character) : base(SkillType.Passive, character) + public 智慧与力量(Character? character = null) : base(SkillType.Passive, character) { Effects.Add(new 智慧与力量特效(this)); } diff --git a/Library/Skills/Oshima/META马.cs b/Library/Skills/Oshima/META马.cs index 27560fa..2a3082f 100644 --- a/Library/Skills/Oshima/META马.cs +++ b/Library/Skills/Oshima/META马.cs @@ -6,11 +6,11 @@ namespace Milimoe.FunGame.Testing.Skills { public class META马 : Skill { - public override long Id => 4001; + public override long Id => (long)PassiveID.META马; public override string Name => "META马"; public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; - public META马(Character character) : base(SkillType.Passive, character) + public META马(Character? character = null) : base(SkillType.Passive, character) { Effects.Add(new META马特效(this)); } diff --git a/Library/Skills/Oshima/力量爆发.cs b/Library/Skills/Oshima/力量爆发.cs index 34bf69e..6a79569 100644 --- a/Library/Skills/Oshima/力量爆发.cs +++ b/Library/Skills/Oshima/力量爆发.cs @@ -6,14 +6,14 @@ namespace Milimoe.FunGame.Testing.Skills { public class 力量爆发 : Skill { - public override long Id => 3002; + public override long Id => (long)SuperSkillID.力量爆发; public override string Name => "力量爆发"; public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; public override double EPCost => 100; public override double CD => 55; public override double HardnessTime { get; set; } = 0; - public 力量爆发(Character character) : base(SkillType.SuperSkill, character) + public 力量爆发(Character? character = null) : base(SkillType.SuperSkill, character) { Effects.Add(new 力量爆发特效(this)); } diff --git a/Library/Skills/QWQAQW/玻璃大炮.cs b/Library/Skills/QWQAQW/玻璃大炮.cs index 03cc86c..1688971 100644 --- a/Library/Skills/QWQAQW/玻璃大炮.cs +++ b/Library/Skills/QWQAQW/玻璃大炮.cs @@ -6,11 +6,11 @@ namespace Milimoe.FunGame.Testing.Skills { public class 玻璃大炮 : Skill { - public override long Id => 4009; + public override long Id => (long)PassiveID.玻璃大炮; public override string Name => "玻璃大炮"; public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; - public 玻璃大炮(Character character) : base(SkillType.Passive, character) + public 玻璃大炮(Character? character = null) : base(SkillType.Passive, character) { Effects.Add(new 玻璃大炮特效(this)); } diff --git a/Library/Skills/QWQAQW/迅捷之势.cs b/Library/Skills/QWQAQW/迅捷之势.cs index d4f2b65..81234fa 100644 --- a/Library/Skills/QWQAQW/迅捷之势.cs +++ b/Library/Skills/QWQAQW/迅捷之势.cs @@ -6,14 +6,14 @@ namespace Milimoe.FunGame.Testing.Skills { public class 迅捷之势 : Skill { - public override long Id => 3009; + public override long Id => (long)SuperSkillID.迅捷之势; public override string Name => "迅捷之势"; public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; public override double EPCost => 100; public override double CD => 60 - 2 * (Level - 1); public override double HardnessTime { get; set; } = 15; - public 迅捷之势(Character character) : base(SkillType.SuperSkill, character) + public 迅捷之势(Character? character = null) : base(SkillType.SuperSkill, character) { Effects.Add(new 迅捷之势特效(this)); } diff --git a/Library/Skills/QingXiang/枯竭打击.cs b/Library/Skills/QingXiang/枯竭打击.cs index 28b414b..c1f9b86 100644 --- a/Library/Skills/QingXiang/枯竭打击.cs +++ b/Library/Skills/QingXiang/枯竭打击.cs @@ -6,11 +6,11 @@ namespace Milimoe.FunGame.Testing.Skills { public class 枯竭打击 : Skill { - public override long Id => 4008; + public override long Id => (long)PassiveID.枯竭打击; public override string Name => "枯竭打击"; public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; - public 枯竭打击(Character character) : base(SkillType.Passive, character) + public 枯竭打击(Character? character = null) : base(SkillType.Passive, character) { Effects.Add(new 枯竭打击特效(this)); } diff --git a/Library/Skills/QingXiang/能量毁灭.cs b/Library/Skills/QingXiang/能量毁灭.cs index e3eaf9f..7148b4a 100644 --- a/Library/Skills/QingXiang/能量毁灭.cs +++ b/Library/Skills/QingXiang/能量毁灭.cs @@ -6,14 +6,14 @@ namespace Milimoe.FunGame.Testing.Skills { public class 能量毁灭 : Skill { - public override long Id => 3008; + public override long Id => (long)SuperSkillID.能量毁灭; public override string Name => "能量毁灭"; public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; public override double EPCost => 100; public override double CD => 55 - 3 * (Level - 1); public override double HardnessTime { get; set; } = 25; - public 能量毁灭(Character character) : base(SkillType.SuperSkill, character) + public 能量毁灭(Character? character = null) : base(SkillType.SuperSkill, character) { Effects.Add(new 能量毁灭特效(this)); } diff --git a/Library/Skills/QuDuoduo/弱者猎手.cs b/Library/Skills/QuDuoduo/弱者猎手.cs index 955e1b8..44fbb97 100644 --- a/Library/Skills/QuDuoduo/弱者猎手.cs +++ b/Library/Skills/QuDuoduo/弱者猎手.cs @@ -6,11 +6,11 @@ namespace Milimoe.FunGame.Testing.Skills { public class 弱者猎手 : Skill { - public override long Id => 4012; + public override long Id => (long)PassiveID.弱者猎手; public override string Name => "弱者猎手"; public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; - public 弱者猎手(Character character) : base(SkillType.Passive, character) + public 弱者猎手(Character? character = null) : base(SkillType.Passive, character) { Effects.Add(new 弱者猎手特效(this)); } diff --git a/Library/Skills/QuDuoduo/血之狂欢.cs b/Library/Skills/QuDuoduo/血之狂欢.cs index d61bc88..3f8f941 100644 --- a/Library/Skills/QuDuoduo/血之狂欢.cs +++ b/Library/Skills/QuDuoduo/血之狂欢.cs @@ -7,14 +7,14 @@ namespace Milimoe.FunGame.Testing.Skills { public class 血之狂欢 : Skill { - public override long Id => 4012; + public override long Id => (long)SuperSkillID.血之狂欢; public override string Name => "血之狂欢"; public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; public override double EPCost => 100; public override double CD => 45; public override double HardnessTime { get; set; } = 7; - public 血之狂欢(Character character) : base(SkillType.SuperSkill, character) + public 血之狂欢(Character? character = null) : base(SkillType.SuperSkill, character) { Effects.Add(new 血之狂欢特效(this)); } diff --git a/Library/Skills/SkillID.cs b/Library/Skills/SkillID.cs new file mode 100644 index 0000000..a85d65a --- /dev/null +++ b/Library/Skills/SkillID.cs @@ -0,0 +1,54 @@ +namespace Milimoe.FunGame.Testing.Skills +{ + public enum MagicID : long + { + 冰霜攻击 = 1001, + } + + public enum SkillID : long + { + 疾风步 = 2001, + } + + public enum SuperSkillID : long + { + 力量爆发 = 3001, + 天赐之力 = 3002, + 魔法涌流 = 3003, + 三重叠加 = 3004, + 变幻之心 = 3005, + 精准打击 = 3006, + 绝对领域 = 3007, + 能量毁灭 = 3008, + 迅捷之势 = 3009, + 嗜血本能 = 3010, + 平衡强化 = 3011, + 血之狂欢 = 3012, + } + + public enum PassiveID : long + { + META马 = 4001, + 心灵之火 = 4002, + 魔法震荡 = 4003, + 灵能反射 = 4004, + 智慧与力量 = 4005, + 致命打击 = 4006, + 毁灭之势 = 4007, + 枯竭打击 = 4008, + 玻璃大炮 = 4009, + 累积之压 = 4010, + 敏捷之刃 = 4011, + 弱者猎手 = 4012, + } + + public enum ItemPassiveID : long + { + 攻击之爪 = 5001, + } + + public enum ItemActiveID : long + { + + } +} diff --git a/Library/Skills/XinYin/天赐之力.cs b/Library/Skills/XinYin/天赐之力.cs index 725cc29..258087f 100644 --- a/Library/Skills/XinYin/天赐之力.cs +++ b/Library/Skills/XinYin/天赐之力.cs @@ -6,14 +6,14 @@ namespace Milimoe.FunGame.Testing.Skills { public class 天赐之力 : Skill { - public override long Id => 3001; + public override long Id => (long)SuperSkillID.天赐之力; public override string Name => "天赐之力"; public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; public override double EPCost => 100; public override double CD => 60; public override double HardnessTime { get; set; } = 15; - public 天赐之力(Character character) : base(SkillType.SuperSkill, character) + public 天赐之力(Character? character = null) : base(SkillType.SuperSkill, character) { Effects.Add(new 天赐之力特效(this)); } diff --git a/Library/Skills/XinYin/心灵之火.cs b/Library/Skills/XinYin/心灵之火.cs index e52acba..e0a90eb 100644 --- a/Library/Skills/XinYin/心灵之火.cs +++ b/Library/Skills/XinYin/心灵之火.cs @@ -6,11 +6,11 @@ namespace Milimoe.FunGame.Testing.Skills { public class 心灵之火 : Skill { - public override long Id => 4002; + public override long Id => (long)PassiveID.心灵之火; public override string Name => "心灵之火"; public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; - public 心灵之火(Character character) : base(SkillType.Passive, character) + public 心灵之火(Character? character = null) : base(SkillType.Passive, character) { Effects.Add(new 心灵之火特效(this)); } diff --git a/Library/Skills/Yang/魔法涌流.cs b/Library/Skills/Yang/魔法涌流.cs index bc48260..b6639f5 100644 --- a/Library/Skills/Yang/魔法涌流.cs +++ b/Library/Skills/Yang/魔法涌流.cs @@ -6,14 +6,14 @@ namespace Milimoe.FunGame.Testing.Skills { public class 魔法涌流 : Skill { - public override long Id => 3003; + public override long Id => (long)SuperSkillID.魔法涌流; public override string Name => "魔法涌流"; public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; public override double EPCost => 100; public override double CD => 35; public override double HardnessTime { get; set; } = 10; - public 魔法涌流(Character character) : base(SkillType.SuperSkill, character) + public 魔法涌流(Character? character = null) : base(SkillType.SuperSkill, character) { Effects.Add(new 魔法涌流特效(this)); } diff --git a/Library/Skills/Yang/魔法震荡.cs b/Library/Skills/Yang/魔法震荡.cs index 3440af9..37ccfee 100644 --- a/Library/Skills/Yang/魔法震荡.cs +++ b/Library/Skills/Yang/魔法震荡.cs @@ -6,11 +6,11 @@ namespace Milimoe.FunGame.Testing.Skills { public class 魔法震荡 : Skill { - public override long Id => 4003; + public override long Id => (long)PassiveID.魔法震荡; public override string Name => "魔法震荡"; public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; - public 魔法震荡(Character character) : base(SkillType.Passive, character) + public 魔法震荡(Character? character = null) : base(SkillType.Passive, character) { Effects.Add(new 魔法震荡特效(this)); } diff --git a/Library/Skills/战技/疾风步.cs b/Library/Skills/战技/疾风步.cs index 61036f6..fb37cd1 100644 --- a/Library/Skills/战技/疾风步.cs +++ b/Library/Skills/战技/疾风步.cs @@ -6,14 +6,14 @@ namespace Milimoe.FunGame.Testing.Skills { public class 疾风步 : Skill { - public override long Id => 2001; + public override long Id => (long)SkillID.疾风步; public override string Name => "疾风步"; public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; public override double EPCost => 60; public override double CD => 35; public override double HardnessTime { get; set; } = 5; - public 疾风步(Character character) : base(SkillType.Skill, character) + public 疾风步(Character? character = null) : base(SkillType.Skill, character) { Effects.Add(new 疾风步特效(this)); } diff --git a/Library/Skills/绿拱门/平衡强化.cs b/Library/Skills/绿拱门/平衡强化.cs index f98e934..6e25ac1 100644 --- a/Library/Skills/绿拱门/平衡强化.cs +++ b/Library/Skills/绿拱门/平衡强化.cs @@ -5,14 +5,14 @@ namespace Milimoe.FunGame.Testing.Skills { public class 平衡强化 : Skill { - public override long Id => 4011; + public override long Id => (long)SuperSkillID.平衡强化; public override string Name => "平衡强化"; public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; public override double EPCost => 100; public override double CD => 55 - (1 * (Level - 1)); public override double HardnessTime { get; set; } = 12; - public 平衡强化(Character character) : base(SkillType.SuperSkill, character) + public 平衡强化(Character? character = null) : base(SkillType.SuperSkill, character) { Effects.Add(new 平衡强化特效(this)); } diff --git a/Library/Skills/绿拱门/敏捷之刃.cs b/Library/Skills/绿拱门/敏捷之刃.cs index c5b33a2..2aa9c8f 100644 --- a/Library/Skills/绿拱门/敏捷之刃.cs +++ b/Library/Skills/绿拱门/敏捷之刃.cs @@ -6,11 +6,11 @@ namespace Milimoe.FunGame.Testing.Skills { public class 敏捷之刃 : Skill { - public override long Id => 4011; + public override long Id => (long)PassiveID.敏捷之刃; public override string Name => "敏捷之刃"; public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; - public 敏捷之刃(Character character) : base(SkillType.Passive, character) + public 敏捷之刃(Character? character = null) : base(SkillType.Passive, character) { Effects.Add(new 敏捷之刃特效(this)); } diff --git a/Library/Skills/马猴烧酒/毁灭之势.cs b/Library/Skills/马猴烧酒/毁灭之势.cs index ce5afe8..c53eee4 100644 --- a/Library/Skills/马猴烧酒/毁灭之势.cs +++ b/Library/Skills/马猴烧酒/毁灭之势.cs @@ -6,11 +6,11 @@ namespace Milimoe.FunGame.Testing.Skills { public class 毁灭之势 : Skill { - public override long Id => 4007; + public override long Id => (long)PassiveID.毁灭之势; public override string Name => "毁灭之势"; public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; - public 毁灭之势(Character character) : base(SkillType.Passive, character) + public 毁灭之势(Character? character = null) : base(SkillType.Passive, character) { Effects.Add(new 毁灭之势特效(this)); } diff --git a/Library/Skills/马猴烧酒/绝对领域.cs b/Library/Skills/马猴烧酒/绝对领域.cs index 30efab8..1fa9d21 100644 --- a/Library/Skills/马猴烧酒/绝对领域.cs +++ b/Library/Skills/马猴烧酒/绝对领域.cs @@ -6,14 +6,14 @@ namespace Milimoe.FunGame.Testing.Skills { public class 绝对领域 : Skill { - public override long Id => 3007; + public override long Id => (long)SuperSkillID.绝对领域; public override string Name => "绝对领域"; public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; public override double EPCost => Math.Max(100, Character?.EP ?? 100); public override double CD => 32 + (1 * (Level - 1)); public override double HardnessTime { get; set; } = 12; - public 绝对领域(Character character) : base(SkillType.SuperSkill, character) + public 绝对领域(Character? character = null) : base(SkillType.SuperSkill, character) { Effects.Add(new 绝对领域特效(this)); } diff --git a/Library/Skills/魔法/冰霜攻击.cs b/Library/Skills/魔法/冰霜攻击.cs index 2256552..bd80d23 100644 --- a/Library/Skills/魔法/冰霜攻击.cs +++ b/Library/Skills/魔法/冰霜攻击.cs @@ -6,7 +6,7 @@ namespace Milimoe.FunGame.Testing.Skills { public class 冰霜攻击 : Skill { - public override long Id => 2001; + public override long Id => (long)MagicID.冰霜攻击; public override string Name => "冰霜攻击"; public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; public override double MPCost => 30 + (50 * (Level - 1)); @@ -14,7 +14,7 @@ namespace Milimoe.FunGame.Testing.Skills public override double CastTime => 6; public override double HardnessTime { get; set; } = 3; - public 冰霜攻击(Character character) : base(SkillType.Magic, character) + public 冰霜攻击(Character? character = null) : base(SkillType.Magic, character) { Effects.Add(new 冰霜攻击特效(this)); } diff --git a/Library/Solutions/TestModule.cs b/Library/Solutions/TestModule.cs index 03fc18a..066371c 100644 --- a/Library/Solutions/TestModule.cs +++ b/Library/Solutions/TestModule.cs @@ -1,6 +1,7 @@ using Milimoe.FunGame.Core.Api.Utility; using Milimoe.FunGame.Core.Entity; using Milimoe.FunGame.Core.Library.Common.Addon; +using Milimoe.FunGame.Core.Library.Constant; using Milimoe.FunGame.Testing.Items; using Milimoe.FunGame.Testing.Skills; @@ -49,47 +50,108 @@ namespace Addons { get { - Character c = Factory.GetCharacter(); - List list = []; - list.Add(new 冰霜攻击(c)); - list.Add(new 疾风步(c)); - list.Add(new META马(c)); - list.Add(new 力量爆发(c)); - list.Add(new 心灵之火(c)); - list.Add(new 天赐之力(c)); - list.Add(new 魔法震荡(c)); - list.Add(new 魔法涌流(c)); - list.Add(new 灵能反射(c)); - list.Add(new 三重叠加(c)); - list.Add(new 智慧与力量(c)); - list.Add(new 变幻之心(c)); - list.Add(new 致命打击(c)); - list.Add(new 精准打击(c)); - list.Add(new 毁灭之势(c)); - list.Add(new 绝对领域(c)); - list.Add(new 枯竭打击(c)); - list.Add(new 能量毁灭(c)); - list.Add(new 玻璃大炮(c)); - list.Add(new 迅捷之势(c)); - list.Add(new 累积之压(c)); - list.Add(new 嗜血本能(c)); - list.Add(new 敏捷之刃(c)); - list.Add(new 平衡强化(c)); - list.Add(new 弱者猎手(c)); - list.Add(new 血之狂欢(c)); - list.Add(new 冰霜攻击(c)); - list.Add(new 疾风步(c)); - return list; + EntityModuleConfig config = new(ExampleGameModuleConstant.Example, ExampleGameModuleConstant.ExampleSkill); + config.LoadConfig(); + foreach (string key in config.Keys) + { + Skill prev = config[key]; + Skill? next = GetSkill(prev.Id, prev.Name, prev.SkillType); + if (next != null) + { + config[key] = next; + } + } + return [.. config.Values]; } } - public override Skill? GetSkill(long id, string name) + public override Skill? GetSkill(long id, string name, SkillType type) { - string str = id + "." + name; - if (Skills.Where(s => s.GetIdName() == str).FirstOrDefault() is Skill s) + if (type == SkillType.Magic) { - return s; + switch ((MagicID)id) + { + case MagicID.冰霜攻击: + return new 冰霜攻击(); + } } + + if (type == SkillType.Skill) + { + switch ((SkillID)id) + { + case SkillID.疾风步: + return new 疾风步(); + } + } + + if (type == SkillType.SuperSkill) + { + switch ((SuperSkillID)id) + { + case SuperSkillID.力量爆发: + return new 力量爆发(); + case SuperSkillID.天赐之力: + return new 天赐之力(); + case SuperSkillID.魔法涌流: + return new 魔法涌流(); + case SuperSkillID.三重叠加: + return new 三重叠加(); + case SuperSkillID.变幻之心: + return new 变幻之心(); + case SuperSkillID.精准打击: + return new 精准打击(); + case SuperSkillID.绝对领域: + return new 绝对领域(); + case SuperSkillID.能量毁灭: + return new 能量毁灭(); + case SuperSkillID.迅捷之势: + return new 迅捷之势(); + case SuperSkillID.嗜血本能: + return new 嗜血本能(); + case SuperSkillID.平衡强化: + return new 平衡强化(); + case SuperSkillID.血之狂欢: + return new 血之狂欢(); + } + } + + if (type == SkillType.Passive) + { + switch ((PassiveID)id) + { + case PassiveID.META马: + return new META马(); + case PassiveID.心灵之火: + return new 心灵之火(); + case PassiveID.魔法震荡: + return new 魔法震荡(); + case PassiveID.灵能反射: + return new 灵能反射(); + case PassiveID.智慧与力量: + return new 智慧与力量(); + case PassiveID.致命打击: + return new 致命打击(); + case PassiveID.毁灭之势: + return new 毁灭之势(); + case PassiveID.枯竭打击: + return new 枯竭打击(); + case PassiveID.玻璃大炮: + return new 玻璃大炮(); + case PassiveID.累积之压: + return new 累积之压(); + case PassiveID.敏捷之刃: + return new 敏捷之刃(); + case PassiveID.弱者猎手: + return new 弱者猎手(); + } + switch ((ItemPassiveID)id) + { + case ItemPassiveID.攻击之爪: + return new 攻击之爪技能(); + } + } + return null; } } @@ -108,19 +170,42 @@ namespace Addons { get { - List list = []; - list.Add(new 攻击之爪50()); - return list; + EntityModuleConfig config = new(ExampleGameModuleConstant.Example, ExampleGameModuleConstant.ExampleItem); + config.LoadConfig(); + foreach (string key in config.Keys) + { + Item prev = config[key]; + Item? next = GetItem(prev.Id, prev.Name, prev.ItemType); + if (next != null) + { + prev.SetPropertyToItemModuleNew(next); + config[key] = next; + } + } + return [.. config.Values]; } } - public override Item? GetItem(long id, string name) + public override Item? GetItem(long id, string name, ItemType type) { - string str = id + "." + name; - if (Items.Where(s => s.GetIdName() == str).FirstOrDefault() is Item i) + if (type == ItemType.MagicCardPack) { - return i; + } + + if (type == ItemType.Accessory) + { + switch ((AccessoryID)id) + { + case AccessoryID.攻击之爪10: + return new 攻击之爪10(); + case AccessoryID.攻击之爪30: + return new 攻击之爪30(); + case AccessoryID.攻击之爪50: + return new 攻击之爪50(); + } + } + return null; } } diff --git a/Library/Solutions/TestPlugin.cs b/Library/Solutions/TestPlugin.cs index e1909ef..851d49e 100644 --- a/Library/Solutions/TestPlugin.cs +++ b/Library/Solutions/TestPlugin.cs @@ -78,6 +78,8 @@ namespace Addons EntityModuleConfig config3 = new(ExampleGameModuleConstant.Example, ExampleGameModuleConstant.ExampleItem) { + { "攻击之爪10", new 攻击之爪10() }, + { "攻击之爪30", new 攻击之爪30() }, { "攻击之爪50", new 攻击之爪50() } }; config3.SaveConfig(); diff --git a/Library/Tests/FunGame.cs b/Library/Tests/FunGame.cs index f28af28..7b3ae63 100644 --- a/Library/Tests/FunGame.cs +++ b/Library/Tests/FunGame.cs @@ -422,10 +422,10 @@ namespace Milimoe.FunGame.Testing.Tests Item[] 这次发放的空投; if (totalTime == 0) { - WriteLine("社区送温暖了,现在向所有人发放 [ 攻击之爪 +50 ]!!"); + WriteLine("社区送温暖了,现在向所有人发放 [ 攻击之爪 +10 ]!!"); foreach (Character character in queue.Queue) { - 这次发放的空投 = [new 攻击之爪50()]; + 这次发放的空投 = [new 攻击之爪10()]; foreach (Item item in 这次发放的空投) { queue.Equip(character, EquipItemToSlot.Accessory1, item);