少年修仙传客户端代码仓库
client_linchunjie
2018-12-06 29fceda1622fff7edf4cd5f9b3e56103ee04f64a
5282 【1.3.100】上古战场机器人名字
2个文件已修改
2个文件已添加
74 ■■■■■ 已修改文件
Core/GameEngine/Model/Config/AncientRobotNameConfig.cs 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/GameEngine/Model/Config/AncientRobotNameConfig.cs.meta 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/GameEngine/Model/ConfigManager.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Activity/ActivityModel.cs 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/GameEngine/Model/Config/AncientRobotNameConfig.cs
New file
@@ -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);
            }
        }
    }
}
Core/GameEngine/Model/Config/AncientRobotNameConfig.cs.meta
New file
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: b49056d4d67eaff4aa0cbad948b7d5ad
timeCreated: 1544094304
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:
Core/GameEngine/Model/ConfigManager.cs
@@ -212,6 +212,7 @@
        AddAsyncTask<GodWeaponEffectConfig>();
        AddAsyncTask<DungeonHelpBattleConfig>();
        AddAsyncTask<FuncSwitchConfig>();
        AddAsyncTask<AncientRobotNameConfig>();
        while (!AllCompleted())
        {
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))
            {