Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine.UI;
- public class DataListController : MonoBehaviour {
- public List<string> universityName = new List<string>();
- public List<int> points = new List<int>();
- bool swapped = true;
- // Use this for initialization
- void Start()
- {
- //sortTheList();
- }
- // Update is called once per frame
- void Update ()
- {
- // sortTheList();
- }
- void sortTheList()
- {
- while (swapped)
- {
- swapped = false;
- for (int i = 0; i <= universityName.Count; i++)
- {
- if (points[i] < points[i + 1])
- {
- int tmp = points[i];
- points[i] = points[i + 1];
- points[i + 1] = tmp;
- string tmpName = universityName[i];
- universityName[i] = universityName[i + 1];
- universityName[i + 1] = tmpName;
- }
- swapped = true;
- }
- if (!swapped)
- break;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement