public ActionResult Edit(StatsInfo collection)
        {
            StatsInfoDao bdDao = new StatsInfoDao();

            try
            {
                UserLogin us = (UserLogin)Session[SystemConsts.USER_SESSION];

                collection.ModifiedBy   = us.UserName;
                collection.ModifiedDate = Hepper.GetDateServer();


                if (bdDao.Update(collection))
                {
                    SetAlert(@Resources.ResourceAdmin.AdminEditRecordSucess, "success");
                    return(RedirectToAction("Index"));
                }
                else
                {
                    SetAlert(@Resources.ResourceAdmin.AdminEditRecordFailed, "danger");
                }

                return(RedirectToAction("Index"));
            }
            catch
            {
                SetAlert(@Resources.ResourceAdmin.AdminEditRecordFailed, "danger");
                return(View());
            }
        }
Example #2
0
        public bool Update(StatsInfo mode)
        {
            try
            {
                var bd = db.StatsInfoes.Find(mode.StasInfoID);

                // bd.StatsInfoID = mode.StatsInfoID;
                //bd.CreateBy = mode.CreateBy;
                //bd.CreateDate = mode.CreateDate;
                bd.Description  = mode.Description;
                bd.DisplayOrder = mode.DisplayOrder;


                bd.LanguageID = mode.LanguageID;

                bd.ModifiedBy   = mode.ModifiedBy;
                bd.ModifiedDate = mode.ModifiedDate;


                bd.Number = mode.Number;
                bd.Speed  = mode.Speed;

                bd.Name = mode.Name;
                db.SaveChanges();
                return(true);
            }
            catch
            {
                return(false);
            }
        }
Example #3
0
 /// <summary>
 /// Sets the stats.
 /// </summary>
 /// <param name="nextLevel">Next Level.</param>
 /// <param name="info">Info.</param>
 public void setStats(string nextLevel, StatsInfo levelInfo, StatsInfo totalInfo)
 {
     // Store a copy
     levelStats = levelInfo;
     totalStats = totalInfo;
     nextLvl    = nextLevel;
 }
        public ActionResult Create(StatsInfo collection)
        {
            try
            {
                StatsInfoDao bdDao = new StatsInfoDao();

                UserLogin us = (UserLogin)Session[SystemConsts.USER_SESSION];
                collection.CreateBy     = us.UserName;
                collection.CreateDate   = Hepper.GetDateServer();
                collection.ModifiedBy   = us.UserName;
                collection.ModifiedDate = Hepper.GetDateServer();
                collection.LanguageID   = "vi";

                //collection.CreateBy = us.UserName;
                //collection.ModifiedBy = us.UserName;
                if (bdDao.Insert(collection))
                {
                    SetAlert(@Resources.ResourceAdmin.AdminCreateRecordSuccess, "success");
                    return(RedirectToAction("Index"));
                }
                else
                {
                    SetAlert(@Resources.ResourceAdmin.AdminCreateRecordFailed, "danger");
                }

                return(RedirectToAction("Index"));
            }
            catch
            {
                SetAlert(@Resources.ResourceAdmin.AdminCreateRecordFailed, "danger");
                return(View());
            }
        }
Example #5
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
 public void ReceiveDamage(StatsInfo attacker, int i)
 {
     if (active && si != null)
     {
         float probabilityHit = (20.0F - ((attacker.THAC0 - si.AC) - 1)) / 20.0F;
         float dmg            = i * probabilityHit;
         si.HP = si.HP - dmg;
         if (si.HP <= 0)
         {
             if (si.name == "Player" || si.name == "Xenus")
             {
                 // ci pensa il checkpoint controller
             }
             else if (si.name == "Mercenary Brute")
             {
                 StartCoroutine(MercenaryStun(si.gameObject));
             }
             else if (si.name == "Noirah Nah")
             {
                 si.HP = 5;
             }
             else
             {
                 Destroy(si.gameObject);
             }
         }
     }
 }
 void Awake()
 {
     currentStats = new StatsInfo();
     // Setup the input manager
     InputManager.Setup();
     // Get the ninja renderer
     ninjaRenderers = GetComponentsInChildren <Renderer> ();
     // Search for the Effects holder
     foreach (Transform tf in GetComponentsInChildren <Transform> ())
     {
         // Is this the effects game object?
         if (tf.name == "Effects")
         {
             // Save the game object
             ninjaEffects = tf.gameObject;
             // We are done here
             break;
         }
     }
     // Initialize GUI
     initializeGUI();
     // Set the base ninja
     setBaseNinja();
     // Set the base walking audio
     walkingAudio = metalWalkingAudio;
     // Initialize the move direction
     moveDirection = transform.TransformDirection(Vector3.forward);
 }
    // Use this for initialization
    void Start()
    {
        // Initialize stats info
        currentStats           = new StatsInfo();
        currentStats.startTime = Time.time;
        totalStats             = new StatsInfo();
        totalStats.startTime   = Time.time;
        // Get the Message Manager
        msgManager = GetComponent <MessageManager> ();
        // Get the Player
        player = GameObject.FindGameObjectWithTag("Player");
        // Get the Ninja Controller
        ninjaController = player.GetComponent <NinjaController> ();
        ninjaController.setMessageManager(msgManager);
        // Get the Puzzles
        GameObject puzzle = GameObject.FindGameObjectWithTag("Puzzle");

        if (puzzle != null)
        {
            // Find the puzzles
            if (puzzle.name.Equals("Fire Puzzle", System.StringComparison.CurrentCultureIgnoreCase))
            {
                firePuzzle = puzzle;
            }
            else if (puzzle.name.Equals("Water Puzzle", System.StringComparison.CurrentCultureIgnoreCase))
            {
                waterPuzzle = puzzle;
            }
            else if (puzzle.name.Equals("Combo Puzzle", System.StringComparison.CurrentCultureIgnoreCase))
            {
                comboPuzzle = puzzle;
            }
        }
        // See if we need to find the pause UI
        if (pauseUI == null)
        {
            // Get the Pause UI
            pauseUI = GameObject.FindGameObjectWithTag("PauseUI");
        }
        // See if we need to find the stats UI
        if (statsUI == null)
        {
            // Get the Stats UI
            statsUI = GameObject.FindGameObjectWithTag("StatsUI");
            if (statsUI != null)
            {
                // Disable it for now
                statsUI.SetActive(false);
            }
        }
        // See if we need to find the ninja animation controller again
        if (ninjaAnimationController == null)
        {
            // Get the Ninja Animation Controller
            ninjaAnimationController = player.GetComponent <CyborgNinjaAnimationController> ();
        }
        // Get the pause script
        pauseScript = GetComponent <PauseGame> ();
    }
Example #9
0
        public void ConstructMissing()
        {
            allValues.Clear();
            var       server = InfoTestsHelper.Create("Stats", allValues);
            StatsInfo info   = new StatsInfo(server);

            Assert.IsNull(info.TotalCommands);
        }
Example #10
0
        public StatsInfo GetStatistics(string lastvisit)
        {
            StatsInfo    stats = new StatsInfo();
            SqlParameter parm  = new SqlParameter("@LastVisit", SqlDbType.VarChar)
            {
                Value = lastvisit
            };

            using (SqlDataReader rdr = SqlHelper.ExecuteReader(SqlHelper.ConnString, CommandType.Text, ACTIVE_MEMBERS + ACTIVE_TOPICS + ARCHIVED_REPLY + ARCHIVED_TOPICS + TOTAL_MEMBERS + TOTAL_TOPICS + TOTAL_POSTS, parm))
            {
                while (rdr.Read())
                {
                    stats.ActiveMembers = rdr.GetInt32(0);
                }
                rdr.NextResult();
                while (rdr.Read())
                {
                    stats.ActiveTopicCount = rdr.GetInt32(0);
                }
                rdr.NextResult();
                while (rdr.Read())
                {
                    stats.ArchiveReplyCount = rdr.GetInt32(0);
                }
                rdr.NextResult();
                while (rdr.Read())
                {
                    stats.ArchiveTopicCount = rdr.GetInt32(0);
                }
                rdr.NextResult();
                while (rdr.Read())
                {
                    stats.MemberCount = rdr.GetInt32(0);
                }
                rdr.NextResult();
                while (rdr.Read())
                {
                    stats.TopicCount = rdr.GetInt32(0);
                }
                rdr.NextResult();
                while (rdr.Read())
                {
                    stats.TotalPostCount = rdr.GetInt32(0);
                }
            }

            stats.LastPost = GetLastPost();
            if (stats.LastPost != null)
            {
                if (stats.LastPost.LastPostAuthorId != null)
                {
                    stats.LastPostAuthor = GetLastPostAuthor(stats.LastPost.LastPostAuthorId.Value);
                }
            }
            stats.NewestMember = GetNewestMember();

            return(stats);
        }
Example #11
0
        public void Construct()
        {
            var server = InfoTestsHelper.Create("Stats", allValues);

            Assert.Throws <ArgumentNullException>(() => new StatsInfo(null));
            StatsInfo info = new StatsInfo(server);

            Assert.AreEqual(100, info.TotalCommands);
        }
Example #12
0
    public void RecieveUpdate(StatsInfo info)
    {
        numStarsCollected.text      = "Number of Stars: " + info.numStarsCollected.ToString();
        constelationsCollected.text = "Constelations: " + "0";
        distanceTraveled.text       = "Distance Traveled: " + ((int)info.distanceTraveled).ToString() + " feet!";
        totalPoints.text            = "Total Points: " + info.numStarsCollected.ToString();

        // Serialize best somehow
        // Load best somehow
    }
Example #13
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["CurrentProfile"] != null)
         Session.Remove("CurrentProfile");
     _page = (PageBase) Page;
     _stats = Statistics.GetStatistics();
     if (_stats == null)
         return;
     PopulateData();
 }
Example #14
0
    public void WriteLastStats()
    {
        StatsInfo info = JsonUtility.FromJson <StatsInfo> (
            PlayerPrefs.GetString(lastStatsString, "{}")
            );

        score.InitializeStringBuilder(info.Score);
        hitCount.InitializeStringBuilder(info.HitCount);
        roundTime.InitializeStringBuilder(info.RoundTime);
    }
Example #15
0
 public RedisInfo()
 {
     Replication = new ReplicationInfo();
     Clients     = new ClientInfo();
     Server      = new ServerInfo();
     Memory      = new MemoryInfo();
     Persistence = new PersistenceInfo();
     Stats       = new StatsInfo();
     CPU         = new CPUInfo();
     Keyspace    = new KeyspaceInfo();
 }
Example #16
0
 public RedisInfo()
 {
     Replication = new ReplicationInfo();
     Clients = new ClientInfo();
     Server = new ServerInfo();
     Memory = new MemoryInfo();
     Persistence = new PersistenceInfo();
     Stats = new StatsInfo();
     CPU = new CPUInfo();
     Keyspace = new KeyspaceInfo();
 }
Example #17
0
 public StatsModifier(ModifierInfo info, Entity casterEntity,
                      Entity targetEntity, Environment environment,
                      CollectionOfInteractions modifierInteractionCollection,
                      SkillCastingSource src) : base(info, casterEntity, targetEntity, environment, modifierInteractionCollection)
 {
     this.src              = src;
     this.info             = (StatsInfo)info;
     targetStatsComponent  = targetEntity.GetComponent <StatsComponent>();
     targetHealthComponent = targetEntity.GetComponent <HealthComponent>();
     statsType             = this.info.Smc.ShowStatsType();
     targetHero            = (DefaultHero)targetEntity.GetComponent <HeroStateMachineComponent>().StateMachineHero;
 }
Example #18
0
 void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.tag == "PlayerBody")
     {
         si = other.gameObject.GetComponentInParent <StatsInfo>();
         int crash = Random.Range(1, 20);
         if (si.DEX < crash)
         {
             si.HP = 0;
             Destroy(transform.parent.gameObject);
         }
     }
 }
 public MetaInfo(BinaryReader br)
 {
     Unknown3 = br.ReadUInt32();
     Title    = new TitleInfo(br);
     Guild    = new GuildInfo(br);
     Unknown4 = br.ReadUInt32();
     Stats    = new StatsInfo(br);
     Unknown5 = br.ReadUInt16();
     Unknown6 = br.ReadByte();
     Unknown7 = br.ReadUInt16();
     Unknown8 = br.ReadUInt16();
     Energy   = new EnergyInfo(br);
     Unknown9 = br.ReadBytes(13);
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["CurrentProfile"] != null)
     {
         Session.Remove("CurrentProfile");
     }
     _page  = (PageBase)Page;
     _stats = Statistics.GetStatistics();
     if (_stats == null)
     {
         return;
     }
     PopulateData();
 }
Example #21
0
        public bool Insert(StatsInfo mode)
        {
            try
            {
                db.StatsInfoes.Add(mode);
                db.SaveChanges();
                return(true);
            }

            catch
            {
                return(false);
            }
        }
Example #22
0
 public Tester(string host, string userId = null)
 {
     this.host = host;
     if (string.IsNullOrWhiteSpace(userId))
     {
         this.userId = Guid.NewGuid().ToString();
     }
     else
     {
         this.userId = userId;
     }
     ConnectStats     = new StatsInfo("connect", userId, logger);
     RecoverStats     = new StatsInfo("recover", userId, logger);
     SendMessageStats = new StatsInfo("echo", userId, logger);
 }
    public bool Disarm(Transform t)
    {
        StatsInfo si     = t.root.GetComponentInChildren <StatsInfo>();
        int       disarm = Random.Range(1, 20);
        int       dmg    = Random.Range(1, 4);

        if (si.INT >= disarm)
        {
            return(true);
        }
        else
        {
            si.HP -= dmg;
            return(false);
        }
    }
Example #24
0
    // Use this for initialization
    void Start()
    {
        stats = new StatsInfo();

        dayTimeLeft      = initialDayLength;
        moveSpeed        = initialSpeed;
        environmentSpeed = initialEnvironmentSpeed;
        spawnTime        = initialSpawnTime;
        spawnTimer       = spawnTime;
        envSpawnTimer    = initialEnvSpawnTime;

        if (itemSpawnVariance < 1)
        {
            itemSpawnVariance = 1;
        }
        if (envSpawnVariance < 1)
        {
            envSpawnVariance = 1;
        }
    }
Example #25
0
    /// <summary>
    /// Transfers the level specific stats.
    /// Should only be passed the current stats object, and only
    /// be called from the total stats.
    /// </summary>
    /// <param name="info">Info.</param>
    public void transferLevelSpecificStats(StatsInfo info)
    {
        // Add the energy times
        totalAirTime   += info.totalAirTime;
        totalFireTime  += info.totalFireTime;
        totalWaterTime += info.totalWaterTime;

        // Add the charging times
        totalAirCharging   += info.totalAirCharging;
        totalFireCharging  += info.totalFireCharging;
        totalWaterCharging += info.totalWaterCharging;

        // Add the attack stats
        numberAttacks      += info.numberAttacks;
        numberTroopsKilled += info.numberTroopsKilled;

        // Add the health stats
        sumHealth       += info.sumHealth;
        numHealthPoints += info.numHealthPoints;
    }
Example #26
0
        public StatsInfo GetStatus(string key, string port = null)
        {
            var       f    = MainApp.dirs[1] + "/" + key + "_" + port + "/uptime_" + TimeChron.GetRealTime().ToString("dd.MM.yyyy") + ".txt";
            StatsInfo list = new StatsInfo();

            if (File.Exists(f))
            {
                var r = File.OpenText(f);
                while (!r.EndOfStream)
                {
                    var line = r.ReadLine();
                    list.StatList.Add(StatsInfo.Parse(line));
                }
            }
            foreach (var i in POOL.Where(x => x.Key.Contains(key) && x.Key.Contains(port)).First().Stats)
            {
                list.StatList.Add(StatsInfo.Parse(i));
            }
            return(list);
        }
        public async Task <IActionResult> GetStatsInfo(string userNo)
        {
            if (string.IsNullOrEmpty(userNo))
            {
                return(StatusCode(HttpStatusCode.Unauthorized));
            }
            string key = string.Format("{0}_STATS_INFO", userNo);

            if (cache.Get(key) != null)
            {
                return(Ok <StatsInfo>(cache.Get(key) as StatsInfo));
            }
            var user = userService.GetUser(userNo);

            if (user == null)
            {
                return(StatusCode(HttpStatusCode.Unauthorized));
            }
            bool isAdmin          = user.UserType == EUserType.Admin;//判断是否为管理员身份,用于显示不同权限的统计数据
            int  totalDeviceCount = await deviceService.GetDeviceCount((isAdmin ? "" : user.UserNo));

            int onlineDeviceCount = await deviceService.GetDeviceCount((isAdmin ? "" : user.UserNo), true);

            int totalUserCount = await userService.GetUserCount();

            var value = new StatsInfo()
            {
                TotalDeviceCount    = totalDeviceCount,
                TotalDeviceDisplay  = true,
                OnlineDeviceCount   = onlineDeviceCount,
                OnlineDeviceDisplay = true,
                TotalUserCount      = totalUserCount,
                TotalUserDisplay    = isAdmin
            };

            cache.Set(key, value, new DateTimeOffset(DateTime.Now.AddMinutes(5)));
            return(Ok(value));
        }
Example #28
0
    /// <summary>
    /// Save the specified info.
    /// </summary>
    /// <param name="info">Info.</param>
    public void Save(StatsInfo info)
    {
#if PLAY_TESTING
        // Set the file path
        string filePath = Application.persistentDataPath + "/playTest.csv";

        // Check for the file not existing
        if (!File.Exists(filePath))
        {
            // Write the headers out
            File.AppendAllText(filePath, "Start Time,End Time,Total Time," +
                               "Fire Start Time,Fire End Time,Fire Total Time," +
                               "Water Start Time,Water End Time,Water Total Time," +
                               "Air Time,Water Time,Fire Time," +
                               "Air Charge Time,Water Charge Time,Fire Charge Time," +
                               "Failed Fire,Failed Water," +
                               "Number of Attacks,Troops Killed,Average Health,Success\n");
        }
        Debug.Log("Play Test Data saved: " + filePath);
        // Write all the data out
        File.AppendAllText(filePath, info.getData());
#endif
    }
Example #29
0
        public void StackValue(Modifier newOne)
        {
            StatsInfo     statsInfoFromNewOne = (StatsInfo)newOne.Cookies()[0];
            ValueModifier valueModifier       = stats.AddModifier(
                statsInfoFromNewOne.Smc.ShowStatsModifierOperator(),
                ((StatsModifier)newOne).CalculateValue()
                );

            valueModifiers.Add(valueModifier);

            for (int kIndex = 0; kIndex < statsInfoFromNewOne.Smc.extras.Count; kIndex++)
            {
                StatsModifierValue extra         = statsInfoFromNewOne.Smc.extras[kIndex];
                ValueModifier      extraModifier = stats.AddModifier(
                    extra.ShowOperator(), extra.statsModifierValue * powerScale
                    );
                if (extraValueModifiers.Count - 1 < kIndex)
                {
                    extraValueModifiers.Add(new List <ValueModifier>());
                }
                extraValueModifiers[kIndex].Add(extraModifier);
            }
        }
Example #30
0
        public void SearchSummoner(string Summoner)
        {
            #region Control_TextBox
            LoadCircle.Visible = true;
            if (Summoner == "")
            {
                MessageLabel.Visible             = true;
                MessageLabel.Text                = "Enter summoner name!";             //CONTROL EMPTY TEXTOBX
                emptyTextBoxControlTimer.Enabled = true;
                LoadCircle.Visible               = false;
            }
            #endregion
            else
            {
                try
                {
                    #region GetSummonerAndIcon

                    SummonerInfo summonerInfo = GetSummoner.ReturnSummoner(Summoner, regionsComboBox.Text, apiKey);

                    SummonerIconPictureBox.Image = ProfileIcon.ReturnIcon(summonerInfo.profileIconId.ToString(), version);


                    SummonerNameLabel.Text = summonerInfo.name;
                    levelLabel.Text        = "Level: " + summonerInfo.summonerLevel;
                    #endregion

                    //---------------------------------------------------------------------------------#ff000000------#ff010101----------------------------------------------------------------------------------------------------------------------//



                    #region DataTable

                    DataTable dt = new DataTable();
                    dt.Columns.Add("Champion");
                    dt.Columns.Add("KDA");
                    dt.Columns.Add("Games played");
                    dt.Columns.Add("Wins");

                    dt.Columns.Add("Minions");
                    dt.Columns.Add("Golds");
                    dt.Columns.Add("Penta Kills");
                    dt.Columns.Add("Quadra Kills");
                    dt.Columns.Add("Triple Kills");
                    dt.Columns.Add("Double Kills");
                    dt.Columns.Add("Max kills");
                    dt.Columns.Add("Max deaths");
                    dt.Columns.Add("Turrets destroyed");

                    if (summonerInfo.summonerLevel == 30)
                    {
                        WebClient    statclient = new WebClient();
                        Stream       statdata   = statclient.OpenRead("https://" + regionsComboBox.Text.ToLower() + ".api.pvp.net/api/lol/" + regionsComboBox.Text.ToLower() + "/v1.3/stats/by-summoner/" + summonerInfo.id + "/ranked?api_key=" + apiKey);
                        StreamReader statreader = new StreamReader(statdata);                        //GET STATS
                        string       result     = statreader.ReadLine();
                        StatsInfo    statsInfo  = JsonConvert.DeserializeObject <StatsInfo>(result); //DESERIALIZE JSON STRING


                        //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------//
                        Champion        TotalStatus   = new Champion();
                        List <Champion> listChampions = new List <Champion>();
                        foreach (Champion champion in statsInfo.champions)
                        {
                            if (champion.id == 0)
                            {
                                TotalStatus = champion;
                            }
                            listChampions.Add(champion);
                        }
                        listChampions.Sort(delegate(Champion c1, Champion c2) { return(c2.stats.totalSessionsPlayed.CompareTo(c1.stats.totalSessionsPlayed)); });
                        string joinedIDs     = "";
                        int    countChampion = 0;
                        foreach (Champion champ in listChampions)
                        {
                            joinedIDs += champ.id.ToString() + ",";
                            countChampion++;                            //RETURN CHAMPIONS BY IDS AND RETURN VERSION OF CHAMPION POOL
                        }
                        joinedIDs = joinedIDs.Remove(joinedIDs.Length - 1);
                        string[] Champions = Transform.ReturnChampion(JSON, joinedIDs, countChampion);
                        version = Transform.returnVersion(JSON);

                        //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------//

                        int x = 0;


                        foreach (Champion champion in statsInfo.champions)                                    //SORT STATS INFO
                        {
                            if (x != 0)
                            {
                                float WonPercentage = ((float)listChampions[x].stats.totalSessionsWon / (float)listChampions[x].stats.totalSessionsPlayed) * 100;
                                int   wonPercToInt  = (int)WonPercentage;
                                dt.Rows.Add(Champions[x],
                                            Math.Round(listChampions[x].stats.totalChampionKills / listChampions[x].stats.totalSessionsPlayed) + "/" + Math.Round(listChampions[x].stats.totalDeathsPerSession / listChampions[x].stats.totalSessionsPlayed) + "/" + Math.Round(listChampions[x].stats.totalAssists / listChampions[x].stats.totalSessionsPlayed),
                                            listChampions[x].stats.totalSessionsPlayed,
                                            listChampions[x].stats.totalSessionsWon + " (" + wonPercToInt + "%)",
                                            listChampions[x].stats.totalMinionKills / listChampions[x].stats.totalSessionsPlayed,
                                            listChampions[x].stats.totalGoldEarned / listChampions[x].stats.totalSessionsPlayed,
                                            listChampions[x].stats.totalPentaKills,
                                            listChampions[x].stats.totalQuadraKills,
                                            listChampions[x].stats.totalTripleKills,
                                            listChampions[x].stats.totalDoubleKills,
                                            listChampions[x].stats.maxChampionsKilled,
                                            listChampions[x].stats.maxNumDeaths,
                                            listChampions[x].stats.totalTurretsKilled);
                            }

                            x++;
                        }


                        float AvgWon    = ((float)listChampions[0].stats.totalSessionsWon / (float)listChampions[0].stats.totalSessionsPlayed) * 100;
                        int   avgWonINT = (int)AvgWon;


                        WLlabel.Text            = (TotalStatus.stats.totalSessionsWon + "/" + TotalStatus.stats.totalSessionsLost) + " (" + avgWonINT.ToString() + "%)";
                        avgKDAlabel.Text        = Math.Round(listChampions[0].stats.totalChampionKills / listChampions[0].stats.totalSessionsPlayed) + "/" + Math.Round(listChampions[0].stats.totalDeathsPerSession / listChampions[0].stats.totalSessionsPlayed) + "/" + Math.Round(listChampions[0].stats.totalAssists / listChampions[0].stats.totalSessionsPlayed);
                        avgPentakillsLabel.Text = listChampions[0].stats.totalPentaKills.ToString();
                        avgMinionsLabel.Text    = (listChampions[0].stats.totalMinionKills / listChampions[0].stats.totalSessionsPlayed).ToString();
                    }
                    else    //UNDER LV30
                    {
                        WLlabel.Text            = "-";
                        avgKDAlabel.Text        = "-";
                        avgPentakillsLabel.Text = "-";
                        avgMinionsLabel.Text    = "-";
                    }


                    ChampionsInfoGrid.DataSource = dt;
                    foreach (DataGridViewColumn column in ChampionsInfoGrid.Columns)
                    {
                        column.SortMode = DataGridViewColumnSortMode.NotSortable;
                        //column.Width = 75;
                    }
                    //ChampionsInfoGrid.Sort(ChampionsInfoGrid.Columns[1], ListSortDirection.Descending);
                    if (ChampionsInfoGrid.Rows.Count == 0)
                    {
                        ChampionSearchTextBox.Enabled = false;
                    }
                    else
                    {
                        ChampionSearchTextBox.Enabled = true;
                    }
                    #endregion



                    //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------//
                    #region GetDivison
                    string DivisionResult = "";
                    Image  DivisionImage  = new Bitmap(LoLAssistant.Properties.Resources.provisional);
                    try
                    {
                        WebClient    DivisionClient = new WebClient();
                        string       s              = "https://" + regionsComboBox.Text.ToLower() + ".api.pvp.net/api/lol/" + regionsComboBox.Text.ToLower().ToLower() + "/v2.5/league/by-summoner/" + summonerInfo.id + "/entry?api_key=" + apiKey;
                        Stream       DivisionData   = DivisionClient.OpenRead(s);
                        StreamReader DivisionReader = new StreamReader(DivisionData);
                        DivisionResult = DivisionReader.ReadLine();
                    }
                    catch (WebException ex)
                    {
                        if (ex.Status == WebExceptionStatus.ProtocolError)
                        {
                            HttpWebResponse response = (HttpWebResponse)ex.Response;
                            if (response.StatusCode == HttpStatusCode.NotFound)
                            {
                                DivisionImage = new Bitmap(LoLAssistant.Properties.Resources.provisional);
                            }
                        }
                    }
                    if (summonerInfo.summonerLevel == 30 && DivisionResult != "")
                    {
                        DivisionResult = DivisionResult.Replace("{\"" + summonerInfo.id + "\":", string.Empty);
                        DivisionResult = DivisionResult.Replace("}]}]}", "}]}]");

                        List <Division> divisions = JsonConvert.DeserializeObject <List <Division> >(DivisionResult);


                        foreach (Division div in divisions)
                        {
                            if (div.queue == "RANKED_SOLO_5x5")
                            {
                                DivisionLabel.Text = div.tier + " " + div.entries[0].division + " " + "(" + div.entries[0].leaguePoints + "lp)";
                                switch (div.tier)
                                {
                                case "BRONZE":
                                    DivisionImage = new Bitmap(LoLAssistant.Properties.Resources.bronze);
                                    break;

                                case "SILVER":
                                    DivisionImage = new Bitmap(LoLAssistant.Properties.Resources.silver);
                                    break;

                                case "GOLD":
                                    DivisionImage = new Bitmap(LoLAssistant.Properties.Resources.gold);
                                    break;

                                case "PLATINUM":
                                    DivisionImage = new Bitmap(LoLAssistant.Properties.Resources.platinum);
                                    break;

                                case "DIAMOND":
                                    DivisionImage = new Bitmap(LoLAssistant.Properties.Resources.diamond);
                                    break;

                                case "MASTER":
                                    DivisionImage = new Bitmap(LoLAssistant.Properties.Resources.master);
                                    break;

                                case "CHALLENGER":
                                    DivisionImage = new Bitmap(LoLAssistant.Properties.Resources.challenger);
                                    break;
                                }
                            }
                        }
                    }

                    else    //UNRANKED OR NOT 30LV
                    {
                        DivisionImage      = new Bitmap(LoLAssistant.Properties.Resources.provisional);
                        DivisionLabel.Text = "UNRANKED";
                    }


                    DivisionImage            = new Bitmap(DivisionImage, new Size(150, 150));
                    DivisionPictureBox.Image = DivisionImage;
                    #endregion
                    //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------//

                    #region PageNavigation
                    basicPage.Hide();
                    SummonerInfoPanel.Show();
                    SummonerInfoPanel.BringToFront();
                    LoadCircle.Visible = false;                                  //PAGE NAVIGATION
                    TypeLabel.Text     = "Ranked Statistics";
                    TypeLabel.Visible  = true;
                    #endregion
                }
                catch (WebException ex)
                {
                    if (ex.Status == WebExceptionStatus.ProtocolError)
                    {
                        var response = (HttpWebResponse)ex.Response;
                        if (response.StatusCode == HttpStatusCode.NotFound)
                        {
                            MessageLabel.Visible             = true;
                            MessageLabel.Text                = "Summoner does not exist!";
                            emptyTextBoxControlTimer.Enabled = true;
                            LoadCircle.Visible               = false;
                        }
                    }
                }
            }
        }
 void Start()
 {
     si = GetComponentInChildren <StatsInfo> ();
 }
Example #32
0
    public StatsData()
    {
        TextAsset fileAsString = Resources.Load("Stats") as TextAsset;

        Stats = JsonUtility.FromJson <StatsInfo>(fileAsString.ToString());
    }