OnOtherBuffApply/Remove监听
This commit is contained in:
@@ -8,7 +8,6 @@
|
||||
"GUID:8d9e84799a3968d4ba38c55892d14093",
|
||||
"GUID:75469ad4d38634e559750d17036d5f7c",
|
||||
"GUID:cf414061cae3a954baf92763590f3127",
|
||||
"GUID:84651a3751eca9349aac36a66bba901b",
|
||||
"GUID:6463cfac4956c284ba7542bd246502cc",
|
||||
"GUID:21b0c8d1703a94250bfac916590cea4f",
|
||||
"GUID:776d03a35f1b52c4a9aed9f56d7b4229",
|
||||
|
||||
@@ -26,6 +26,7 @@ namespace Continentis.MainGame
|
||||
|
||||
public class ContentSubmodule : BuffSubmodule
|
||||
{
|
||||
public string modClassName;
|
||||
public string displayName;
|
||||
public string originalFunctionText;
|
||||
public string interpretedFunctionText;
|
||||
@@ -38,7 +39,7 @@ namespace Continentis.MainGame
|
||||
/// <param name="willLocalizeFuncText">是否本地化功能描述文本,默认为true,设为false说明此Buff具有不止一条本地化文本,需要切换。</param>
|
||||
public ContentSubmodule(BuffBase<T> buff, bool willLocalizeFuncText = true) : base(buff)
|
||||
{
|
||||
string modClassName = ModManager.GetModClassName(buff.GetType());
|
||||
modClassName = ModManager.GetModClassName(buff.GetType());
|
||||
this.displayName = ("Buff_" + modClassName + "_DisplayName").Localize();
|
||||
|
||||
if (willLocalizeFuncText)
|
||||
@@ -90,7 +91,17 @@ namespace Continentis.MainGame
|
||||
this.iconID = iconID;
|
||||
}
|
||||
|
||||
this.icon = SpriteExtension.Create(ModManager.GetAsset<Texture2D>(this.iconID));
|
||||
Texture2D tex = ModManager.GetAsset<Texture2D>(this.iconID);
|
||||
|
||||
if (tex != null)
|
||||
{
|
||||
this.icon = SpriteExtension.Create(tex);
|
||||
}
|
||||
else
|
||||
{
|
||||
Texture2D defaultTex = ModManager.GetAsset<Texture2D>("BuffIcon_Basic_Default");
|
||||
this.icon = SpriteExtension.Create(defaultTex);
|
||||
}
|
||||
|
||||
if (buff.contentSubmodule != null)
|
||||
{
|
||||
@@ -125,6 +136,10 @@ namespace Continentis.MainGame
|
||||
|
||||
public OrderedDictionary<string, PrioritizedAction> onActionStart; //每次行动开始时
|
||||
public OrderedDictionary<string, PrioritizedAction> onActionEnd; //每次行动结束时
|
||||
|
||||
public OrderedDictionary<string, PrioritizedAction<BuffBase<T>>> onOtherBuffApplied; //Buff被添加时,参数为被添加的Buff实例
|
||||
public OrderedDictionary<string, PrioritizedAction<BuffBase<T>>> onOtherBuffFirstApplied; //Buff被新添加时,参数为被添加的Buff实例
|
||||
public OrderedDictionary<string, PrioritizedAction<BuffBase<T>>> onOtherBuffRemoved; //Buff被移除时,参数为被移除的Buff实例
|
||||
|
||||
public OrderedDictionary<string, PrioritizedAction<CharacterBase, IntendedCard, CharacterBase>> onOpponentDecideAction; //对手AI决定行动时,参数为对手,和原定的目标角色
|
||||
|
||||
@@ -148,6 +163,10 @@ namespace Continentis.MainGame
|
||||
onActionStart = new OrderedDictionary<string, PrioritizedAction>();
|
||||
onActionEnd = new OrderedDictionary<string, PrioritizedAction>();
|
||||
|
||||
onOtherBuffApplied = new OrderedDictionary<string, PrioritizedAction<BuffBase<T>>>();
|
||||
onOtherBuffFirstApplied = new OrderedDictionary<string, PrioritizedAction<BuffBase<T>>>();
|
||||
onOtherBuffRemoved = new OrderedDictionary<string, PrioritizedAction<BuffBase<T>>>();
|
||||
|
||||
onDealAttack = new OrderedDictionary<string, PrioritizedAction<AttackResult>>();
|
||||
onGetAttacked = new OrderedDictionary<string, PrioritizedAction<AttackResult>>();
|
||||
onOpponentDecideAction = new OrderedDictionary<string, PrioritizedAction<CharacterBase, IntendedCard, CharacterBase>>();
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Linq;
|
||||
using Continentis.MainGame.Card;
|
||||
using Continentis.MainGame.Character;
|
||||
using SLSFramework.General;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Continentis.MainGame.Card
|
||||
@@ -32,6 +33,7 @@ namespace Continentis.MainGame.Card
|
||||
|
||||
public override void OnBuffRemove()
|
||||
{
|
||||
//attachedCard.combatBuffSubmodule.buffList.For(buff => buff.eventSubmodule.onOtherBuffRemoved.Invoke(this));
|
||||
attributeSubmodule?.RefreshAllModifiedAttributes();
|
||||
}
|
||||
|
||||
@@ -94,7 +96,8 @@ namespace Continentis.MainGame.Card
|
||||
public override void Remove()
|
||||
{
|
||||
OnBuffRemove();
|
||||
this.attachedCard.combatBuffSubmodule.buffList.Remove(this);
|
||||
attachedCard.combatBuffSubmodule.buffList.Remove(this);
|
||||
//attachedCard.combatBuffSubmodule.buffList.Exclude(this).For(buff => buff.eventSubmodule?.onOtherBuffRemoved.Invoke(this));
|
||||
}
|
||||
|
||||
public override void UntriggerRemove()
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace Continentis.MainGame.Card
|
||||
/// </summary>
|
||||
public static CardLogicBase GenerateCardLogic(CardData data)
|
||||
{
|
||||
string typeID = ModManager.GetTypeID(data.modName, "Cards", data.className);
|
||||
string typeID = ModManager.GetTypeID(data.modName, "Cards", data.categoryName, data.className);
|
||||
Type logicType = ModManager.GetType(typeID);
|
||||
|
||||
if(logicType == null)
|
||||
|
||||
@@ -46,6 +46,7 @@ namespace Continentis.MainGame.Character
|
||||
public override void OnAfterFirstApply()
|
||||
{
|
||||
statusSubmodule?.AddStatus();
|
||||
attachedCharacter.combatBuffSubmodule.buffList.Exclude(this).For(buff => buff.eventSubmodule?.onOtherBuffFirstApplied.Invoke(this));
|
||||
}
|
||||
|
||||
public override void OnBuffRemove()
|
||||
@@ -90,7 +91,8 @@ namespace Continentis.MainGame.Character
|
||||
{
|
||||
existingBuff.iconSubmodule?.Update();
|
||||
}
|
||||
|
||||
|
||||
attachedCharacter.combatBuffSubmodule.buffList.Exclude(this).For(buff => buff.eventSubmodule?.onOtherBuffApplied.Invoke(this));
|
||||
RefreshAttributes();
|
||||
iconSubmodule?.Update();
|
||||
attachedCharacter.deckSubmodule.GetAllCards().ForEach(card => card.cardLogic.RefreshCardAttributes());
|
||||
@@ -101,6 +103,7 @@ namespace Continentis.MainGame.Character
|
||||
OnBuffRemove();
|
||||
this.attachedCharacter.combatBuffSubmodule.buffList.Remove(this);
|
||||
attachedCharacter.deckSubmodule.GetAllCards().ForEach(card => card.cardLogic.RefreshCardAttributes());
|
||||
attachedCharacter.combatBuffSubmodule.buffList.Exclude(this).For(buff => buff.eventSubmodule?.onOtherBuffRemoved.Invoke(this));
|
||||
}
|
||||
|
||||
public override void UntriggerRemove()
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace Continentis.MainGame.Equipment
|
||||
|
||||
if (data.haveCustomClass)
|
||||
{
|
||||
typeID = ModManager.GetTypeID(data.modName, "Equipments", data.className);
|
||||
typeID = ModManager.GetTypeID(data.modName, "Equipments", "", data.className);
|
||||
logicType = ModManager.GetType(typeID);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"name": "StorySystemEditor",
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"GUID:d1e9096bb63948544a42da8fa8cc647d"
|
||||
],
|
||||
"includePlatforms": [
|
||||
"Editor"
|
||||
],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 42222c69a0f89ff43a1c0018c677ad97
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -3,9 +3,7 @@ using UnityEngine;
|
||||
namespace SLSFramework.StorySystem
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEditor.Experimental.GraphView;
|
||||
|
||||
// 节点连接的数据结构
|
||||
[Serializable]
|
||||
|
||||
@@ -8,7 +8,6 @@ using SLSFramework.General;
|
||||
using UMod;
|
||||
using UMod.Scripting;
|
||||
using UnityEngine;
|
||||
using UnityEngine.ResourceManagement.Exceptions;
|
||||
using Object = UnityEngine.Object;
|
||||
|
||||
namespace SLSFramework.UModAssistance
|
||||
@@ -34,7 +33,7 @@ namespace SLSFramework.UModAssistance
|
||||
}
|
||||
if (!host.IsSuccessful)
|
||||
{
|
||||
throw new OperationException($"Failed to load mod '{modName}'");
|
||||
throw new Exception($"Failed to load mod '{modName}' asynchronously");
|
||||
}
|
||||
LoadedMods.Add(modName, host.Result);
|
||||
Debug.Log($"Mod '{modName}' async loaded successfully.");
|
||||
@@ -156,9 +155,14 @@ namespace SLSFramework.UModAssistance
|
||||
return type.Namespace!.Replace("Continentis.Mods.", "") + "." + type.Name;
|
||||
}
|
||||
|
||||
public static string GetTypeID(string modName, string classification, string className)
|
||||
public static string GetTypeID(string modName, string classification, string category, string className)
|
||||
{
|
||||
return $"{modName}.{classification}.{className}";
|
||||
if (string.IsNullOrEmpty(category))
|
||||
{
|
||||
return $"{modName}.{classification}.{className}";
|
||||
}
|
||||
|
||||
return $"{modName}.{classification}.{category}.{className}";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user