SkillScriptManager.cs 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. using Excel2Json;
  2. using Fort23.Core;
  3. using Fort23.UTool;
  4. using GameLogic.Combat.Skill;
  5. using Utility;
  6. namespace GameLogic.Combat.CombatTool
  7. {
  8. public class SkillScriptManager : Singleton<SkillScriptManager>
  9. {
  10. public static object ActivatorLoock = "lock";
  11. public SkillBasic CreateSkillBasic(SkillConfig skillConfig)
  12. {
  13. try
  14. {
  15. string typeName = "GameLogic.Combat.Skill." + skillConfig.scriptName;
  16. // lock (ActivatorLoock)
  17. {
  18. System.Type type = System.Type.GetType(typeName);
  19. if (type == null)
  20. {
  21. typeName = "GameLogic.Combat.Skill.MagicSkill." + skillConfig.scriptName;
  22. type = System.Type.GetType(typeName);
  23. if (type == null)
  24. {
  25. if (skillConfig.SkillType != 5 && skillConfig.SkillType != 6)
  26. {
  27. LogTool.Error("没有技能脚本" + typeName);
  28. }
  29. return null;
  30. }
  31. }
  32. // SkillBasic
  33. SkillBasic sb = (SkillBasic)CObjectPool.Instance.Fetch(type);
  34. ;
  35. sb.InitSkillConfig(skillConfig);
  36. return sb;
  37. }
  38. }
  39. catch (System.Exception e)
  40. {
  41. LogTool.Log(e + "错误技能" + skillConfig.scriptName);
  42. }
  43. return null;
  44. }
  45. // public SuitBasic CreateSkillBasic(RelicSuitConfig relicSuitConfig)
  46. // {
  47. // try
  48. // {
  49. // string typeName = "Common.Combat.Suit." + relicSuitConfig.ScriptName;
  50. // // lock (ActivatorLoock)
  51. // {
  52. // System.Type type = System.Type.GetType(typeName);
  53. // if (type == null)
  54. // {
  55. // return null;
  56. // }
  57. //
  58. // SuitBasic suitBasic = (SuitBasic)System.Activator.CreateInstance(type);
  59. // suitBasic.Init(relicSuitConfig);
  60. // return suitBasic;
  61. // }
  62. // }
  63. // catch (System.Exception e)
  64. // {
  65. // LogTool.Log("错误套装" + relicSuitConfig.ScriptName);
  66. // }
  67. //
  68. // return null;
  69. // }
  70. }
  71. }