public ButtonRoom Copy() { var b = new ButtonRoom(this.b, this.r); b.drawable = false; return(b); }
void UpdateRooms() { if (!PhotonNetwork.connected) { return; } if (loadingTextA.activeSelf) { contentFullA.SetActive(true); loadingTextA.SetActive(false); } if (PhotonNetwork.inRoom) { return; } Transform itemTemp = null; foreach (Transform tran in contentListRoom.transform) { if (tran.name != "Item") { Destroy(tran.gameObject); } else { itemTemp = tran; itemTemp.gameObject.SetActive(true); } } int maxRoom = PhotonNetwork.GetRoomList().Length; if (maxRoom > 10) { maxRoom = 10; } for (int i = 0; i < maxRoom; i++) { Transform itemNow = Instantiate(itemTemp, contentListRoom.transform) as Transform; Transform tranMember = itemNow.transform.Find("Member"); Transform tranName = itemNow.transform.Find("Name"); Text textMember = tranMember.GetComponent <Text>(); Text textName = tranName.GetComponent <Text>(); textMember.text = PhotonNetwork.GetRoomList()[i].PlayerCount + "/" + PhotonNetwork.GetRoomList()[i].MaxPlayers; textName.text = PhotonNetwork.GetRoomList()[i].Name; ButtonRoom butRoom = itemNow.GetComponent <ButtonRoom>(); butRoom.nameRoom = textName.text; } itemTemp.gameObject.SetActive(false); }
// Use this for initialization void Start() { //Gets scripts off player baseEnter = player.GetComponent<BaseEnter>(); buttonRoom = player.GetComponent<ButtonRoom>(); grid = player.GetComponent<Grid>(); keyPickUp = player.GetComponent<KeyPickUp>(); paint = player.GetComponent<Paint>(); //Sets all scripts enabled to false initially baseEnter.enabled = false; buttonRoom.enabled = false; grid.enabled = false; keyPickUp.enabled = false; paint.enabled = false; //player starts in first room so it initially returns true for first room inFirstRoom = true; inSecondRoom = false; inThirdRoom = false; inFourthRoom = false; }
void Start() { //Gets scripts off of player script = plane.GetComponent<ScriptEnabler>(); buttonScript = player.GetComponent<ButtonRoom>(); }
public static void rerollRooms() { //find out why room except on list doesn't work List <Room> validRooms = new List <Room>(); //get all keys to room_tiers List <int> keys = skilltree.room_tiers.Keys.ToList(); //sort to get from lowest to highest keys.Sort(); int boss_level = BattleManager.boss.level; //go though all ints representing levels in the for (int x = 0; x < keys.Count; x++) { int key = keys[x]; //if we are at a higher level than we should be if (key > BattleManager.boss.level) { break; } List <Room> rooms = skilltree.room_tiers[key]; foreach (Room r in rooms) { Console.WriteLine(r.name); } validRooms.AddRange(rooms); } foreach (Room r in boughtRooms) { Console.WriteLine("Bought: " + r.name); } //get rooms not already bought List <Room> roomlist = new List <Room>(); foreach (Room r in validRooms) { if (boughtRooms.Contains(r) == false) { roomlist.Add(r); } } validRooms = roomlist; //clear the old rooms //zeroAvailableRooms(); int numToPick = 2; if (validRooms.Count < 2) { numToPick = validRooms.Count; } int index = 0; for (index = 0; index < numToPick; index++) { Room r = validRooms[LeaveMeAlone.random.Next(validRooms.Count)]; validRooms.Remove(r); var roombutton = AvailableRooms[index]; AvailableRooms[index] = new ButtonRoom(new Button(r.img, (int)baseRoomButtonPos.X + 300 * index, (int)baseRoomButtonPos.Y, 200, 50), r); AvailableRooms[index].b.text.font = Text.fonts["RetroComputer-12"]; AvailableRooms[index].b.text.position = new Vector2(roombutton.b.rectangle.X, roombutton.b.rectangle.Y + roombutton.b.rectangle.Height + 5); AvailableRooms[index].b.text.color = Color.White; } for (; index < 2; index++) { AvailableRooms[index] = new ButtonRoom(new Button(nothing_img, (int)baseRoomButtonPos.X + 300 * index, (int)baseRoomButtonPos.Y, 200, 50), makeNothing()); } }
public static void zeroAvailableRooms() { AvailableRooms[0] = new ButtonRoom(new Button(nothing_img, (int)baseRoomButtonPos.X, (int)baseRoomButtonPos.Y, 200, 50), makeNothing()); AvailableRooms[1] = new ButtonRoom(new Button(nothing_img, (int)baseRoomButtonPos.X + 300, (int)baseRoomButtonPos.Y, 200, 50), makeNothing()); }