From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- .../Scripts/XMainClient/AI/AIRunTimeCompareTo.cs | 54 ++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/AI/AIRunTimeCompareTo.cs (limited to 'Client/Assets/Scripts/XMainClient/AI/AIRunTimeCompareTo.cs') diff --git a/Client/Assets/Scripts/XMainClient/AI/AIRunTimeCompareTo.cs b/Client/Assets/Scripts/XMainClient/AI/AIRunTimeCompareTo.cs new file mode 100644 index 00000000..5724d626 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/AI/AIRunTimeCompareTo.cs @@ -0,0 +1,54 @@ +using System; +using System.Xml; + +namespace XMainClient +{ + internal class AIRunTimeCompareTo : AIRunTimeNodeAction + { + private string _first_string_name; + + private string _first_string_value; + + private string _second_string_name; + + private string _second_string_value; + + private string _store_result_name; + + public AIRunTimeCompareTo(XmlElement node) : base(node) + { + this._first_string_name = node.GetAttribute("Shared_FirstStringName"); + this._first_string_value = node.GetAttribute("firstString"); + this._second_string_name = node.GetAttribute("Shared_SecondStringName"); + this._second_string_value = node.GetAttribute("secondString"); + this._store_result_name = node.GetAttribute("Shared_ResultName"); + } + + public override bool Update(XEntity entity) + { + string stringByName = entity.AI.AIData.GetStringByName(this._first_string_name, this._first_string_value); + string stringByName2 = entity.AI.AIData.GetStringByName(this._second_string_name, this._second_string_value); + int num = stringByName.CompareTo(stringByName2); + bool flag = num > 0; + int para; + if (flag) + { + para = 1; + } + else + { + bool flag2 = num < 0; + if (flag2) + { + para = -1; + } + else + { + para = 0; + } + } + entity.AI.AIData.SetIntByName(this._store_result_name, para); + return true; + } + } +} -- cgit v1.1-26-g67d0