Beispiel #1
0
        public static void Update(this OperaComponent self)
        {
            if (Input.GetMouseButtonDown(1))
            {
                Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
                RaycastHit hit;
                if (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);
                }
            }

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

            if (Input.GetKeyDown(KeyCode.T))
            {
                C2M_TransferMap c2MTransferMap = new C2M_TransferMap();
                self.ZoneScene().GetComponent <SessionComponent>().Session.Call(c2MTransferMap).Coroutine();
            }
        }
Beispiel #2
0
 public static void Update(this OperaComponent self)
 {
     if (Input.GetMouseButtonDown(1))
     {
         Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
         RaycastHit hit;
         if (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.DomainScene().GetComponent <SessionComponent>().Session.Send(self.frameClickMap);
         }
     }
 }
Beispiel #3
0
        public static async ETVoid TestActor(this OperaComponent self)
        {
            try
            {
                M2C_TestActorResponse response = (M2C_TestActorResponse)await self.ZoneScene().GetComponent <SessionComponent>().Session.Call(
                    new C2M_TestActorRequest()
                {
                    Info = "actor rpc request"
                });

                Log.Info(response.Info);
            }
            catch (Exception e)
            {
                Log.Error(e);
            }
        }
Beispiel #4
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();
                    }
                }
            }
        }