Exemple #1
0
    public IEnumerator RequestUserData(OnDelegate action)
    {
        string          strScheme = "/UserData?userId=" + m_userId;
        string          strURL    = m_serverIP + strScheme;
        UnityWebRequest request   = UnityWebRequest.Get(strURL);

        UIManager.Instance.AddUI(UIPrefab.LOADING);

        yield return(request.SendWebRequest());

        UIManager.Instance.RemoveOneUI();

        if (request.isNetworkError || request.isHttpError)
        {
            UIManager.Instance.AddUI(UIPrefab.ERROR);
        }
        else if (request.downloadHandler.text == "fail")
        {
            UIManager.Instance.AddUI(UIPrefab.ERROR);
        }
        else
        {
            UserDataManager.Instance.InitializeUserData(request.downloadHandler.text);

            if (action != null)
            {
                action();
            }
        }
    }
Exemple #2
0
    public IEnumerator RequestUpdateUserExp(float exp, OnDelegate action)
    {
        UserData userData = UserDataManager.Instance.AddUserExp(exp);

        string          strScheme = "/UpdateUserExp?userId=" + m_userId + "&lv=" + userData.lv.ToString() + "&exp=" + userData.exp.ToString();
        string          strURL    = m_serverIP + strScheme;
        UnityWebRequest request   = UnityWebRequest.Get(strURL);

        UIManager.Instance.AddUI(UIPrefab.LOADING);

        yield return(request.SendWebRequest());

        UIManager.Instance.RemoveOneUI();

        if (request.isNetworkError || request.isHttpError)
        {
            UIManager.Instance.AddUI(UIPrefab.ERROR);
        }
        else if (request.downloadHandler.text == "fail")
        {
            UIManager.Instance.AddUI(UIPrefab.ERROR);
        }
        else
        {
            UserDataManager.Instance.InitializeUserData(userData);

            if (action != null)
            {
                action();
            }
        }
    }
Exemple #3
0
    public IEnumerator RequestUpdateSoldierExp(SoldierData soldierData, float exp, OnDelegate action)
    {
        SoldierData data = SoldierManager.Instance.AddSoldierExp(soldierData, exp);

        string strScheme = "/UpdateSoldierExp?userId=" + m_userId + "&soldierId=" + data.soldier_id.ToString()
                           + "&lv=" + data.level.ToString() + "&exp=" + data.exp.ToString();
        string          strURL  = m_serverIP + strScheme;
        UnityWebRequest request = UnityWebRequest.Get(strURL);

        yield return(request.SendWebRequest());


        if (request.isNetworkError || request.isHttpError)
        {
            UIManager.Instance.AddUI(UIPrefab.ERROR);
        }
        else if (request.downloadHandler.text == "fail")
        {
            UIManager.Instance.AddUI(UIPrefab.ERROR);
        }
        else
        {
            if (action != null)
            {
                action();
            }
        }
    }
 //LevelDesignerから、ターゲットが1つ減ったという処理をする「DestroyTaegetOne()」を受け取る
 public void SendDestroyDelegate(OnDelegate del)
 {
     destroyTaegetOne = del;
 }