From 29fceda1622fff7edf4cd5f9b3e56103ee04f64a Mon Sep 17 00:00:00 2001
From: client_linchunjie <461730578@qq.com>
Date: 星期四, 06 十二月 2018 19:25:04 +0800
Subject: [PATCH] 5282 【1.3.100】上古战场机器人名字
---
Core/GameEngine/Model/ConfigManager.cs | 1
Core/GameEngine/Model/Config/AncientRobotNameConfig.cs.meta | 12 ++++++
System/Activity/ActivityModel.cs | 20 ++++++---
Core/GameEngine/Model/Config/AncientRobotNameConfig.cs | 41 ++++++++++++++++++++
4 files changed, 67 insertions(+), 7 deletions(-)
diff --git a/Core/GameEngine/Model/Config/AncientRobotNameConfig.cs b/Core/GameEngine/Model/Config/AncientRobotNameConfig.cs
new file mode 100644
index 0000000..e68a516
--- /dev/null
+++ b/Core/GameEngine/Model/Config/AncientRobotNameConfig.cs
@@ -0,0 +1,41 @@
+锘�//--------------------------------------------------------
+// [Author]: 绗簩涓栫晫
+// [ Date ]: Thursday, December 06, 2018
+//--------------------------------------------------------
+
+using UnityEngine;
+using System;
+
+namespace TableConfig {
+
+
+ public partial class AncientRobotNameConfig : ConfigBase {
+
+ public int id { get ; private set ; }
+ public string Name { get ; private set; }
+
+ public override string getKey()
+ {
+ return id.ToString();
+ }
+
+ public override void Parse() {
+ try
+ {
+ id=IsNumeric(rawContents[0]) ? int.Parse(rawContents[0]):0;
+
+ Name = rawContents[1].Trim();
+ }
+ catch (Exception ex)
+ {
+ DebugEx.Log(ex);
+ }
+ }
+
+ }
+
+}
+
+
+
+
diff --git a/Core/GameEngine/Model/Config/AncientRobotNameConfig.cs.meta b/Core/GameEngine/Model/Config/AncientRobotNameConfig.cs.meta
new file mode 100644
index 0000000..cc08445
--- /dev/null
+++ b/Core/GameEngine/Model/Config/AncientRobotNameConfig.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: b49056d4d67eaff4aa0cbad948b7d5ad
+timeCreated: 1544094304
+licenseType: Pro
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Core/GameEngine/Model/ConfigManager.cs b/Core/GameEngine/Model/ConfigManager.cs
index b8c08aa..7807fcb 100644
--- a/Core/GameEngine/Model/ConfigManager.cs
+++ b/Core/GameEngine/Model/ConfigManager.cs
@@ -212,6 +212,7 @@
AddAsyncTask<GodWeaponEffectConfig>();
AddAsyncTask<DungeonHelpBattleConfig>();
AddAsyncTask<FuncSwitchConfig>();
+ AddAsyncTask<AncientRobotNameConfig>();
while (!AllCompleted())
{
diff --git a/System/Activity/ActivityModel.cs b/System/Activity/ActivityModel.cs
index 457301e..7742222 100644
--- a/System/Activity/ActivityModel.cs
+++ b/System/Activity/ActivityModel.cs
@@ -146,8 +146,7 @@
else
{
ancientRandomName.Clear();
- firstNameRandoms.Clear();
- secondNameRandoms.Clear();
+ nameRandomIndexs.Clear();
}
}
@@ -364,8 +363,7 @@
#endregion
Dictionary<int, Dictionary<int, string>> ancientRandomName = new Dictionary<int, Dictionary<int, string>>();
- List<int> firstNameRandoms = new List<int>();
- List<int> secondNameRandoms = new List<int>();
+ List<int> nameRandomIndexs = new List<int>();
public string GetAncientRobotName(int objId, int npcId)
{
if (ancientRandomName.ContainsKey(objId)
@@ -373,9 +371,17 @@
{
return ancientRandomName[objId][npcId];
}
- var firstName = RandomNameConfig.GetFirstName(ref firstNameRandoms);
- var secondName = RandomNameConfig.GetSecondName(ref secondNameRandoms);
- var name = StringUtility.Contact(firstName, secondName);
+ var configs = Config.Instance.GetAllValues<AncientRobotNameConfig>();
+ if (nameRandomIndexs.Count == 0)
+ {
+ for (int i = 0; i < configs.Count; i++)
+ {
+ nameRandomIndexs.Add(configs[i].id);
+ }
+ }
+ var index = UnityEngine.Random.Range(0, nameRandomIndexs.Count);
+ var name = Config.Instance.Get<AncientRobotNameConfig>(nameRandomIndexs[index]).Name;
+ nameRandomIndexs.RemoveAt(index);
Dictionary<int, string> dict;
if (!ancientRandomName.ContainsKey(objId))
{
--
Gitblit v1.8.0