protected override void ProcessPlayerTurnEvents() { var player = (Mech)Player; player.ProcessTick(); WallWalk = false; if (CheckMissionCompletion()) { MessagePanel.Add("Mission Success"); MessagePanel.Add("Press [[Enter]] to continue"); Game.StateHandler.PushState(new MissionEndState(true)); Game.Year++; Game.Scrap += NextMission.RewardScrap; if (Game.NextMission.RewardPart != null) { Game.AvailParts.Add(Game.NextMission.RewardPart); } Difficulty++; NextMission = GenerateMission(); } }
protected override void Handle(ConnectionResultCommand command) { // We only want this message while connecting if (MultiplayerManager.Instance.CurrentClient.Status != ClientStatus.Connecting) { return; } // If we are allowed to connect if (command.Success) { // Log and set that we are connected. Log.Info("Successfully connected to server. Downloading world..."); MultiplayerManager.Instance.CurrentClient.ClientPlayer = new Player(); MultiplayerManager.Instance.CurrentClient.Status = ClientStatus.Downloading; MultiplayerManager.Instance.CurrentClient.ClientId = command.ClientId; } else { Log.Info($"Could not connect: {command.Reason}"); MultiplayerManager.Instance.CurrentClient.ConnectionMessage = command.Reason; MultiplayerManager.Instance.CurrentClient.Disconnect(); if (command.Reason.Contains("DLC")) // No other way to detect if we should display the box { DLCHelper.DLCComparison compare = DLCHelper.Compare(command.DLCBitMask, DLCHelper.GetOwnedDLCs()); ThreadHelper.dispatcher.Dispatch(() => { MessagePanel panel = PanelManager.ShowPanel <MessagePanel>(); panel.DisplayDlcMessage(compare); }); } } }
public override void Render() { Terminal.Clear(); StateHandler.Draw(); AnimationHandler.Draw(_mapLayer); bool inMission = StateHandler.Peek().Match( some: state => !(state is MenuState) && !(state is IntermissionFrameState), none: () => false); if (inMission) { InfoPanel.Draw(_infoLayer); RadarPanel.Draw(_radarLayer); ObjectivePanel.Draw(_objectiveLayer); MessagePanel.Draw(_messageLayer); foreach (KeyValuePair <ISchedulable, int> kvp in EventScheduler._schedule) { if (kvp.Key is DelayAttack da) { da.Draw(_mapLayer); } } } Terminal.Refresh(); }
private void Signin_Click(object sender, EventArgs e) { SigninPanel.Show(); AvailablePanel.Hide(); RequestPanel.Hide(); MessagePanel.Hide(); }
public void SetMessagePanel(MessagePanel mp) { if (messagePanel == null) { messagePanel = mp; } }
private void ExecuteLoginButtonClicked() { //:执行登录操作 Debug.Log("输入的用户名" + usernameInputField.text); Debug.Log("输入的密码" + passwordInputField.text); //前端校验-这里只用进行判断为空的校验,在注册的时候才进行格式,长度等校验 string emailRegex = @"^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$"; if (Regex.IsMatch(usernameInputField.text, emailRegex)) { if (passwordInputField.text != null && passwordInputField.text != "") { //通过loginRequest对象发送请求 _loginRequestObj.SendRequest(usernameInputField.text, passwordInputField.text); } else { MessagePanel msgPanel = GameFacade.Instance.UiManager.PushPanel(PanelType.Message) as MessagePanel; msgPanel.ShowTipsMsg("密码不能为空"); } } else { MessagePanel msgPanel = GameFacade.Instance.UiManager.PushPanel(PanelType.Message) as MessagePanel; msgPanel.ShowTipsMsg("邮箱格式不正确"); } }
/// <summary> /// 创建对象完成 /// </summary> /// <param name="go"></param> private void OnCreateOK(GameObject go) { gameObj = go; panel = go.AddComponent <MessagePanel>(); panel.btnButton.onClick.AddListener(OnCloseButton); Debug.LogWarning("OnCreateOK---->>>>" + go.name); }
public override void OnLevelLoaded(LoadMode mode) { base.OnLevelLoaded(mode); ResetData(); if (MultiplayerManager.Instance.CurrentRole == MultiplayerRole.Client) { MultiplayerManager.Instance.CurrentClient.Status = ClientStatus.Connected; Command.SendToServer(new ClientLevelLoadedCommand()); } // Add the chat log UIView.GetAView().AddUIComponent(typeof(ChatLogPanel)); // Setup Pause menu. PauseMenuHandler.CreateOrUpdateMultiplayerButton(); // Show release notes if not shown for this version Version version = Assembly.GetAssembly(typeof(CSM)).GetName().Version; string strVersion = $"{version.Major}.{version.Minor}"; if (string.Compare(strVersion, CSM.Settings.LastSeenReleaseNotes) > 0) { MessagePanel panel = PanelManager.ShowPanel <MessagePanel>(); panel.DisplayReleaseNotes(); CSM.Settings.LastSeenReleaseNotes.value = strVersion; } }
/// <summary> /// 执行登录按钮点击事件 /// </summary> private void ExecuteRegisterButtonClicked() { //按钮音效 GameFacade.Instance.AudioManager.PlaySound(AudioType.ButtonClicked); //:前端校验 if (usernameInputField.text != "" && passwordInputField.text != "" && repeatPasswordInputField.text != "") { if (passwordInputField.text == repeatPasswordInputField.text) { // :发送注册请求 _registerRequest.SendRequest(usernameInputField.text, passwordInputField.text); } else { MessagePanel msgPanel = GameFacade.Instance.UiManager.PushPanel(PanelType.Message) as MessagePanel; msgPanel.ShowTipsMsg("两次密码不同"); } } else { MessagePanel msgPanel = GameFacade.Instance.UiManager.PushPanel(PanelType.Message) as MessagePanel; msgPanel.ShowTipsMsg("下面3项都不为空"); return; } }
private void OnSelectBattel(object sender, TypeBattelEnum typeBattel) { if (user.Decks.Count == 0) { MessagePanel.SimpleMessage(transform, "no_decks"); return; } user.CurrentTypeBattel = typeBattel; BaseBattel battel = null; switch (typeBattel) { case TypeBattelEnum.training: battel = trainingFactory.Create(); break; case TypeBattelEnum.common: break; case TypeBattelEnum.rating: break; default: break; } battel.ReturnBack += Battel_ReturnBack; returnButton.SetActive(false); Disable(); }
/// <summary> /// 前端校验,来确定格式对不对 /// </summary> /// <returns></returns> private bool FormatVerifty() { if (password_InputField.text == "" || password_InputField == null) { MessagePanel msgPanel = GameFacade.Instance.UiManager.PushPanel(PanelType.Message) as MessagePanel; msgPanel.ShowTipsMsg("密码不能为空"); return(false); } if (!password_InputField.text.Equals(repeatePassword_InputField.text)) { MessagePanel msgPanel = GameFacade.Instance.UiManager.PushPanel(PanelType.Message) as MessagePanel; msgPanel.ShowTipsMsg("两次密码不同"); return(false); } if (password_InputField.text.Contains("#")) { MessagePanel msgPanel = GameFacade.Instance.UiManager.PushPanel(PanelType.Message) as MessagePanel; msgPanel.ShowTipsMsg("密码中不能包含特殊字符"); return(false); } if (idCard_InputField.text == null || idCard_InputField.text == "" || idCard_InputField.text.Length < 18) { MessagePanel msgPanel = GameFacade.Instance.UiManager.PushPanel(PanelType.Message) as MessagePanel; msgPanel.ShowTipsMsg("身份证格式不对"); return(false); } return(true); }
// Update is called once per frame private void Update() { if (!MapOptions.MadeChoise && !Game.devMode) { return; } //starts loading thread if (game == null)// && Input.GetKeyUp(KeyCode.Backspace)) { LoadGame(); } else #if UNITY_WEBGL if (!gameLoadingIsFinished) // non multi-threading #else if (game.IsDone && !gameLoadingIsFinished) #endif { OnGameLoaded(); } #if !UNITY_WEBGL else // multi-threading { loadingPanel.updateStatus(game.getStatus()); } #endif if (gameLoadingIsFinished) { UpdateMapTooltip(); if (World.Get.IsRunning && !MessagePanel.IsOpenAny()) { if (Game.isPlayerSurrended() || !Game.Player.IsAlive || Time.time - previousFrameTime >= simulationSpeedLimit) { World.simulate(); //Unit.RedrawAll(); previousFrameTime = Time.time; //refreshAllActive(); UIEvents.RiseSomethingVisibleToPlayerChangedInWorld(EventArgs.Empty, this); } } if (Game.provincesToRedrawArmies.Count > 0) { Unit.RedrawAll(); } if (Input.GetKeyDown(KeyCode.Return)) // enter key { CloseToppestPanel(); } DrawFogOfWar(); //if (Message.HasUnshownMessages()) // MessagePanel.Instance.ShowMessageBox(LinksManager.Get.CameraLayerCanvas, this); } }
private void logout_Click_1(object sender, EventArgs e) { MessagePanel.Hide(); SigninPanel.Hide(); RequestPanel.Hide(); AvailablePanel.Hide(); StartPanel.Show(); }
public static void NewMission(MissionInfo info) { MessagePanel.Clear(); AnimationHandler.Clear(); SetupLevel(info); StateHandler.PushState(NormalState.Instance); }
public void ReplaceMessagePanel(MessagePanel newValue) { var index = GameComponentsLookup.MessagePanel; var component = (MessagePanelComponent)CreateComponent(index, typeof(MessagePanelComponent)); component.value = newValue; ReplaceComponent(index, component); }
public void InternalSafeAppend(object obj) { string response = obj.ToString(); if (response.Length > 0) { string type = response.Substring(0, 1); string message = response.Substring(2); int messageMaxWidth = this.Width - 50; MessagePanel msgPanel = new MessagePanel(messageMaxWidth); msgPanel.MouseEnter += msgPanel_MouseEnter; msgPanel.MouseLeave += msgPanel_MouseLeave; switch (type) { case "u": msgPanel.Message(message + " joined the chat"); plOutput.Controls.Add(msgPanel); plOutput.SetFlowBreak(msgPanel, true); scrolldown(); txtMessage.Text = null; break; case "m": int pos = message.IndexOf(':'); string username = message.Substring(0, pos); Color userColor; if (_userColors.ContainsKey(username)) { userColor = _userColors[username]; } else { Random rnd = new Random(); int num = rnd.Next(_colors.Count); userColor = _colors[num]; _userColors[username] = userColor; } message = message.Substring(pos + 1, message.Length - username.Length - 1); msgPanel.Username(username, userColor); msgPanel.Message(message); plOutput.Controls.Add(msgPanel); plOutput.SetFlowBreak(msgPanel, true); scrolldown(); txtMessage.Text = null; break; } } }
//显示提示文字 public void ShowMessage(string msg) { MessagePanel msgPanel = GetPanel(UIPanelType.Message) as MessagePanel; if (msgPanel != null) { msgPanel.ShowMessage(msg); } }
private void CreateUI() { // Pause button this.b_pause = new Button() { IsBorder = false, Text = string.Empty, BackgroundImage = WaveContent.Assets.Textures.pause_bt_PNG, PressedBackgroundImage = WaveContent.Assets.Textures.pause_bt_pressed_PNG, HorizontalAlignment = HorizontalAlignment.Right, VerticalAlignment = VerticalAlignment.Top, Margin = new Thickness(0, WaveServices.ViewportManager.TopEdge + 10, 10, 0), }; this.b_pause.Click += (s, o) => { SoundsManager.Instance.PlaySound(SoundsManager.SOUNDS.Button); WaveServices.ScreenContextManager.Push(new ScreenContext(new PauseScene(this))); }; EntityManager.Add(this.b_pause); // Ready! Go! Timeout! this.messagePanel = new MessagePanel(MessagePanel.MessageType.HurryUp) { HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, }; EntityManager.Add(this.messagePanel); // Stadistics this.stadisticsPanel = new StadisticsPanel() { HorizontalAlignment = HorizontalAlignment.Center, Margin = new Thickness(0, WaveServices.ViewportManager.TopEdge, 0, 0), }; EntityManager.Add(this.stadisticsPanel); // HighScore this.highScorePanel = new HighScorePanel() { HorizontalAlignment = HorizontalAlignment.Right, Margin = new Thickness(0, 100, 0, 0), }; EntityManager.Add(this.highScorePanel); // Combo this.comboPanel = new ComboPanel(new Vector2(WaveServices.ViewportManager.VirtualWidth / 2, WaveServices.ViewportManager.TopEdge + 150)); EntityManager.Add(this.comboPanel); // Scoreboard this.scoreboardPanel = new ScoreboardPanel(this.comboPanel) { HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Top, Margin = new Thickness(0, WaveServices.ViewportManager.TopEdge, 0, 0), }; EntityManager.Add(this.scoreboardPanel); }
//获取MessagePanel界面的引用 public void InjectMsgPanel(MessagePanel msgPanel) { if (msgPanel == null) { Debug.Log("无法显示提示信息,MessagePanel为空"); return; } this.msgPanel = msgPanel; }
// ======================================================================== // Con- / Destructors #region === Con- / Destructors /// <summary> /// Initializes a new instance of <see cref="CoreView"/>. /// </summary> private CoreView() { MainForm = new MainForm(); MessagePanel = new MessagePanel(); OptionsPanel = new OptionsPanel(); TestCasesPanel = new TestCasesPanel(); TestCasesPanel.SelectedTestCaseChanged += (sender, args) => OnPropertyChanged("SelectedTestCase"); }
internal static void GameOver() { if (!_dead) { _dead = true; MessagePanel.Add("[color=err]System shutting down[/color]"); MessagePanel.Add("Mission Failed. Press [[Enter]] to continue"); Game.StateHandler.PushState(new MissionEndState(false)); } }
public void HideMessage() { if (!messagePanel) { messagePanel = GetPanel <MessagePanel>(UINames.messagePanel); } if (messagePanel) { messagePanel.OnExit(); } }
void msgPanel_MouseLeave(object sender, EventArgs e) { MessagePanel panel = (MessagePanel)sender; int index = plOutput.Controls.GetChildIndex(panel); if (plOutput.Controls.Count > (index + 1)) { string text = plOutput.Controls[index + 1].Text; plOutput.Controls[index + 1].Text = new String(' ', 1000) + text; } }
/// <summary> /// Reanders a panel with text. /// </summary> /// <param name="text">The text to be rendered in the panel.</param> /// <param name="options">The options that determines how the panel is rendered.</param> public virtual void ShowPanel(string text, MessagePanelOptions options) { MessagePanel messagePanel = new MessagePanel { Text = text, Options = options }; Console.WriteLine(); messagePanel.Show(); }
public void ShowMessageSync(string msg) { MessagePanel msgPanel = GetComponentByType(UIPanelType.Message) as MessagePanel; if (msgPanel == null) { Debug.LogError("ShowMessage is Called But msgPanel == null"); return; } msgPanel.ShowMessageSync(msg); }
void msgPanel_MouseEnter(object sender, EventArgs e) { MessagePanel panel = (MessagePanel)sender; int index = plOutput.Controls.GetChildIndex(panel); if (plOutput.Controls.Count > (index + 1)) { string text = plOutput.Controls[index + 1].Text; plOutput.Controls[index + 1].Text = text.Trim(); } }
void CreateMessagePanel(string sender, string message) { GameObject chatMessagePanelClone = Instantiate(chatMessagePanel) as GameObject; //Set the parent of the message panel to the chat panel that acts as the content panel //for chat chatMessagePanelClone.transform.SetParent(this.gameObject.transform, false); MessagePanel messagePanel = chatMessagePanelClone.GetComponent <MessagePanel>(); messagePanel.SetupWithSenderAndText(sender, message); }
private void Awake() { usernameIF = transform.Find("UserNameLabel/UserNameInput").GetComponent <InputField>(); passwordIF = transform.Find("PasswordLabel/PasswordInput").GetComponent <InputField>(); msgPanel = transform.Find("MessagePanel").GetComponent <MessagePanel>(); transform.Find("LoginButton").GetComponent <Button>().onClick.AddListener(OnLoginClick); transform.DOScale(0, 0.0f);//播放渐变 gameObject.SetActive(false); }
static Game() { // main UI elements _statLayer = new LayerInfo("Stats", 1, Constants.SIDEBAR_WIDTH + 2, 1, Constants.MAPVIEW_WIDTH, Constants.STATUS_HEIGHT); _mapLayer = new LayerInfo("Map", 1, Constants.SIDEBAR_WIDTH + 2, Constants.STATUS_HEIGHT + 1, Constants.MAPVIEW_WIDTH, Constants.MAPVIEW_HEIGHT); _messageLayer = new LayerInfo("Message", 1, Constants.SIDEBAR_WIDTH + 2, Constants.STATUS_HEIGHT + Constants.MAPVIEW_HEIGHT + 2, Constants.MAPVIEW_WIDTH, Constants.MESSAGE_HEIGHT); // left panel for look and info _leftLayer = new LayerInfo("Look", 1, 1, 1, Constants.SIDEBAR_WIDTH, Constants.SCREEN_HEIGHT); // right panel for inventory and equipment _rightLayer = new LayerInfo("Inventory", 1, Constants.SIDEBAR_WIDTH + Constants.MAPVIEW_WIDTH + 3, 1, Constants.SIDEBAR_WIDTH, Constants.SCREEN_HEIGHT); // overlay over map _highlightLayer = new LayerInfo("Highlight", 3, _mapLayer.X, _mapLayer.Y, _mapLayer.Width, _mapLayer.Height); _fullConsole = new LayerInfo("Full", 11, 0, 0, Constants.SCREEN_WIDTH + 2, Constants.SCREEN_HEIGHT + 2); StateHandler = new StateHandler(new Dictionary <Type, LayerInfo> { [typeof(ApplyState)] = _rightLayer, [typeof(AutoexploreState)] = _mapLayer, [typeof(DropState)] = _rightLayer, [typeof(EquipState)] = _rightLayer, [typeof(InventoryState)] = _rightLayer, [typeof(SubinvState)] = _rightLayer, [typeof(ItemMenuState)] = _rightLayer, [typeof(MenuState)] = _fullConsole, [typeof(NormalState)] = _mapLayer, [typeof(TargettingState)] = _mapLayer, [typeof(TextInputState)] = _mapLayer, [typeof(UnequipState)] = _rightLayer }); MessageHandler = new MessagePanel(Constants.MESSAGE_HISTORY_COUNT); EventScheduler = new EventScheduler(16); Overlay = new OverlayHandler(Constants.MAP_WIDTH, Constants.MAP_HEIGHT); Threatened = new OverlayHandler(Constants.MAP_WIDTH, Constants.MAP_HEIGHT); Animations = new AnimationSystem(); }
// Update is called once per frame private void Update() { if (!MapOptions.MadeChoise) { return; } //starts loading thread if (game == null)// && Input.GetKeyUp(KeyCode.Backspace)) { LoadGame(); } else #if UNITY_WEBGL if (!gameLoadingIsFinished) // non multi-threading #else if (game.IsDone && !gameLoadingIsFinished) #endif { OnGameLoaded(); } #if !UNITY_WEBGL else // multi-threading { loadingPanel.updateStatus(game.getStatus()); } #endif if (gameLoadingIsFinished) { UpdateMapTooltip(); if (World.Get.IsRunning && !MessagePanel.IsOpenAny()) { if (Game.isPlayerSurrended() || !Game.Player.isAlive() || Time.time - previousFrameTime >= simulationSpeedLimit) { World.simulate(); //Unit.RedrawAll(); previousFrameTime = Time.time; refreshAllActive(); } } if (Game.provincesToRedrawArmies.Count > 0) { Unit.RedrawAll(); } DrawFogOfWar(); if (Message.HasUnshownMessages()) { MessagePanel.showMessageBox(LinksManager.Get.CameraLayerCanvas, this); } } }
public void LoadNewMessagingPanel() { messagePanel = Instantiate(Resources.Load<GameObject>("Prefabs/MessagePanel")).GetComponent<MessagePanel>(); //Find the main canvas (if more than one) or specific canvas to attach message panel to canvas = (GameObject.Find("Canvas") != null) ? GameObject.Find("Canvas").GetComponent<Canvas>() : CreateCanvas().GetComponent<Canvas>(); canvas.renderMode = RenderMode.ScreenSpaceOverlay; messagePanel.name = "Message Panel - " + this.name; messagePanel.transform.SetParent(canvas.transform, false); //don't forget the second parameter! messagePanel.transform.SetAsLastSibling(); //If the panel has a local scale of (0,0,0) [it happens] and the ui won't display and you'll be confused messagePanel.transform.localScale = Vector3.one; messagePanel.gameObject.SetActive(false); ResizePanel(); }
/** * Initialize */ public override void Start() { if (panel == null) { panel = this; } else if (panel != this) { Destroy(gameObject); } windowState = true; TogglePanel(); buttons = RetrieveButtonList("Buttons"); texts = RetrieveTextList("Texts"); GeneratePanel(); }
/// <summary> /// 创建对象完成 /// </summary> /// <param name="go"></param> private void OnCreateOK(GameObject go) { gameObj = go; panel = go.AddComponent<MessagePanel>(); panel.m_Button.onClick.AddListener(OnCloseButton); string str; switch(Message){ case 1: str = "这是个好玩的游戏,不骗你!"; break; case 2: str = "读上次的游戏存档玩,应该是这样的!"; break; case 3: str = "再见!"; break; case 4: str = "少年,你已经死掉了!点击重新开始!"; break; default: str = ""; break; } panel.m_Text.text = str; Debug.LogWarning("OnCreateOK---->>>>" + go.name); }