Beispiel #1
0
    public void NickSearch()
    { //닉네임 찾기 버튼 클릭
        string nickPhone = nickPhoneInput.text;

        nickPhoneInput.text = "";

        StringBuilder sendInfo = new StringBuilder();

        sendInfo.Append("flag=nick");
        sendInfo.Append("&phone=" + nickPhone);

        string url      = "UserSearch";
        string respData = web.ConnectServer(url, sendInfo);
        string text     = "";

        MSGWin.SetActive(true);
        if (respData == "fail")
        {
            IsClickSearchNickBtn = false;
            text = "가입되지 않은 번호입니다.";
        }
        else
        {
            IsClickSearchNickBtn = true;
            text = "당신의 닉네임은 '" + respData + "' 입니다.";
            MSGWin.transform.GetChild(1).gameObject.SetActive(true);
        }
        MSGWin.GetComponent <PrintMSG>().print(text);
    }
Beispiel #2
0
    private void Update()
    {
        if (loginResult) //중복체크 결과에 따른 반응
        {
            loginResult = false;
            if (loginSucc == 0) //로그인 성공
            {
                web.nick = nick;
                GameObject.Find("GameMgr").gameObject.transform.GetChild(3).GetChild(5).gameObject.SetActive(true);

                if (tuto == 0)
                {
                    tutorialWin.SetActive(true);
                }
                if (tuto == 1)
                {
                    loading.LoadScene("WaitScene");
                }
            }
            else if (loginSucc == 1) //실패
            {
                string text = "이미 로그인 중입니다.";
                MSGWin.SetActive(true);
                MSGWin.GetComponent <PrintMSG>().print(text);
            }
        }

        if (tutorialWin.activeSelf == true) //튜토리얼 실행 여부 창 출력
        {
            if (EventSystem.current.currentSelectedGameObject == YesBtn)
            {
                block.SetActive(false);
                StringBuilder sendInfo = new StringBuilder();
                sendInfo.Append("nick=" + nick);
                sendInfo.Append("&tuto=" + tuto);
                web.ConnectServer("Tuto", sendInfo);
                loading.LoadScene("TutorialScene");
            }
            else if (EventSystem.current.currentSelectedGameObject == NoBtn)
            {
                block.SetActive(false);
                StringBuilder sendInfo = new StringBuilder();
                sendInfo.Append("nick=" + nick);
                sendInfo.Append("&tuto=" + tuto);
                web.ConnectServer("Tuto", sendInfo);
                loading.LoadScene("WaitScene");
            }
        }
    }
Beispiel #3
0
    public void DelBtnClick()
    {
        string delPass = passInput.text;

        passInput.text = "";

        StringBuilder sendInfo = new StringBuilder();

        sendInfo.Append("nick=" + web.nick);
        sendInfo.Append("&password="******"UserDel";
        string respData = web.ConnectServer(url, sendInfo);
        string text     = "";

        if (respData == "succ")
        {
            text   = "탈퇴되었습니다.";
            delete = true;
        }
        else
        {
            text   = "회원정보를 다시 확인해주세요.";
            delete = false;
        }
        MSGWin.SetActive(true);
        MSGWin.GetComponent <PrintMSG>().print(text);
        MSGWin.transform.GetChild(1).gameObject.SetActive(false);
    }
Beispiel #4
0
    void Start()
    {
        url        = "Friends"; //친구 요청이 있는지 확인
        tmpObj     = new List <GameObject>();
        webServ    = GameObject.Find("WebServer");
        webScript  = webServ.GetComponent <WebServerScript>();
        nick       = webScript.nick;
        friendBtn  = friendBtnObj.GetComponent <Button>();
        friendText = friendBtn.GetComponentInChildren <Text>();

        StringBuilder sendInfo = new StringBuilder();

        sendInfo.Append("flag=reqlist");
        sendInfo.Append("&nick=" + nick);
        string respData = webScript.ConnectServer(url, sendInfo);

        savReqList = respData.Split(',');

        if (respData != "no request") //친구 요청이 있을 경우 표시
        {
            existImg.SetActive(true);
        }
        friendEntList = new List <sFriendEnter>();
        SocketServer.SingleTonServ().GetFriendScript(this);
    }
    public void RankBtnClick()
    {
        StringBuilder sendInfo = new StringBuilder();

        sendInfo.Append("flag=reqlist");
        sendInfo.Append("&nick=" + nick);
        string url      = "Ranking";
        string respData = webScript.ConnectServer(url, sendInfo);//랭킹 순서대로 서버에서 받아오기
        int    y        = -25;

        string[] rankList  = respData.Split(',');//받아온 스트링 ,기준으로 나누기
        string[] nickList  = new string[100];
        string[] scoreList = new string[100];
        int      rankLen   = rankList.Length;
        string   userScore = rankList[0];//리스트 맨처음 나의 점수 가져오기
        int      nickNum   = 0;
        int      scoreNum  = 0;

        for (int i = 1; i < rankLen; i++) //점수, 닉네임 나눠 리스트에 저장하기
        {
            if (i % 2 == 0)
            {
                scoreList[scoreNum] = rankList[i];
                scoreNum++;
            }
            else
            {
                nickList[nickNum] = rankList[i];
                nickNum++;
            }
        }

        int userRank = 0;

        for (int i = 0; i < rankLen / 2; i++) //순서대로 출력하기
        {
            if (nickList[i] == nick)
            {
                userRank = i + 1;
            }
            Vector3    chatPos  = new Vector3(5, y, 0);
            Quaternion q        = new Quaternion(0, 0, 0, 0);
            Text       rankText = rankUser.GetComponentInChildren <Text>();
            rankText.text = (i + 1) + "          " + nickList[i] + "                    " + scoreList[i];
            GameObject tmp = Instantiate(rankUser, Vector3.zero, q, rankScroll.transform);
            tmpObj.Add(tmp);
            tmp.transform.localPosition = chatPos;
            y -= 20;
        }
        if (userRank == 0)
        {
            userInfo.GetComponentInChildren <Text>().text = "내 정보\n닉네임 : " + nick + "          순위 : 100위권 밖          점수 : " + userScore;
        }
        else
        {
            userInfo.GetComponentInChildren <Text>().text = "내 정보\n닉네임 : " + nick + "          순위 : " + userRank + "          점수 : " + userScore;
        }
        rankingWin.SetActive(true);
    }
Beispiel #6
0
    string ResultSave(string result) //웹서버와 연결, 승률 계산하여 가져오기
    {
        string        Url      = "BattleEnd";
        StringBuilder sendInfo = new StringBuilder();

        sendInfo.Append("flag=" + result);
        sendInfo.Append("&nick=" + server.nick);
        return(server.ConnectServer(Url, sendInfo));
    }
Beispiel #7
0
    void Update()
    {
        if (MSGWin == null && GameObject.Find("GameMgr") != null)
        {
            MSGWin = GameObject.Find("GameMgr").transform.GetChild(4).gameObject;
        }

        if (friendWin.activeSelf && !winActive) //friendWin창이 활성화되어 있는 경우 GameMgr의 Layer 앞으로 보내기
        {
            winActive = true;
            GameObject gameMgr = GameObject.Find("GameMgr");
            gameMgr.GetComponent <Canvas>().sortingOrder = 3;
            gameMgr.transform.GetChild(0).gameObject.SetActive(false);
            gameMgr.transform.GetChild(1).gameObject.SetActive(false);
        }
        else if (!friendWin.activeSelf && winActive)
        {
            winActive = false;
            GameObject gameMgr = GameObject.Find("GameMgr");
            gameMgr.GetComponent <Canvas>().sortingOrder = 2;
            gameMgr.transform.GetChild(0).gameObject.SetActive(true);
            gameMgr.transform.GetChild(1).gameObject.SetActive(true);
        }

        reqExist += Time.deltaTime;
        if (friendListOn == false && reqExist >= 10) //10초마다 새로운 친구요청이 있는지 확인
        {
            reqExist = 0;
            StringBuilder sendInfo = new StringBuilder();
            sendInfo.Append("flag=reqlist");
            sendInfo.Append("&nick=" + nick);
            string respData = webScript.ConnectServer(url, sendInfo);

            if (respData != "no request")
            {
                string[] nowReqList = respData.Split(',');

                int reqLen = nowReqList.Length;
                int savLen = savReqList.Length;
                if (reqLen == savLen)
                {
                    for (int i = 0; i < reqLen; i++)
                    {
                        if (nowReqList[i] != savReqList[i])
                        {
                            existImg.SetActive(true);
                        }
                    }
                }
                else
                {
                    existImg.SetActive(true);
                }
            }
        }

        if (matchReqRecv == true)
        {
            matchReqRecv = false;
            if (matchSucc == 1)
            {
                string text = "대전신청이 거절되었습니다.";
                MSGWin.SetActive(true);
                MSGWin.GetComponent <PrintMSG>().print(text);
                randBtn.SetActive(true);
                friendMatchBtn.SetActive(true);
                matchingImg.SetActive(false);
            }
            else if (matchSucc == 2)
            {
                matchReqWin.GetComponentInChildren <Text>().text = "'" + matchReqFriendNick + "'님의 대전신청을 수락하시겠습니까?";
                matchReqWin.SetActive(true);
            }
            else if (matchSucc == 3)
            {
                randBtn.SetActive(true);
                friendMatchBtn.SetActive(true);
                matchingImg.SetActive(false);
                string text = "상대 유저가 이미 매칭중입니다.";
                MSGWin.SetActive(true);
                MSGWin.GetComponent <PrintMSG>().print(text);
            }
        }
    }