Exemple #1
0
    public void Init()
    {
        mCanGet = 0;
        if (UtilMgr.GetLastBackState() != UtilMgr.STATE.LiveBingo)
        {
            transform.root.FindChild("LiveBingo").gameObject.SetActive(true);
            transform.root.FindChild("LiveBingo").localPosition = new Vector3(2000f, 0);
            NetMgr.JoinGame();
            mUpdateCnt      = 0;
            mBingoResponse  = null;
            mLineupResponse = null;
            mCallResponse   = null;
        }

        IsReload   = false;
        BoardOnly  = false;
        IsNotReady = false;
        IsEnded    = UserMgr.eventJoined.status.Equals("Final") ? true : false;

        ClearBoard();
        mItemDic = new Dictionary <int, ItemBingo>();
        transform.GetComponent <LiveBingoAnimation>().Init();
        transform.FindChild("Body").FindChild("Scroll View").FindChild("Board").FindChild("Sprite")
        .FindChild("NotReady").gameObject.SetActive(false);

        mBingoEvent = new GetBingoEvent(ReceivedBingo);
        NetMgr.GetBingo(UserMgr.eventJoined.gameId, mBingoEvent);
    }
Exemple #2
0
    void OnApplicationPause(bool pause)
    {
        UtilMgr.OnPause = pause;
//		Debug.Log("Application pause : "+pause);
        if (pause)
        {
            UtilMgr.PauseTime = System.DateTime.Now;
        }
        else
        {
            System.TimeSpan timeDiff = System.DateTime.Now - UtilMgr.PauseTime;
//			Debug.Log("hours : "+timeDiff.Hours+", minutes : "+timeDiff.Minutes+", secs : "+timeDiff.Seconds);

            if (timeDiff.Minutes > 29)
            {
                AutoFade.LoadLevel("Login"); return;
            }

            if (UtilMgr.GetLastBackState() == UtilMgr.STATE.LiveBingo &&
                UserMgr.eventJoined != null)
            {
                NetMgr.JoinGame();
                transform.FindChild("LiveBingo").GetComponent <LiveBingo>().ReloadAll();
            }
        }
//			UtilMgr.DismissLoading();
    }
    void ReceivedTicketShop()
    {
        UtilMgr.RemoveBackState(UtilMgr.STATE.Profile);
        UtilMgr.AnimatePageToLeft(UtilMgr.GetLastBackState().ToString(), "Shop");
        UtilMgr.AddBackState(UtilMgr.STATE.Shop);

        transform.root.FindChild("Shop").GetComponent <Shop>().InitItemShop(
            UtilMgr.GetLocalText("StrTicketShop"), Shop.TICKET, mItemEvent);
    }
Exemple #4
0
 void ShowNext()
 {
     if (!IsReload && UtilMgr.GetLastBackState() != UtilMgr.STATE.LiveBingo)
     {
         StartCoroutine(Next());
     }
     if (IsEnded)
     {
         ShowGameEnded();
     }
 }
    void ReceivedGold()
    {
        UtilMgr.RemoveBackState(UtilMgr.STATE.Profile);

        if (UtilMgr.GetLastBackState() != UtilMgr.STATE.Shop)
        {
            UtilMgr.AnimatePageToLeft(UtilMgr.GetLastBackState().ToString(), "Shop");
            UtilMgr.AddBackState(UtilMgr.STATE.Shop);
        }

        transform.root.FindChild("Shop").GetComponent <Shop>().InitGoldShop(
            UtilMgr.GetLocalText("StrGoldShop"), Shop.GOLD, mGoldEvent);
    }
    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;
        }
    }
Exemple #7
0
    public void Init()
    {
        transform.localPosition = new Vector3(2000f, 0);
        transform.gameObject.SetActive(true);

        Reset();

        transform.FindChild("Body").FindChild("Scroll View").GetComponent <UIScrollView>().ResetPosition();


        UtilMgr.RemoveBackState(UtilMgr.STATE.Profile);
        UtilMgr.AnimatePageToLeft(UtilMgr.GetLastBackState().ToString(), "Settings");
        UtilMgr.AddBackState(UtilMgr.STATE.Settings);

//		UtilMgr.AnimatePageToLeft(UtilMgr.
    }
    void ReceivedSkill()
    {
        transform.gameObject.SetActive(true);

        mList = new List <SkillsetInfo>();
        foreach (SkillsetInfo skill in mSkillEvent.Response.data)
        {
            if (skill.dockingYn == 0)
            {
                mList.Add(skill);
            }
        }

        transform.FindChild("Top").FindChild("Skills").FindChild("LblSkillsV").GetComponent <UILabel>().text
            = mList.Count + " / " + UserMgr.LobbyInfo.userInvenOfSkill;

        transform.FindChild("Body").FindChild("Draggable").GetComponent <UIDraggablePanel2>().RemoveAll();
        transform.FindChild("Body").FindChild("Draggable").GetComponent <UIDraggablePanel2>().Init(
            mList.Count, delegate(UIListItem item, int index) {
            SkillsetInfo info = mList[index];
            item.Target.transform.GetComponent <ItemSkill>().Init(info);

            if (mCardInfo == null)
            {
                item.Target.transform.FindChild("BtnRight").gameObject.SetActive(false);
            }
            else
            {
                item.Target.transform.FindChild("BtnRight").gameObject.SetActive(true);
            }
        });
        transform.FindChild("Body").FindChild("Draggable").GetComponent <UIDraggablePanel2>().ResetPosition();

        if (UtilMgr.GetLastBackState() != UtilMgr.STATE.SkillList)
        {
            UtilMgr.AddBackState(UtilMgr.STATE.SkillList);
            UtilMgr.AnimatePageToLeft("MyCards", "SkillList");
        }
    }
Exemple #9
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);
    }