public override void OnStartLocalPlayer() { Debug.Log("OnStartLocalPlayer"); SetupLocalPlayer(); SendAvatarInfo (); MyPlayer = this; }
public void AddPlayer(LobbyPlayer player) { _players.Add(player); player.transform.SetParent(playerListContentTransform, false); addButtonRow.transform.SetAsLastSibling(); PlayerListModified(); }
private WaitForSeconds m_StartWait; // Used to have a delay whilst the round starts. #endregion Fields #region Methods // int playerNum, Color c, string name, int localID); /// <summary> /// Add a player from the lobby hook /// </summary> /// <param name="player">The actual GameObject instantiated by the lobby, which is a NetworkBehaviour</param> /// <param name="lobbyPlayer">The Lobby Player</param> /// lp.slot, lp.playerColor, lp.nameInput.text, lp.playerControllerId public static void AddPlayer(GameObject player, LobbyPlayer lobbyPlayer) { PlayMakerSanPlayerManager tmp = new PlayMakerSanPlayerManager(); tmp.m_Instance = player; tmp.m_PlayerNumber = lobbyPlayer.playerControllerId; tmp.m_PlayerColor = lobbyPlayer.playerColor; tmp.m_PlayerName = lobbyPlayer.nameInput.name; tmp.m_LocalPlayerID = lobbyPlayer.playerControllerId; tmp.Setup(); m_Players.Add(tmp); }
// Set artifact tree public static Coroutine SetArtifactInventory(LobbyPlayer player, ArtifactInventory inv) { return GameDB.instance.StartCoroutine(GameDB.Set<ArtifactInventory>( "AccountToArtifactInventory", player.accountId, inv, data => { if(data == null) Lobby.RPC("ArtifactInventorySaveError", player.peer); else player.artifactInventory = data; } )); }
// -------------------------------------------------------------------------------- // AccountToArtifactInventory // -------------------------------------------------------------------------------- // Get artifact inventory public static Coroutine GetArtifactInventory(LobbyPlayer player) { return GameDB.instance.StartCoroutine(GameDB.Get<ArtifactInventory>( "AccountToArtifactInventory", player.accountId, data => { if(data == null) { player.artifactInventory = new ArtifactInventory(); } else { player.artifactInventory = data; } Lobby.RPC("ReceiveArtifactInventory", player.peer, player.accountId, Jboy.Json.WriteObject(player.artifactInventory)); } )); }
// Get artifact tree public static Coroutine GetArtifactTree(LobbyPlayer player) { return GameDB.instance.StartCoroutine(GameDB.Get<ArtifactTree>( "AccountToArtifactTree", player.accountId, data => { if(data == null) { player.artifactTree = ArtifactTree.GetStarterArtifactTree(); } else { player.artifactTree = data; } Lobby.RPC("ReceiveArtifactTree", player.peer, player.accountId, Jboy.Json.WriteObject(player.artifactTree)); } )); }
// Called when this Client receives the 'SetLocalPlayer' message. private void SetLocalPlayer(NetworkMessage networkMessage) { myPlayer = networkMessage.ReadMessage <LobbyPlayer>(); }
protected virtual UserFormSubmission Vote(LobbyPlayer player) { return(CommonSubmissions.SubmitSingleSelector(player.UserId)); }
public void RemovePlayer(LobbyPlayer player) { player.RemovePlayer(); }
private void RemoveLocalPlayer(int player) { LobbyPlayer lobbyPlayer = GameObject.Find("LobbyPlayer (" + player + ")").GetComponent <LobbyPlayer>(); lobbyPlayer.RemovePlayer(); }
public static void AddPlayer(GameObject playerGo, LobbyPlayer lobbyPlayer, LobbyPlayerParam param) { UIDebug.Log("AddPlayer Slot:{0} isLocalPlayer:{1} RoleName:{2} Instance:{3}", param.Slot, param.isLocalPlayer, param.RoleName, Instance); PLAYER_LIST.Add(new PlayerManager(playerGo, param.Slot, param.RoleName, param.RoleColor)); }
void ClientChat(string channelName, string msg, LobbyMessageInfo info) { LobbyPlayer player = LobbyServer.GetLobbyPlayer(info); // Command? if (ProcessLobbyChatCommands(player, msg)) { LogManager.Chat.Log("Lobby chat command: [" + channelName + "][" + player.name + "] '" + msg + "'"); return; } // Add instance to channel name if (channelName == "Map") { if (player.canUseMapChat) { var instance = player.instance; if (instance == null) { LogManager.Chat.LogError("Player instance is null on [" + channelName + "][" + player.name + "] '" + msg + "'"); return; } var postfix = instance.node.publicAddress + ":" + instance.port; channelName += "@" + postfix; } else { LogManager.Chat.LogError("Player tries to use map chat while not being in an instance [" + channelName + "][" + player.name + "] '" + msg + "'"); LogManager.Chat.LogError(player.gameInstance.ToString()); return; } } // Log all chat tries LogManager.Chat.Log("[" + channelName + "][" + player.name + "] '" + msg + "'"); // Access level? if (channelName == "Announcement" && player.accessLevel < AccessLevel.CommunityManager) { LogManager.Chat.LogError("Player tried to chat in announcement channel without having the rights for it!"); return; } // Does the channel exist? if (!LobbyChatChannel.channels.ContainsKey(channelName)) { LogManager.Chat.LogError(string.Format("Channel '{0}' does not exist in the global channel list!", channelName)); return; } var channel = LobbyChatChannel.channels[channelName]; // Channel member? if (!channel.members.Contains(player)) { LogManager.Chat.LogError(string.Format("Player '{0}' is not a member of chat channel '{1}'!", player.name, channelName)); return; } // Broadcast message channel.BroadcastMessage(player.name, msg); }
public override void OnLobbyServerSceneLoadedForPlayer(NetworkManager manager, GameObject lobbyPlayer, GameObject gamePlayer) { LobbyPlayer lobby = lobbyPlayer.GetComponent <LobbyPlayer>(); }
public void AddPlayer(LobbyPlayer player) { player.transform.SetParent(playerListContentTransform, false); }
protected virtual UserFormSubmission MakePrompt(LobbyPlayer player) { return(CommonSubmissions.SubmitSingleText(player.UserId)); }
public void RemovePlayer(LobbyPlayer player) { _players.Remove(player); PlayerListModified(); }
void Start() { //setContent Holder Height; content.sizeDelta = new Vector2(0, LobbyManager.s_Singleton.numPlayers * 120); for (int i = 0; i < LobbyManager.s_Singleton.lobbySlots.Length; ++i) { LobbyPlayer p = LobbyManager.s_Singleton.lobbySlots[i] as LobbyPlayer; if (p != null) { //Altezza dello slot del playerResult float spawnY = i * 120; //Nuova posizione dello slot Vector3 pos = new Vector3(0, -spawnY, spawnPoint.position.z); //Spawnato uno slot player GameObject playerSlot = Instantiate(playerResult, pos, spawnPoint.rotation) as GameObject; playerSlot.transform.SetParent(spawnPoint, false); playerSlot.GetComponentsInChildren <Text>()[0].text = i + 1 + "."; playerSlot.transform.GetComponentsInChildren <Image>()[1].sprite = p.imgMiniature.sprite; playerSlot.GetComponentsInChildren <Text>()[1].text = p.txtPlayerName.text; playerSlot.GetComponentsInChildren <Text>()[2].text = p.globalCharacterScore + ""; } } //foreach (LobbyPlayer lp in LobbyManager.s_Singleton.lobbySlots) //{ // if (lp != null) // { // lp.isReady = false; // Debug.Log("messo falso"); // } //} //GameObject lm = GameObject.FindGameObjectWithTag("LobbyManager"); //Debug.Log("lobbyslots trovati: " ); //foreach (GameObject player in lobbyPlayers) //{ // if (!player.GetComponent<NetworkIdentity>().isLocalPlayer) // Debug.Log("ciao vez"); //} // For the host to do: use the timer and control the time. foreach (GameObject go in GameObject.FindGameObjectsWithTag("Player")) { if (go.GetComponent <SwipeDetector>() != null) { go.GetComponent <SwipeDetector>().enabled = false; } if (go.GetComponent <ChubbyTummySwipeDetector>() != null) { go.GetComponent <ChubbyTummySwipeDetector>().enabled = false; } } GameObject toDeleteButton = GameObject.Find("FireButton"); if (toDeleteButton != null) { toDeleteButton.SetActive(false); } toDeleteButton = GameObject.Find("JumpButton"); if (toDeleteButton != null) { toDeleteButton.SetActive(false); } }
/// <summary> /// Get the layer bitmask associated to a specific player. /// Used to filter out things that can only be seen by a given player (such as HUD, ecc.) /// </summary> public static int GetPlayerLayerBitmask(LobbyPlayer player) { return(1 << GetPlayerLayer(player)); }
/// <summary> /// Get the layer associated to a specific player. /// Used to filter out things that can only be seen by a given player (such as HUD, ecc.) /// </summary> public static int GetPlayerLayer(LobbyPlayer player) { return(LayerMask.NameToLayer(string.Format("Player{0}Only", player.player_index + 1))); }
protected virtual UserFormSubmission MakeDrawing(LobbyPlayer player) { return(CommonSubmissions.SubmitSingleDrawing(player.UserId, Drawings[Rand.Next(Drawings.Count)])); }
/// <summary> /// Called whenever a player score changes. /// </summary> private void OnPlayerScore(LobbyPlayer lobby_player) { text_mesh.text = string.Format("{0:0000}", lobby_player.score); }
void Start() { lobbyPlayer = GetComponentInParent <Player>().lobbyPlayer; textMesh = GetComponent <TextMesh>(); }
public void AddPlayer( LobbyPlayer player ) { player.transform.position = new Vector3( 0, 0, 0 ); player.transform.SetParent( playerListContentTransform, false ); }
public void SetLobbyPlayer(LobbyPlayer lp) { lobbyPlayer = lp; LobbyTeam = lp.MyTeam; }
// Remove player public void RemovePlayer(LobbyPlayer player) { playerList.Remove(player); player.queue = null; }
public override void OnStartClient() { base.OnStartClient(); lobbyPlayer = GetComponent <LobbyPlayer>(); }
public override void OnStartLocalPlayer() //2 - if local player { Me = this; CmdPlayerName(Data.PlayerName); }
/// <summary> /// Create our lobby object /// </summary> private void CreateLobbyObject() { LobbyObject = Instantiate(_lobbyPrefab).GetComponent <LobbyPlayer>(); LobbyObject.Init(this); }
protected virtual UserFormSubmission Query(LobbyPlayer player, int numSliders) { return(CommonSubmissions.SubmitSliders(player.UserId, range: true, numSliders: numSliders)); }
public void SetLobbyPlayer(LobbyPlayer player) { _lobbyPlayer = player; }
public void Load(LobbyPlayer player) { PlayerColorImage.color = player.isLocalPlayer ? LocalColor : OtherColor; PlayerNameText.text = player.PlayerName; CheckImage.enabled = player.readyToBegin; }
public LobbyData(LobbyPlayer copyFrom) { Name = copyFrom.name; Color = copyFrom.playerColor; }
protected virtual UserFormSubmission MakeDrawing(LobbyPlayer player) { return(CommonSubmissions.SubmitSingleDrawing(player.UserId)); }
public override void OnLobbyServerSceneLoadedForPlayer(UnityEngine.Networking.NetworkManager manager, GameObject lobbyPlayer, GameObject gamePlayer) { LobbyPlayer I = lobbyPlayer.GetComponent <LobbyPlayer> (); //PlayerBoard playerB = gamePlayer.GetComponent<PlayerBoard> (); }
IEnumerator PositionPlayers(LobbyPlayer instance) { instance.transform.SetParent(lobbyPlayerListPanel, false); yield return(new WaitForEndOfFrame()); }
public static void RegisterNewClient(LobbyPlayer newClient) { newClient.transform.SetParent(_instance.clientsContent, false); }
protected virtual UserFormSubmission Vote(LobbyPlayer player, UserPrompt prompt) { return(CommonSubmissions.SubmitSingleRadio(player.UserId, Rand.Next(prompt.SubPrompts[0].Answers.Length))); }
void ProcessLobbyMessage(LobbyMessage lobbyMessage, IPEndPoint remoteEndPoint) { if (lobbyMessage.requestRoomList) { if (lobby != null && lobby.isMaster && lobbyState == LobbyState.InLobby) { BroadcastLobby(); } } else if (lobbyMessage.startGame && lobbyState == LobbyState.InLobby) { if (lobbyMessage.senderGuid == lobby.master.guid) { StartGame(); NotifyStartGame(); } } else if (lobbyMessage.startGame && lobbyState == LobbyState.InGame && lobby.isMaster) { var targetPlayer = lobby.players.Find(item => item.guid == lobbyMessage.senderGuid); if (targetPlayer != null) { targetPlayer.started = true; } CheckReady(); } else if (lobby != null && lobby.isMaster) // I am the lobby master { if (lobbyMessage.masterGuid != guidStr) { return; } if (lobbyMessage.iWantToJoin) { var targetPlayer = lobby.players.Find(item => item.guid == lobbyMessage.senderGuid); if (targetPlayer == null && lobby.players.Count < MAX_PLAYER_COUNT) { targetPlayer = new LobbyPlayer { guid = lobbyMessage.senderGuid, endPoint = new IPEndPoint(remoteEndPoint.Address, lobbyMessage.myPort), isMaster = false }; lobby.players.Add(targetPlayer); NotifyJoinSuccess(targetPlayer); ThreadSafeLog(string.Format("player on {0} joined.", targetPlayer.endPoint)); } } } else if (lobbyState == LobbyState.NoLobby) // then I'm just a guest player { if (lobbyMessage.iWantToJoin == false) { var targetLobby = lobbyList.Find(item => item.master.guid == lobbyMessage.senderGuid); if (targetLobby == null) { var newLobby = new Lobby { currentCount = lobbyMessage.currentPlayerCount, maxCount = lobbyMessage.maxPlayerCount, isMaster = false, master = new LobbyPlayer { guid = lobbyMessage.senderGuid, endPoint = new IPEndPoint(remoteEndPoint.Address, lobbyMessage.myPort), isMaster = true } }; lobbyList.Add(newLobby); ThreadSafeLog("Found lobby on " + newLobby.master.endPoint.ToString()); if (autoJoin) { RequestJoinLobby(newLobby); } } else if (targetLobby.master.guid == lobbyMessage.senderGuid) { targetLobby.currentCount = lobbyMessage.currentPlayerCount; if (lobbyMessage.joinStatus == 1) { lobby = targetLobby; master = lobby.master; lobbyState = LobbyState.InLobby; ThreadSafeLog("Successfully joined lobby: " + lobby.master.endPoint.ToString()); } } } } }
public void RpcResetUserUI(LobbyPlayer player) { }
public void AddPlayer(LobbyPlayer player) { //if(HomePlayerListTransform.childCount > AwayPlayerListTransform.childCount) // player.transform.SetParent(AwayPlayerListTransform, false); //else player.UI.SetParent(HomePlayerListTransform, false); }
public override void OnStartLocalPlayer() { me = this; CmdSendIdentity(Data.playerName); }
void UpdatePlayers(string playerStr) { players.Clear(); string[] plStr = playerStr.Split(new char[]{'\n'}); int dataSegmentPerPlayer = 3; for (int i = 0; i < plStr.Length / dataSegmentPerPlayer; i++) { LobbyPlayer newPlayer = new LobbyPlayer(); bool parseOk = int.TryParse (plStr[dataSegmentPerPlayer * i], out newPlayer.clientID); if (!parseOk) { Debug.Log ("Couldn't parse ClientID " + plStr[dataSegmentPerPlayer * i]); } if (newPlayer.clientID == localClientID) { newPlayer.isLocalPlayer = true; localPlayerIndex = i; } else { /* NOP */ } newPlayer.name = plStr[dataSegmentPerPlayer * i + 1]; newPlayer.isReady = String2Bool(plStr[dataSegmentPerPlayer * i + 2]); players.Add(newPlayer); } }
// Unity editor calls this to make sure the inputs in the editor are correct void OnValidate() { if (minPlayers < 0) { minPlayers = 0; } if (minPlayers > maxPlayers) { minPlayers = maxPlayers; } if (m_LobbyPlayerPrefab != null) { var uv = m_LobbyPlayerPrefab.GetComponent<NetworkIdentity>(); if (uv == null) { m_LobbyPlayerPrefab = null; Debug.LogWarning("LobbyPlayer prefab must have a NetworkIdentity component."); } } if (m_GamePlayerPrefab != null) { var uv = m_GamePlayerPrefab.GetComponent<NetworkIdentity>(); if (uv == null) { m_GamePlayerPrefab = null; Debug.LogWarning("GamePlayer prefab must have a NetworkIdentity component."); } } }
void Start() { image = GetComponent<Image>(); lobbyPlayer = GetComponentInParent<LobbyPlayer>(); }
// Set artifact tree public static Coroutine SetArtifactTree(LobbyPlayer player, ArtifactTree tree) { return GameDB.instance.StartCoroutine(GameDB.Set<ArtifactTree>( "AccountToArtifactTree", player.accountId, tree, data => { if(data == null) Lobby.RPC("ArtifactTreeSaveError", player.peer); else player.artifactTree = data; } )); }
void Start() { lobbyPlayer = GetComponentInParent<Player>().lobbyPlayer; textMesh = GetComponent<TextMesh>(); }
void Start() { text = GetComponent <Text>(); lobbyPlayer = GetComponentInParent <LobbyPlayer>(); }
void Start() { text = GetComponent<Text>(); lobbyPlayer = GetComponentInParent<LobbyPlayer>(); }
private void Lobby_MemberJoined(object sender, MemberEventArgs e) { Dispatcher.Invoke(() => { var invitee = e.Member as LobbyInvitee; var member = e.Member as CustomLobbyMember; if (member != null) { StackPanel stack; if (member.Team == 0) stack = BlueTeam; else if (member.Team == 1) stack = RedTeam; else throw new Exception("UNEXPECTED TEAM"); var player = new LobbyPlayer(member); stack.Children.Add(player); if (e.Member.IsMe) { RedJoin.Visibility = BlueJoin.Visibility = Visibility.Collapsed; if (member.Team != 0) BlueJoin.Visibility = Visibility.Visible; if (member.Team != 1) RedJoin.Visibility = Visibility.Visible; } Sort(); } else { var player = new InvitedPlayer(invitee); InviteList.Children.Add(player); } }); }