Welcome to GEMENTAR TOUR PUO V2 Development Documentation. Enjoy your stay!

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
wiki:menu_scriptss_code [2022/08/04 11:01] – created adminwiki:menu_scriptss_code [2022/08/04 11:04] (current) – [RankingSystem.cs] admin
Line 1: Line 1:
 +
 +{{ :wiki:getusers.php_6_.png?nolink&600 |}}
  
 ====== PasswordChange.cs ====== ====== PasswordChange.cs ======
Line 47: Line 49:
         form.AddField("newPassword", new_password.text);         form.AddField("newPassword", new_password.text);
  
-        using (UnityWebRequest www = UnityWebRequest.Post("https://puov2.gementar.com/unity_database/ChangePassword.php", form))+        using (UnityWebRequest www = UnityWebRequest.Post("hidden", form))
         {         {
             yield return www.SendWebRequest();             yield return www.SendWebRequest();
Line 86: Line 88:
 </file> </file>
  
 +<file | IEnumerator Upload() > 
 +Upload password into database and check error.
 +</file>
  
 +
 +====== RankingSystem.cs ======
 +
 +<code CSharp | Full Script>
 +using Sirenix.OdinInspector;
 +using System.Collections;
 +using System.Collections.Generic;
 +using TMPro;
 +using UnityEngine;
 +
 +public class RankingSystem : MonoBehaviour
 +{
 +    public GameObject RankParent;
 +    public GameObject rankFirst;
 +    public GameObject rankSecond;
 +    public GameObject rankThird;
 +    public GameObject rankNorm;
 +    public GameObject scoreUI;
 +
 +    public hidden;
 +
 +    bool toggleRankingList = true;
 +
 +    public void ButtonOpenRankingList()
 +    {
 +        scoreUI.SetActive(true);
 +
 +        if (toggleRankingList == false) return;
 +        toggleRankingList = false;
 +        var playerlist = hidden
 +
 +        int i = 0;
 +        foreach (var item in playerlist)
 +        {
 +            GameObject newItem;
 +            if (i == 0)
 +            {
 +                newItem = Instantiate(rankFirst, this.transform);
 +                newItem.transform.SetParent(RankParent.transform);
 +            }
 +            else if (i == 1)
 +            {
 +                newItem = Instantiate(rankSecond, this.transform);
 +                newItem.transform.SetParent(RankParent.transform);
 +            }
 +            else if (i == 2)
 +            {
 +                newItem = Instantiate(rankThird, this.transform);
 +                newItem.transform.SetParent(RankParent.transform);
 +            }
 +            else
 +            {
 +                newItem = Instantiate(rankNorm, this.transform);
 +                newItem.transform.SetParent(RankParent.transform);
 +            }
 +
 +
 +            try
 +            {
 +            var split = item.Split(':');
 +
 +            newItem.transform.Find("Text_Score").gameObject.GetComponent<TextMeshProUGUI>().SetText(split[1], 3.5f);
 +            newItem.transform.Find("Text_NickName").gameObject.GetComponent<TextMeshProUGUI>().SetText(split[0], 3.5f);
 +
 +            if (i >= 3) newItem.transform.Find("Text_4").gameObject.GetComponent<TextMeshProUGUI>().SetText((i + 1).ToString(), 3.5f);
 +            }
 +            catch (System.Exception)
 +            {
 +                Destroy(newItem);
 +            }
 +
 +            i++;
 +        }
 +
 +    }
 +
 +}
 +
 +
 +</code>
  
 <file | public void ButtonOpenRankingList() >  <file | public void ButtonOpenRankingList() > 
Line 94: Line 179:
 due to the list already sort it self by player score in sQL query so we will not sort it here all done in server side.. due to the list already sort it self by player score in sQL query so we will not sort it here all done in server side..
 </file> </file>
- 
- 

QR Code
QR Code wiki:menu_scriptss_code (generated for current page)
Hello World!
DokuWiki with monobook... rules!