示例#1
0
    // Start
    void Start()
    {
        //allWeapons = Magic.instance.allWeapons;
        currentWeapon          = null;
        currentAttunementBuild = null;
        currentSkillSlotIndex  = -1;
        showSkill = null;

        // Receive RPCs from the lobby
        Lobby.AddListener(this);
    }
示例#2
0
    public static void SwitchAttunement(this AttunementBuild myBuild, int nAttunementId)
    {
        myBuild.attunementId = nAttunementId;

        //var attunement = Attunement.idToAttunement[myBuild.attunementId];
        //attunement.skills[i].id;

        myBuild.skills[0] = Magic.EmptyAutoAttackSkill.id;

        for (int i = 1; i < myBuild.skills.Length; i++)
        {
            myBuild.skills[i] = Magic.EmptySkill.id;
        }
    }
示例#3
0
    // Draw weapon build
    void DrawWeaponBuild(WeaponBuild weaponBuild)
    {
        var weapon = Weapon.idToWeapon[weaponBuild.weaponId];

        GUILayout.Label("Weapon: <b>" + weapon.name + "</b>", titleStyle);

        // Reset shown skill description
        ExecuteLater(() => {
            showSkill = null;
        });

        // Add attunements from attunement IDs
        foreach (var attunementBuild in weaponBuild.attunements)
        {
            var lambdaAttunementBuild = attunementBuild;
            var attunement            = Attunement.idToAttunement[attunementBuild.attunementId];

            if (currentAttunementBuild != null && attunementBuild == currentAttunementBuild && currentSkillSlotIndex == -1)
            {
                GUI.backgroundColor = GUIColor.MenuItemActive;
            }
            else
            {
                GUI.backgroundColor = GUIColor.MenuItemInactive;
            }

            using (new GUIHorizontal()) {
                if (GUIHelper.Button(new GUIContent(attunement.icon)))
                {
                    ExecuteLater(() => {
                        currentWeapon          = weapon;
                        currentAttunementBuild = lambdaAttunementBuild;
                        currentSkillSlotIndex  = -1;
                        scrollPositionSelect   = Vector2.zero;
                    });
                }

                // Add skills from skill IDs
                for (int slotIndex = 0; slotIndex < attunementBuild.skills.Length; slotIndex++)
                {
                    var skillId       = attunementBuild.skills[slotIndex];
                    var skillIdString = skillId.ToStringLookup();
                    var skill         = Skill.idToSkill[skillId];

                    if (attunementBuild == currentAttunementBuild && slotIndex == currentSkillSlotIndex)
                    {
                        GUI.backgroundColor = GUIColor.MenuItemActive;
                    }
                    else
                    {
                        GUI.backgroundColor = GUIColor.MenuItemInactive;
                    }

                    if (slotIndex == 0)
                    {
                        GUILayout.Space(8);
                    }

                    if (GUIHelper.Button(new GUIContent(skill.icon, skillIdString)))
                    {
                        var lambdaSlotIndex = slotIndex;

                        // Remove skill from slot
                        if (Event.current.button == 1)
                        {
                            ExecuteLater(() => {
                                currentSkill = Skill.idToSkill[lambdaAttunementBuild.skills[lambdaSlotIndex]];

                                var lambdaSkill = currentSkill.type == Skill.SkillType.AutoAttack ? Magic.EmptyAutoAttackSkill : Magic.EmptySkill;
                                lambdaAttunementBuild.skills[lambdaSlotIndex] = lambdaSkill.id;
                            });
                        }
                        else
                        {
                            ExecuteLater(() => {
                                currentWeapon          = weapon;
                                currentAttunementBuild = lambdaAttunementBuild;
                                currentSkillSlotIndex  = lambdaSlotIndex;
                                scrollPositionSelect   = Vector2.zero;
                            });
                        }
                    }

                    if (GUI.tooltip == skillIdString)
                    {
                        ExecuteLater(() => {
                            showSkill = skill;
                        });
                        GUI.tooltip = null;
                    }

                    if (slotIndex == 0)
                    {
                        GUILayout.Space(8);
                    }
                }
            }
        }
    }