Ejemplo n.º 1
0
        void Update()
        {
            Player player = Player.localPlayer;

            if (player)
            {
                // hotkey (not while typing in chat, etc.)
                if (Input.GetKeyDown(hotKey) && !UIUtils.AnyInputActive())
                {
                    panel.SetActive(!panel.activeSelf);
                }

                // only update the panel if it's active
                if (panel.activeSelf)
                {
                    // instantiate/destroy enough slots
                    // (we only care about non status skills)
                    UIUtils.BalancePrefabs(slotPrefab.gameObject, player.skills.Count, content);

                    // refresh all
                    for (int i = 0; i < player.skills.Count; ++i)
                    {
                        UISkillSlot slot  = content.GetChild(i).GetComponent <UISkillSlot>();
                        Skill       skill = player.skills[i];

                        bool isPassive = skill.data is PassiveSkill;

                        // set state
                        slot.dragAndDropable.name     = i.ToString();
                        slot.dragAndDropable.dragable = skill.level > 0 && !isPassive;

                        // click event
                        slot.button.interactable = skill.level > 0 &&
                                                   !isPassive &&
                                                   player.CastCheckSelf(skill); // checks mana, cooldown etc.
                        int icopy = i;
                        slot.button.onClick.SetListener(() =>
                        {
                            // try use the skill or walk closer if needed
                            player.TryUseSkill(icopy);
                        });

                        // image
                        if (skill.level > 0)
                        {
                            slot.image.color  = Color.white;
                            slot.image.sprite = skill.image;
                        }

                        // description
                        slot.descriptionText.text = skill.ToolTip(showRequirements: skill.level == 0);

                        // learn / upgrade
                        if (skill.level < skill.maxLevel)
                        {
                            slot.upgradeButton.gameObject.SetActive(true);
                            slot.upgradeButton.GetComponentInChildren <Text>().text = skill.level == 0 ? "Learn" : "Upgrade";
                            slot.upgradeButton.interactable = player.CanUpgradeSkill(skill);
                            slot.upgradeButton.onClick.SetListener(() => { player.CmdUpgradeSkill(icopy); });
                        }
                        // otherwise no button needed
                        else
                        {
                            slot.upgradeButton.gameObject.SetActive(false);
                        }

                        // cooldown overlay
                        float cooldown = skill.CooldownRemaining();
                        slot.cooldownOverlay.SetActive(skill.level > 0 && cooldown > 0);
                        slot.cooldownText.text         = cooldown.ToString("F0");
                        slot.cooldownCircle.fillAmount = skill.cooldown > 0 ? cooldown / skill.cooldown : 0;
                    }

                    // skill experience
                    skillExperienceText.text = player.skillExperience.ToString();
                }
            }
            else
            {
                panel.SetActive(false);
            }
        }
Ejemplo n.º 2
0
        void Update()
        {
            Player player = Player.localPlayer;

            if (player)
            {
                // hotkey (not while typing in chat, etc.)
                if (Input.GetKeyDown(hotKey) && !UIUtils.AnyInputActive())
                {
                    panel.SetActive(!panel.activeSelf);
                }

                // only update the panel if it's active
                if (panel.activeSelf)
                {
                    // instantiate/destroy enough category slots
                    UIUtils.BalancePrefabs(categorySlotPrefab.gameObject, player.itemMallCategories.Length, categoryContent);

                    // refresh all category buttons
                    for (int i = 0; i < player.itemMallCategories.Length; ++i)
                    {
                        Button button = categoryContent.GetChild(i).GetComponent <Button>();
                        button.interactable = i != currentCategory;
                        button.GetComponentInChildren <Text>().text = player.itemMallCategories[i].category;
                        int icopy = i; // needed for lambdas, otherwise i is Count
                        button.onClick.SetListener(() =>
                        {
                            // set new category and then scroll to the top again
                            currentCategory = icopy;
                            ScrollToBeginning();
                        });
                    }

                    if (player.itemMallCategories.Length > 0)
                    {
                        // instantiate/destroy enough item slots for that category
                        ScriptableItem[] items = player.itemMallCategories[currentCategory].items;
                        UIUtils.BalancePrefabs(itemSlotPrefab.gameObject, items.Length, itemContent);

                        // refresh all items in that category
                        for (int i = 0; i < items.Length; ++i)
                        {
                            UIItemMallSlot slot = itemContent.GetChild(i).GetComponent <UIItemMallSlot>();
                            ScriptableItem item = items[i];

                            // refresh item
                            slot.tooltip.text              = new Item(item).ToolTip();
                            slot.image.color               = Color.white;
                            slot.image.sprite              = item.image;
                            slot.nameText.text             = item.name;
                            slot.priceText.text            = item.itemMallPrice.ToString();
                            slot.unlockButton.interactable = player.Health > 0 && player.coins >= item.itemMallPrice;
                            int icopy = i; // needed for lambdas, otherwise i is Count
                            slot.unlockButton.onClick.SetListener(() =>
                            {
                                player.CmdUnlockItem(currentCategory, icopy);
                                inventoryPanel.SetActive(true); // better feedback
                            });
                        }
                    }

                    // overview
                    nameText.text           = player.name;
                    levelText.text          = "Lv. " + player.level;
                    currencyAmountText.text = player.coins.ToString();
                    buyButton.onClick.SetListener(() => { Application.OpenURL(buyUrl); });
                    couponInput.interactable  = NetworkTime.time >= player.nextRiskyActionTime;
                    couponButton.interactable = NetworkTime.time >= player.nextRiskyActionTime;
                    couponButton.onClick.SetListener(() =>
                    {
                        if (!string.IsNullOrWhiteSpace(couponInput.text))
                        {
                            player.CmdEnterCoupon(couponInput.text);
                        }
                        couponInput.text = "";
                    });
                }
            }
            else
            {
                panel.SetActive(false);
            }
        }
Ejemplo n.º 3
0
        void Update()
        {
            Player player = Player.localPlayer;

            if (player)
            {
                // hotkey (not while typing in chat, etc.)
                if (Input.GetKeyDown(hotKey) && !UIUtils.AnyInputActive())
                {
                    panel.SetActive(!panel.activeSelf);
                }

                // only update the panel if it's active
                if (panel.activeSelf)
                {
                    // instantiate/destroy enough slots
                    UIUtils.BalancePrefabs(ingredientSlotPrefab.gameObject, player.craftingIndices.Count, ingredientContent);

                    // refresh all
                    for (int i = 0; i < player.craftingIndices.Count; ++i)
                    {
                        UICraftingIngredientSlot slot = ingredientContent.GetChild(i).GetComponent <UICraftingIngredientSlot>();
                        slot.dragAndDropable.name = i.ToString(); // drag and drop index
                        int itemIndex = player.craftingIndices[i];

                        if (0 <= itemIndex && itemIndex < player.inventory.Count &&
                            player.inventory[itemIndex].amount > 0)
                        {
                            ItemSlot itemSlot = player.inventory[itemIndex];

                            // refresh valid item
                            slot.tooltip.enabled          = true;
                            slot.tooltip.text             = itemSlot.ToolTip();
                            slot.dragAndDropable.dragable = true;
                            slot.image.color  = Color.white;
                            slot.image.sprite = itemSlot.item.Image;
                            slot.amountOverlay.SetActive(itemSlot.amount > 1);
                            slot.amountText.text = itemSlot.amount.ToString();
                        }
                        else
                        {
                            // reset the index because it's invalid
                            player.craftingIndices[i] = -1;

                            // refresh invalid item
                            slot.tooltip.enabled          = false;
                            slot.dragAndDropable.dragable = false;
                            slot.image.color  = Color.clear;
                            slot.image.sprite = null;
                            slot.amountOverlay.SetActive(false);
                        }
                    }

                    // find valid indices => item templates => matching recipe
                    List <int> validIndices = player.craftingIndices.Where(
                        index => 0 <= index && index < player.inventory.Count &&
                        player.inventory[index].amount > 0
                        ).ToList();
                    List <ItemSlot>  items  = validIndices.Select(index => player.inventory[index]).ToList();
                    ScriptableRecipe recipe = ScriptableRecipe.Dictionary.Values.ToList().Find(r => r.CanCraftWith(items)); // good enough for now
                    if (recipe != null)
                    {
                        // refresh valid recipe
                        Item item = new Item(recipe.result);
                        resultSlotToolTip.enabled = true;
                        resultSlotToolTip.text    = new ItemSlot(item).ToolTip(); // ItemSlot so that {AMOUNT} is replaced too
                        resultSlotImage.color     = Color.white;
                        resultSlotImage.sprite    = recipe.result.image;

                        // show progress bar while crafting
                        // (show 100% if craft time = 0 because it's just better feedback)
                        progressSlider.gameObject.SetActive(player.State == "CRAFTING");
                        double startTime   = player.craftingTimeEnd - recipe.craftingTime;
                        double elapsedTime = NetworkTime.time - startTime;
                        progressSlider.value = recipe.craftingTime > 0 ? (float)elapsedTime / recipe.craftingTime : 1;
                    }
                    else
                    {
                        // refresh invalid recipe
                        resultSlotToolTip.enabled = false;
                        resultSlotImage.color     = Color.clear;
                        resultSlotImage.sprite    = null;
                        progressSlider.gameObject.SetActive(false);
                    }

                    // craft result
                    // (no recipe != null check because it will be null if those were
                    //  the last two ingredients in our inventory)
                    if (player.craftingState == CraftingState.Success)
                    {
                        resultText.color = successColor;
                        resultText.text  = "Success!";
                    }
                    else if (player.craftingState == CraftingState.Failed)
                    {
                        resultText.color = failedColor;
                        resultText.text  = "Failed :(";
                    }
                    else
                    {
                        resultText.text = "";
                    }

                    // craft button with 'Try' prefix to let people know that it might fail
                    // (disabled while in progress)
                    craftButton.GetComponentInChildren <Text>().text = recipe != null &&
                                                                       recipe.probability < 1
                        ? "Try Craft"
                        : "Craft";
                    craftButton.interactable = recipe != null &&
                                               player.State != "CRAFTING" &&
                                               player.craftingState != CraftingState.InProgress &&
                                               player.InventoryCanAdd(new Item(recipe.result), 1);
                    craftButton.onClick.SetListener(() =>
                    {
                        player.craftingState = CraftingState.InProgress; // wait for result

                        // pass original array so server can copy it to it's own
                        // craftingIndices. we pass original one and not only the valid
                        // indicies because then in host mode we would make the crafting
                        // indices array smaller by only copying the valid indices,
                        // hence losing crafting slots
                        player.CmdCraft(player.craftingIndices.ToArray());
                    });
                }
            }
            else
            {
                panel.SetActive(false);
            }
        }
Ejemplo n.º 4
0
        void Update()
        {
            Player player = Player.localPlayer;

            if (player)
            {
                panel.SetActive(true);

                // instantiate/destroy enough slots
                UIUtils.BalancePrefabs(slotPrefab.gameObject, player.skillbar.Length, content);

                // refresh all
                for (int i = 0; i < player.skillbar.Length; ++i)
                {
                    UISkillbarSlot slot = content.GetChild(i).GetComponent <UISkillbarSlot>();
                    slot.dragAndDropable.name = i.ToString(); // drag and drop index

                    // hotkey overlay (without 'Alpha' etc.)
                    string pretty = player.skillbar[i].hotKey.ToString().Replace("Alpha", "");
                    slot.hotkeyText.text = pretty;

                    // skill, inventory item or equipment item?
                    int skillIndex     = player.GetSkillIndexByName(player.skillbar[i].reference);
                    int inventoryIndex = player.GetInventoryIndexByName(player.skillbar[i].reference);
                    int equipmentIndex = player.GetEquipmentIndexByName(player.skillbar[i].reference);
                    if (skillIndex != -1)
                    {
                        Skill skill   = player.skills[skillIndex];
                        bool  canCast = player.CastCheckSelf(skill);

                        // hotkey pressed and not typing in any input right now?
                        if (Input.GetKeyDown(player.skillbar[i].hotKey) &&
                            !UIUtils.AnyInputActive() &&
                            canCast) // checks mana, cooldowns, etc.)
                        {
                            // try use the skill or walk closer if needed
                            player.TryUseSkill(skillIndex);
                        }

                        // refresh skill slot
                        slot.button.interactable = canCast; // check mana, cooldowns, etc.
                        slot.button.onClick.SetListener(() =>
                        {
                            // try use the skill or walk closer if needed
                            player.TryUseSkill(skillIndex);
                        });
                        slot.tooltip.enabled          = true;
                        slot.tooltip.text             = skill.ToolTip();
                        slot.dragAndDropable.dragable = true;
                        slot.image.color  = Color.white;
                        slot.image.sprite = skill.image;
                        float cooldown = skill.CooldownRemaining();
                        slot.cooldownOverlay.SetActive(cooldown > 0);
                        slot.cooldownText.text         = cooldown.ToString("F0");
                        slot.cooldownCircle.fillAmount = skill.cooldown > 0 ? cooldown / skill.cooldown : 0;
                        slot.amountOverlay.SetActive(false);
                    }
                    else if (inventoryIndex != -1)
                    {
                        ItemSlot itemSlot = player.inventory[inventoryIndex];

                        // hotkey pressed and not typing in any input right now?
                        if (Input.GetKeyDown(player.skillbar[i].hotKey) && !UIUtils.AnyInputActive())
                        {
                            player.CmdUseInventoryItem(inventoryIndex);
                        }

                        // refresh inventory slot
                        slot.button.onClick.SetListener(() =>
                        {
                            player.CmdUseInventoryItem(inventoryIndex);
                        });
                        slot.tooltip.enabled          = true;
                        slot.tooltip.text             = itemSlot.ToolTip();
                        slot.dragAndDropable.dragable = true;
                        slot.image.color  = Color.white;
                        slot.image.sprite = itemSlot.item.Image;
                        slot.cooldownOverlay.SetActive(false);
                        slot.cooldownCircle.fillAmount = 0;
                        slot.amountOverlay.SetActive(itemSlot.amount > 1);
                        slot.amountText.text = itemSlot.amount.ToString();
                    }
                    else if (equipmentIndex != -1)
                    {
                        ItemSlot itemSlot = player.equipment[equipmentIndex];

                        // refresh equipment slot
                        slot.button.onClick.RemoveAllListeners();
                        slot.tooltip.enabled          = true;
                        slot.tooltip.text             = itemSlot.ToolTip();
                        slot.dragAndDropable.dragable = true;
                        slot.image.color  = Color.white;
                        slot.image.sprite = itemSlot.item.Image;
                        slot.cooldownOverlay.SetActive(false);
                        slot.cooldownCircle.fillAmount = 0;
                        slot.amountOverlay.SetActive(itemSlot.amount > 1);
                        slot.amountText.text = itemSlot.amount.ToString();
                    }
                    else
                    {
                        // clear the outdated reference
                        player.skillbar[i].reference = "";

                        // refresh empty slot
                        slot.button.onClick.RemoveAllListeners();
                        slot.tooltip.enabled          = false;
                        slot.dragAndDropable.dragable = false;
                        slot.image.color  = Color.clear;
                        slot.image.sprite = null;
                        slot.cooldownOverlay.SetActive(false);
                        slot.cooldownCircle.fillAmount = 0;
                        slot.amountOverlay.SetActive(false);
                    }
                }
            }
            else
            {
                panel.SetActive(false);
            }
        }
Ejemplo n.º 5
0
        void Update()
        {
            Player player = Player.localPlayer;

            if (player)
            {
                // hotkey (not while typing in chat, etc.)
                if (Input.GetKeyDown(hotKey) && !UIUtils.AnyInputActive())
                {
                    panel.SetActive(!panel.activeSelf);
                }

                // only update the panel if it's active
                if (panel.activeSelf)
                {
                    // instantiate/destroy enough slots
                    UIUtils.BalancePrefabs(slotPrefab.gameObject, player.inventory.Count, content);

                    // refresh all items
                    for (int i = 0; i < player.inventory.Count; ++i)
                    {
                        UIInventorySlot slot = content.GetChild(i).GetComponent <UIInventorySlot>();
                        slot.dragAndDropable.name = i.ToString(); // drag and drop index
                        ItemSlot itemSlot = player.inventory[i];

                        if (itemSlot.amount > 0)
                        {
                            // refresh valid item
                            int icopy = i; // needed for lambdas, otherwise i is Count
                            slot.button.onClick.SetListener(() =>
                            {
                                if (itemSlot.item.Data is UsableItem &&
                                    ((UsableItem)itemSlot.item.Data).CanUse(player, icopy))
                                {
                                    player.CmdUseInventoryItem(icopy);
                                }
                            });
                            slot.tooltip.enabled          = true;
                            slot.tooltip.text             = itemSlot.ToolTip();
                            slot.dragAndDropable.dragable = true;
                            slot.image.color  = Color.white;
                            slot.image.sprite = itemSlot.item.Image;
                            slot.amountOverlay.SetActive(itemSlot.amount > 1);
                            slot.amountText.text = itemSlot.amount.ToString();
                        }
                        else
                        {
                            // refresh invalid item
                            slot.button.onClick.RemoveAllListeners();
                            slot.tooltip.enabled          = false;
                            slot.dragAndDropable.dragable = false;
                            slot.image.color  = Color.clear;
                            slot.image.sprite = null;
                            slot.amountOverlay.SetActive(false);
                        }
                    }

                    // gold
                    goldText.text = player.Money.ToString();

                    // trash (tooltip always enabled, dropable always true)
                    trash.dragable = player.trash.amount > 0;
                    if (player.trash.amount > 0)
                    {
                        // refresh valid item
                        trashImage.color  = Color.white;
                        trashImage.sprite = player.trash.item.Image;
                        trashOverlay.SetActive(player.trash.amount > 1);
                        trashAmountText.text = player.trash.amount.ToString();
                    }
                    else
                    {
                        // refresh invalid item
                        trashImage.color  = Color.clear;
                        trashImage.sprite = null;
                        trashOverlay.SetActive(false);
                    }
                }
            }
            else
            {
                panel.SetActive(false);
            }
        }
Ejemplo n.º 6
0
        void Update()
        {
            Player player = Player.localPlayer;

            if (player)
            {
                // hotkey (not while typing in chat, etc.)
                if (Input.GetKeyDown(hotKey) && !UIUtils.AnyInputActive())
                {
                    panel.SetActive(!panel.activeSelf);
                }

                // only update the panel if it's active
                if (panel.activeSelf)
                {
                    Guild guild       = player.guild;
                    int   memberCount = guild.members != null ? guild.members.Length : 0;

                    // guild properties
                    nameText.text            = player.guild.name;
                    masterText.text          = guild.master;
                    currentCapacityText.text = memberCount.ToString();
                    maximumCapacityText.text = GuildSystem.Capacity.ToString();

                    // notice edit button
                    noticeEditButton.interactable = guild.CanNotify(player.name) &&
                                                    !noticeInput.interactable;
                    noticeEditButton.onClick.SetListener(() =>
                    {
                        noticeInput.interactable = true;
                    });

                    // notice set button
                    noticeSetButton.interactable = guild.CanNotify(player.name) &&
                                                   noticeInput.interactable &&
                                                   NetworkTime.time >= player.nextRiskyActionTime;
                    noticeSetButton.onClick.SetListener(() =>
                    {
                        noticeInput.interactable = false;
                        if (noticeInput.text.Length > 0 &&
                            !string.IsNullOrWhiteSpace(noticeInput.text) &&
                            noticeInput.text != guild.notice)
                        {
                            player.CmdSetGuildNotice(noticeInput.text);
                        }
                    });

                    // notice input: copies notice while not editing it
                    if (!noticeInput.interactable)
                    {
                        noticeInput.text = guild.notice ?? "";
                    }
                    noticeInput.characterLimit = GuildSystem.NoticeMaxLength;

                    // leave
                    leaveButton.interactable = guild.CanLeave(player.name);
                    leaveButton.onClick.SetListener(() =>
                    {
                        player.CmdLeaveGuild();
                    });

                    // instantiate/destroy enough slots
                    UIUtils.BalancePrefabs(slotPrefab.gameObject, memberCount, memberContent);

                    // refresh all members
                    for (int i = 0; i < memberCount; ++i)
                    {
                        UIGuildMemberSlot slot   = memberContent.GetChild(i).GetComponent <UIGuildMemberSlot>();
                        GuildMember       member = guild.members[i];

                        slot.onlineStatusImage.color    = member.online ? onlineColor : offlineColor;
                        slot.nameText.text              = member.name;
                        slot.levelText.text             = member.level.ToString();
                        slot.rankText.text              = member.rank.ToString();
                        slot.promoteButton.interactable = guild.CanPromote(player.name, member.name);
                        slot.promoteButton.onClick.SetListener(() =>
                        {
                            player.CmdGuildPromote(member.name);
                        });
                        slot.demoteButton.interactable = guild.CanDemote(player.name, member.name);
                        slot.demoteButton.onClick.SetListener(() =>
                        {
                            player.CmdGuildDemote(member.name);
                        });
                        slot.kickButton.interactable = guild.CanKick(player.name, member.name);
                        slot.kickButton.onClick.SetListener(() =>
                        {
                            player.CmdGuildKick(member.name);
                        });
                    }
                }
            }
            else
            {
                panel.SetActive(false);
            }
        }
Ejemplo n.º 7
0
        void Update()
        {
            Player player = Player.localPlayer;

            if (player)
            {
                // hotkey (not while typing in chat, etc.)
                if (Input.GetKeyDown(hotKey) && !UIUtils.AnyInputActive())
                {
                    panel.SetActive(!panel.activeSelf);
                }

                // only update the panel if it's active
                if (panel.activeSelf)
                {
                    Party party       = player.party;
                    int   memberCount = party.members != null ? party.members.Length : 0;

                    // properties
                    currentCapacityText.text = memberCount.ToString();
                    maximumCapacityText.text = Party.Capacity.ToString();

                    // instantiate/destroy enough slots
                    UIUtils.BalancePrefabs(slotPrefab.gameObject, memberCount, memberContent);

                    // refresh all members
                    for (int i = 0; i < memberCount; ++i)
                    {
                        UIPartyMemberSlot slot       = memberContent.GetChild(i).GetComponent <UIPartyMemberSlot>();
                        string            memberName = party.members[i];

                        slot.nameText.text = memberName;
                        slot.masterIndicatorText.gameObject.SetActive(i == 0);

                        // party struct doesn't sync health, mana, level, etc. We find
                        // those from observers instead. Saves bandwidth and is good
                        // enough since another member's health is only really important
                        // to use when we are fighting the same monsters.
                        // => null if member not in observer range, in which case health
                        //    bars etc. should be grayed out!

                        // update some data only if around. otherwise keep previous data.
                        // update icon only if around. otherwise keep previous one.
                        if (Player.onlinePlayers.ContainsKey(memberName))
                        {
                            Player member = Player.onlinePlayers[memberName];
                            slot.icon.sprite        = member.classIcon;
                            slot.levelText.text     = member.level.ToString();
                            slot.guildText.text     = member.guild.name;
                            slot.healthSlider.value = member.HealthPercent();
                            slot.manaSlider.value   = member.MindPercent();
                        }

                        // action button:
                        // dismiss: if i=0 and member=self and master
                        // kick: if i > 0 and player=master
                        // leave: if member=self and not master
                        if (memberName == player.name && i == 0)
                        {
                            slot.actionButton.gameObject.SetActive(true);
                            slot.actionButton.GetComponentInChildren <Text>().text = "Dismiss";
                            slot.actionButton.onClick.SetListener(() =>
                            {
                                player.CmdPartyDismiss();
                            });
                        }
                        else if (memberName == player.name && i > 0)
                        {
                            slot.actionButton.gameObject.SetActive(true);
                            slot.actionButton.GetComponentInChildren <Text>().text = "Leave";
                            slot.actionButton.onClick.SetListener(() =>
                            {
                                player.CmdPartyLeave();
                            });
                        }
                        else if (party.members[0] == player.name && i > 0)
                        {
                            slot.actionButton.gameObject.SetActive(true);
                            slot.actionButton.GetComponentInChildren <Text>().text = "Kick";
                            slot.actionButton.onClick.SetListener(() =>
                            {
                                player.CmdPartyKick(memberName);
                            });
                        }
                        else
                        {
                            slot.actionButton.gameObject.SetActive(false);
                        }
                    }

                    // exp share toggle
                    experienceShareToggle.interactable = player.InParty() && party.members[0] == player.name;
                    experienceShareToggle.onValueChanged.SetListener((val) => { }); // avoid callback while setting .isOn via code
                    experienceShareToggle.isOn = party.shareExperience;
                    experienceShareToggle.onValueChanged.SetListener((val) =>
                    {
                        player.CmdPartySetExperienceShare(val);
                    });

                    // gold share toggle
                    goldShareToggle.interactable = player.InParty() && party.members[0] == player.name;
                    goldShareToggle.onValueChanged.SetListener((val) => { }); // avoid callback while setting .isOn via code
                    goldShareToggle.isOn = party.shareGold;
                    goldShareToggle.onValueChanged.SetListener((val) =>
                    {
                        player.CmdPartySetGoldShare(val);
                    });
                }
            }
            else
            {
                panel.SetActive(false);
            }
        }