示例#1
0
    public void ChangeInning(SocketMsgInfo info)
    {
        UserMgr.eventJoined.inningState = info.data.inningState;
        if (info.data.changeBingo > 0)
        {
            Init();
            return;
        }

        if (mLineupResponse == null)
        {
            return;
        }
        mLineupResponse.data.inningHalf   = info.data.inningHalf;
        mLineupResponse.data.inningNumber = int.Parse(info.data.inning);
        if (info.data.inningState.Equals("END"))
        {
            UserMgr.eventJoined.status = "Scheduled";
        }

        Debug.Log("state : " + UserMgr.eventJoined.inningState + ",half : " + mLineupResponse.data.inningHalf);
        InitBtm();
//		IsReload = true;
//		mLineupEvent = new GetCurrentLineupEvent(ReceivedLineup);
//		NetMgr.GetCurrentLineup(UserMgr.eventJoined.gameId, int.Parse(info.data.inning),
//		                        mBingoEvent.Response.data.bingo.bingoId, mLineupEvent);
    }
示例#2
0
    public void ReceivedResult(SocketMsgInfo info)
    {
        transform.FindChild("Body").FindChild("Scroll View").FindChild("Board").FindChild("Result")
        .GetComponent <BingoResult>().SocketResult(info);
        StartCoroutine(IReloadBoard(info));
//		ReloadLineup();
        mOutCount = info.data.outs;
    }
示例#3
0
    //    public static void EndProcess(){
    //        Instance.StopCoroutine(Instance.IWaitProcess());
    //        IsProcessing = false;
    //    }
    //
    //    IEnumerator IWaitProcess(){
    //        yield return new WaitForSeconds(10f);
    //        IsProcessing = false;
    //    }
    public static bool SocketReceived(SocketMsgInfo msgInfo)
    {
        //		if(IsProcessing) return true;
        //
        //		IsProcessing = true;

        if(UserMgr.eventJoined == null) return false;

        if(UtilMgr.GetLastBackState() != UtilMgr.STATE.LiveBingo) return false;

        LiveBingo bingo = UtilMgr.Instance.mRoot.FindChild("LiveBingo").GetComponent<LiveBingo>();
        bingo.mUpdateCnt = 0;
        bingo.transform.FindChild("Top").FindChild("BtnDebug").GetComponent<BtnDebugLiveBingo>().AddLog(msgInfo);

        if(msgInfo.type == ConstantsSocketType.RES.TYPE_ALIVE_OK
           && bingo.mMsgCount < msgInfo.data.msgCount){
            string msg = "\n[ff0000]Socket msg count is wrong[-]";
            bingo.transform.FindChild("Top").FindChild("BtnDebug").GetComponent<BtnDebugLiveBingo>().AddLog(msg);
            bingo.ReloadAll();
            return false;
        }

        if(msgInfo.data.msgCount > 0)
            bingo.mMsgCount = msgInfo.data.msgCount;

        switch(msgInfo.type){
        case ConstantsSocketType.RES.TYPE_ALIVE:
        //			IsProcessing = false;
            NetMgr.Alive();
            break;
        case ConstantsSocketType.RES.RESULT_HITTER :
        //			Instance.StartCoroutine(Instance.IWaitProcess());
            bingo.ReceivedResult(msgInfo);
            break;
        case ConstantsSocketType.RES.CHANGE_INNING:
        //			Instance.StartCoroutine(Instance.IWaitProcess());
        //			bingo.ChangeInning(msgInfo);
            break;
        case ConstantsSocketType.RES.RELOAD_BINGO:
        //			Instance.StartCoroutine(Instance.IWaitProcess());
            bingo.ReloadBoard();
            break;
        case ConstantsSocketType.RES.CHANGE_PLAYER:
        //			Instance.StartCoroutine(Instance.IWaitProcess());
            bingo.ChangePlayer(msgInfo);
        //			bingo.ReloadLineup(msgInfo);
            break;
        case ConstantsSocketType.RES.GAME_ENDED:
        //			bingo.ShowGameEnded();
            bingo.GameEnded();
            break;
        }

        return false;
    }
示例#4
0
    private void HandleDataReceive(IAsyncResult ar)
    {
        Int32 recvBytes = 0;

        try{
            recvBytes = mSocket.EndReceive(ar);
        } catch {
            Debug.Log("recv error");
//			Alive();
            return;
        }

        // 수신받은 자료의 크기가 1 이상일 때에만 자료 처리
        if (recvBytes > 0)
        {
            mRecvSemaphore = true;

            Byte[] msgByte = new Byte[recvBytes];
            Array.Copy(mReceiveBuffer, msgByte, recvBytes);
            string msg = Encoding.UTF8.GetString(msgByte);

            // 받은 메세지를 출력
            Debug.Log("Received : " + msg);
//			msg += msg;
            string[] msgArr = msg.Split("\r\n".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
//			if(msgArr.Length > 1){
//				DialogueMgr.ShowDialogue("adasd", UtilMgr.GetDateTimeNow("HH:mm:ss"), DialogueMgr.DIALOGUE_TYPE.Alert
//				                         ,null);
//			}
            for (int i = 0; i < msgArr.Length; i++)
            {
//				Debug.Log("Received(" + i + ") : " + msgArr[i]);
                SocketMsgInfo msgInfo = Newtonsoft.Json.JsonConvert.DeserializeObject <SocketMsgInfo>(msgArr[i]);
                if (!UtilMgr.OnPause &&
                    UtilMgr.GetLastBackState() == UtilMgr.STATE.LiveBingo)
                {
                    mSocketMsgList.Add(msgInfo);
                }
            }
            mRecvSemaphore = false;
        }

        try {
            mSocket.BeginReceive(mReceiveBuffer, 0, mReceiveBuffer.Length, SocketFlags.None, mReceivingCallback, null);
        } catch (Exception ex) {
            // 예외가 발생하면 mReceiveBuffer 종료한다mReceiveBuffer("자료 수신 대기 도중 오류 발생! 메세지: "+ ex.Message);
            Instance.socketJoinEvent();
            return;
        }
    }
示例#5
0
    IEnumerator IReloadBoard(SocketMsgInfo info)
    {
        yield return(new WaitForSeconds(3f));

//		ReloadBoard();
        if (info.data.inningState.Equals("END"))
        {
            UserMgr.eventJoined.inningState = "END";
            UserMgr.eventJoined.status      = "Scheduled";
            InitBtm();
            ReloadBoard();
        }
        else
        {
            ReloadAll();
        }
    }
    public void SocketResult(SocketMsgInfo info)
    {
        transform.FindChild("Label").gameObject.SetActive(true);
        transform.FindChild("SprTxt").gameObject.SetActive(false);
        if (info.data.value > 0)         //Out
        {
            transform.FindChild("Label").GetComponent <UILabel>().text = UtilMgr.GetLocalText("StrOut") + "!";
        }
        else
        {
            transform.FindChild("Label").GetComponent <UILabel>().text = UtilMgr.GetLocalText("StrGetOnBase") + "!";
        }

//		if(transform.root.FindChild("LiveBingo").GetComponent<LiveBingo>().mLineupEvent.Response.data.inningHalf.Equals("T")){
//			foreach(PlayerInfo player in
//			        transform.root.FindChild("LiveBingo").GetComponent<LiveBingo>().mLineupEvent.Response.data.away.hit){
//				Debug.Log("T info id : "+info.playerId+", player id : "+player.playerId);
//				if(player.playerId == info.data.playerId){
//					transform.FindChild("Label").FindChild("LblPlayer").GetComponent<UILabel>().text
//						= Localization.language.Equals("English") ? player.playerName : player.korName;
//					break;
//				}
//			}
//		} else{
//			foreach(PlayerInfo player in
//			        transform.root.FindChild("LiveBingo").GetComponent<LiveBingo>().mLineupEvent.Response.data.home.hit){
//				Debug.Log("B info id : "+info.playerId+", player id : "+player.playerId);
//				if(player.playerId == info.data.playerId){
//					transform.FindChild("Label").FindChild("LblPlayer").GetComponent<UILabel>().text
//						= Localization.language.Equals("English") ? player.playerName : player.korName;
//					break;
//				}
//			}
//		}
        try{
            PlayerInfo player = UserMgr.PlayerDic[info.data.playerId];
            transform.FindChild("Label").FindChild("LblPlayer").GetComponent <UILabel>().text
                = Localization.language.Equals("English") ? player.firstName.Substring(0, 1) + ". " + player.lastName
                                : player.korName;

            transform.GetComponent <Animator>().SetTrigger("Result");
        } catch {
            Debug.Log("Not found player : " + info.data.playerId);
        }
    }
示例#7
0
    public void ReloadLineup(SocketMsgInfo info)
    {
//		UserMgr.eventJoined.inningState = "ING";
//		UserMgr.eventJoined.status = "InProgress";
//
//		if(info.data.changeBingo > 0){
//			Init ();
//			return;
//		}
//		IsReload = true;
//		int inning = mLineupResponse.data.inningNumber;
        int inning = 0;

        UserMgr.eventJoined.inningState = info.data.inningState;
        mLineupEvent = new GetCurrentLineupEvent(ReceivedLineup);
        NetMgr.GetCurrentLineup(UserMgr.eventJoined.gameId, inning,
                                mBingoId, mLineupEvent);
    }
    public void SocketResult(SocketMsgInfo info)
    {
        transform.FindChild("Label").gameObject.SetActive(true);
        transform.FindChild("SprTxt").gameObject.SetActive(false);
        if(info.data.value > 0){ //Out
            transform.FindChild("Label").GetComponent<UILabel>().text = UtilMgr.GetLocalText("StrOut")+"!";
        } else{
            transform.FindChild("Label").GetComponent<UILabel>().text = UtilMgr.GetLocalText("StrGetOnBase")+"!";
        }

        //		if(transform.root.FindChild("LiveBingo").GetComponent<LiveBingo>().mLineupEvent.Response.data.inningHalf.Equals("T")){
        //			foreach(PlayerInfo player in
        //			        transform.root.FindChild("LiveBingo").GetComponent<LiveBingo>().mLineupEvent.Response.data.away.hit){
        //				Debug.Log("T info id : "+info.playerId+", player id : "+player.playerId);
        //				if(player.playerId == info.data.playerId){
        //					transform.FindChild("Label").FindChild("LblPlayer").GetComponent<UILabel>().text
        //						= Localization.language.Equals("English") ? player.playerName : player.korName;
        //					break;
        //				}
        //			}
        //		} else{
        //			foreach(PlayerInfo player in
        //			        transform.root.FindChild("LiveBingo").GetComponent<LiveBingo>().mLineupEvent.Response.data.home.hit){
        //				Debug.Log("B info id : "+info.playerId+", player id : "+player.playerId);
        //				if(player.playerId == info.data.playerId){
        //					transform.FindChild("Label").FindChild("LblPlayer").GetComponent<UILabel>().text
        //						= Localization.language.Equals("English") ? player.playerName : player.korName;
        //					break;
        //				}
        //			}
        //		}
        try{
        PlayerInfo player = UserMgr.PlayerDic[info.data.playerId];
        transform.FindChild("Label").FindChild("LblPlayer").GetComponent<UILabel>().text
            = Localization.language.Equals("English") ? player.firstName.Substring(0, 1) + ". " + player.lastName
                : player.korName;

        transform.GetComponent<Animator>().SetTrigger("Result");
        } catch{
            Debug.Log("Not found player : "+info.data.playerId);
        }
    }
示例#9
0
    public void ChangeInning(SocketMsgInfo info)
    {
        UserMgr.eventJoined.inningState = info.data.inningState;
        if(info.data.changeBingo > 0){
            Init ();
            return;
        }

        if(mLineupResponse == null)
            return;
        mLineupResponse.data.inningHalf = info.data.inningHalf;
        mLineupResponse.data.inningNumber = int.Parse(info.data.inning);
        if(info.data.inningState.Equals("END"))
            UserMgr.eventJoined.status = "Scheduled";

        Debug.Log("state : "+UserMgr.eventJoined.inningState+",half : "+mLineupResponse.data.inningHalf);
        InitBtm();
        //		IsReload = true;
        //		mLineupEvent = new GetCurrentLineupEvent(ReceivedLineup);
        //		NetMgr.GetCurrentLineup(UserMgr.eventJoined.gameId, int.Parse(info.data.inning),
        //		                        mBingoEvent.Response.data.bingo.bingoId, mLineupEvent);
    }
示例#10
0
    public void ChangePlayer(SocketMsgInfo info)
    {
        UserMgr.eventJoined.inningState = "ING";
        UserMgr.eventJoined.status = "InProgress";

        if(info.data.changeBingo > 0){
            Init ();
            return;
        }

        //		try{
        //			if(info.data.pitcherId != mPitcher.playerId
        //			   || info.data.playerId != mSortedLineup[0].playerId){
        //				Debug.Log ("Lineup Changed");
        //				throw new UnassignedReferenceException();
        //			}
        //
        //		} catch{
            ReloadLineup (info);
        //		}
        mOutCount = info.data.outs;
    }
示例#11
0
    public void ChangePlayer(SocketMsgInfo info)
    {
        UserMgr.eventJoined.inningState = "ING";
        UserMgr.eventJoined.status      = "InProgress";

        if (info.data.changeBingo > 0)
        {
            Init();
            return;
        }

//		try{
//			if(info.data.pitcherId != mPitcher.playerId
//			   || info.data.playerId != mSortedLineup[0].playerId){
//				Debug.Log ("Lineup Changed");
//				throw new UnassignedReferenceException();
//			}
//
//		} catch{
        ReloadLineup(info);
//		}
        mOutCount = info.data.outs;
    }
示例#12
0
    private void HandleDataReceive(IAsyncResult ar)
    {
        Int32 recvBytes = 0;

        try{
            recvBytes = mSocket.EndReceive(ar);
        } catch {
            Debug.Log("recv error");
            return;
        }

        // 수신받은 자료의 크기가 1 이상일 때에만 자료 처리
        if (recvBytes > 0)
        {
            mRecvSemaphore = true;

            Byte[] msgByte = new Byte[recvBytes];
            Array.Copy(mReceiveBuffer, msgByte, recvBytes);
            string msg = Encoding.UTF8.GetString(msgByte);

            // 받은 메세지를 출력
            Debug.Log("Received : " + msg);

            SocketMsgInfo msgInfo = Newtonsoft.Json.JsonConvert.DeserializeObject <SocketMsgInfo>(msg);
            mSocketMsgList.Add(msgInfo);
            mRecvSemaphore = false;
        }

        try {
            mSocket.BeginReceive(mReceiveBuffer, 0, mReceiveBuffer.Length, SocketFlags.None, mReceivingCallback, null);
        } catch (Exception ex) {
            // 예외가 발생하면 mReceiveBuffer 종료한다mReceiveBuffer("자료 수신 대기 도중 오류 발생! 메세지: "+ ex.Message);
            Instance.socketJoinEvent();
            return;
        }
    }
示例#13
0
    void GetSimpleResult(SocketMsgInfo msgInfo)
    {
        int quizListSeq = int.Parse(msgInfo.data.quizListSeq);

        StartCoroutine(RoutineSimpleResult(quizListSeq));
    }
示例#14
0
    public static void SocketReceived(SocketMsgInfo msgInfo)
    {
        if (Instance.mMatchPlaying != null)
        {
            Instance.mMatchPlaying.mCntAlive     = 0;
            Instance.mMatchPlaying.mNeedResponse = false;
        }
        Debug.Log("msgInfo.type" + msgInfo.type);
        if (msgInfo.type == ConstantsSocketType.RES.TYPE_JOIN)
        {
            if (Instance.mMatchPlaying != null)
            {
                Instance.mMatchPlaying.CompleteJoin();
            }
        }
        else if (msgInfo.type.Equals(ConstantsSocketType.RES.TYPE_START))
        {
            Instance.mMainTop.StartGame();
        }
        else if (msgInfo.type.Equals(ConstantsSocketType.RES.TYPE_CLOSE))
        {
//			Instance.mMainTop.GameReslut();
//			Debug.Log("Game Close");
            if (UserMgr.Schedule.myEntryFee != "0")
            {
                if (UserMgr.Schedule.doneGame != null)
                {
                    if (UserMgr.Schedule.doneGame == "0")
                    {
                        Instance.mMainTop.ResetData();
                    }
                    else
                    {
                        Instance.mMainTop.GameReslut();
                    }
                }
            }
            Instance.mMainTop.GameEnd();


            //Reset Contest,Preset,History List;
        }
        else if (msgInfo.type == ConstantsSocketType.RES.TYPE_STATUS)
        {
            if (Instance.mMainTop != null)
            {
//				bool hasQuiz = false;
                if (msgInfo.data.quiz != null &&
                    msgInfo.data.quiz.Equals("1"))
                {
                    if (QuizMgr.IsBettingOpended)
                    {
                        MoreQuiz = true;
                        Debug.Log("MoreQuiz");
                    }
                    else
                    {
                        HasQuiz = true;
                        Debug.Log("HasQuiz");
                    }
                }

                if (msgInfo.data.inning != null &&
                    msgInfo.data.inning.Equals("1"))
                {
                    NeedsDetailInfo = true;
                }
                else if (msgInfo.data.score != null &&
                         msgInfo.data.score.Equals("1"))
                {
                    NeedsDetailInfo = true;
                }
                else if (msgInfo.data.result != null &&
                         msgInfo.data.result.Equals("1"))
                {
                    Debug.Log("result");
                    if (Instance.mMainTop != null)
                    {
                        Debug.Log("GetSimpleResult");
                        Instance.GetSimpleResult(msgInfo);
                    }
                }
                else
                {
                    NeedsDetailInfo = false;
                }

                //				Debug.Log ("RequestBoardInfo");
                Instance.mMainTop.RequestBoardInfo();
            }
        }
        else if (msgInfo.type == ConstantsSocketType.RES.TYPE_ALIVE)
        {
//			NetMgr.SendSocketMsg(new AliveRequest().ToRequestString());
            if (Instance.mMatchPlaying != null)
            {
                Instance.mMatchPlaying.mCntAlive = ScriptMatchPlaying.TIME_MAX_ALIVE;
            }
        }
    }
    public void AddLog(SocketMsgInfo info)
    {
        //		mStrLog += log;
        //		string msg = "\n[00ff00][" + UtilMgr.GetDateTimeNow("HH:mm:ss") + "]" + "Send:7000[-]";
        string value = "\n[" + UtilMgr.GetDateTimeNow("HH:mm:ss") + "]";
        switch(info.type){
        case ConstantsSocketType.RES.TYPE_JOIN: value += "[00ff00]Received:Join"; break;
        case ConstantsSocketType.RES.TYPE_ALIVE_OK: value += "[00ff00]Received:Alive"; break;
        case ConstantsSocketType.RES.RESULT_HITTER:
            value += "[ff0000]Received:ResultHitter(";
            PlayerInfo player = null;
            try{
                player = UserMgr.PlayerDic[info.data.playerId];
            } catch{
                player = new PlayerInfo();
                if(UtilMgr.IsMLB())
                    player.lastName = "Unknown:"+info.data.playerId;
                else
                    player.korName = "선수정보없음:"+info.data.playerId;
            }

            if(UtilMgr.IsMLB()){
                value += player.lastName + "," + info.data.result + ","
                    + info.data.value + ")"; break;}
            else {
                value += player.korName + "," + info.data.result + ","
                    + info.data.value + ")"; break;}
        case ConstantsSocketType.RES.CHANGE_PLAYER: value += "[ff00ff]Received:ChangePlayer(";
            PlayerInfo hitter = null;
            PlayerInfo pitcher = null;
            try{
                hitter = UserMgr.PlayerDic[info.data.playerId];
            } catch{
                hitter = new PlayerInfo();
                if(UtilMgr.IsMLB())
                    hitter.lastName = "Unknown:"+info.data.playerId;
                else
                    hitter.korName = "선수정보없음:"+info.data.playerId;
            }
            try{
                pitcher = UserMgr.PlayerDic[info.data.pitcherId];
            } catch{
                pitcher = new PlayerInfo();
                if(UtilMgr.IsMLB())
                    pitcher.lastName = "Unknown:"+info.data.playerId;
                else
                    pitcher.korName = "선수정보없음:"+info.data.pitcherId;
            }
            if(UtilMgr.IsMLB()){
                value += "hit:" + hitter.lastName + ",pit:" + pitcher.lastName + ")";			break;}
            else{
                value += "hit:" + hitter.korName + ",pit:" + pitcher.korName + ")";			break;}
        case ConstantsSocketType.RES.RELOAD_BINGO: value += "[ffff00]Received:UpdateBingo"; break;
        case ConstantsSocketType.RES.CHANGE_INNING: value += "[00ffff]Received:ChangeInning(";
            value += info.data.inning + "," + info.data.inningHalf + "," + info.data.inningState + ")"; break;
        default: value += "[ffffff]Recieved:"+info.type; break;
        }
        value += "[-],"+info.data.msgCount;
        mStrLog += value;

        Reposition();
    }
示例#16
0
    public void AddLog(SocketMsgInfo info)
    {
//		mStrLog += log;
//		string msg = "\n[00ff00][" + UtilMgr.GetDateTimeNow("HH:mm:ss") + "]" + "Send:7000[-]";
        string value = "\n[" + UtilMgr.GetDateTimeNow("HH:mm:ss") + "]";

        switch (info.type)
        {
        case ConstantsSocketType.RES.TYPE_JOIN: value += "[00ff00]Received:Join"; break;

        case ConstantsSocketType.RES.TYPE_ALIVE_OK: value += "[00ff00]Received:Alive"; break;

        case ConstantsSocketType.RES.RESULT_HITTER:
            value += "[ff0000]Received:ResultHitter(";
            PlayerInfo player = null;
            try{
                player = UserMgr.PlayerDic[info.data.playerId];
            } catch {
                player = new PlayerInfo();
                if (UtilMgr.IsMLB())
                {
                    player.lastName = "Unknown:" + info.data.playerId;
                }
                else
                {
                    player.korName = "선수정보없음:" + info.data.playerId;
                }
            }

            if (UtilMgr.IsMLB())
            {
                value += player.lastName + "," + info.data.result + ","
                         + info.data.value + ")"; break;
            }
            else
            {
                value += player.korName + "," + info.data.result + ","
                         + info.data.value + ")"; break;
            }

        case ConstantsSocketType.RES.CHANGE_PLAYER: value += "[ff00ff]Received:ChangePlayer(";
            PlayerInfo hitter  = null;
            PlayerInfo pitcher = null;
            try{
                hitter = UserMgr.PlayerDic[info.data.playerId];
            } catch {
                hitter = new PlayerInfo();
                if (UtilMgr.IsMLB())
                {
                    hitter.lastName = "Unknown:" + info.data.playerId;
                }
                else
                {
                    hitter.korName = "선수정보없음:" + info.data.playerId;
                }
            }
            try{
                pitcher = UserMgr.PlayerDic[info.data.pitcherId];
            } catch {
                pitcher = new PlayerInfo();
                if (UtilMgr.IsMLB())
                {
                    pitcher.lastName = "Unknown:" + info.data.playerId;
                }
                else
                {
                    pitcher.korName = "선수정보없음:" + info.data.pitcherId;
                }
            }
            if (UtilMgr.IsMLB())
            {
                value += "hit:" + hitter.lastName + ",pit:" + pitcher.lastName + ")";                   break;
            }
            else
            {
                value += "hit:" + hitter.korName + ",pit:" + pitcher.korName + ")";                     break;
            }

        case ConstantsSocketType.RES.RELOAD_BINGO: value += "[ffff00]Received:UpdateBingo"; break;

        case ConstantsSocketType.RES.CHANGE_INNING: value += "[00ffff]Received:ChangeInning(";
            value += info.data.inning + "," + info.data.inningHalf + "," + info.data.inningState + ")"; break;

        default: value += "[ffffff]Recieved:" + info.type; break;
        }
        value   += "[-]," + info.data.msgCount;
        mStrLog += value;

        Reposition();
    }
示例#17
0
 public void ReceivedResult(SocketMsgInfo info)
 {
     transform.FindChild("Body").FindChild("Scroll View").FindChild("Board").FindChild("Result")
         .GetComponent<BingoResult>().SocketResult(info);
     StartCoroutine(IReloadBoard(info));
     //		ReloadLineup();
     mOutCount = info.data.outs;
 }
示例#18
0
 public void ReloadLineup(SocketMsgInfo info)
 {
     //		UserMgr.eventJoined.inningState = "ING";
     //		UserMgr.eventJoined.status = "InProgress";
     //
     //		if(info.data.changeBingo > 0){
     //			Init ();
     //			return;
     //		}
     //		IsReload = true;
     //		int inning = mLineupResponse.data.inningNumber;
     int inning = 0;
     UserMgr.eventJoined.inningState = info.data.inningState;
     mLineupEvent = new GetCurrentLineupEvent(ReceivedLineup);
     NetMgr.GetCurrentLineup(UserMgr.eventJoined.gameId, inning,
                             mBingoId, mLineupEvent);
 }
示例#19
0
//	public static void EndProcess(){
//		Instance.StopCoroutine(Instance.IWaitProcess());
//		IsProcessing = false;
//	}
//
//	IEnumerator IWaitProcess(){
//		yield return new WaitForSeconds(10f);
//		IsProcessing = false;
//	}

    public static bool SocketReceived(SocketMsgInfo msgInfo)
    {
//		if(IsProcessing) return true;
//
//		IsProcessing = true;

        if (UserMgr.eventJoined == null)
        {
            return(false);
        }

        if (UtilMgr.GetLastBackState() != UtilMgr.STATE.LiveBingo)
        {
            return(false);
        }

        LiveBingo bingo = UtilMgr.Instance.mRoot.FindChild("LiveBingo").GetComponent <LiveBingo>();

        bingo.mUpdateCnt = 0;
        bingo.transform.FindChild("Top").FindChild("BtnDebug").GetComponent <BtnDebugLiveBingo>().AddLog(msgInfo);

        if (msgInfo.type == ConstantsSocketType.RES.TYPE_ALIVE_OK &&
            bingo.mMsgCount < msgInfo.data.msgCount)
        {
            string msg = "\n[ff0000]Socket msg count is wrong[-]";
            bingo.transform.FindChild("Top").FindChild("BtnDebug").GetComponent <BtnDebugLiveBingo>().AddLog(msg);
            bingo.ReloadAll();
            return(false);
        }

        if (msgInfo.data.msgCount > 0)
        {
            bingo.mMsgCount = msgInfo.data.msgCount;
        }

        switch (msgInfo.type)
        {
        case ConstantsSocketType.RES.TYPE_ALIVE:
//			IsProcessing = false;
            NetMgr.Alive();
            break;

        case ConstantsSocketType.RES.RESULT_HITTER:
//			Instance.StartCoroutine(Instance.IWaitProcess());
            bingo.ReceivedResult(msgInfo);
            break;

        case ConstantsSocketType.RES.CHANGE_INNING:
//			Instance.StartCoroutine(Instance.IWaitProcess());
//			bingo.ChangeInning(msgInfo);
            break;

        case ConstantsSocketType.RES.RELOAD_BINGO:
//			Instance.StartCoroutine(Instance.IWaitProcess());
            bingo.ReloadBoard();
            break;

        case ConstantsSocketType.RES.CHANGE_PLAYER:
//			Instance.StartCoroutine(Instance.IWaitProcess());
            bingo.ChangePlayer(msgInfo);
//			bingo.ReloadLineup(msgInfo);
            break;

        case ConstantsSocketType.RES.GAME_ENDED:
//			bingo.ShowGameEnded();
            bingo.GameEnded();
            break;
        }


        return(false);
    }
示例#20
0
 IEnumerator IReloadBoard(SocketMsgInfo info)
 {
     yield return new WaitForSeconds(3f);
     //		ReloadBoard();
     if(info.data.inningState.Equals("END")){
         UserMgr.eventJoined.inningState = "END";
         UserMgr.eventJoined.status = "Scheduled";
         InitBtm();
         ReloadBoard();
     }
     else
         ReloadAll();
 }