Beispiel #1
0
    public void Back()
    {
        this.drawState = MatchController.DrawState.FREE;
        isDraw = false;
        Destroy(matchRoom.gameObject);
        Application.LoadLevel((int)Definition.eSceneID.MapScene);

        //		if(PlayerPrefs.GetString("GameType", "Single") == "Network") {
        //			this.drawState = MatchController.DrawState.FREE;
        //			isDraw = false;
        //
        //			Destroy(matchRoom.gameObject);
        //			Application.LoadLevel(Definition.eSceneID.LobbyScene.ToString());
        //
        //
        //
        //		}else{
        //			this.drawState = MatchController.DrawState.FREE;
        //			isDraw = false;
        //			Destroy(matchRoom.gameObject);
        //			Application.LoadLevel((int)Definition.eSceneID.MapScene);
        //		}
    }
Beispiel #2
0
    public void ReceiveByClientPortal_LeaveMatchRoom(int roomIndex, int leaverGUPID, int p, NetworkMessageInfo msgInfo)
    {
        Definition.RPCProcessState resultState = (Definition.RPCProcessState)p;
        // 		Debug.Log("ReceiveByClientPortal_LeaveMatchRoom");
        if(resultState == Definition.RPCProcessState.SUCCESS) {
            if((this.matchRoom != null)) {
                if(this.matchRoom.GetComponent<Room>().roomIndex == roomIndex) {

                    if(this.playerInfo.GUPID != leaverGUPID) {

                        if(this.matchRoom.GetComponent<Room>().IsPlayerInRoom(leaverGUPID)) {

                            GameUserPlayer leaver = this.matchRoom.GetComponent<Room>().GetPlayer(leaverGUPID);

                            this.matchRoom.PlayerLeave(leaver);
                            Destroy(leaver.gameObject);
                            StopCoroutine("StartCountDown");
                        }

                    }else{
        //						Debug.Log("you are left");

        //						Destroy(matchRoom.gameObject);

                        selectedCarInsanityCarInfo = new CarInsanityCarInfo();
                        isLockedOn = false;
                        isStartPlay = false;
                        StopCoroutine("StartCountDown");
        //						this.actionState = MatchController.ActionState.LEFT;
                        this.drawState = MatchController.DrawState.QUIT;
                        this.isLeaving = true;

                        OnLeaveFromMatchRoom();
                    }

                }else{
        //					this.errorMsg = "Game index not match!";
        //					Debug.Log(errorMsg);
                    matchRoomSceneViewer.LeaveMatchErrorSceneSetting();
                }
            }else{

        //				this.errorMsg = "Game not available (it is null)!";
        //				Debug.Log(errorMsg);
                matchRoomSceneViewer.LeaveMatchErrorSceneSetting();
            }

        }else if(resultState == Definition.RPCProcessState.PLAYERNOTINROOM){
        //			this.errorMsg = "PLAYERNOTINROOM";
        //			Debug.Log(errorMsg);
            matchRoomSceneViewer.LeaveMatchErrorSceneSetting();

        }else if(resultState == Definition.RPCProcessState.ROOMNOTEXIST){

        //			this.errorMsg = "ROOMNOTEXIST";
        //			Debug.Log(errorMsg);
            matchRoomSceneViewer.LeaveMatchErrorSceneSetting();

        }else if(resultState == Definition.RPCProcessState.PLAYERNOTEXIST){

        //			this.errorMsg = "PLAYERNOTEXIST";
        //			Debug.Log(errorMsg);
            matchRoomSceneViewer.LeaveMatchErrorSceneSetting();

        }else if(resultState == Definition.RPCProcessState.UNAVAILABLE){

        //			this.errorMsg = "UNAVAILABLE";
        //			Debug.Log(errorMsg);
            matchRoomSceneViewer.LeaveMatchErrorSceneSetting();

        }else{
        //			Debug.Log(p.ToString());
            matchRoomSceneViewer.LeaveMatchErrorSceneSetting();
        }
    }
Beispiel #3
0
    void Update()
    {
        Board_Owner = Board_Owner_+ n;

        n += (int)temp;
        temp = (temp >= 1) ? 0.0f : temp + Time.deltaTime * 10;
        if(n > 5) {
            n = 0;
        }
        if(this.drawState == MatchController.DrawState.ENTER) {
            if(groupRoomBannerRect.y < bannerEndPoint) {
                groupRoomBannerRect.y = groupRoomBannerRect.y + (groupRoomBannerHeight*Time.deltaTime*3);

            }else{
                groupRoomBannerRect.y = bannerEndPoint;
            }

            if(groupRoomBoardRect.y > roomBoardEndPoint) {
                groupRoomBoardRect.y = groupRoomBoardRect.y - (groupRoomBoardHeight*Time.deltaTime*3);
            }else{
                groupRoomBoardRect.y = roomBoardEndPoint;
            }

            if((groupRoomBannerRect.y == bannerEndPoint) && (groupRoomBoardRect.y == roomBoardEndPoint)) {
                if(groupBoardLeftRect.y < leftBoardEndPoint) {
                    groupBoardLeftRect.y = groupBoardLeftRect.y + (groupBoardLeftHeight * Time.deltaTime*3);
                    groupBoardRightRect.y = groupBoardRightRect.y + (groupBoardRightHeight * Time.deltaTime*3);
                }else{
                    groupBoardLeftRect.y = leftBoardEndPoint;
                    groupBoardRightRect.y = leftBoardEndPoint;

                    this.drawState = MatchController.DrawState.MATCHROOM;

                    if(OnAfterBoardDrawn != null) {
                        OnAfterBoardDrawn();
                    }
                }
            }
        }

        if(this.drawState == MatchController.DrawState.QUIT) {

            if(groupBoardLeftRect.y > leftBoardStartPoint) {
                groupBoardLeftRect.y = groupBoardLeftRect.y - (groupBoardLeftHeight*Time.deltaTime*3);
                groupBoardRightRect.y = groupBoardRightRect.y - (groupBoardRightHeight*Time.deltaTime*3);
            }else{
                groupBoardLeftRect.y = leftBoardStartPoint;
                groupBoardRightRect.y = leftBoardStartPoint;
            }

            if(groupBoardLeftRect.y == leftBoardStartPoint) {
                if(groupRoomBannerRect.y > bannerStartPoint) {
                    groupRoomBannerRect.y = groupRoomBannerRect.y - (groupRoomBannerHeight*Time.deltaTime*3);

                }else{
                    groupRoomBannerRect.y = bannerStartPoint;
                }

                if(groupRoomBoardRect.y < roomBoardStartPoint) {
                    groupRoomBoardRect.y = groupRoomBoardRect.y + (groupRoomBoardHeight*Time.deltaTime*3);

                }else{
                    groupRoomBoardRect.y = roomBoardStartPoint;
                }

                if((groupRoomBannerRect.y == bannerStartPoint) && (groupRoomBoardRect.y == roomBoardStartPoint)) {
                    if(isStartPlay) {

                        this.StartPreparingForPlay();

                    }else if(isLeaving) {
                        this.Back();
                    }
                }
            }
        }
    }
Beispiel #4
0
    void OnLevelWasLoaded(int mapIndex)
    {
        //		Debug.Log(strTest);

        if(mapIndex == (int)Definition.eSceneID.MatchRoomScene) {

            this.drawState = MatchController.DrawState.ENTER;
            isDraw = true;

            switch(currentLanguage) {
                case Definition.eLanguage.ENGLISH:
        //					Debug.Log("OnLevelWasLoaded:Definition.eLanguage.ENGLISH");
                    this.matchRoomSkin = Resources.Load("Skin/RoomEnglishLanguage", typeof(GUISkin)) as GUISkin;
                    break;

                case Definition.eLanguage.SIMPLECHINESE:
        //					Debug.Log("OnLevelWasLoaded:Definition.eLanguage.SIMPLECHINESE");
                    this.matchRoomSkin = Resources.Load("Skin/RoomSimpleChineseLanguage",  typeof(GUISkin)) as GUISkin;
                    break;

                case Definition.eLanguage.TRANDITIONALCHIINESE:
        //					Debug.Log("OnLevelWasLoaded:Definition.eLanguage.TRANDITIONALCHIINESE");
                    this.matchRoomSkin = Resources.Load("Skin/RoomTranditionalChineseLanguage",  typeof(GUISkin)) as GUISkin;
                    break;
            }

            matchRoomSceneViewer = GameObject.FindObjectOfType(typeof(MatchRoomSceneViewer)) as MatchRoomSceneViewer;
            lobbySceneViewer = GameObject.FindObjectOfType(typeof(LobbySceneViewer)) as LobbySceneViewer;

            LoadCarListStart();
            enabled = true;

            if(PlayerPrefs.GetString("GameType") == "Network") {
                OnJoinedMatch();
            }

        }else{
            enabled = false;
            this.drawState = MatchController.DrawState.FREE;
            isDraw = false;
            this.matchRoomSkin = null;
        }

        //		Debug.Log("Match:OnLevelWasLoaded");
    }
Beispiel #5
0
    public void StartPreparingForPlay()
    {
        this.drawState = MatchController.DrawState.FREE;
        //		isDraw = false;

        OnMatchStarted();
        playGameController.StartPreparingForPlay();
    }
Beispiel #6
0
    public void StartLeaveRoom()
    {
        if(PlayerPrefs.GetString("GameType") == "Network") {
            networkView.RPC("SendToGameLobby_LeaveMatchRoom", RPCMode.Server, this.matchRoom.GetComponent<Room>().roomIndex, this.playerInfo.GUPID);
        }else{
            selectedCarInsanityCarInfo = new CarInsanityCarInfo();
            isLockedOn = false;
            isStartPlay = false;
            StopCoroutine("StartCountDown");
        //			this.actionState = MatchController.ActionState.LEFT;
            this.drawState = MatchController.DrawState.QUIT;
            this.isLeaving = true;

            OnLeaveFromMatchRoom();
        }
    }
Beispiel #7
0
 public void StartingMatch()
 {
     this.drawState = MatchController.DrawState.QUIT;
     this.isStartPlay = true;
 }