IEnumerator CleanExpiredGame() { while (true) { // Bool used to check if a game has been removed bool expiredGameRemoved = false; // Get all games discovered var keys = new List <CustomNetworkManager.GameInfo>(activeGames.Keys); foreach (var key in keys) { // Check if the game has expired if (activeGames[key] <= Time.time) { activeGames.Remove(key); expiredGameRemoved = true; } } LobbyMenu lobby = FindObjectOfType <LobbyMenu>(); // Update the lobby game list if at least one as been removed if (expiredGameRemoved && lobby != null) { lobby.UpdateGameList(); } yield return(new WaitForSeconds(activeGamesTimeOut)); } }
public void Init(NetworkPlayer networkPlayer) { if (_lobbyMenu == null) { _lobbyMenu = LobbyMenu.Instance; } _networkPlayer = networkPlayer; PlayerNameTxt.text = playerName; _networkPlayer.syncVarsChanged += OnNetworkPlayerSyncvarChanged; UpdateButton(networkPlayer); if (_networkPlayer.GetPlayerSymbol() == Symbol.CIRCLE) { Debug.Log("Circle"); SymbolImage.GetComponent <Image>().sprite = CircleSprite; } else { Debug.Log("Cross"); SymbolImage.GetComponent <Image>().sprite = CrossSprite; } if (_networkPlayer.hasAuthority) { SetUpLocalPlayer(); } else { SetUpOtherPlayers(); } }
// Use this for initialization void Start() { DontDestroyOnLoad(this.gameObject); playersConnected = new bool[4]; Instance = this; //if a controllers deadzone is not proper, use dpad instead for (int i = 0; i < 4; i++) //max 4 players { if (InputManager.GetAxis("Horizontal", (PlayerID)i) != 0 || InputManager.GetAxis("Vertical", (PlayerID)i) != 0) { ChangeAxis((PlayerID)i); } } menuOptions = new MenuOptions(); //load previews for level select levels = new Sprite[amountOfLevels]; for (int i = 0; i < levels.Length; i++) { levels[i] = Resources.Load <Sprite>("Menu/Level" + (i + 1) + "Icon"); } SetButtonText(); //after full initialization }
public LobbyMenuWrapper() { lobbyMenu = App.LobbyMenu; oldMousePosition = Input.mousePosition; fadeOutSceneMethodInfo = lobbyMenu.GetType ().GetMethod ("fadeOutScene", BindingFlags.NonPublic | BindingFlags.Instance); CreateGUISkins (); }
public GameClient() { LobbyMenu = new LobbyMenu(this); ServerInfo = new ClientsideServerInfo(); tcpClient = new TcpClient(); Character = new PlayerCharacter(); Character.Randomize(); }
public void Initialize(PlayerLobbySlot slot, LobbyMenu menu) { m_slot = slot; m_menu = menu; m_menu.SetSlotTeam(m_slot, m_team); m_slot.SetPlayerName(m_playerName); m_slot.SetReadyMarkerTexture(m_ready); }
public static Node LobbyMenu() { Node menuInstance = Session.Instance("res://Scenes/Prefabs/Menus/LobbyMenu.tscn"); LobbyMenu menu = (LobbyMenu)menuInstance; Session.session.AddChild(menu); menu.Init(); return(menuInstance); }
void Awake() { if (instance != null) { Destroy(gameObject); } else { instance = this; } }
// Update is called once per frame void Update() { if (lobby == null && lobbyPlayer.activeSelf) { lobby = FindObjectOfType <LobbyMenu>(); } if (!connectionToLobbyUI && lobby != null) { lobby.OnPlayerConnect(this); connectionToLobbyUI = true; } }
void Awake() { if (instance != null && instance != this) { Destroy(this); } else { instance = this; lobbyMenu = FindObjectOfType <LobbyMenu>(); DontDestroyOnLoad(gameObject); } }
public void Init() { gameManager = CoreTools.GetManager <GameManager>(); pool = CoreTools.GetManager <RegulatoryPools>(); timerManager = CoreTools.GetManager <TimerManager>(); inputManager = CoreTools.GetManager <InputManager>(); FindCamera(); DefiningScreenBoundaries(); AddEventSystem(); CreatePools(); state = GameState.Start; gameCanvas = GameObject.Instantiate(gameManager.GameCanvasPrefab); gameUi = gameCanvas.GetComponent <GameUI>(); gameUi.Init(); gameCanvas.SetActive(false); lobbyCanvas = GameObject.Instantiate(gameManager.LobbyCanvasPrefab); lobbyMenu = lobbyCanvas.GetComponent <LobbyMenu>(); lobbyMenu.Init(); lobbyCanvas.SetActive(false); SetInput(inputManager.CurrentType); inputManager.GetInput().SetActive(false); gameManager.sceneRightEdge = sceneRightEdge; gameManager.sceneLeftEdge = sceneLeftEdge; gameManager.sceneTopEdge = sceneTopEdge; gameManager.sceneBottomEdge = sceneBottomEdge; gameManager.sceneWidth = sceneWidth; gameManager.sceneHeight = sceneHeight; startAsteroidCount = gameManager.StartAsteroidsCount; player = GameObject.Instantiate(gameManager.PlayerPrefab); ship = player.GetComponent <Ship>(); ship.Init(); player.SetActive(false); Ufo = GameObject.Instantiate(gameManager.UfoPrefab); ufo = Ufo.GetComponent <UFO>(); ufo.Init(); Ufo.SetActive(false); EnteringGameMenu(); }
public static Node LobbyMenu() { PackedScene menu_ps = (PackedScene)GD.Load("res://Scenes/Prefabs/Menus/LobbyMenu.tscn"); Node menu_instance = menu_ps.Instance(); LobbyMenu menu = (LobbyMenu)menu_instance; menu.SetMainMenuButton((Godot.Button)Button(text: "MainMenu", onClick: menu.ReturnToMainMenu)); menu.SetSendButton((Godot.Button)Button(text: "Send", onClick: menu.Send)); menu.SetJoinButton((Godot.Button)Button(text: "Join", onClick: menu.Join)); menu.SetHostButton((Godot.Button)Button(text: "Host", onClick: menu.Host)); menu.SetComposeBox((Godot.TextEdit)TextBox()); menu.SetMessageBox((Godot.TextEdit)TextBox()); menu.SetAddressBox((Godot.TextEdit)TextBox(Session.DefaultServerAddress)); menu.SetNameBox((Godot.TextEdit)TextBox("PlayerName")); return(menu_instance); }
// Use this for initialization void Start() { /* * if (!TNManager.isConnected || !TNManager.isInChannel) * { * OnNetworkLeaveChannel(); * return; * } */ for (int lcv = 0; lcv < Teams.Count(); lcv++) { Teams[lcv].TeamId = lcv; } myLobbyMenu = TeamPanel.GetComponent <LobbyMenu>(); TeamPanel.SetActive(false); MenuPanel.SetActive(true); // spawnPoints = GameObject.FindObjectsOfType<SpawnPoint>(); }
// Use this for initialization void Start() { lobbyManager = GameObject.Find("Lobby").GetComponent <MyNetworkLobbyManager>(); MyNetworkLobbyManager.networkLobbyManagerInstance = lobbyManager; lobbyManager.showLobbyGUI = true; lobbyPlayerList = GameObject.Find("LobbyPlayerList"); menu = transform.FindChild("LobbyUI").GetComponent <LobbyMenu>(); startButton = GameObject.Find("StartButton"); lobbyManager.showLobbyUI = true; if (ServerInfo.hosting) { lobbyManager.StartHost(); } else { lobbyManager.networkAddress = ServerInfo.ip; client = lobbyManager.StartClient(); } }
// Use this for initialization void Start () { lobbyManager = GameObject.Find("Lobby").GetComponent<MyNetworkLobbyManager>(); MyNetworkLobbyManager.networkLobbyManagerInstance = lobbyManager; lobbyManager.showLobbyGUI = true; lobbyPlayerList = GameObject.Find("LobbyPlayerList"); menu = transform.FindChild("LobbyUI").GetComponent<LobbyMenu>(); startButton = GameObject.Find("StartButton"); lobbyManager.showLobbyUI = true; if (ServerInfo.hosting) { lobbyManager.StartHost(); } else { lobbyManager.networkAddress = ServerInfo.ip; client = lobbyManager.StartClient(); } }
public override void Draw(GameTime gameTime) { var offset = new Vector2(30, 30); Game.SpriteBatch.Begin(); Game.SpriteBatch.DrawString(LobbyNameFont, Lobby.Name, offset, Color.Black); Game.SpriteBatch.DrawString(PlayersCountFont, PlayersCount, new Vector2(Game.Window.ClientBounds.Width - PlayersCountFont.MeasureString(PlayersCount).X - offset.X, offset.Y), Color.Black); var posY = offset.Y + Game.Window.ClientBounds.Height * 0.15f; foreach (var playerName in Lobby.Players.Select(player => player.Name)) { var playerStrSize = PlayersNamesFont.MeasureString(playerName); Game.SpriteBatch.DrawString(PlayersNamesFont, playerName, new Vector2(Game.Window.ClientBounds.Width / 2 - playerStrSize.X / 2, posY), Color.Black); posY += playerStrSize.Y * 1.3f; } Game.SpriteBatch.End(); LobbyMenu.Draw(gameTime); }
void ShowStartMenu(bool isMultiplayer) { Debug.Log("Show"); LobbyMenu.Show(isMultiplayer); }
private void Start() { menu = gameObject.GetComponent <LobbyMenu>(); }
public static Node MenuFactory(Menus menu) { Node ret = null; switch (menu) { case Menus.None: Sound.PauseSong(); return(null); break; case Menus.HUD: ret = new HUDMenu(); ret.Name = "Pause"; break; case Menus.Pause: ret = new PauseMenu(); ret.Name = "Pause"; break; case Menus.Main: ret = new MainMenu(); ret.Name = "Main"; break; case Menus.Local: ret = new LocalMenu(); ret.Name = "Local"; break; case Menus.Online: ret = new OnlineMenu(); ret.Name = "Online"; break; case Menus.Lobby: ret = new LobbyMenu(); ret.Name = "Lobby"; break; case Menus.Inventory: ret = new InventoryMenu(); ret.Name = "Inventory"; break; case Menus.Settings: ret = new SettingsMenu(); ret.Name = "Settings"; break; case Menus.LoadAdventure: ret = new LoadAdventureMenu(); ret.Name = "LoadAdventure"; break; } Session.session.AddChild(ret); IMenu menuInstance = ret as IMenu; if (menuInstance != null) { menuInstance.Init(0, 0, 0, 0); // Assuiming these are not subMenus } return(ret); }
public void EnterLobbyMenu() { currentGameState = GameState.Lobby; lobby_menu = new LobbyMenu(this, "Alice's Lobby"); }
private void Start() { _lobbyMenu = LobbyMenu.Instance; ReadyButton.GetComponent <Image>().color = Color.red; }
public override void AfterInvoke(InvocationInfo info, ref object returnValue) { //if (info.target is EndGameScreen && info.targetMethod.Equals("GoToLobby")) { ntwrk.inbattle = false; } // user leaved a battle if (info.target is ChatUI && info.targetMethod.Equals("Show")) { helpf.chatisshown = (bool)info.arguments[0]; this.screenh = 0; } // so position will be calculatet new on next ongui if (info.target is ChatUI && info.targetMethod.Equals("Initiate")) { helpf.target = (ChatUI)info.target; helpf.setchatlogstyle((GUIStyle)this.chatLogStyleinfo.GetValue(info.target)); } if (info.target is TradeSystem && info.targetMethod.Equals("StartTrade"))// user start a trade, show the buy-message { if (helpf.postmsgontrading == true) { helpf.postmsgontrading = false; helpf.postmsggetnextroomenter = true;// the next RoomEnterMsg is the tradeRoom! } } if (info.target is Store && info.targetMethod.Equals("Start"))//user opened store { helpf.setlobbyskin((GUISkin)typeof(Store).GetField("lobbySkin", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(info.target)); helpf.storeinfo = (Store)info.target; helpf.showtradedialog = false; helpf.inauchouse = false; helpf.generator = false; helpf.settings = false; } if (info.target is ChatRooms && info.targetMethod.Equals("SetRoomInfo")) //adding new users to userlist { RoomInfoMessage roomInfo = (RoomInfoMessage)info.arguments[0]; RoomInfoProfile[] profiles = roomInfo.updated; for (int i = 0; i < profiles.Length; i++) { RoomInfoProfile p = profiles[i]; ChatUser user = ChatUser.FromRoomInfoProfile(p); if (!helpf.globalusers.ContainsKey(user.name)) { helpf.globalusers.Add(user.name, user); } ; } } if (info.target is Store && info.targetMethod.Equals("OnGUI")) // drawing our buttons and stuff in store { GUI.color = Color.white; GUI.contentColor = Color.white; drawsubmenu.Invoke(info.target, null); Vector2 screenMousePos = GUIUtil.getScreenMousePos(); if (!(Screen.height == screenh) || !(Screen.width == screenw) || helpf.chatLogStyle == null) // if resolution was changed, recalc positions { Console.WriteLine("change resolution"); screenh = Screen.height; screenw = Screen.width; helpf.chatLogStyle = (GUIStyle)chatLogStyleinfo.GetValue(helpf.target); recto.setupPositions(helpf.chatisshown, sttngs.rowscale, helpf.chatLogStyle, helpf.cardListPopupSkin); // need it to calc fieldhight even if bothmenue=true if ((helpf.bothmenue || (helpf.createAuctionMenu && !helpf.offerMenuSelectCardMenu)) && !helpf.generator) { recto.setupPositionsboth(helpf.chatisshown, sttngs.rowscale, helpf.chatLogStyle, helpf.cardListPopupSkin); } recto.setupsettingpositions(helpf.chatLogStyle, helpf.cardListPopupBigLabelSkin); } // delete picture on click! if ((Input.GetMouseButtonUp(0) || Input.GetMouseButtonUp(1)) && crdvwr.clicked >= 3) { crdvwr.clearallpics(); } //klick button AH //Console.WriteLine("draw buttons"); if (LobbyMenu.drawButton(recto.ahbutton, "AH", helpf.lobbySkin) && !helpf.showtradedialog) { if (this.deckchanged) { App.Communicator.sendRequest(new LibraryViewMessage()); this.deckchanged = false; } if (helpf.bothmenue || helpf.createAuctionMenu) { recto.setupPositionsboth(helpf.chatisshown, sttngs.rowscale, helpf.chatLogStyle, helpf.cardListPopupSkin); } else { recto.setupPositions(helpf.chatisshown, sttngs.rowscale, helpf.chatLogStyle, helpf.cardListPopupSkin); } ahui.ahbuttonpressed(); } // klick button Gen if (LobbyMenu.drawButton(recto.genbutton, "Gen", helpf.lobbySkin) && !helpf.showtradedialog) { if (this.deckchanged) { App.Communicator.sendRequest(new LibraryViewMessage()); this.deckchanged = false; } recto.setupPositions(helpf.chatisshown, sttngs.rowscale, helpf.chatLogStyle, helpf.cardListPopupSkin); genui.genbuttonpressed(); } //klick settings-button if (LobbyMenu.drawButton(recto.settingsbutton, "Settings", helpf.lobbySkin) && !helpf.showtradedialog) { recto.setupsettingpositions(helpf.chatLogStyle, helpf.cardListPopupBigLabelSkin); setui.setbuttonpressed(); } // draw ah oder gen-menu if (helpf.inauchouse) { ahui.drawAH(); } if (helpf.generator) { genui.drawgenerator(); } if (helpf.settings) { setui.drawsettings(); } GUI.color = Color.white; GUI.contentColor = Color.white; crdvwr.draw(); // drawing the card you have clicked } else if (info.target is Store && (info.targetMethod.Equals("showBuyMenu") || info.targetMethod.Equals("showSellMenu"))) { //disable auc.house + generator Store.ENABLE_SHARD_PURCHASES = true; helpf.inauchouse = false; helpf.generator = false; helpf.settings = false; helpf.showtradedialog = false; helpf.makeOfferMenu = false; helpf.offerMenuSelectCardMenu = false; helpf.showtradedialog = false; if (info.targetMethod.Equals("showSellMenu")) { this.deckchanged = false; } } if (info.target is ChatRooms && info.targetMethod.Equals("ChatMessage")) { //get trademessages from chatmessages RoomChatMessageMessage msg = (RoomChatMessageMessage)info.arguments[0]; if (msg.from != "Scrolls") { AuctionHouse.Instance.addAuctions(mssgprsr.GetAuctionsFromMessage(msg.text, msg.from, msg.roomName)); } } return; }
private void Start() { lm = GameObject.Find("NetworkManager").GetComponent <LobbyMenu>(); }
// Toggle visibility of lobby menu private void ToggleLobbyMenu() { TitleText.gameObject.SetActive(LobbyMenu.activeSelf); LobbyMenu.SetActive(!LobbyMenu.activeSelf); }
public override void Update(GameTime gameTime) { LobbyMenu.Update(gameTime); }