// public ChatRoomService chatRoomService; // // void Awake() { // chatRoomService = GameObject.FindObjectOfType(typeof(ChatRoomService)) as ChatRoomService; // } // public bool IsCreator(GameUserPlayer p) { if(this.creator == p) { return true; }else { return false; } }
public bool IsPlayerInRoom(GameUserPlayer p) { foreach (GameUserPlayer player in playersInRoom) { if(p == player) { return true; } } return false; }
void Awake() { PlayGameController.OnShowRecord += OnShowRecord; PlayGameController.OnShowGainGold += OnShowGainGold; GameObject pgo = GameObject.Find("PlayerInfo"); player = pgo.GetComponent<GameUserPlayer>(); animationStar.enabled = false; }
public bool PlayerLeave(GameUserPlayer u) { if(room.PlayerLeave(u)){ if(u.isAI) { onlyAICount--; }else{ onlyPlayerCount--; } return true; } else { return false; } }
public bool PlayerJoin(GameUserPlayer u) { if((onlyAICount + onlyPlayerCount) < room.maxPlayerNumber) { if(room.PlayerJoin(u)) { if(u.isAI) { onlyAICount++; }else{ onlyPlayerCount++; } return true; }else{ return false; } }else { return false; } }
public bool PlayerLeave(GameUserPlayer u) { if(playersInRoom.Contains(u)){ playersInRoom.Remove(u); return true; } else { return false; } }
public bool PlayerJoin(GameUserPlayer u) { if(playersInRoom.Count < maxPlayerNumber) { if(!playersInRoom.Contains(u)){ playersInRoom.Add(u); return true; } else { return false; } }else { return false; } }
public MatchRoom CreateMatchRoom(int roomIndex, string roomName, int maxPlayerNumber, int matchMap, string matchType, GameUserPlayer creator) { matchRoom = GameObject.Instantiate(matchRoomPrefab, Vector3.zero, Quaternion.identity) as MatchRoom; matchRoom.matchMap = matchMap; matchRoom.matchType = matchType; matchRoom.GetComponent<Room>().roomIndex = roomIndex; matchRoom.GetComponent<Room>().roomName = roomName; matchRoom.GetComponent<Room>().maxPlayerNumber = maxPlayerNumber; matchRoom.GetComponent<Room>().creator = creator; matchRoom.name = matchRoom.GetComponent<Room>().roomIndex.ToString(); matchRoom.transform.parent = gameObject.transform; return matchRoom; }
void OnPlayerLoaded(GameUserPlayer player) { // Debug.Log ("OnPlayerLoaded:"+player.money.ToString()); goldsLabel.text = player.money.ToString(); }