示例#1
0
    // Use this for initialization
    void Awake()
    {
        if (wonBattleState.value == "lose")
        {
            gameObject.SetActive(false);
            return;
        }

        if (wonBattleState.value == "escape")
        {
            expGained.value   = 0;
            moneyGained.value = 0;
        }

        ExpLevel startLevel = new ExpLevel(totalExp.value);

        totalExp.value += expGained.value;
        ExpLevel endLevel = new ExpLevel(totalExp.value);

        if (startLevel.level != endLevel.level)
        {
            playerStatsChangedEvent.Invoke();
            if (endLevel.level == 2)
            {
                levelupTutorial.SetActive(true);
            }
        }

        totalMoney.value += moneyGained.value;
        SetTexts();
        playMusicEvent.Invoke();
    }
 public Configuration()
 {
     StarterShipCommand = "cb:startership";
     BlueprintName      = "SV_Prefab_Tier1";
     EntityType         = Entity.EntityType.HV;
     ShipNameFormat     = "{0}'s Starter Ship";
     MinimumLevelNeeded = ExpLevel.L1;
 }
 public ActionResult Edit(ExpLevel item)
 {
     if (ModelState.IsValid)
     {
         CH.Edit <ExpLevel>(item);
         return(RedirectToAction("Index"));
     }
     return(View(item));
 }
示例#4
0
        /// <summary>
        /// Returns true if ClanMember instances are equal
        /// </summary>
        /// <param name="input">Instance of ClanMember to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(ClanMember?input)
        {
            if (input == null)
            {
                return(false);
            }

            return
                ((
                     League == input.League ||
                     (League != null &&
                      League.Equals(input.League))
                     ) &&
                 (
                     Tag == input.Tag ||
                     (Tag != null &&
                      Tag.Equals(input.Tag))
                 ) &&
                 (
                     Name == input.Name ||
                     (Name != null &&
                      Name.Equals(input.Name))
                 ) &&
                 (
                     Role == input.Role ||
                     Role.Equals(input.Role)
                 ) &&
                 (
                     ExpLevel == input.ExpLevel ||
                     ExpLevel.Equals(input.ExpLevel)
                 ) &&
                 (
                     ClanRank == input.ClanRank ||
                     ClanRank.Equals(input.ClanRank)
                 ) &&
                 (
                     PreviousClanRank == input.PreviousClanRank ||
                     PreviousClanRank.Equals(input.PreviousClanRank)
                 ) &&
                 (
                     Donations == input.Donations ||
                     Donations.Equals(input.Donations)
                 ) &&
                 (
                     DonationsReceived == input.DonationsReceived ||
                     DonationsReceived.Equals(input.DonationsReceived)
                 ) &&
                 (
                     Trophies == input.Trophies ||
                     Trophies.Equals(input.Trophies)
                 ) &&
                 (
                     VersusTrophies == input.VersusTrophies ||
                     VersusTrophies.Equals(input.VersusTrophies)
                 ));
        }
示例#5
0
        /// <summary>
        /// Returns true if PlayerRanking instances are equal
        /// </summary>
        /// <param name="input">Instance of PlayerRanking to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(PlayerRanking?input)
        {
            if (input == null)
            {
                return(false);
            }

            return
                ((
                     Clan == input.Clan ||
                     (Clan != null &&
                      Clan.Equals(input.Clan))
                     ) &&
                 (
                     League == input.League ||
                     (League != null &&
                      League.Equals(input.League))
                 ) &&
                 (
                     AttackWins == input.AttackWins ||
                     AttackWins.Equals(input.AttackWins)
                 ) &&
                 (
                     DefenseWins == input.DefenseWins ||
                     DefenseWins.Equals(input.DefenseWins)
                 ) &&
                 (
                     Tag == input.Tag ||
                     (Tag != null &&
                      Tag.Equals(input.Tag))
                 ) &&
                 (
                     Name == input.Name ||
                     (Name != null &&
                      Name.Equals(input.Name))
                 ) &&
                 (
                     ExpLevel == input.ExpLevel ||
                     ExpLevel.Equals(input.ExpLevel)
                 ) &&
                 (
                     Rank == input.Rank ||
                     Rank.Equals(input.Rank)
                 ) &&
                 (
                     PreviousRank == input.PreviousRank ||
                     PreviousRank.Equals(input.PreviousRank)
                 ) &&
                 (
                     Trophies == input.Trophies ||
                     Trophies.Equals(input.Trophies)
                 ));
        }
示例#6
0
    IEnumerator FillExpBar()
    {
        currentAnimationTime = 0;
        float    startExp = totalExp.value - gainedExp.value;
        float    endExp   = totalExp.value;
        ExpLevel expLevel = new ExpLevel((int)startExp);
        float    filled   = expLevel.PercentToNext();

        valueImage.fillAmount = filled;

        yield return(new WaitForSeconds(startDelay));

        float value        = startExp;
        float currentDelay = sfxDelayTime;

        do
        {
            currentAnimationTime += Time.deltaTime / animationDuration;
            value = Mathf.Lerp(startExp, endExp, currentAnimationTime);
            bool levelUp = expLevel.SetExp((int)value);
            valueImage.fillAmount = expLevel.PercentToNext();

            currentDelay += Time.deltaTime / animationDuration;

            if (levelUp)
            {
                levelupText.SetActive(true);
                valueImage.color      = levelupColor;
                valueImage.fillAmount = 1;
                currentSfx.value.Enqueue(levelupSfx.clip);
                playSfxEvent.Invoke();
                yield return(new WaitForSeconds(1));

                valueImage.fillAmount = 0;
                valueImage.color      = normalColor;
                levelupText.SetActive(false);
            }
            else if (currentDelay > sfxDelayTime)
            {
                currentSfx.value.Enqueue(gainExpSfx.clip);
                currentDelay = 0;
                playSfxEvent.Invoke();
            }

            yield return(null);
        } while (value < endExp);

        yield break;
    }
    void SetAllStats()
    {
        ExpLevel expLevel = new ExpLevel(totalExp.value);

        dayText.text = ingameDay.value.ToString();
        // levelText.text = playerLevel.value.ToString();
        levelText.text    = expLevel.level.ToString();
        expText.text      = expLevel.restExp.ToString();
        moneyText.text    = totalMoney.value.ToString();
        playtimeText.text = playTime.value;

        healthText.text   = maxHealth.value.ToString();
        attackText.text   = attack.value.ToString();
        defenseText.text  = defense.value.ToString();
        sAttackText.text  = sAttack.value.ToString();
        sDefenseText.text = sDefense.value.ToString();
    }
示例#8
0
    void SetAllStats()
    {
        ExpLevel expLevel = new ExpLevel(totalExp.value);

        levelText.text    = expLevel.level.ToString();
        expText.text      = expLevel.restExp.ToString();
        moneyText.text    = totalMoney.value.ToString();
        chapterText.text  = ((Constants.CHAPTER)currentChapter.value).ToString();
        areaText.text     = ((Constants.SCENE_INDEXES)currentArea.value).ToString();
        playtimeText.text = playTime.value;

        healthText.text   = maxHealth.value.ToString();
        attackText.text   = attack.value.ToString();
        defenseText.text  = defense.value.ToString();
        sAttackText.text  = sAttack.value.ToString();
        sDefenseText.text = sDefense.value.ToString();
    }
        private static int GetLevelAsInt(ExpLevel playersLevel)
        {
            int index = 1;

            foreach (ExpLevel level in System.Enum.GetValues(typeof(ExpLevel)))
            {
                if (playersLevel == level)
                {
                    return(index);
                }
                else
                {
                    ++index;
                }
            }

            throw new InvalidOperationException(playersLevel.ToString());
        }
示例#10
0
        /// <summary>
        /// Returns true if PlayerVersusRanking instances are equal
        /// </summary>
        /// <param name="input">Instance of PlayerVersusRanking to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(PlayerVersusRanking?input)
        {
            if (input == null)
            {
                return(false);
            }

            return
                ((
                     Clan == input.Clan ||
                     (Clan != null &&
                      Clan.Equals(input.Clan))
                     ) &&
                 (
                     VersusBattleWins == input.VersusBattleWins ||
                     VersusBattleWins.Equals(input.VersusBattleWins)
                 ) &&
                 (
                     Tag == input.Tag ||
                     (Tag != null &&
                      Tag.Equals(input.Tag))
                 ) &&
                 (
                     Name == input.Name ||
                     (Name != null &&
                      Name.Equals(input.Name))
                 ) &&
                 (
                     ExpLevel == input.ExpLevel ||
                     ExpLevel.Equals(input.ExpLevel)
                 ) &&
                 (
                     Rank == input.Rank ||
                     Rank.Equals(input.Rank)
                 ) &&
                 (
                     PreviousRank == input.PreviousRank ||
                     PreviousRank.Equals(input.PreviousRank)
                 ) &&
                 (
                     VersusTrophies == input.VersusTrophies ||
                     VersusTrophies.Equals(input.VersusTrophies)
                 ));
        }
        public async Task <ExpLevel> GetExperienceLevel()
        {
            ExpLevel result = ExpLevel.L1;

            int expPoints = await GetExperiencePoints();

            foreach (ExpLevel level in System.Enum.GetValues(typeof(ExpLevel)))
            {
                if (expPoints < (int)level)
                {
                    break;
                }
                else
                {
                    result = level;
                }
            }

            return(result);
        }
示例#12
0
    IEnumerator FillExpBar()
    {
        currentAnimationTime = 0;
        float    startExp = totalExp.value - gainedExp.value;
        float    endExp   = totalExp.value;
        ExpLevel expLevel = new ExpLevel((int)startExp);
        float    filled   = expLevel.PercentToNext();

        valueImage.fillAmount = filled;
        Debug.Log("Filled is now: " + filled);

        Debug.Log("Waiting for start delay");
        yield return(new WaitForSeconds(startDelay));

        float value = startExp;

        do
        {
            currentAnimationTime += Time.deltaTime / animationDuration;
            value = Mathf.Lerp(startExp, endExp, currentAnimationTime);
            bool levelUp = expLevel.SetExp((int)value);
            valueImage.fillAmount = expLevel.PercentToNext();
            // Debug.Log("Amount is now: " + value);
            if (levelUp)
            {
                // Debug.Log("#######Levelup!");
                valueImage.color      = levelupColor;
                valueImage.fillAmount = 1;
                yield return(new WaitForSeconds(1));

                valueImage.fillAmount = 0;
                valueImage.color      = normalColor;
            }
            yield return(null);
        } while (value < endExp);

        yield break;
    }
示例#13
0
 public static JsonExpLevel ExpLevel(ExpLevel expLevel) {
     return new JsonExpLevel() { id = expLevel.Id, floor = expLevel.Floor, ceiling = expLevel.Ceiling, title = expLevel.Title };
 }
示例#14
0
    /// <summary>
    /// Calculates the current level where 100 exp more is required per level.
    /// </summary>
    public void CalculateExp()
    {
        ExpLevel expLevel = new ExpLevel(totalExp.value);

        playerLevel.value = expLevel.level;
    }
示例#15
0
 public Configuration()
 {
     StarterCreditsCommand = "cb:startercredits";
     AmountOfCredits       = 1;
     MinimumLevelNeeded    = ExpLevel.L1;
 }
示例#16
0
        /// <summary>
        /// Returns true if Player instances are equal
        /// </summary>
        /// <param name="input">Instance of Player to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Player?input)
        {
            if (input == null)
            {
                return(false);
            }

            return
                ((
                     Clan == input.Clan ||
                     (Clan != null &&
                      Clan.Equals(input.Clan))
                     ) &&
                 (
                     League == input.League ||
                     (League != null &&
                      League.Equals(input.League))
                 ) &&
                 (
                     Role == input.Role ||
                     Role.Equals(input.Role)
                 ) &&
                 (
                     AttackWins == input.AttackWins ||
                     AttackWins.Equals(input.AttackWins)
                 ) &&
                 (
                     DefenseWins == input.DefenseWins ||
                     DefenseWins.Equals(input.DefenseWins)
                 ) &&
                 (
                     TownHallLevel == input.TownHallLevel ||
                     TownHallLevel.Equals(input.TownHallLevel)
                 ) &&
                 (
                     TownHallWeaponLevel == input.TownHallWeaponLevel ||
                     TownHallWeaponLevel.Equals(input.TownHallWeaponLevel)
                 ) &&
                 (
                     VersusBattleWins == input.VersusBattleWins ||
                     VersusBattleWins.Equals(input.VersusBattleWins)
                 ) &&
                 (
                     LegendStatistics == input.LegendStatistics ||
                     (LegendStatistics != null &&
                      LegendStatistics.Equals(input.LegendStatistics))
                 ) &&
                 (
                     Troops == input.Troops ||
                     Troops != null &&
                     input.Troops != null &&
                     Troops.SequenceEqual(input.Troops)
                 ) &&
                 (
                     Heroes == input.Heroes ||
                     Heroes != null &&
                     input.Heroes != null &&
                     Heroes.SequenceEqual(input.Heroes)
                 ) &&
                 (
                     Spells == input.Spells ||
                     Spells != null &&
                     input.Spells != null &&
                     Spells.SequenceEqual(input.Spells)
                 ) &&
                 (
                     Labels == input.Labels ||
                     Labels != null &&
                     input.Labels != null &&
                     Labels.SequenceEqual(input.Labels)
                 ) &&
                 (
                     Tag == input.Tag ||
                     (Tag != null &&
                      Tag.Equals(input.Tag))
                 ) &&
                 (
                     Name == input.Name ||
                     (Name != null &&
                      Name.Equals(input.Name))
                 ) &&
                 (
                     ExpLevel == input.ExpLevel ||
                     ExpLevel.Equals(input.ExpLevel)
                 ) &&
                 (
                     Trophies == input.Trophies ||
                     Trophies.Equals(input.Trophies)
                 ) &&
                 (
                     BestTrophies == input.BestTrophies ||
                     BestTrophies.Equals(input.BestTrophies)
                 ) &&
                 (
                     Donations == input.Donations ||
                     Donations.Equals(input.Donations)
                 ) &&
                 (
                     DonationsReceived == input.DonationsReceived ||
                     DonationsReceived.Equals(input.DonationsReceived)
                 ) &&
                 (
                     BuilderHallLevel == input.BuilderHallLevel ||
                     BuilderHallLevel.Equals(input.BuilderHallLevel)
                 ) &&
                 (
                     VersusTrophies == input.VersusTrophies ||
                     VersusTrophies.Equals(input.VersusTrophies)
                 ) &&
                 (
                     BestVersusTrophies == input.BestVersusTrophies ||
                     BestVersusTrophies.Equals(input.BestVersusTrophies)
                 ) &&
                 (
                     WarStars == input.WarStars ||
                     WarStars.Equals(input.WarStars)
                 ) &&
                 (
                     Achievements == input.Achievements ||
                     Achievements != null &&
                     input.Achievements != null &&
                     Achievements.SequenceEqual(input.Achievements)
                 ) &&
                 (
                     VersusBattleWinCount == input.VersusBattleWinCount ||
                     VersusBattleWinCount.Equals(input.VersusBattleWinCount)
                 ));
        }
示例#17
0
        //the html that displays the clan card used in the pop down menu's and header of searched clan
        public override string ToString()
        {
            string returnString = "<div class=\"card card-group\"> <div class=\"container-fluid d-inline-flex\"> <div class=\"col-2\"> <p><b>Name:</b>" + Name + "</p> <p><b>Tag:</b>" + Tag + "</p> <p><b>Level:</b>" + ExpLevel.ToString() + "</p>";

            if (ExpLevel == 13)
            {
                returnString += "<p><b>Star Points:</b>" + StarPoints.ToString() + "</p>";
            }

            returnString += "<p><b>Current Tropies:</b>" + Trophies.ToString() + "</p><p><b>Highest Trophies:</b>" + BestTrophies + "</p></div>";

            returnString += "<div class=\"col-2\"><p><b>All Time Wins:</b>" + Wins.ToString() + "</p><p><b>All Time Losses:</b>" + Losses.ToString() + "</p>";
            Console.WriteLine();
            returnString += "<p><b>Current Favorite Card:</b>" + CurrentFavouriteCard.Name + "</p><img class=\"text-center\" src=\"" + CurrentFavouriteCard.Url + "\" width=\"64px\" />";
            returnString += "<p><b>Cards Discovered:</b>" + CardsDiscovered.ToString() + "/" + CardsInGame.ToString() + "</p></div>";

            returnString += "<div class=\"col-3\">";
            if (Clan != null)
            {
                returnString += "<p><b>Clan Name:</b>" + Clan.Name + "</p>";
            }
            if (Clan != null)
            {
                returnString += "<p><b>Clan Tag:</b>" + ClanTag + "</p>";
            }
            else
            {
                returnString += "<h2 class=\"text-center m-2\">Not In a Clan</h2>";
            }

            returnString += "<p><b>Recent Donations:</b>" + Donations.ToString() + "</p><p><b>Recent Donations Recieved:</b>" + DonationsReceived.ToString() + "</p>";
            returnString += "<p><b>Total Donations:</b>" + TotalDonations.ToString() + "</p><p><b>Total Donations Recieved:</b>" + ClanCardsCollected.ToString() + "</p></div>";


            returnString += "<div class=\"col-5 m-0\"><div class=\"text-center\"><p><b>Current Deck</b></p> " + Deck.ToString() + "<p>Profile Updated:" + UpdateTime + "</p></div></div></div></div>";

            return(returnString);
        }
示例#18
0
        /// <summary>
        /// gets the collection of the jsonexp levels
        /// </summary>
        /// <param name="levels"></param>
        /// <returns></returns>

        public static JsonExpLevel[] ExpLevels(ExpLevel[] levels) {
            List<JsonExpLevel> result = new List<JsonExpLevel>();
            Array.ForEach(levels, l => {
                result.Add(ExpLevel(l));
            });
            return result.ToArray<JsonExpLevel>();
        }