Ejemplo n.º 1
0
        private void OnLobbySessionSlotSelected(LobbySessionSlot lobbySessionSlot)
        {
            statusLabel.SetString(connectionStartString);

            UpdateInputState(false);

            var clientConnectionToken = new ClientConnectionToken
            {
                PrefferedClass = (ClassType)PlayerPrefs.GetInt(UnitUtils.PreferredClassPrefName, 0),
                Name           = playerNameInput.text
            };

            photonReference.StartConnection(lobbySessionSlot.UdpSession, clientConnectionToken, OnConnectSuccess, OnConnectFail);

            void OnConnectFail(ClientConnectFailReason failReason)
            {
                statusLabel.SetString(LocalizationReference.Localize(failReason));

                UpdateInputState(true);
            }

            void OnConnectSuccess()
            {
                statusLabel.SetString(connectSuccessString);

                UpdateInputState(true);

                WindowController.HidePanel <LobbyPanel>();
            }
        }
        public void SetErrorText(SpellCastResult spellCastResult)
        {
            CastResult = spellCastResult;

            errorLabel.SetString(LocalizationReference.Localize(spellCastResult));
            errorLabel.TextMeshPro.fontSize = displaySettings.FontSize;
            targetLifeTime       = displaySettings.LifeTime;
            transform.localScale = Vector3.one;
            currentLifeTime      = 0;
        }
 public void SetDamage(int damageAmount, HitType hitType)
 {
     if (hitType == HitType.Immune)
     {
         SetText(missSettings, LocalizationReference.Localize(SpellMissType.Immune).Value);
     }
     else if (hitType.HasTargetFlag(HitType.FullAbsorb))
     {
         SetText(fullAbsorbSettings, fullAbsrobString.Value);
     }
     else
     {
         SetText(hitType.HasTargetFlag(HitType.CriticalHit) ? damageCritSettings : damageSettings, damageAmount.ToString());
     }
 }
Ejemplo n.º 4
0
        private void OnLobbySessionSlotSelected(LobbySessionSlot lobbySessionSlot)
        {
            statusLabel.SetString(connectionStartString);

            UpdateInputState(false);

            photonReference.StartConnection(lobbySessionSlot.UdpSession, new ClientConnectionToken(playerNameInput.text), OnConnectSuccess, OnConnectFail);

            void OnConnectFail(ClientConnectFailReason failReason)
            {
                statusLabel.SetString(LocalizationReference.Localize(failReason));

                UpdateInputState(true);
            }

            void OnConnectSuccess()
            {
                statusLabel.SetString(connectSuccessString);

                UpdateInputState(true);

                WindowController.HidePanel <LobbyPanel>();
            }
        }
Ejemplo n.º 5
0
 public void SetMissText(SpellMissType missType)
 {
     SetText(missSettings, LocalizationReference.Localize(missType).Value);
 }
Ejemplo n.º 6
0
 private void OnHotkeyBindingChanged()
 {
     hotkeyText.text = LocalizationReference.Localize(hotkeyInput);
 }
        public override bool ModifyContent(SpellInfo spellInfo)
        {
            spellIcon.sprite = rendering.SpellVisuals.ContainsKey(spellInfo.Id)
                ? rendering.SpellVisuals[spellInfo.Id].SpellIcon
                : rendering.DefaultSpellIcon;

            if (localization.TooltipInfoBySpell.TryGetValue(spellInfo, out SpellTooltipInfo tooltipInfo))
            {
                spellName.text = tooltipInfo.SpellNameString.Value;

                // update spell description with configured arguments
                for (int i = 0; i < tooltipInfo.ArgumentSettings.Count; i++)
                {
                    descriptionArguments[i] = tooltipInfo.ArgumentSettings[i].Resolve() ?? unknownArguments[i];
                }

                for (int i = tooltipInfo.ArgumentSettings.Count; i < unknownArguments.Length; i++)
                {
                    descriptionArguments[i] = unknownArguments[i];
                }

                spellDescription.text = string.Format(tooltipNumberFormat, tooltipInfo.SpellDescriptionString.Value, descriptionArguments);

                // update spell range label
                float range = Mathf.Max(spellInfo.MaxRangeFriend, spellInfo.MaxRangeHostile);
                spellRange.text = Mathf.Approximately(range, 0.0f) ? string.Empty : string.Format(rangeFormatString.Value, range);

                // update cooldown label
                float cooldown = (float)spellInfo.CooldownTime / 1000;
                spellCooldown.text = cooldown <= 0 ? string.Empty : string.Format(cooldownFormatString.Value, cooldown);

                // update cast time label
                float castTime = (float)spellInfo.CastTime / 1000;
                spellCastTime.text = castTime <= 0 ? castTimeInstantString.Value : string.Format(castTimeFormatString.Value, castTime);

                // update cost
                spellCost.text = string.Empty;
                for (int i = 0; i < spellInfo.PowerCosts.Count; i++)
                {
                    SpellPowerCostInfo powerCost = spellInfo.PowerCosts[i];
                    if (powerCost.PowerCostPercentage > 0)
                    {
                        if (spellCost.text != string.Empty)
                        {
                            spellCost.text += " / ";
                        }

                        spellCost.text += string.Format(LocalizationReference.Localize(powerCost.SpellPowerType, true).Value, powerCost.PowerCostPercentage);
                    }

                    if (powerCost.PowerCost > 0)
                    {
                        if (spellCost.text != string.Empty)
                        {
                            spellCost.text += " / ";
                        }

                        spellCost.text += string.Format(LocalizationReference.Localize(powerCost.SpellPowerType, false).Value, powerCost.PowerCost);
                    }
                }

                if (spellInfo.HasAttribute(SpellAttributes.RequiresComboPoints))
                {
                    if (spellCost.text != string.Empty)
                    {
                        spellCost.text += " / ";
                    }

                    spellCost.text += LocalizationReference.Localize(SpellPowerType.ComboPoints, false).Value;
                }

                return(true);
            }

            Debug.LogError($"Missing tooltip for spell: {spellInfo.name}!");
            return(false);
        }