Example #1
0
 public override void Awake(SpellPreviewComponent self, Dictionary <int, int> info)
 {
     self.Enable = true;
     if (info != null)
     {
         var combatU = self.GetParent <CombatUnitComponent>();
         for (int i = 0; i < KeyCodeComponent.Instance.Skills.Length; i++)
         {
             var keyCode = KeyCodeComponent.Instance.Skills[i];
             if (info.ContainsKey(keyCode) && combatU.TryGetSkillAbility(info[keyCode], out var skill))
             {
                 self.BindSkillKeyCode(keyCode, skill);
             }
         }
     }
     else
     {
         self.BindSkillKeyDefault();
     }
 }
Example #2
0
        /// <summary>
        /// 使用默认按键配置,技能绑定按键
        /// </summary>
        /// <param name="self"></param>
        public static void BindSkillKeyDefault(this SpellPreviewComponent self)
        {
            var combatU = self.GetParent <CombatUnitComponent>();

            Log.Info("使用默认按键配置,技能绑定按键");
            int i = 0;

            foreach (var item in combatU.IdSkillMap)
            {
                if (i < KeyCodeComponent.Instance.Skills.Length)
                {
                    var keyCode = KeyCodeComponent.Instance.Skills[i];
                    self.BindSkillKeyCode(keyCode, combatU.GetChild <SkillAbility>(item.Value));
                }
                else
                {
                    break;
                }

                i++;
            }
        }