private void CreateCommandPanels() { this.bottomCommandPanel = new CommandPanel(); this.bottomCommandPanel.DeleteButtonClick += this.DeleteButton_Click; this.bottomCommandPanel.EditButtonClick += this.EditButton_Click; this.bottomCommandPanel.ButtonCssClass = this.GetCommandPanelButtonCssClass(); this.bottomCommandPanel.CssClass = this.GetCommandPanelCssClass(); this.bottomCommandPanel.SelectButtonIconCssClass = this.GetSelectButtonIconCssClass(); this.bottomCommandPanel.CompactButtonIconCssClass = this.GetCompactButtonIconCssClass(); this.bottomCommandPanel.AllButtonIconCssClass = this.GetAllButtonIconCssClass(); this.bottomCommandPanel.AddButtonIconCssClass = this.GetAddButtonIconCssClass(); this.bottomCommandPanel.EditButtonIconCssClass = this.GetEditButtonIconCssClass(); this.bottomCommandPanel.DeleteButtonIconCssClass = this.GetDeleteButtonIconCssClass(); this.bottomCommandPanel.PrintButtonIconCssClass = this.GetPrintButtonIconCssClass(); this.topCommandPanel = new CommandPanel(); this.topCommandPanel.DeleteButtonClick += this.DeleteButton_Click; this.topCommandPanel.EditButtonClick += this.EditButton_Click; this.topCommandPanel.ButtonCssClass = this.GetCommandPanelButtonCssClass(); this.topCommandPanel.CssClass = this.GetCommandPanelCssClass(); this.topCommandPanel.SelectButtonIconCssClass = this.GetSelectButtonIconCssClass(); this.topCommandPanel.CompactButtonIconCssClass = this.GetCompactButtonIconCssClass(); this.topCommandPanel.AllButtonIconCssClass = this.GetAllButtonIconCssClass(); this.topCommandPanel.AddButtonIconCssClass = this.GetAddButtonIconCssClass(); this.topCommandPanel.EditButtonIconCssClass = this.GetEditButtonIconCssClass(); this.topCommandPanel.DeleteButtonIconCssClass = this.GetDeleteButtonIconCssClass(); this.topCommandPanel.PrintButtonIconCssClass = this.GetPrintButtonIconCssClass(); }
public void ShowTrainYardCommandsTest1() { CommandPanel target = new CommandPanel(); // TODO: Initialize to an appropriate value target.ShowTrainYardCommands(); Assert.Inconclusive("A method that does not return a value cannot be verified."); }
/// <summary> /// Android用曲再生メソッドの呼び出し /// </summary> private void CallPlay4Android() { try { bool result = false; // 曲ファイルのパスを渡して再生 plugin.Call <bool>(PLAY_METHOD, Application.persistentDataPath + "/" + names[0]); //for (int i = 1; i < names.Length; i++) // result = plugin.Call<bool>(NEXT_PLAY_METHOD, Application.persistentDataPath + "/" + names[i]); if (result) { ResultText.text = "Play!!"; } else { ResultText.text = "Play Failure!!"; } } catch (Exception e) { CommandPanel.ShowError(e.ToString() + e.Message); } }
void Start() { cmdPanel = CommandPanel.GetCommandPanel(); #if UNITY_ANDROID GameObject[] cmdpanels = GameObject.FindGameObjectsWithTag(cmdPanelAndroidStr); #else GameObject[] cmdpanels = GameObject.FindGameObjectsWithTag(cmdPanelWindowsStr); #endif if (cmdpanels.Length > 1) { #if UNITY_ANDROID Debug.LogWarning("CommandData: There are more than one CommandPanel with " + cmdPanelAndroidStr + " tag, functions may won't work fine!"); #else Debug.LogWarning("CommandData: There are more than one CommandPanel with " + cmdPanelWindowsStr + " tag, functions may won't work fine!"); #endif } else if (cmdpanels.Length == 0) { Debug.LogError("CommandData: There are no CommandPanel"); } if (cmdpanels.Length > 0) { cmdpanel = cmdpanels[0]; } CmdPanelSlot = Command.PanelSlot; canvasGroup = GetComponent <CanvasGroup>(); }
void OnEnable() { instance = (CommandPanel)target; margins = serializedObject.FindProperty("panelMargin"); columns = serializedObject.FindProperty("panels"); panelDimensions = serializedObject.FindProperty("panelDimensions"); }
public void Render_WithAttackFocusAndDifferentWidth_RendersCorrectly() { var mockUIStateTracker = new MockUIStateTracker { CommandFocusNumber = 1 }; var commandPanel = new CommandPanel(mockUIStateTracker) { MaxWidth = 20 }; List <string> expected = new List <string>() { "╔═══════════════════", "║ ► Attack │", "║ │", "║ Spells │", "║ │", "║ Skills │", "║ │", "║ Items │", "║ │", "║ Status │", "║ │", "║ Wait │", "║ │", "║ Run │", "║ │", "╚═══════════════════" }; var actual = commandPanel.Render(); var actualAsList = new List <string>(actual); CollectionAssert.AreEqual(expected, actualAsList); }
public void ClearButtonsTest() { CommandPanel target = new CommandPanel(); // TODO: Initialize to an appropriate value target.ClearButtons(); Assert.Inconclusive("A method that does not return a value cannot be verified."); }
public void Render_WithSkillsFocus_RendersCorrectly() { var mockUIStateTracker = new MockUIStateTracker(); var commandPanel = new CommandPanel(mockUIStateTracker); commandPanel.FocusNumber = 3; List <string> expected = new List <string>() { "╔════════════════", "║ Attack │", "║ │", "║ Spells │", "║ │", "║ ► Skills │", "║ │", "║ Items │", "║ │", "║ Status │", "║ │", "║ Wait │", "║ │", "║ Run │", "║ │", "╚════════════════" }; var actual = commandPanel.Render(); var actualAsList = new List <string>(actual); CollectionAssert.AreEqual(expected, actualAsList); }
protected virtual void InitSlot() { cmdpanelmanager = CommandPanel.GetCommandPanel(); if (cmdpanelmanager == null) { Debug.LogError("Slot: CommandPanel is null!"); } }
public void SetCommandsTest1() { CommandPanel target = new CommandPanel(); // TODO: Initialize to an appropriate value Dictionary <object, string> commands = null; // TODO: Initialize to an appropriate value target.SetCommands(commands); Assert.Inconclusive("A method that does not return a value cannot be verified."); }
void Start() { ActualMapData.HawNewItem = false; commandPanel = CommandPanel.GetCommandPanel(); if (commandPanel == null) { Debug.Log("FinisMap: CommandPanel is null!"); } }
void Awake() { if (instance != null) { Debug.LogWarning("More than one instance of CommandPannel found!"); return; } instance = this; selectedPanel = 1; SelectPanel(selectedPanel); }
// Start is called before the first frame update void Start() { commandsPanel = CommandPanel.instance; // List of our commands firstBotPos = bot.GetComponent <Transform>().position; firstBotDirection = bot.GetComponent <BotRotation>().botDirection; firstBotLayer = bot.GetComponentInChildren <Trigger>().floorToCheckForWalking; // Take other gameobject's scripts botRotationScript = bot.GetComponent <BotRotation>(); botJumpingScript = bot.GetComponent <BotJumping>(); }
public void DeselectPlayerCharacter(CommandPanel playerCP) { foreach (CharacterSelectEntry entry in roster.Values) { if (entry.Owner != null && entry.Owner.Equals(playerCP)) { entry.Owner = null; playerCP.Character = null; break; } } }
void Start() { commandsPanel = CommandPanel.instance; //commandsPanelProc1 = CommandPanel.instanceProc1; commandsPanel.onCommandChangedCallback += UpdateUI; //commandsPanelProc1.onCommandChangedCallback += UpdateUI; slots = commandsParent.GetComponentsInChildren <PanelSlot>(); slotsProc1 = commandsParentProc1.GetComponentsInChildren <PanelSlot>(); slotsProc2 = commandsParentProc2.GetComponentsInChildren <PanelSlot>(); }
private void CreateCommandPanels() { this.bottomCommandPanel = new CommandPanel(); this.bottomCommandPanel.DeleteButtonClick += this.DeleteButton_Click; this.bottomCommandPanel.EditButtonClick += this.EditButton_Click; this.bottomCommandPanel.ButtonCssClass = this.GetCommandPanelButtonCssClass(); this.topCommandPanel = new CommandPanel(); this.topCommandPanel.DeleteButtonClick += this.DeleteButton_Click; this.topCommandPanel.EditButtonClick += this.EditButton_Click; this.topCommandPanel.ButtonCssClass = this.GetCommandPanelButtonCssClass(); }
void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } summSlots = fv1Count + fv2Count + mainCount; CmdLoad(); }
private void CreateCommandPanels() { this.bottomCommandPanel = new CommandPanel(); this.bottomCommandPanel.DeleteButtonClick += this.DeleteButton_Click; this.bottomCommandPanel.EditButtonClick += this.EditButton_Click; this.bottomCommandPanel.ButtonCssClass = this.GetCommandPanelButtonCssClass(); this.bottomCommandPanel.CssClass = this.GetCommandPanelCssClass(); this.bottomCommandPanel.SelectButtonIconCssClass = this.GetSelectButtonIconCssClass(); this.bottomCommandPanel.CompactButtonIconCssClass = this.GetCompactButtonIconCssClass(); this.bottomCommandPanel.AllButtonIconCssClass = this.GetAllButtonIconCssClass(); this.bottomCommandPanel.AddButtonIconCssClass = this.GetAddButtonIconCssClass(); this.bottomCommandPanel.EditButtonIconCssClass = this.GetEditButtonIconCssClass(); this.bottomCommandPanel.DeleteButtonIconCssClass = this.GetDeleteButtonIconCssClass(); this.bottomCommandPanel.PrintButtonIconCssClass = this.GetPrintButtonIconCssClass(); this.topCommandPanel = new CommandPanel(); this.topCommandPanel.DeleteButtonClick += this.DeleteButton_Click; this.topCommandPanel.EditButtonClick += this.EditButton_Click; this.topCommandPanel.WordExportButtonClick += delegate { string html = this.markupHidden.Value; ExportHelper.DownloadWord(html); }; this.topCommandPanel.ExcelExportButtonClick += delegate { string html = this.markupHidden.Value; ExportHelper.DownloadExcel(html); }; this.topCommandPanel.PdfExportButtonClick += delegate { string html = this.markupHidden.Value; ExportHelper.DownloadPdf(html); }; this.topCommandPanel.ButtonCssClass = this.GetCommandPanelButtonCssClass(); this.topCommandPanel.CssClass = this.GetCommandPanelCssClass(); this.topCommandPanel.SelectButtonIconCssClass = this.GetSelectButtonIconCssClass(); this.topCommandPanel.CompactButtonIconCssClass = this.GetCompactButtonIconCssClass(); this.topCommandPanel.AllButtonIconCssClass = this.GetAllButtonIconCssClass(); this.topCommandPanel.AddButtonIconCssClass = this.GetAddButtonIconCssClass(); this.topCommandPanel.EditButtonIconCssClass = this.GetEditButtonIconCssClass(); this.topCommandPanel.DeleteButtonIconCssClass = this.GetDeleteButtonIconCssClass(); this.topCommandPanel.PrintButtonIconCssClass = this.GetPrintButtonIconCssClass(); }
/* * public void SelectCharForPlayer(string characterName, CommandPanel playerCP) * { * * if (roster.ContainsKey(characterName)) * { * CharacterSelectEntry desiredCharacter = roster[characterName]; * * // if the character is * if (desiredCharacter.isPicked == false) * { * // deselect any character they may already have selected * if (playerCP.Character != null) * { * roster[playerCP.].isPicked = false; * } * // select the newly desired character * desiredCharacter.isPicked = true; * playerCP.Character = desiredCharacter; * * // if the player clicks the character they already have, deselect it * } else if (desiredCharacter.isPicked == true && playerCP.Character.Equals(desiredCharacter)) * { * desiredCharacter.isPicked = false; * playerCP.Character = null; * } * * } * * } */ public void SelectCharForPlayer(string characterName, CommandPanel playerCP) { if (roster.ContainsKey(characterName)) { CharacterSelectEntry desiredCharacter = roster[characterName]; if (desiredCharacter.Owner != null && desiredCharacter.Owner.Equals(playerCP)) // If player selects the character they already had again, deselect it instead { DeselectPlayerCharacter(playerCP); } else if (desiredCharacter.Owner == null && playerCP.Character == null) // If player has no character and selected character has no owner, { desiredCharacter.Owner = playerCP; playerCP.Character = desiredCharacter.CharacterPrefab; } else if (desiredCharacter.Owner == null && playerCP.Character != null) // If the player selects a character with no owner and already has a character, deselect the old character { DeselectPlayerCharacter(playerCP); desiredCharacter.Owner = playerCP; playerCP.Character = desiredCharacter.CharacterPrefab; } } }
public void CommandPanelConstructorTest() { CommandPanel target = new CommandPanel(); Assert.Inconclusive("TODO: Implement code to verify target"); }
public ReversibleAddCommand(S2VXCommand command, CommandPanel commandPanel) { Command = command; CommandPanel = commandPanel; }
protected override IEnumerator OnRequest(HttpListenerContext context) { string dataString = ""; HttpListenerRequest request = context.Request; StreamReader reader = new StreamReader(request.InputStream); string username = reader.ReadToEnd(); username = username.Trim(); //JSONWrapper j = new JSONWrapper(username); if (playerRegister.ContainsKey(username) && playerRegister[username].IsConnected == false) { // figure out alternative to allowing IsConnected to be written to? playerRegister[username].IsConnected = true; dataString = "Player found, reconnecting!"; } else if (!playerRegister.ContainsKey(username) && playerRegister.Count < 5 && allowNewJoins) { if (!firstPlayerJoined) { GameStateManager.Instance.GameState = GameState.CharacterSelect; } //accept the request to join and create a controller instance GameObject newController = Instantiate <GameObject>(controllerPrefab); newController.transform.parent = this.gameObject.transform; newController.name = username + "'s Controller"; CommandPanel newControllerCP = newController.GetComponent <CommandPanel>(); newControllerCP.PlayerName = username; newControllerCP.Pulse(); playerRegister.Add(username, newControllerCP); dataString = "Player not found; space available, adding " + username + " to the register!"; firstPlayerJoined = true; } else if (!allowNewJoins) { dataString = "Game in progress; no new joins allowed, only reconnects!"; } else { //reject the request to join dataString = "Maximum player count reached or player still connected!"; } CheckAllConnected(); Debug.Log(dataString); byte[] data = Encoding.ASCII.GetBytes(dataString); yield return(null); HttpListenerResponse response = context.Response; response.ContentType = "text/plain"; Stream responseStream = response.OutputStream; int count = data.Length; int i = 0; while (i < count) { if (i != 0) { yield return(null); } int writeLength = Math.Min((int)writeStaggerCount, count - i); responseStream.Write(data, i, writeLength); i += writeLength; } }
/* public void SelectCharForPlayer(string characterName, CommandPanel playerCP) { if (roster.ContainsKey(characterName)) { CharacterSelectEntry desiredCharacter = roster[characterName]; // if the character is if (desiredCharacter.isPicked == false) { // deselect any character they may already have selected if (playerCP.Character != null) { roster[playerCP.].isPicked = false; } // select the newly desired character desiredCharacter.isPicked = true; playerCP.Character = desiredCharacter; // if the player clicks the character they already have, deselect it } else if (desiredCharacter.isPicked == true && playerCP.Character.Equals(desiredCharacter)) { desiredCharacter.isPicked = false; playerCP.Character = null; } } } */ public void SelectCharForPlayer(string characterName, CommandPanel playerCP) { if (roster.ContainsKey(characterName)) { CharacterSelectEntry desiredCharacter = roster[characterName]; if (desiredCharacter.Owner != null && desiredCharacter.Owner.Equals(playerCP)) // If player selects the character they already had again, deselect it instead { DeselectPlayerCharacter(playerCP); } else if (desiredCharacter.Owner == null && playerCP.Character == null) // If player has no character and selected character has no owner, { desiredCharacter.Owner = playerCP; playerCP.Character = desiredCharacter.CharacterPrefab; } else if (desiredCharacter.Owner == null && playerCP.Character != null) // If the player selects a character with no owner and already has a character, deselect the old character { DeselectPlayerCharacter(playerCP); desiredCharacter.Owner = playerCP; playerCP.Character = desiredCharacter.CharacterPrefab; } } }
bool IsYourTurn(CommandPanel cp) { return (cp.Team == Alliance.Cops && GameStateManager.Instance.GameState == GameState.CopsTurn) || (cp.Team == Alliance.Robbers && GameStateManager.Instance.GameState == GameState.GangTurn); }
// Throws exception if CommandString is invalid public void Redo() { CommandPanel.AddCommand(NewCommand); CommandPanel.RemoveCommand(OldCommand); // Add and reload command panel }
public ReversibleUpdateCommand(S2VXCommand oldCommand, S2VXCommand newCommand, CommandPanel commandPanel) { OldCommand = oldCommand; NewCommand = newCommand; CommandPanel = commandPanel; }
private void ShowCommand() { AddingPanel.Hide(); CommandPanel.Show(); }
private void ShowAdding() { CommandPanel.Hide(); AddingPanel.Show(); }
bool IsYourTurn(CommandPanel cp) { return((cp.Team == Alliance.Cops && GameStateManager.Instance.GameState == GameState.CopsTurn) || (cp.Team == Alliance.Robbers && GameStateManager.Instance.GameState == GameState.GangTurn)); }
protected override IEnumerator OnRequest(HttpListenerContext context) { HttpListenerRequest request = context.Request; StreamReader reader = new StreamReader(request.InputStream); string command = reader.ReadToEnd(); string dataString = ""; JSONWrapper j = new JSONWrapper(command); string givenCommand = ""; string user = ""; try { givenCommand = j["command"]; user = j["username"]; Debug.Log("Receiving command " + givenCommand + " from " + user); } catch (Exception e) { Debug.Log(e.Message); } if (PlayerRegisterRule.PlayerRegister.ContainsKey(user)) { Debug.Log(user + " found, entering command switch"); CommandPanel cp = PlayerRegisterRule.PlayerRegister[user]; cp.IsConnected = true; switch (givenCommand) { // for getting the size (and more if needed) of the map, to generate a grid at runtime case "GetMapData": if (selectedMap != null) { dataString = JsonUtility.ToJson(selectedMap.ToJSON()); } break; // for use during charcter select case "ChooseCharacter": if (GameStateManager.Instance.GameState == GameState.CharacterSelect) { string charSelected = ""; try { charSelected = j["character"]; Debug.Log(charSelected); } catch (Exception e) { Debug.Log(e.Message); } // if the character was able to be assigned if (charSelected != "" && charSelectManager != null) { charSelectManager.SelectCharForPlayer(charSelected, cp); } } break; case "ToggleReady": if (charSelectManager != null) { cp.IsReady = !cp.IsReady; List <bool> readies = new List <bool>(); foreach (CommandPanel r in PlayerRegisterRule.PlayerRegister.Values) { readies.Add(r.IsReady); } if (!readies.Contains(false) && !CharSelectManager.InCountdown) { charSelectManager.StartCoroutine("Countdown"); } else if (readies.Contains(false)) { charSelectManager.StartCoroutine(charSelectManager.StopCountdown()); } } break; // commit their movement path and execute a move case "CommitMove": if (IsYourTurn(cp)) { cp.CommitToMove(); } break; // select a tile to add to the movement path case "SelectTile": if (IsYourTurn(cp)) { if (mapGenerator != null) { try { Debug.Log("Processing tile data: {x:" + j["x"] + "," + "z:" + j["z"] + "}"); cp.PathSelection(mapGenerator.TileArray[int.Parse(j["x"]), int.Parse(j["z"])]); PathTile p = new PathTile(); List <Coordinate> queuedCoords = new List <Coordinate>(); foreach (TileBehavior tb in cp.QueuedPath) { queuedCoords.Add(tb.Coords); } p.path = queuedCoords.ToArray(); Debug.Log(JsonUtility.ToJson(p)); dataString = JsonUtility.ToJson(p); } catch (Exception e) { Debug.Log(e.Message); } } } break; // none of the above default: Debug.Log("Command either not parsed or not valid. Given command was: " + givenCommand); break; } } Debug.Log("Sending " + user + ": " + dataString); byte[] data = Encoding.ASCII.GetBytes(dataString); yield return(null); HttpListenerResponse response = context.Response; response.ContentType = "text/plain"; Stream responseStream = response.OutputStream; int count = data.Length; int i = 0; while (i < count) { if (i != 0) { yield return(null); } int writeLength = Math.Min((int)writeStaggerCount, count - i); responseStream.Write(data, i, writeLength); i += writeLength; } }
private void Start() { commandPanel = CommandPanel.GetCommandPanel(); }