コード例 #1
0
        public static void SetTargeting(CursorTarget targeting, uint cursorID, TargetType cursorType)
        {
            if (targeting == CursorTarget.Invalid)
            {
                return;
            }

            bool lastTargetting = IsTargeting;

            IsTargeting    = cursorType < TargetType.Cancel;
            TargetingState = targeting;
            TargetingType  = cursorType;

            if (IsTargeting)
            {
                //UIManager.RemoveTargetLineGump(LastTarget);
            }
            else if (lastTargetting)
            {
                CancelTarget();
            }

            // https://github.com/andreakarasho/ClassicUO/issues/1373
            // when receiving a cancellation target from the server we need
            // to send the last active cursorID, so update cursor data later

            _targetCursorId = cursorID;
        }
コード例 #2
0
ファイル: TargetManager.cs プロジェクト: dust765/ClassicUO
        public static void SetTargeting(CursorTarget targeting, uint cursorID, TargetType cursorType)
        {
            if (targeting == CursorTarget.Invalid)
            {
                return;
            }

            TargetingState  = targeting;
            _targetCursorId = cursorID;
            TargetingType   = cursorType;

            // ## BEGIN - END ## //
            UOClassicCombatCollection.StartSpelltime();
            // ## BEGIN - END ## //

            bool lastTargetting = IsTargeting;

            IsTargeting = cursorType < TargetType.Cancel;

            if (IsTargeting)
            {
                //UIManager.RemoveTargetLineGump(LastTarget);
            }
            else if (lastTargetting)
            {
                CancelTarget();
            }
        }
コード例 #3
0
    public override void Execute(float alpha)
    {
        foreach (CursorTarget target in cursorTargets)
        {
            if (target.IsCollidingWith(this))
            {
                if (!target.collidingCursors[playerId])
                {
                    target.collidingCursors[playerId] = true;
                    //collision enter
                    target.OnCursorEnter(this);
                }
                else
                {
                    //colliding
                    target.OnCursorOver(this);
                }

                currentTarget = target;
            }
            else
            {
                if (target.collidingCursors[playerId])
                {
                    target.collidingCursors[playerId] = false;
                    //collision exit
                    target.OnCursorExit(this);
                }
                else
                {
                    //not colliding
                }
            }
        }
    }
コード例 #4
0
ファイル: uonetwork.cs プロジェクト: uotools/majesticuo
        public byte[] ClickTargetPacket(int ID, int x, int y, int z, int Type, CursorTarget target)
        {
            byte[] packet = new byte[19];
            packet[0] = UOopcodes.MSG_TargetCursorCommands;
            packet[1] = (byte)target;
            byte[] temp = intToByteArray(UOClient.CursorID);
            packet[2]  = temp[0];
            packet[3]  = temp[1];
            packet[4]  = temp[2];
            packet[5]  = temp[3];
            packet[6]  = 0x00; // maybe this should be setable?
            temp       = new byte[4];
            temp       = intToByteArray(ID);
            packet[7]  = temp[0];
            packet[8]  = temp[1];
            packet[9]  = temp[2];
            packet[10] = temp[3];
            packet[11] = (byte)(x >> 8);
            packet[12] = (byte)x;
            packet[13] = (byte)(y >> 8);
            packet[14] = (byte)y;
            packet[15] = 0x00;
            packet[16] = (byte)z;
            packet[17] = (byte)(Type >> 8);
            packet[18] = (byte)Type;

            return(packet);
        }
コード例 #5
0
 void Start()
 {
     playerShip     = GameObject.Find("PlayerShip");
     playerScript   = PlayerProperties.playerScript;
     spriteRenderer = GetComponent <SpriteRenderer>();
     template       = shipWeaponTemplate.GetComponent <ShipWeaponTemplate>();
     cursorTarget   = FindObjectOfType <CursorTarget>();
     setShipWeaponScript();
     playerScript.RegisterWeaponScript(this);
 }
コード例 #6
0
 public PTargetCancel(CursorTarget type, uint cursorID, byte cursorType) : base(0x6C)
 {
     WriteByte((byte)type);
     WriteUInt(cursorID);
     WriteByte(cursorType);
     WriteUInt(0);
     WriteUInt(0xFFFF_FFFF);
     WriteByte(0);
     WriteByte(0);
     WriteUShort(0);
 }
コード例 #7
0
        public static void SetTargeting(CursorTarget targeting, Serial cursorID, TargetType cursorType)
        {
            if (targeting == CursorTarget.Invalid)
            {
                throw new Exception("Invalid target type");
            }

            TargetingState    = targeting;
            _targetCursorId   = cursorID;
            _targetCursorType = cursorType;
            IsTargeting       = cursorType < TargetType.Cancel;
        }
コード例 #8
0
        public TargetCursorPacket(CursorTarget cursorTarget, CursorId cursorId, CursorType cursorType)
        {
            CursorTarget = cursorTarget;
            CursorId     = cursorId;
            CursorType   = cursorType;
            byte[] payload = new byte[19];
            var    writer  = new ArrayPacketWriter(payload);

            writer.WriteByte((byte)PacketDefinitions.TargetCursor.Id);
            writer.WriteByte((byte)cursorTarget);
            writer.WriteUInt(cursorId.Value);
            writer.WriteByte((byte)cursorType);

            rawPacket = new Packet(PacketDefinitions.TargetCursor.Id, payload);
        }
コード例 #9
0
    public virtual void LoadData()
    {
        CursorTarget target = GetComponent <CursorTarget>();

        UnityEventTools.RemovePersistentListener <CursorBehaviour>(target.CursorEnterEvent, OnEnter);
        UnityEventTools.RemovePersistentListener <CursorBehaviour>(target.CursorOverEvent, OnOver);
        UnityEventTools.RemovePersistentListener <CursorBehaviour>(target.CursorExitEvent, OnExit);
        UnityEventTools.RemovePersistentListener <CursorBehaviour>(target.CursorAButtonEvent, OnAButton);
        UnityEventTools.RemovePersistentListener <CursorBehaviour>(target.CursorBButtonEvent, OnBButton);

        UnityEventTools.AddPersistentListener(target.CursorEnterEvent, OnEnter);
        UnityEventTools.AddPersistentListener(target.CursorOverEvent, OnOver);
        UnityEventTools.AddPersistentListener(target.CursorExitEvent, OnExit);
        UnityEventTools.AddPersistentListener(target.CursorAButtonEvent, OnAButton);
        UnityEventTools.AddPersistentListener(target.CursorBButtonEvent, OnBButton);
    }
コード例 #10
0
        public static void SetTargeting(CursorTarget targeting, Serial cursorID, TargetType cursorType)
        {
            if (targeting == CursorTarget.Invalid)
            {
                throw new Exception("Invalid target type");
            }

            TargetingState    = targeting;
            _targetCursorId   = cursorID;
            _targetCursorType = cursorType;
            IsTargeting       = cursorType < TargetType.Cancel;

            if (IsTargeting)
            {
                Engine.UI.RemoveTargetLineGump(LastGameObject);
            }
        }
コード例 #11
0
        public static void SetTargeting(CursorTarget targeting, Serial cursorID, TargetType cursorType)
        {
            if (targeting == CursorTarget.Invalid)
            {
                return;
            }

            TargetingState  = targeting;
            _targetCursorId = cursorID;
            TargeringType   = cursorType;
            IsTargeting     = cursorType < TargetType.Cancel;

            if (IsTargeting)
            {
                Engine.UI.RemoveTargetLineGump(LastTarget);
            }
        }
コード例 #12
0
        public static void SetTargeting(CursorTarget targeting, uint cursorID, TargetType cursorType)
        {
            if (targeting == CursorTarget.Invalid)
            {
                return;
            }

            TargetingState  = targeting;
            _targetCursorId = cursorID;
            TargetingType   = cursorType;

            bool lastTargetting = IsTargeting;

            IsTargeting = cursorType < TargetType.Cancel;

            if (IsTargeting)
            {
                //UIManager.RemoveTargetLineGump(LastTarget);
            }
            else if (lastTargetting)
            {
                CancelTarget();
            }
        }
コード例 #13
0
ファイル: UltimaClient.cs プロジェクト: uoinfusion/Infusion
        public void TargetCursor(CursorTarget location, CursorId cursorId, CursorType type)
        {
            TargetCursorPacket packet = new TargetCursorPacket(location, cursorId, type);

            Send(packet.RawPacket);
        }
コード例 #14
0
 public static void TargetCancel(CursorTarget type, Serial cursorID, byte cursorType)
 {
     Socket.Send(new PTargetCancel(type, cursorID, cursorType));
 }
コード例 #15
0
ファイル: uonetwork.cs プロジェクト: Albertogon/majesticuo
        public byte[] ClickTargetPacket(int ID, int x, int y, int z, int Type, CursorTarget target)
        {
            byte[] packet = new byte[19];
            packet[0] = UOopcodes.MSG_TargetCursorCommands;
            packet[1] = (byte)target;
            byte[] temp = intToByteArray(UOClient.CursorID);
            packet[2] = temp[0];
            packet[3] = temp[1];
            packet[4] = temp[2];
            packet[5] = temp[3];
            packet[6] = 0x00; // maybe this should be setable?
            temp = new byte[4];
            temp = intToByteArray(ID);
            packet[7] = temp[0];
            packet[8] = temp[1];
            packet[9] = temp[2];
            packet[10] = temp[3];
            packet[11] = (byte)(x >> 8);
            packet[12] = (byte)x;
            packet[13] = (byte)(y >> 8);
            packet[14] = (byte)y;
            packet[15] = 0x00;
            packet[16] = (byte)z;
            packet[17] = (byte)(Type >> 8);
            packet[18] = (byte)Type;

            return packet;
        }