コード例 #1
0
    public void IconPressed(KeyCode keyCode)
    {
        if (chatUI.InputTextActiveInHierarchy())
        {
            return;
        }

        if (keyCode == KeyCode.Alpha1)
        {
            network.Send(MessageType.UseItem, MessagePackSerializer.Serialize((byte)0), ENet.PacketFlags.Reliable);
        }
        else if (keyCode == KeyCode.Alpha2)
        {
            network.Send(MessageType.UseItem, MessagePackSerializer.Serialize((byte)1), ENet.PacketFlags.Reliable);
        }
        else if (keyCode == KeyCode.Alpha3)
        {
            network.Send(MessageType.UseItem, MessagePackSerializer.Serialize((byte)2), ENet.PacketFlags.Reliable);
        }
        else if (keyCode == KeyCode.Alpha4)
        {
            network.Send(MessageType.UseItem, MessagePackSerializer.Serialize((byte)3), ENet.PacketFlags.Reliable);
        }
        else if (keyCode == KeyCode.Alpha5)
        {
            network.Send(MessageType.UseItem, MessagePackSerializer.Serialize((byte)4), ENet.PacketFlags.Reliable);
        }
        else if (keyCode == KeyCode.Alpha6)
        {
            network.Send(MessageType.UseItem, MessagePackSerializer.Serialize((byte)5), ENet.PacketFlags.Reliable);
        }
        else if (keyCode == KeyCode.Q && actives.ContainsKey(0) && actives[0])
        {
            DestroySkillInstance();

            if (skillState != SkillState.QActive)
            {
                ActivateSkill(0, SkillState.QActive);
            }
            else
            {
                skillState = SkillState.None;
            }
        }
        else if (keyCode == KeyCode.W && actives.ContainsKey(1) && actives[1])
        {
            DestroySkillInstance();

            if (skillState != SkillState.WActive)
            {
                ActivateSkill(1, SkillState.WActive);
            }
            else
            {
                skillState = SkillState.None;
            }
        }
        else if (keyCode == KeyCode.E && actives.ContainsKey(2) && actives[2])
        {
            DestroySkillInstance();

            if (skillState != SkillState.EActive)
            {
                ActivateSkill(2, SkillState.EActive);
            }
            else
            {
                skillState = SkillState.None;
            }
        }
        else if (keyCode == KeyCode.R && actives.ContainsKey(3) && actives[3])
        {
            DestroySkillInstance();

            if (skillState != SkillState.RActive)
            {
                ActivateSkill(3, SkillState.RActive);
            }
            else
            {
                skillState = SkillState.None;
            }
        }
    }