Exemplo n.º 1
0
 protected void imgBtnSave_Click(object sender, ImageClickEventArgs e)
 {
     Scores insertExamScore = new Scores();  //创建Scores类对象
     insertExamScore.UserID = Request.QueryString["UserID"].ToString();
     insertExamScore.ExamTime = Convert.ToDateTime(lblExamtime.Text);
     insertExamScore.PaperID = int.Parse(Request.QueryString["PaperID"].ToString());
     insertExamScore.Score = Convert.ToInt32(sumScore.Text);
     insertExamScore.PingYu = tbxPingyu.Text;
     //实例化公共类Paper
     Paper mypaper = new Paper();
     mypaper.UserID = Request.QueryString["UserID"].ToString();
     mypaper.PaperID = int.Parse(Request.QueryString["PaperID"].ToString());
     mypaper.state = "已评阅";
     //使用CheckScore方法验证成绩是否存在
     if (!insertExamScore.CheckScore(insertExamScore.UserID, insertExamScore.PaperID))
     {
         //调用InsertByProc方法向数据库中插入成绩
         if (insertExamScore.InsertByProc())
         {
             mypaper.UpdateByProc(mypaper.UserID, mypaper.PaperID, mypaper.state);
             //给出成功提示信息
             lblMessage.Text = "考生成绩保存成功!";
         }
         else
         {
             lblMessage.Text = "考生成绩保存失败!";
         }
     }
     else
     {
         lblMessage.Text = "该用户的成绩已存在,请先删除成绩再评阅!";
     }
 }
Exemplo n.º 2
0
 public static void UpdateScoreboard(string name, int score)
 {
     if (score > scoreboard[0].score)
     {
         Scores newScore = new Scores();
         newScore.name = name;
         newScore.score = score;
         int index = 0;
         bool newHighScore = false;
         foreach (Scores s in scoreboard)
         {
             if (newScore.score < s.score)
             {
                 newHighScore = true;
                 index = scoreboard.IndexOf(s);
             }
             else if (s == scoreboard.Last())
             {
                 newHighScore = true;
                 index = scoreboard.Count;
             }
         }
         if (newHighScore)
         {
             scoreboard.Insert(index, newScore);
         }
         scoreboard.RemoveAt(0);
         SaveScoreboard();
     }
 }
Exemplo n.º 3
0
    public HighScores()
    {
        BackRect = new Rect(Main.NativeWidth * 0.05f, Main.NativeHeight - (((Main.NativeHeight / 12f) - (Main.NativeWidth * 0.05f)) + (Main.NativeWidth * 0.05f)), (Main.NativeWidth / 3) - (Main.NativeWidth * 0.1f), (Main.NativeHeight / 12f) - (Main.NativeWidth * 0.05f));

        EasyLabelRect = new Rect(Main.NativeWidth * 0.05f, Main.NativeWidth * 0.05f, Main.NativeWidth - (Main.NativeWidth * 0.1f), Main.NativeHeight / 3.5f);
        MediumLabelRect = new Rect(EasyLabelRect.x, EasyLabelRect.y + EasyLabelRect.height, EasyLabelRect.width, EasyLabelRect.height);
        HardLabelRect = new Rect(EasyLabelRect.x, MediumLabelRect.y + EasyLabelRect.height, EasyLabelRect.width, EasyLabelRect.height);

        BackStyle = new GUIStyle();
        BackStyle.fontSize = Main.FontLarge;
        BackStyle.normal.textColor = Colors.ClickableText;
        BackStyle.alignment = TextAnchor.MiddleCenter;

        DifficultyLabelStyle = new GUIStyle();
        DifficultyLabelStyle.fontSize = Main.FontLargest;
        DifficultyLabelStyle.normal.textColor = Colors.ReadableText;
        DifficultyLabelStyle.alignment = TextAnchor.UpperLeft;
        DifficultyLabelStyle.fontStyle = FontStyle.Bold;

        DifficultyScoreStyle = new GUIStyle();
        DifficultyScoreStyle.fontSize = Main.FontLarge;
        DifficultyScoreStyle.normal.textColor = Colors.ReadableText;
        DifficultyScoreStyle.alignment = TextAnchor.UpperCenter;

        // DifficultyAverageStyle = new GUIStyle();
        // DifficultyAverageStyle.fontSize = Main.FontLargest;
        // DifficultyAverageStyle.normal.textColor = Colors.ReadableText;
        // DifficultyAverageStyle.alignment = TextAnchor.UpperRight;

        scores = new Scores(WordOptions.Difficulty.Easy);
    }
Exemplo n.º 4
0
        private static void AddMatch(int id,string homeTeam, string awayTeam, int homeGoals,
            int awayteamGoals )
        {
            if (League.Matches.Any(p => p.ID == id))
            {
                throw new ArgumentException("Тоя мач сме го играли вече, дай друг.");
            }

            if (League.Teams.All(team => team.Name != homeTeam))
            {
                throw new InvalidOperationException("Home team not found");
            }

            if (League.Teams.All(teamGuest => teamGuest.Name != awayTeam))
            {
                throw new InvalidOperationException("Away team not found");
            }

            var currentHomeTeam = League.Teams.First(team => team.Name == homeTeam);
            var currentAwayTeam = League.Teams.First(team => team.Name == awayTeam);
            var currentScore = new Scores(homeGoals, awayteamGoals);
            var currentMatch = new Matches(id, currentHomeTeam, currentAwayTeam, currentScore );
            League.AddMatches(currentMatch);

            Console.WriteLine($"Match *{currentMatch.HomeTeam.Name} VS {currentMatch.AwayTeam.Name}* added");
        }
Exemplo n.º 5
0
 void Update()
 {
     if(!scoreManager){
         scoreObject = GameObject.FindGameObjectWithTag("ScoreManager");
         scoreManager = scoreObject.GetComponent<Scores>();
     }
     text.text = position+1 + ": " + scoreManager.Position(position).ToString();
 }
    public Scores GetScores()
    {
        /*
         * [
         *  {"playerID":"mickey","highscore":"48"},
         *  {"playerID":"12","highscore":"32"},
         *  {"playerID":"sdfsdf","highscore":"2"}
         *  ]
         */
        var scores = new Scores();

        string url = uri + gameID + @"/rankedlist";

        HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest;
        request.Accept = "application/json";

        using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
        {
            if (response.StatusCode != HttpStatusCode.OK)
                throw new System.Exception(string.Format(
                "Server error (HTTP {0}: {1}).",
                response.StatusCode,
                response.StatusDescription));
            else
            {
                using (var sr = new StreamReader(response.GetResponseStream()))
                {
                    var text = sr.ReadToEnd();

                    var jsonDic = MiniJSON.Json.Deserialize(text) as List<object>;

                    if (jsonDic != null)
                    {
                        int c = 1;
                        foreach (var k in jsonDic)
                        {
                            var dict = k as Dictionary<string, object>;

                            string name = (string)dict["playerID"];
                            int score = int.Parse((string)dict["highscore"]);
                                                        
                            scores.Add(new Score(name, score, c++));
                            
                            if (c > 10)
                                break;
                        }

                        return scores;
                    }
                }
            }
        }

        return null;
    }
Exemplo n.º 7
0
 void Start()
 {
     scorePlus = gameObject.GetComponent<QuestionScript>();
     score = gameObject.GetComponent<Scores>();
     spawn = gameObject.GetComponent<EnemySpawner>();
     //closestMissle = FindClosestEnemy();
     if(closestMissle)
     {
         target = closestMissle.transform;
     }
 }
Exemplo n.º 8
0
 public Matches(int id,Teams homeTeam, Teams awayTeam, Scores scores )
 {
     if (homeTeam.Name == awayTeam.Name)
     {
         throw new ArgumentException("Home and away team must be different");
     }
     this.HomeTeam = homeTeam;
     this.AwayTeam = awayTeam;
     this.Scores = scores;
     this.ID = id;
 }
Exemplo n.º 9
0
	void saveHighScore(int score){
		//No highscores exist. Add current highscore
		if(HighScoreList.Count==0){
			//print ("highscorelist.count == 0");
			Scores temp = new Scores();
			temp.score = score;
			temp.name = "Your score";
			HighScoreList.Add (temp);
		}
		//Highscores exist, add if score is high enough. 
		else{
			for(int i=1; i<=HighScoreList.Count && i<=numberOfHighScores; i++){
				//if the score is high enough, add it at that position.
				if(score>HighScoreList[i-1].score){
					//print ("First if");
					Scores temp = new Scores();
					temp.score = score;
					temp.name = "Your score";
					if(HighScoreList.Count==numberOfHighScores){
						HighScoreList.RemoveAt(HighScoreList.Count-1);
					}
					HighScoreList.Insert (i-1, temp);
					break;
				}
				//if you reach the end of the list but the number is higher than the last one -> replace 
				if(i==HighScoreList.Count && i<numberOfHighScores){
					Scores temp = new Scores();
					temp.score = score;
					temp.name = "Your score";
					if(HighScoreList.Count==numberOfHighScores){
						HighScoreList.RemoveAt(HighScoreList.Count-1);
					}
					HighScoreList.Add(temp);
					break;
				}
				//If your score isn't high enough, print it above the Highscore-list
				if(i==HighScoreList.Count && i==numberOfHighScores && score<HighScoreList[i-1].score){
					//print ("Third if");
					text = "Your score: "+ score + "\n \n";
					break;
				}
			}
		}

		//Save the new HighScoresList to PlayerPrefs and print the list
		text += "Highscores: \n";
		for(int i=1; i<=HighScoreList.Count; i++){
			PlayerPrefs.SetInt("HighScore"+i, HighScoreList[i-1].score);
			text += HighScoreList[i-1].score + " " +HighScoreList[i-1].name + "\n";
		}

		updateText (text);
		HighScoreList.Clear();
	}
Exemplo n.º 10
0
    public static void SetList()
    {
        scorings.Clear();

        string[] content = File.ReadAllLines(path);

        for (int i = 0; i < content.Length; i = i + 2)
        {
            Scores newStuff = new Scores(content[i],float.Parse(content[i + 1]));
            scorings.Add(newStuff);
        }
    }
Exemplo n.º 11
0
    public void SaveHighScore(string name, int score)
    {
        List<Scores> HighScores = new List<Scores>();

        int i = 1;
        while (i <= LeaderboardLength && PlayerPrefs.HasKey("HighScore" + i + "score"))
        {
            Scores temp = new Scores();
            temp.score = PlayerPrefs.GetInt("HighScore" + i + "score");
            temp.name = PlayerPrefs.GetString("HighScore" + i + "name");
            HighScores.Add(temp);
            i++;
        }
        if (HighScores.Count == 0)
        {
            Scores _temp = new Scores();
            _temp.name = name;
            _temp.score = score;
            HighScores.Add(_temp);
        }
        else
        {
            for (i = 1; i <= HighScores.Count && i <= LeaderboardLength; i++)
            {
                if (score > HighScores[i - 1].score)
                {
                    Scores _temp = new Scores();
                    _temp.name = name;
                    _temp.score = score;
                    HighScores.Insert(i - 1, _temp);
                    break;
                }
                if (i == HighScores.Count && i < LeaderboardLength)
                {
                    Scores _temp = new Scores();
                    _temp.name = name;
                    _temp.score = score;
                    HighScores.Add(_temp);
                    break;
                }
            }
        }

        i = 1;
        while (i <= LeaderboardLength && i <= HighScores.Count)
        {
            PlayerPrefs.SetString("HighScore" + i + "name", HighScores[i - 1].name);
            PlayerPrefs.SetInt("HighScore" + i + "score", HighScores[i - 1].score);
            i++;
        }

    }
Exemplo n.º 12
0
    public Scores GetHighestScore()
    {
        Scores highestScore = new Scores();
        List<Scores> HighScores = new List<Scores>();

        HighScores = GetHighScores();

        if (HighScores.Count == 0) {
            return highestScore;
        } else {
            return HighScores[0];
        }
    }
Exemplo n.º 13
0
 // Use this for initialization
 void Start()
 {
     for (int i = 0; i < 10; ++i)
     {
         Scores temp = new Scores
         {
             name = "AAA",
             score = 0
         };
         scoreboard.Add(temp);
     }
     MakeScoreboard();
 }
Exemplo n.º 14
0
            public SoccerCupMatch(Guid id, Scores team1Scores, Scores team2Scores)
            {
                if (id == null)
                    throw new ArgumentNullException("Soccer cup match ID cannot be null");

                if (team1Scores == null)
                    throw new ArgumentNullException("Team 1 scores cannot be null");

                if (team2Scores == null)
                    throw new ArgumentNullException("Team 2 scores cannot be null");

                this.ID = id;
                this.Team1Scores = team1Scores;
                this.Team2Scores = team2Scores;
            }
Exemplo n.º 15
0
    public static List<Scores> GetHighScore()
    {
        List<Scores> HighScores = new List<Scores> ();

        int i = 1;
        while (i<=LeaderboardLength && PlayerPrefs.HasKey("HighScore"+i+"score")) {
            Scores temp = new Scores ();
            temp.score = PlayerPrefs.GetInt ("HighScore" + i + "score");
            temp.name = PlayerPrefs.GetString ("HighScore" + i + "name");
            HighScores.Add (temp);
            i++;
        }

        return HighScores;
    }
Exemplo n.º 16
0
 //GridView控件RowDeleting事件
 protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     Scores score = new Scores();          //创建Scores对象
     int ID = int.Parse(GridView1.DataKeys[e.RowIndex].Values[0].ToString()); //取出要删除记录的主键值
     if (score.DeleteByStr(ID))
     {
         Page.RegisterStartupScript("", "<script language=javascript>alert('成功删除!')</script>");
     }
     else
     {
         Page.RegisterStartupScript("", "<script language=javascript>alert('删除失败!')</script>");
     }
     GridView1.EditIndex = -1;
     InitData();
 }
Exemplo n.º 17
0
	void Awake ()
	{
		//if we don't have an [_instance] set yet
		if (!keep) {
			keep = this;
		}
		//otherwise, if we do, kill this thing
		else {
			Destroy (this.gameObject);
		}
		
		DontDestroyOnLoad (transform.gameObject);
		//keep = GameObject.Find("Keeper");
		
	}
Exemplo n.º 18
0
        /// <summary>
        /// Gets all scores for each users which has played in given parameter as GroupName
        /// </summary>
        /// <param name="GroupName">Name of group which want to get user scores from</param>
        /// <returns>Scores containing information about user scores.</returns>
        public Scores GetAllScores(string GroupName)
        {
            Scores scores = new Scores();

            DataTable dt = TableMethods.GetTable(BaseMethod.DbPath, "UserValues",
                "GroupName", "=", new object[] { GroupName });

            if (dt != null && dt.Rows.Count > 0)
            {
                Dictionary<int, string> AllFields = new Dictionary<int, string>();
                FieldsManager fm = new FieldsManager();
                UserValuesManager userFieldsManager = new UserValuesManager();
                ValidItems validItems = new ValidItems();
                var allFields = fm.GetAllFields();
                foreach (var field in allFields)
                    AllFields.Add(field.ID, field.Title);
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    int FieldID = (int)dt.Rows[i]["FieldID"];
                    string UserNick = (string)dt.Rows[i]["UserNick"];
                    string FieldValue = (string)dt.Rows[i]["FieldValue"];
                    if (!AllFields.ContainsKey(FieldID))
                        continue;
                    string FieldTitle = AllFields[FieldID];

                    int score = 0;
                    bool isValidValue = validItems.IsValidValue(FieldID, FieldValue);
                    if (isValidValue)
                    {
                        if (userFieldsManager.IsValueDuplicate(FieldID, GroupName, FieldValue))
                            score = 5;
                        else score = 10;
                    }

                    UserScores us = scores.GetUserScores(UserNick);
                    ScoreItem si = new ScoreItem()
                    {
                        ID = FieldID,
                        Value = FieldValue,
                        Title = FieldTitle,
                        Score = score
                    };
                    us.AddNewScoreItem(si);
                }
            }
            return scores;
        }
Exemplo n.º 19
0
 public Scores.scoreSet[] highScores; //the local highscores
 #endregion
 #region Functions
 public GameData(Scores _scores)
 {
     if (SaveLoad.Load()) //if can load a save
     {
         //this should get the last GameData saved I think
         //savedGames is a list of GameData
         highScores = SaveLoad.savedGames[SaveLoad.savedGames.Count - 1].highScores;
     }
     else if (_scores.HighScores != null) //if no save but scores has made default scores
     {
         highScores = _scores.HighScores;
     }
     else //if no scores available
     {
         highScores = null; //highscores is null
     }
 }
Exemplo n.º 20
0
 public void Init(LevelBundle bundle)
 {
     bundleName.text = bundle.name;
     for (int i = 0; i < bundle.levels.Length; i++)
     {
         if (LevelManager.currentLevel != null && LevelManager.currentLevel.name == bundle.levels[i])
         {
             levelButton[i].GetComponentInChildren <Text>().color = highlightTextColor;
             levelButton[i].colors = highlightBackgroundColors;
         }
         levelButton[i].transform.GetChild(0).GetComponent <Text>().text = "\t\t" + bundle.levels[i];
         levelButton[i].transform.GetChild(1).GetComponent <Text>().text = Scores.GetHighscore(bundle.levels[i]) + "\t\t";
         string levelName = bundle.levels[i];
         Button me        = levelButton[i];
         levelButton[i].onClick.AddListener(delegate { GameLevelLoader.LoadLevel(levelName); me.interactable = false; });
     }
 }
Exemplo n.º 21
0
    void IPlayerDeathListener.OnPlayerDeath()
    {
        Scores scores = JsonUtility.FromJson <Scores>(PlayerPrefs.GetString("Scores"));

        if (scores == null || scores.highScores.Count == 0)
        {
            scores = new Scores();
            scores.Init();
        }
        showDeathMenu();
        int scoreToSave = scoreBoard.CurrentScore;

        scores.AddScore(scoreToSave);
        var savedScores = JsonUtility.ToJson(scores);

        PlayerPrefs.SetString("Scores", savedScores);
    }
Exemplo n.º 22
0
    private void OnEnable()
    {
        Scores scores = JsonUtility.FromJson <Scores>(PlayerPrefs.GetString("Scores"));

        if (scores == null)
        {
            return;
        }

        else
        {
            for (int i = 0; i < 4; i++)
            {
                scoreDisplay[i].SetText("" + scores.ReturnScore(i));
            }
        }
    }
Exemplo n.º 23
0
    private void LoadNextScene(int finalShotCount, int player, bool next)
    {
        scores.SetScore(courseIndex, Scores.GetWhoseTurn(), finalShotCount);

        scores.DetermineAmountPlayersAndSetScoresIntoPrefs(PlayerPrefs.GetInt("amountPlayers"));

        Scores.SetWhoseTurn(player);

        if (next)
        {
            SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);
        }
        else
        {
            SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
        }
    }
Exemplo n.º 24
0
        public int GetDartBestCheckOut()
        {
            var scoresWithWonLegs = from allScores in Scores
                                    join allScoresGrouped in
                                    Scores.Where(m => m.ScoredInLeg.IsWinner).GroupBy(x => x.ScoredInLeg.Id).ToList() on
                                    allScores.ScoredInLeg.Id equals allScoresGrouped.Key
                                    select allScores;

            var withWonLegs = scoresWithWonLegs as IList <Score> ?? scoresWithWonLegs.ToList();

            if (!withWonLegs.Any())
            {
                return(0);
            }

            return(withWonLegs.GroupBy(x => x.ScoredInLeg.Id).Min(x => x.Count()));
        }
Exemplo n.º 25
0
        private void dtgvStudentScorses_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (dtgvStudentScorses.Columns[e.ColumnIndex].Name == "btnUpdate")
            {
                DataGridViewRow row    = dtgvStudentScorses.SelectedCells[0].OwningRow;
                Scores          scores = new Scores();
                scores.MaPC = int.Parse(values[0]);
                scores.MaHS = int.Parse(row.Cells["MaHS"].Value.ToString());


                // xét điểm
                SETTING_Scores1 set_Scores1 = new SETTING_Scores1(scores);
                set_Scores1.ShowDialog();
                //
                btnSearch_Click(null, null);
            }
        }
Exemplo n.º 26
0
        private void CalculateScore(object sender, EventArgs e)
        {
            BackgroundWorker invoker = new BackgroundWorker();

            invoker.DoWork += delegate
            {
                Thread.Sleep(TimeSpan.FromSeconds(Settings.Delay));
                try
                {
                    //TODO Hide the "Time for this split was..." message if the segment time is <= 0 (yes it can happen)
                    var segment = State.CurrentTime - SegmentBeginning[BetIndex];
                    //Add delay time to the last split
                    if (SplitIndex >= State.Run.Count())
                    {
                        segment += new Time(new TimeSpan(0, 0, Settings.Delay), new TimeSpan(0, 0, Settings.Delay));
                    }
                    var      timeFormatter   = new ShortTimeFormatter();
                    TimeSpan?segmentTimeSpan = GetTime(segment);
                    SendMessage("The time for this split was " + timeFormatter.Format(segmentTimeSpan));
                    Scores[BetIndex] = Scores[BetIndex] ?? (BetIndex > 0 ? new Dictionary <string, int>(Scores[BetIndex - 1]) : new Dictionary <string, int>());
                    foreach (KeyValuePair <string, Tuple <TimeSpan, double> > entry in Bets[BetIndex])
                    {
                        double score = getScore(entry, segmentTimeSpan);
                        if (Scores[BetIndex].ContainsKey(entry.Key))
                        {
                            Scores[BetIndex][entry.Key] += (int)score;
                        }
                        else
                        {
                            Scores[BetIndex].Add(entry.Key, (int)score);
                        }
                    }
                    ShowScore();
                    if (++BetIndex < Scores.Count())
                    {
                        newSplit();
                    }
                    else
                    {
                        EndOfRun = true;
                    }
                }
                catch (Exception ex) { LogException(ex); }
            };
            invoker.RunWorkerAsync();
        }
Exemplo n.º 27
0
 private void ScoresList_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)
 {
     if (ScoresList.SelectedItem == null)
     {
         return;
     }
     if (e.Key == System.Windows.Input.Key.Delete)
     {
         Scores tmp = (Scores)ScoresList.SelectedItem;
         DBAccess.RemoveFromDB(tmp);
         IEditableCollectionView items = ScoresList.Items; //Cast to interface
         if (items.CanRemove)
         {
             items.Remove(ScoresList.SelectedItem);
         }
     }
 }
        public async Task <List <string> > PostScores([FromBody] Scores userscores)
        {
            _context.Scores.Add(userscores);

            await _context.SaveChangesAsync();

            var best_score = _context.Scores.ToList().Where(a => a.UserName == userscores.UserName).OrderByDescending(a => a.Score).Take(10);

            List <string> userscore = new List <string>();

            foreach (var item in best_score)
            {
                userscore.Add(item.Score.ToString());
            }

            return(userscore);
        }
    //Insert new high score into place and save score list
    public void SaveScores()
    {
        Scores temp = new Scores();

        temp.score = newScore;
        temp.name  = newName;

        highScores.Insert((place - 1), temp);

        for (int i = 0; i < highScores.Count; i++)
        {
            Debug.Log("Save temp name = " + temp.name + " save temp score = " + temp.score);
            PlayerPrefs.SetInt("Score" + (i + 1), highScores[i].score);
            PlayerPrefs.SetString("Name" + (i + 1), highScores[i].name);
        }
        PlayerPrefs.Save();
    }
Exemplo n.º 30
0
    /// <summary>
    /// Gets the emotion scores as list of strings.
    /// </summary>
    /// <returns>The emotion as string.</returns>
    /// <param name="emotion">Emotion.</param>
    public static List <string> GetEmotionScoresList(Emotion emotion)
    {
        List <string> alScores = new List <string>();

        if (emotion == null || emotion.scores == null)
        {
            return(alScores);
        }

        Scores es = emotion.scores;

        if (es.anger >= 0.01f)
        {
            alScores.Add(string.Format("{0:F0}% angry", es.anger * 100f));
        }
        if (es.contempt >= 0.01f)
        {
            alScores.Add(string.Format("{0:F0}% contemptuous", es.contempt * 100f));
        }
        if (es.disgust >= 0.01f)
        {
            alScores.Add(string.Format("{0:F0}% disgusted,", es.disgust * 100f));
        }
        if (es.fear >= 0.01f)
        {
            alScores.Add(string.Format("{0:F0}% scared", es.fear * 100f));
        }
        if (es.happiness >= 0.01f)
        {
            alScores.Add(string.Format("{0:F0}% happy", es.happiness * 100f));
        }
        if (es.neutral >= 0.01f)
        {
            alScores.Add(string.Format("{0:F0}% neutral", es.neutral * 100f));
        }
        if (es.sadness >= 0.01f)
        {
            alScores.Add(string.Format("{0:F0}% sad", es.sadness * 100f));
        }
        if (es.surprise >= 0.01f)
        {
            alScores.Add(string.Format("{0:F0}% surprised", es.surprise * 100f));
        }

        return(alScores);
    }
Exemplo n.º 31
0
    //Saves the variables to /playerScores.txt file.
    public void Save()
    {
        BinaryFormatter bf = new BinaryFormatter();

        file = File.Create(Application.persistentDataPath + "/playerScores.txt");

        Scores data = new Scores();

        data.totalCoins = totalCoins;
        foreach (int item in leaderboardScore)
        {
            data.leaderboardScore.Add(item);
        }

        bf.Serialize(file, data);
        file.Close();
    }
Exemplo n.º 32
0
        public ActionResult ViewScore(Guid scoreId)
        {
            var domainModel = Scores.GetScore(scoreId);

            if (ReferenceEquals(domainModel.GetType(), typeof(ErrorDomainModel)))
            {
                var viewModel = new GradeTrackerErrorViewModel((ErrorDomainModel)domainModel);

                return(View("GradeTrackerError", viewModel));
            }
            else
            {
                var viewModel = new ScoreViewModel((ScoreDomainModel)domainModel);

                return(View(viewModel));
            }
        }
Exemplo n.º 33
0
    public List <Scores> GetHighScore()
    {
        List <Scores> HighScores = new List <Scores>();

        int i = 1;

        while (i <= LeaderboardLength && PlayerPrefs.HasKey("HighScore" + i + "score"))
        {
            Scores temp = new Scores();
            temp.score = Mathf.Round(PlayerPrefs.GetFloat("HighScore" + i + "score"));
            temp.name  = PlayerPrefs.GetString("HighScore" + i + "name");
            HighScores.Add(temp);
            i++;
        }

        return(HighScores);
    }
Exemplo n.º 34
0
        private void updateScores()
        {
            getScoresRequest?.Cancel();
            getScoresRequest = null;
            Scores           = null;

            if (Scope == LeaderboardScope.Local)
            {
                // TODO: get local scores from wherever here.
                PlaceholderState = PlaceholderState.NoScores;
                return;
            }

            if (api?.IsLoggedIn != true)
            {
                PlaceholderState = PlaceholderState.NotLoggedIn;
                return;
            }

            if (Beatmap?.OnlineBeatmapID == null)
            {
                PlaceholderState = PlaceholderState.NetworkFailure;
                return;
            }

            PlaceholderState = PlaceholderState.Retrieving;
            loading.Show();

            if (Scope != LeaderboardScope.Global && !api.LocalUser.Value.IsSupporter)
            {
                loading.Hide();
                PlaceholderState = PlaceholderState.NotSupporter;
                return;
            }

            getScoresRequest          = new GetScoresRequest(Beatmap, osuGame?.Ruleset.Value ?? Beatmap.Ruleset, Scope);
            getScoresRequest.Success += r =>
            {
                Scores           = r.Scores;
                PlaceholderState = Scores.Any() ? PlaceholderState.Successful : PlaceholderState.NoScores;
            };
            getScoresRequest.Failure += onUpdateFailed;

            api.Queue(getScoresRequest);
        }
Exemplo n.º 35
0
        public static string Action(string ReceivedData)
        {
            string[] DataArray = ReceivedData.Split('|');
            string   request   = DataArray.Last();
            string   Tag       = DataArray.First();
            string   responce  = "1";

            try
            {
                switch (Tag)
                {
                case "RegistrationRequest":
                    Register.RegisterProfile(DataArray.Last());
                    Scores.CreateTable(Items.GetScoreList(request));
                    break;

                case "LoginRequest":
                    Login.Auth(DataArray.Last());
                    break;

                case "SetScoreRequest":
                    Scores.SetUserScores(request);
                    break;

                case "GetScoreRequest":
                    Scores.GetUserScores(Items.GetScoreList(request));
                    break;

                case "GetPlayerStatsPosition":
                    break;

                case "GetLeaderboardsRequest":
                    responce = MainLeaderboard.RequestLeaderboards();
                    break;

                default:
                    throw new Exception(Tag);
                }
            }
            catch (Exception ex)
            {
                ServerInterface.FormsManaging.TextGenerator(ex.ToString());
            }
            return(responce);
        }
Exemplo n.º 36
0
    public void Load()
    {
        string name      = "Score.txt";
        Scores scoreLine = new Scores();

        if (!File.Exists(name))
        {
            Console.WriteLine("File not found!");
        }
        else
        {
            try
            {
                StreamReader reader = new StreamReader(name);
                string       line;
                do
                {
                    line = (reader.ReadLine());

                    if (line != null && line != "")
                    {
                        string[] parts = line.Split('-');
                        scoreLine.num   = Convert.ToInt16(parts[0]);
                        scoreLine.score = Convert.ToInt16(parts[1]);
                        scoreLine.jumps = Convert.ToInt16(parts[2]);
                        scoreList.Add(scoreLine);
                    }
                } while (line != null);

                reader.Close();
            }
            catch (PathTooLongException)
            {
                Catch("Path too long");
            }
            catch (IOException e)
            {
                Catch("I/O error: " + e.Message);
            }
            catch (Exception e)
            {
                Catch("Oooops... " + e.Message);
            }
        }
    }
Exemplo n.º 37
0
        private async Task <List <GameScore> > GetRankedScoresAsync()
        {
            // Hit a limit in the query parsing in EF in-memory store
            // Since this is just for local dev/test let's keep it simple and pull the list back to massage!
            var scoresList = await Scores.ToListAsync();

            // Not aiming for the most efficient in-memory operation here... ;-)

            // filter down to just the best score for each player
            var bestScoreList = scoresList
                                .GroupBy(s => s.UserId)
                                .Select(g => new
            {
                UserId = g.Key,
                Score  = g.Max(s => s.Score),
            });

            // now sort the list and track the ROW_NUMBER
            var sortedBestScoreListWithIndex = bestScoreList
                                               .OrderByDescending(s => s.Score)
                                               .Select((s, index) => new
            {
                s.UserId,
                s.Score,
                RowNumber = index + 1
            })
                                               .ToList();

            // group the scores to aid adding rank
            var groupedScores = sortedBestScoreListWithIndex.GroupBy(s => s.Score)
                                .Select(g => new
            {
                Score     = g.Key,
                StartRank = g.First().RowNumber,
                Players   = g.OrderBy(s => s.UserId)
            });

            // now unroll the groups applying the rank
            return(groupedScores.SelectMany(g => g.Players.Select(p => new GameScore
            {
                Rank = g.StartRank,
                UserId = p.UserId,
                Score = p.Score,
            })).ToList());
        }
Exemplo n.º 38
0
        public void Show(Action <bool> callback, int?activeTable, int[] visibleTables)
        {
            //Animator.SetTrigger("ShowLoadingIndicator");
            load = transform.Find("ScrollView").Find("Loading").gameObject;
            load.SetActive(true);

            this.callback = callback;

            Scores.GetTables(tables => {
                // preprocess tables to match the visible tables provided by the user
                if (tables != null && visibleTables != null && visibleTables.Length > 0)
                {
                    tables = tables.Where(x => visibleTables.Contains(x.ID)).ToArray();
                }
                if (tables != null && tables.Length > 0)
                {
                    // Create the right number of children.
                    Populate(TabsContainer, TableButton, tables.Length);
                    int activeId = GetActiveTableId(tables, activeTable);

                    // Update children's text.
                    tableIDs = new int[tables.Length];
                    for (int i = 0; i < tables.Length; ++i)
                    {
                        TabsContainer.GetChild(i).GetComponent <TableButton>().Init(tables[i], i, this, tables[i].ID == activeId);

                        // Keep IDs information and current tab for use when switching tabs.
                        tableIDs[i] = tables[i].ID;
                        if (tables[i].ID == activeId)
                        {
                            currentTab = i;
                        }
                    }

                    SetScores(activeId);
                }
                else
                {
                    // TODO: Show error notification
                    //Animator.SetTrigger("HideLoadingIndicator");
                    load.SetActive(false);
                    Dismiss(false);
                }
            });
        }
Exemplo n.º 39
0
        public void Submit()
        {
            gameObject.SetActive(false);

            Scores.Add(
                player.score,
                player.score.ToString(),
                input.text,
                618785,
                null,
                success =>
            {
                GameJoltUI.Instance.ShowLeaderboards((_) =>
                {
                    Restart();
                });
            });
        }
    public List<Scores> GetHighScore()
    {
        List<Scores> HighScores = new List<Scores> ();

         int i = 1;
         while (i<=LeaderboardLength && PlayerPrefs.HasKey("HighScore"+i+"yellowScore") && PlayerPrefs.HasKey("HighScore"+i+"brownScore") && PlayerPrefs.HasKey("HighScore"+i+"blackScore") && PlayerPrefs.HasKey("HighScore"+i+"whiteScore")) {
             Scores temp = new Scores ();
             temp.yellowScore = PlayerPrefs.GetFloat ("HighScore" + i + "yellowScore");
             temp.brownScore = PlayerPrefs.GetFloat ("HighScore" + i + "brownScore");
             temp.blackScore = PlayerPrefs.GetFloat ("HighScore" + i + "blackScore");
             temp.whiteScore = PlayerPrefs.GetFloat ("HighScore" + i + "whiteScore");
             temp.name = PlayerPrefs.GetString ("HighScore" + i + "name");
             HighScores.Add (temp);
             i++;
         }

         return HighScores;
    }
Exemplo n.º 41
0
        private List <double[]> GetApplicableScores(Segmentation applicableSegments)
        {
            var applicableScores = new List <double[]>();
            var segments         = GetApplicableSegments(applicableSegments);

            //Get scores for each applicable segment
            foreach (var segment in segments)
            {
                if (!Scores.ContainsKey(segment))
                {
                    continue;
                }

                applicableScores.Add(Scores[segment]);
            }

            return(applicableScores);
        }
Exemplo n.º 42
0
 protected void GridView1_InitData()
 {
     //Paper paper = new Paper();
     //DataSet ds = paper.QueryUserPaperList1(Session["UserID"].ToString());
     Scores score = new Scores();        //创建Scores对象
     DataSet ds = score.QueryUserScore(Session["UserID"].ToString());
     if (ds.Tables[0].Rows.Count > 0)
     {
         GridView1.DataSource = ds;
         GridView1.DataBind();
         LabelPageInfo.Text = "当前(第" + (GridView1.PageIndex + 1).ToString() + "页 共" + GridView1.PageCount.ToString() + "页)";
     }
     else
     {
         lblScore.Text = "没有成绩!";
         LabelPageInfo.Text = "";
     }
 }
Exemplo n.º 43
0
        private async Task <List <GameScore> > GetRankedScoresAsync()
        {
            // Hit a limit in the query parsing in EF in-memory store
            // Since this is just for local dev/test let's keep it simple and pull the list back to massage!
            var scoresList = await Scores.ToListAsync();

            return(scoresList
                   .GroupBy(s => s.GamerTag)
                   .Select((g, index) => new GameScore
            {
                GamerTag = g.Key,
                CustomTag = "TODO",        // We haven't factored custom tags into the scores yet ;-)
                Score = g.Max(s => s.Score),
                Rank = index
            })
                   .OrderByDescending(s => s.Score)
                   .ToList());
        }
Exemplo n.º 44
0
        public int Create(string name, int score)
        {
            Scores scores = new Scores();

            scores.name  = name;
            scores.score = score;

            try
            {
                db.Scores.Add(scores);
                db.SaveChanges();
            }
            catch (Exception e)
            {
                return(0);
            }
            return(1);
        }
Exemplo n.º 45
0
    private IEnumerator GetScores()
    {
        string result = "";
        string uri    = "http://" + ghostServerHost + "/stages/" + sceneName + "/scores?app=" + app;

        yield return(StartCoroutine(GetRequest(uri, value => result = value)));

        if (!string.IsNullOrEmpty(result))
        {
            Scores newGhosts = JsonUtility.FromJson <Scores>(result);
            scoreList = new List <Score>();
            foreach (Score s in newGhosts.scores)
            {
                scoreList.Add(s);
            }
            scoreList = CutDownScores(scoreList);
        }
    }
Exemplo n.º 46
0
        public void CheckMatchWinner(string nameOnCup, string expectedValue, string firstPerson, string secondPerson, string valueOfName,
                                     int matchId, int pointOne, int pointTwo, int roundOne, int roundTwo)
        {
            GamePersonTesting cup = new GamePersonTesting();

            string accualValues = cup.PlayGame(nameOnCup, valueOfName, matchId, firstPerson, secondPerson,
                                               pointOne, pointTwo, roundOne, roundTwo);

            var games = new Game(nameOnCup, matchId, firstPerson, secondPerson);

            cup.ListOfGames.Add(games);

            var score = new Scores(matchId, expectedValue);

            cup.ScoresList.Add(score);

            Assert.Equal(expectedValue, accualValues);
        }
Exemplo n.º 47
0
    public float LoadBestScore(string scoresFileName)
    {
        string filePath = Path.Combine(Application.dataPath, scoresFileName);

        if (File.Exists(filePath))
        {
            // Read the json from the file into a string
            string dataAsJson = File.ReadAllText(filePath);
            // Pass the json to JsonUtility, and tell it to create a GameData object from it
            Scores scoresData = JsonUtility.FromJson <Scores>(dataAsJson);
            return(scoresData.bestScore);
        }
        else
        {
            Debug.LogError("Cannot load game data!");
            return(0.0f);
        }
    }
Exemplo n.º 48
0
        private IEnumerator TrackModule()
        {
            while (!module.Solved)
            {
                if (module.Claimed && (needyComponent == null || needyComponent.State == NeedyComponent.NeedyStateEnum.Running))
                {
                    var player = module.PlayerName;
                    if (!Scores.ContainsKey(player))
                    {
                        Scores[player] = 0;
                    }

                    Scores[player] += Time.deltaTime * Points;
                }

                yield return(null);
            }
        }
        private string GetHighestEmotion(Scores scores)
        {
            var points = new float[]
            {
                scores.Anger,
                scores.Contempt,
                scores.Disgust,
                scores.Fear,
                scores.Happiness,
                scores.Neutral,
                scores.Sadness,
                scores.Surprise
            };

            int pos = GetEmotionPosition(points);

            return(ConvertEmotionToString(pos));
        }
Exemplo n.º 50
0
    public List <Scores> GetHighScore()
    {
        List <Scores> HighScores = new List <Scores> ();

        int i = 1;

        while (i <= LeaderboardLength && PlayerPrefs.HasKey("HighScore" + i + "killCount"))
        {
            Scores temp = new Scores();
            temp.lampsCollected = PlayerPrefs.GetInt("HighScore" + i + "lampsCollected");
            temp.killCount      = PlayerPrefs.GetInt("HighScore" + i + "killCount");
            temp.name           = PlayerPrefs.GetString("HighScore" + i + "name");
            HighScores.Add(temp);
            i++;
        }

        return(HighScores);
    }
Exemplo n.º 51
0
 public static Scores Load()
 {
     //		string path = Application.persistentDataPath + "/HighScores.xml";
     if (!PlayerPrefs.HasKey("HighScores")) {
         return new Scores ();
     } else {
         var serializer = new XmlSerializer (typeof(Scores));
         using (StringReader reader = new StringReader(PlayerPrefs.GetString("HighScores")))
         {
             Scores iMap = serializer.Deserialize (reader) as Scores;
             if (iMap._version == null || iMap._version != version) {
                 iMap = new Scores ();
                 iMap.Save ();
             }
             return iMap;
         }
     }
     return new Scores ();
 }
Exemplo n.º 52
0
	//

	// Use this for initialization
	void Start () {
		boardtext = scoreboard.GetComponent<TextMesh> ();
		wiicontroller = GetComponent<WiiController> ();
		breathtimer = GetComponent<BreathTimer> ();


		//Load all saved highscores and save to HighScoresList
		int j = 1;
		while(PlayerPrefs.HasKey("HighScore"+j) && j<=numberOfHighScores){
			Scores temp = new Scores();
			temp.score = PlayerPrefs.GetInt("HighScore"+j);
			//temp.name = j.ToString();
			temp.name = "";
			HighScoreList.Add(temp);
			j++;
		}
		logwin = false;
		//print ("start... length of highScoreList: " + HighScoreList.Count);
		//logsession = false;
		//7InvokeRepeating ("logPlayer", 1f, 1f);
	}
Exemplo n.º 53
0
    void Update()
    {
        if(!player || !scoreManager){
            player = GameObject.FindGameObjectWithTag("Allies");
            playerHealth = player.GetComponent<TankHealth>();
            scoreObject = GameObject.FindGameObjectWithTag("ScoreManager");
            scoreManager = scoreObject.GetComponent<Scores>();
        }

        text.text = "Score: " + score;
        if(playerHealth.empty()){
            if(!scoreSent){
                scoreManager.addScore(score);
                scoreSent = true;
            }
            if(isWaiting)
                StartCoroutine(Wait());
            if(!isWaiting)
                SceneManager.LoadScene("MainMenu");
        }
    }
    //批量删除成绩
    protected void Button1_Click(object sender, EventArgs e)
    {
        //程军添加,当未选中任何用户的时候,删除按钮给出提示。2010-6-1
        int count = 0;
        Scores score = new Scores();//创建Scores对象
        foreach (GridViewRow dr in GridView1.Rows)//对GridView中的每一行进行判断
        {
            if (((CheckBox)dr.FindControl("xuanze")).Checked)//如果选择了进行删除
            {
                int ID = int.Parse(((Label)dr.FindControl("Label1")).Text);

                score.ID = ID;
                score.DeleteByProc(ID);
                count++;
            }
        }
        if (count == 0)
        {
            Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script language=javascript>alert('请先选择需要删除的用户!')</script>");
        }

        InitData();
    }
Exemplo n.º 55
0
    public static List<Scores> ListNames(Scores nScore)
    {
        scorings.Add(nScore);//adding the score the player just had
        var rOrder =//sort the scores from high to low
            from score in scorings
                orderby score.score
                descending
                select score;

        List<Scores> ListName = new List<Scores>();//temporary list

        int i = 0;
        foreach (var sc in rOrder)
        {
            pScorings[i] = sc.score.ToString();
            Scores temp = new Scores(sc.plName,sc.score);
            ListName.Add(temp);

            i++;
            if (i > 7)
                break;
        }
        return ListName;
    }
    //GridView控件RowDeleting事件
    protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        Users user = new Users();           //创建Users对象
        string ID = GridView1.DataKeys[e.RowIndex].Values[0].ToString(); //取出要删除记录的主键值

        //胡媛媛添加,删除用户时,删除该用户的成绩,2010-4-12
        int flag = 0;
        Scores score = new Scores();
        if (score.QueryScoreByUserId(ID))
        {
            if ((score.DeleteByUserId(ID))&&(user.DeleteByProc(ID)))
            {
               flag = 1;
            }
        }
        else
        {
            if (user.DeleteByProc(ID))
            {
                flag = 1;
            }
        }

        if (flag == 1)
        {
            Response.Write("<script language=javascript>alert('成功删除该用户!')</script>");
        }
        else
        {
            Response.Write("<script language=javascript>alert('删除该用户失败!')</script>");
        }
        //胡媛媛添加,删除用户时,删除该用户的成绩,2010-4-12

        GridView1.EditIndex = -1;
        InitData();
    }
Exemplo n.º 57
0
    //到出到Excel事件
    protected void ImageButton2_Click(object sender, ImageClickEventArgs e)
    {
        Scores score = new Scores();        //创建Scores对象
        DataSet ds = score.QueryScore();     //调用QueryScore方法查询成绩并将查询结果放到DataSet数据集中
        DataTable DT = ds.Tables[0];
        //生成将要存放结果的Excel文件的名称
        string NewFileName = DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls";
        //转换为物理路径
        NewFileName = Server.MapPath("Temp/" + NewFileName);
        //根据模板正式生成该Excel文件
        File.Copy(Server.MapPath("../Module.xls"), NewFileName, true);
        //建立指向该Excel文件的数据库连接
        string strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + NewFileName + ";Extended Properties='Excel 8.0;'";
        OleDbConnection Conn = new OleDbConnection(strConn);
        //打开连接,为操作该文件做准备
        Conn.Open();
        OleDbCommand Cmd = new OleDbCommand("", Conn);

        foreach (DataRow DR in DT.Rows)
        {
            string XSqlString = "insert into [Sheet1$]";
            XSqlString += "([用户姓名],[试卷],[成绩],[考试时间]) values(";
            XSqlString += "'" + DR["UserName"] + "',";
            XSqlString += "'" + DR["PaperName"] + "',";
            XSqlString += "'" + DR["Score"] + "',";
            XSqlString += "'" + DR["ExamTime"] + "')";
            Cmd.CommandText = XSqlString;
            Cmd.ExecuteNonQuery();
        }

        //操作结束,关闭连接
        Conn.Close();
        //打开要下载的文件,并把该文件存放在FileStream中
        System.IO.FileStream Reader = System.IO.File.OpenRead(NewFileName);
        //文件传送的剩余字节数:初始值为文件的总大小
        long Length = Reader.Length;

        Response.Buffer = false;
        Response.AddHeader("Connection", "Keep-Alive");
        Response.ContentType = "application/octet-stream";
        Response.AddHeader("Content-Disposition", "attachment; filename=" + Server.UrlEncode("学生成绩.xls"));
        Response.AddHeader("Content-Length", Length.ToString());

        byte[] Buffer = new Byte[10000];		//存放欲发送数据的缓冲区
        int ByteToRead;											//每次实际读取的字节数

        while (Length > 0)
        {
            //剩余字节数不为零,继续传送
            if (Response.IsClientConnected)
            {
                //客户端浏览器还打开着,继续传送
                ByteToRead = Reader.Read(Buffer, 0, 10000);					//往缓冲区读入数据
                Response.OutputStream.Write(Buffer, 0, ByteToRead);	//把缓冲区的数据写入客户端浏览器
                Response.Flush();																		//立即写入客户端
                Length -= ByteToRead;																//剩余字节数减少
            }
            else
            {
                //客户端浏览器已经断开,阻止继续循环
                Length = -1;
            }
        }

        //关闭该文件
        Reader.Close();
        //删除该Excel文件
        File.Delete(NewFileName);
    }
Exemplo n.º 58
0
 //初始化成绩表格
 protected void InitData()
 {
     Scores score = new Scores();        //创建Scores对象
     DataSet ds = score.QueryScore();     //调用QueryScore方法查询成绩并将查询结果放到DataSet数据集中
     GridView1.DataSource = ds;          //为GridView控件指名数据源
     GridView1.DataBind();               //绑定数据
 }
Exemplo n.º 59
0
 void Start()
 {
     spawnerScript = this.gameObject.GetComponent<PuzzelItem>();
     rotatePuzzel = this.gameObject.GetComponent<RotateObjects>();
     selectScript = this.gameObject.GetComponent<SelectObject>();
     shakeScript = this.gameObject.GetComponent<CameraShaking>();
     scoreScript = this.gameObject.GetComponent<Scores> ();
     startPosition = transform.position;
 }
Exemplo n.º 60
0
    //提交试卷,生成成绩
    protected void imgBtnSubmit_Click(object sender, ImageClickEventArgs e)
    {
        int score = 0;
        int singlemark = int.Parse(((Label)GridView1.Rows[0].FindControl("Label4")).Text);//取出单选题的每题分值
        foreach (GridViewRow dr in GridView1.Rows)//对单选题每题进行判断用户选择答案
        {
            string str = "";
            if (((RadioButton)dr.FindControl("RadioButton1")).Checked)
            {
                str = "A";
            }
            else if (((RadioButton)dr.FindControl("RadioButton2")).Checked)
            {
                str = "B";
            }
            else if (((RadioButton)dr.FindControl("RadioButton3")).Checked)
            {
                str = "C";
            }
            else if (((RadioButton)dr.FindControl("RadioButton4")).Checked)
            {
                str = "D";
            }
            if (((Label)dr.FindControl("Label3")).Text.Trim() == str)//将用户选择结果和答案进行比较
            {
                score = score + singlemark;
            }
        }
        int multimark = int.Parse(((Label)GridView2.Rows[0].FindControl("Label8")).Text);//取出多选题每题分值
        foreach (GridViewRow dr in GridView2.Rows)//对多选题每题进行判断用户选择答案
        {
            string str = "";
            if (((CheckBox)dr.FindControl("CheckBox1")).Checked)
            {
                str += "A";
            }
            if (((CheckBox)dr.FindControl("CheckBox2")).Checked)
            {
                str += "B";
            }
            if (((CheckBox)dr.FindControl("CheckBox3")).Checked)
            {
                str += "C";
            }
            if (((CheckBox)dr.FindControl("CheckBox4")).Checked)
            {
                str += "D";
            }
            if (((Label)dr.FindControl("Label7")).Text.Trim() == str)//将用户选择结果和答案进行比较
            {
                score = score + multimark;
            }
        }
        int judgemark = int.Parse(((Label)GridView3.Rows[0].FindControl("Label12")).Text);//取出判断题每题分值
        foreach (GridViewRow dr in GridView3.Rows)//对判断题每题进行判断用户选择答案
        {
            bool j = false;
            /* if (((CheckBox)dr.FindControl("CheckBox5")).Checked)
             {
                 j = true;
             }*/

            //胡媛媛修改,获取radiobuttonlist的值,并把lable11的值转换为小写,2010-4-25
            RadioButtonList rdl = (RadioButtonList)dr.FindControl("radiobtlist");
            //胡媛媛添加if,判断是否做了判断题,2010-5-5
            if (rdl.SelectedItem != null)
            {
                if (rdl.SelectedItem.Value == "true")
                {
                    j = true;
                }
                if (j == bool.Parse(((Label)dr.FindControl("Label11")).Text.Trim().ToLower()))
                //胡媛媛修改,获取radiobuttonlist的值,并把lable11的值转换为小写,2010-4-25
                {
                    score = score + judgemark;
                }
            }//胡媛媛添加if,判断是否做了判断题,2010-5-5
        }
        int fillmark = int.Parse(((Label)GridView4.Rows[0].FindControl("Label17")).Text);//取出填空题每题分值
        foreach (GridViewRow dr in GridView4.Rows)
        {
            string str = "";
            str = ((TextBox)dr.FindControl("TextBox1")).Text.Trim();
            if (str == ((Label)dr.FindControl("Label16")).Text.Trim())
            {
                score = score + fillmark;
            }
        }
        //胡媛媛添加,合计当前试卷的总分数,并折合成百分制,2010-4-26;将该语句块从if语句中调整出来,2010-5-30
        int singlescore = Convert.ToInt32(((Label)GridView1.HeaderRow.FindControl("Label27")).Text.ToString()) * GridView1.Rows.Count;
        int multiscore = Convert.ToInt32(((Label)GridView2.HeaderRow.FindControl("Label28")).Text.ToString()) * GridView2.Rows.Count;
        int judgescore = Convert.ToInt32(((Label)GridView3.HeaderRow.FindControl("Label29")).Text.ToString()) * GridView3.Rows.Count;
        int fillblankscore = Convert.ToInt32(((Label)GridView4.HeaderRow.FindControl("Label30")).Text.ToString()) * GridView4.Rows.Count;
        int sum = singlescore + multiscore + judgescore + fillblankscore;
        score = score * 100 / sum;
        //胡媛媛添加,合计当前试卷的总分数,并折合成百分制,2010-4-26;将该语句块从if语句中调整出来,2010-5-30

        Scores insertScore = new Scores();  //创建Scores类对象
        insertScore.UserID = userName;//设置Scores对象的属性
        insertScore.PaperID=int.Parse(paperID);
        insertScore.Score = score;
        if (insertScore.InsertByProc())//调用InsertByProc方法向数据库中插入成绩
        {

            if (score >= 80)//根据成绩给出相应提示
            {
                //Response.Write("<script language=javascript>alert('您太棒了!您的成绩(百分制)为:"+score+"分!')</script>");
                Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script language=javascript>alert('您太棒了!您的成绩(百分制)为:" + score + "分!')</script>");
            }
            else if (score >= 60)
            {
                //Response.Write("<script language=javascript>alert('合格!您的成绩(百分制)为:"+score+"分!')</script>");
                Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script language=javascript>alert('合格!您的成绩(百分制)为:" + score + "分!')</script>");
            }
            else
            {
                //Response.Write("<script language=javascript>alert('需要努力了!您的成绩(百分制)为:"+score+"分!')</script>");
                Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script language=javascript>alert('需要努力了!您的成绩(百分制)为:" + score + "分!')</script>");

            }

            //胡媛媛添加,提交后设置提交按钮为不可用,2010-4-26
            this.imgBtnAnswer.Visible = true;
            this.imgBtnSubmit.Enabled = false;
            //胡媛媛添加,提交后设置提交按钮为不可用,2010-4-26
        }
    }