void Awake() { instance = this; startPanel = transform.Find("PanelStart").GetComponent <StartPanel>(); newGamePanel = transform.Find("PanelNewGame").GetComponent <NewGamePanel>(); joinGamePanel = transform.Find("PanelJoinGame").GetComponent <JoinGamePanel>(); settingPanel = transform.Find("PanelSetting").GetComponent <SettingPanel>(); exitPanel = transform.Find("PanelExit").GetComponent <ExitPanel>(); messagePanel = transform.Find("PanelMessage").GetComponent <MessagePanel>(); playerInfoPanel = transform.Find("PanelPlayerInfo").GetComponent <PlayerInfoPanel>(); teamPanel = transform.Find("PanelTeam").GetComponent <TeamPanel>(); shopPanel = transform.Find("PanelShop"); curHangingText = transform.Find("CurHanging").GetComponent <Text>(); curInGamingText = transform.Find("CurInGaming").GetComponent <Text>(); }
public static void CreateOrUpdateJoinGameButton() { _logger.Info("Creating join game button..."); UIPanel uiView = UIView.GetAView()?.FindUIComponent("Menu") as UIPanel; if (uiView == null) { return; } UIButton joinGameButton = UIView.GetAView().FindUIComponent("JoinGame") as UIButton; // Create the button if it does not exist and assign // the click event. if (joinGameButton == null) { joinGameButton = (UIButton)uiView.AddUIComponent(typeof(UIButton)); joinGameButton.eventClick += (s, e) => { JoinGamePanel panel = UIView.GetAView().FindUIComponent <JoinGamePanel>("MPJoinGamePanel"); if (panel != null) { panel.isVisible = true; panel.Focus(); } else { JoinGamePanel joinGamePanel = (JoinGamePanel)UIView.GetAView().AddUIComponent(typeof(JoinGamePanel)); joinGamePanel.Focus(); } }; } joinGameButton.name = "JoinGame"; joinGameButton.text = "JOIN GAME"; joinGameButton.width = 411; joinGameButton.height = 56; joinGameButton.textHorizontalAlignment = UIHorizontalAlignment.Center; joinGameButton.focusedColor = new Color32(254, 254, 254, 255); joinGameButton.focusedTextColor = new Color32(255, 255, 255, 255); joinGameButton.hoveredColor = new Color32(94, 195, 255, 255); joinGameButton.hoveredFgSprite = "MenuPanelInfo"; joinGameButton.hoveredTextColor = new Color32(7, 123, 255, 255); joinGameButton.bottomColor = new Color32(163, 226, 254, 255); joinGameButton.textColor = new Color32(254, 254, 254, 255); joinGameButton.textScale = 1.5f; joinGameButton.pressedColor = new Color32(185, 221, 254, 255); joinGameButton.pressedFgSprite = "MenuPanelInfo"; joinGameButton.pressedTextColor = new Color32(30, 30, 44, 255); joinGameButton.useDropShadow = true; joinGameButton.useGradient = true; joinGameButton.useGUILayout = true; joinGameButton.dropShadowOffset = new Vector2(0, -1.33f); }