/// <summary> /// 进阶需求扩展人物 /// </summary> public override void InitActor() { base.InitActor(); Actor mrf = new Actor() { Name = "慕容复" }; mrf.ActorStoryEvent += (story) => { LogHelper.WriteInfo("出卖王语嫣", action: Start, bgColor: ConsoleColor.Blue, fgColor: ConsoleColor.DarkCyan); }; mrf.ActorStoryEvent += (story) => { LogHelper.WriteInfo("复燕失败", action: Start, bgColor: ConsoleColor.Blue, fgColor: ConsoleColor.DarkCyan); }; ActorDic.Add(nameof(mrf), mrf); LoadJsonConfig(); }
/// <summary> /// 加载json配置文件 /// </summary> private void LoadJsonConfig() { var filePath = Path.Combine(EnvironmentArgument.JsonPath, "TLBB.json"); JsonHelper.ReadJsonFile <List <ActorInfo> >(filePath) .ForEach(actorInfo => { Actor actor = new Actor() { Name = actorInfo.Name }; actorInfo.StoryContent.ForEach((content) => { actor.ActorStoryEvent += (story) => { LogHelper.WriteInfo(content, action: Start, bgColor: ConsoleColor.Black, fgColor: actorInfo.Color); }; }); ActorDic.Add(actorInfo.Name, actor); }); }