Example #1
0
        public static List <PCOUsage> GetUsage(DateTime startDate, Campus location)
        {
            List <PCOUsage> allUsage = new List <PCOUsage>();
            PCO             thisPCO  = location.PCOData;
            //thisPCO.GetCurrentData();
            List <PCOService> planList = thisPCO.Plans.FindAll(s => s.Date >= startDate);

            foreach (PCOService plan in planList)
            {
                foreach (PCOItem item in plan.Songs)
                {
                    PCOUsage thisSong = allUsage.Find(s => s.songID == item.SongID);
                    if (thisSong == null)
                    {
                        thisSong           = new PCOUsage(location, plan.Date, item, item.Order);
                        thisSong.startDate = startDate.ToString("MM/dd/yyyy");
                        allUsage.Add(thisSong);
                    }
                    else
                    {
                        thisSong.Update(plan.Date, item.Order);
                    }
                    thisSong.lastUpdated = thisPCO.LastUpdated.ToString("MM/dd/yyyy hh:mm tt");
                }
            }

            return(allUsage);
        }
Example #2
0
    // Update is called once per frame
    void Update()
    {
        if (!isActiveAndEnabled)
        {
            return;
        }
        string text = "game has ended, here are the scores \n";

        PlayerConnectionObject[] PCOs = FindObjectsOfType <PlayerConnectionObject>();
        foreach (PlayerConnectionObject PCO in PCOs)
        {
            if (!PCO)
            {
                continue;
            }
            PlayerData pdata = PCO.GetComponent <PlayerData>();
            text += pdata.playerName + " score: " + pdata.score + "\n";
        }
        Text textRefernce = GetComponent <Text>();

        if (textRefernce.text != text)
        {
            textRefernce.text = text;
        }
    }
Example #3
0
    // Update is called once per frame
    void Update()
    {
        if (!isActiveAndEnabled)
        {
            return;
        }
        string text = "game has ended, here are the scores \n";

        PlayerConnectionObject[] PCOs = FindObjectsOfType <PlayerConnectionObject>();
        float[] scores     = new float[PCOs.Length];
        int     namesIndex = 0;

        foreach (PlayerConnectionObject PCO in PCOs)  //find each player scores

        {
            if (!PCO)
            {
                Debug.Log("null PCO");
                return;
            }
            PlayerData PD = PCO.GetComponent <PlayerData>();
            if (!PD)
            {
                Debug.Log("null PD");
                return;
            }

            float playerScore = PD.score;


            scores[namesIndex] = playerScore;
            namesIndex++;
        }
        doubleMergeSort(scores, PCOs);

        foreach (PlayerConnectionObject PCO in PCOs)
        {
            if (!PCO)
            {
                continue;
            }
            PlayerData pdata = PCO.GetComponent <PlayerData>();
            text += pdata.playerName + " score: " + pdata.score +
                    " kills: " + (pdata.killedEntityCount + pdata.killedPlayerCount) +
                    " deaths: " + pdata.roundDeathCount + " jumps: " + pdata.roundJumpCount + "\n";
        }
        Text textRefernce = GetComponent <Text>();

        if (textRefernce.text != text)
        {
            textRefernce.text = text;
        }
    }
Example #4
0
    void updateRanks()
    {
        if (!isActive)  //if script is disabled
        {
            CancelInvoke("updateRanks");
            return;
        }

        PlayerConnectionObject[] PCOs = FindObjectsOfType <PlayerConnectionObject>();
        int namesIndex = 0;

        string[] names  = new string[PCOs.Length];
        float[]  scores = new float[PCOs.Length];
        foreach (PlayerConnectionObject PCO in PCOs) //find each player scores

        {
            if (!PCO)
            {
                Debug.Log("null PCO");
                return;
            }
            PlayerData PD = PCO.GetComponent <PlayerData>();
            if (!PD)
            {
                Debug.Log("null PD");
                return;
            }
            bool localPlayer = false;
            if (PCO.gameObject == gameObject)//this is the currentPlayer
            {
                localPlayer = true;
            }


            string playerName  = PD.playerName;
            float  playerScore = PD.score;

            names[namesIndex]  = playerName;
            scores[namesIndex] = playerScore;
            namesIndex++;
        }

        doubleMergeSort(scores, names);
        displayScores(names, scores, namesIndex);
    }
Example #5
0
    public static List <PCOService> GetServices(Campus location, bool forceUpdate)
    {
        int currentFetchPage = 0;
        //int lastValidPage = 0;
        PCO thisPCO = new PCO(location);

        thisPCO.GetCurrentData();
        bool isLastPage = false;

        currentFetchPage = thisPCO.CurrentDatePage;
        while (!isLastPage)
        {
            dynamic pcoData = Utility.GetRequestObject(thisPCO.Location.ServicesURL.Replace("{recordNo}", currentFetchPage.ToString()));

            if (pcoData != null)
            {
                if (pcoData.data != null)
                {
                    isLastPage = (pcoData.data.Count == 0);
                    foreach (dynamic serviceDynamic in pcoData.data)
                    {
                        int        serviceID   = (serviceDynamic.id != null) ? Convert.ToInt32(serviceDynamic.id.ToString()) : 0;
                        PCOService thisService = thisPCO.GetService(serviceID);
                        if (thisService == null)
                        {
                            thisService = new PCOService(location, serviceDynamic);


                            if (thisService.IsComplete)
                            {
                                thisPCO.Plans.Add(thisService);
                            }
                        }
                        else
                        {
                            if (!thisService.IsConfirmed || forceUpdate)
                            {
                                thisService.Update(serviceDynamic);
                            }
                        }

                        if (thisService.IsPast)
                        {
                            thisPCO.CurrentDatePage = currentFetchPage;
                        }
                        else
                        {
                            isLastPage = true;
                        }

                        if (forceUpdate)
                        {
                            thisPCO.LastUpdated = DateTime.Now;
                            thisPCO.UpdateData();
                        }
                    }
                }

                if (!isLastPage)
                {
                    currentFetchPage += 25;
                }
            }
        }
        thisPCO.LastUpdated = DateTime.Now;
        thisPCO.UpdateData();
        return(thisPCO.Plans);
    }
Example #6
0
 public void RefreshData()
 {
     PCO.GetServices(this);
 }