//根据checkbox内容返回一个list public Chanllenge GetCheckStatus() { Chanllenge choosenChanllenge = Chanllenge.NULL; if (VSshown && !MTshown && !BTshown) { choosenChanllenge = Chanllenge.V; } else if (VSshown && MTshown && !BTshown) { choosenChanllenge = Chanllenge.VM; } else if (VSshown && !MTshown && BTshown) { choosenChanllenge = Chanllenge.VB; } else if (!VSshown && MTshown && !BTshown) { choosenChanllenge = Chanllenge.M; } else if (!VSshown && !MTshown && BTshown) { choosenChanllenge = Chanllenge.B; } return(choosenChanllenge); }
//当点击创建房间按钮时 public void OnClickCreateRoomBtn() { GameSetting gamesetting = GameObject.Find("DDOL/gamesetting").GetComponent <GameSetting>(); int noPlayers = int.Parse(transform.Find("NoPlayers/popup/Label").GetComponent <UILabel>().text); int noEPcards = int.Parse(transform.Find("EPcards/popup/Label").GetComponent <UILabel>().text); Chanllenge chanllenges = GetComponentInChildren <chanllangeChcekBox>().GetCheckStatus(); gamesetting.updateGameSetting(noPlayers, noEPcards, chanllenges); Application.LoadLevel("MainGame"); //建立一个room 名字为roomname RoomOptions roomOptions = new RoomOptions() { IsVisible = true, IsOpen = true, MaxPlayers = 4 }; if (PhotonNetwork.CreateRoom(RoomName.value, roomOptions, TypedLobby.Default)) { print("create room successfully sent");//创建房间成功 } else { print("create room failed to send");//创建房间失败 } }
public void updateGameSetting(int noPlayers, int noEpcards, Chanllenge challgs) { this.noPlayers = noPlayers; this.noEPcards = noEpcards; this.chanllenges = challgs; }