Пример #1
0
        public static void Update(this OperaComponent self)
        {
            var unit = self.GetMyUnitFromZoneScene();

            if (unit == null)
            {
                return;
            }
            if (InputHelper.GetMouseButtonDown(1))
            {
                if (!unit.GetComponent <MoveComponent>().Enable)
                {
                    Log.Error("暂时无法移动");
                    return;
                }
                UnityEngine.Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
                UnityEngine.RaycastHit hit;
                if (UnityEngine.Physics.Raycast(ray, out hit, 1000, self.mapMask))
                {
                    self.ClickPoint      = hit.point;
                    self.frameClickMap.X = self.ClickPoint.x;
                    self.frameClickMap.Y = self.ClickPoint.y;
                    self.frameClickMap.Z = self.ClickPoint.z;
                    self.ZoneScene().GetComponent <SessionComponent>().Session.Send(self.frameClickMap);
                }
            }

            // KeyCode.R
            if (InputHelper.GetKeyDown(114))
            {
                CodeLoader.Instance.LoadLogic();
                Game.EventSystem.Add(CodeLoader.Instance.GetHotfixTypes());
                Game.EventSystem.Load();
                Log.Debug("hot reload success!");
            }

            // KeyCode.T
            if (InputHelper.GetKeyDown(116))
            {
                C2M_TransferMap c2MTransferMap = new C2M_TransferMap();
                self.ZoneScene().RemoveComponent <KeyCodeComponent>();
                self.ZoneScene().GetComponent <SessionComponent>().Session.Call(c2MTransferMap).Coroutine();
            }

            KeyCodeComponent keyCode = KeyCodeComponent.Instance;

            if (keyCode != null)
            {
                var CurCombat             = unit?.GetComponent <CombatUnitComponent>();
                var spellPreviewComponent = CurCombat?.GetComponent <SpellPreviewComponent>();
                if (spellPreviewComponent == null)
                {
                    return;
                }
                for (int i = 0; i < keyCode.Skills.Length; i++)
                {
                    if (InputHelper.GetKeyDown(keyCode.Skills[i]) && spellPreviewComponent.InputSkills.ContainsKey(keyCode.Skills[i]))
                    {
                        var spellSkill = spellPreviewComponent.InputSkills[keyCode.Skills[i]];
                        if (spellSkill == null || !spellSkill.CanUse())
                        {
                            return;
                        }
                        spellPreviewComponent.PreviewingSkill = spellSkill;
                        spellPreviewComponent.EnterPreview();
                    }
                }
            }
        }
Пример #2
0
        public static void Save(this KeyCodeComponent self)
        {
#if !NOT_UNITY
            PlayerPrefs.SetString(CacheKeys.KeyCodeSetting, self.JsonText);
#endif
        }