/** * Unit test of the FindColors function */ void TestFindColors() { print("TestFindColors..."); Dictionary <string, Color> data; PlayerColor newPlayer; CreateFile(); //Empty file data = ColorFileManager.FindColors("Test", path); Assert.AreEqual(null, data, string.Format("<color=#{0:X2}{1:X2}{2:X2}>{3}</color>", (byte)(255), (byte)(0), (byte)(0), "...FAILED : Data should not exist")); //Add a player newPlayer = new PlayerColor("Test", anger, surprise, joy, sadness); ColorFileManager.EditPlayer(newPlayer, path); data = ColorFileManager.FindColors("Test", path); Assert.AreEqual(anger, data["Anger"], string.Format("<color=#{0:X2}{1:X2}{2:X2}>{3}</color>", (byte)(255), (byte)(0), (byte)(0), "...FAILED : Wrong color!")); //Add an other player newPlayer = new PlayerColor("Test", surprise, anger, joy, sadness); ColorFileManager.EditPlayer(newPlayer, path); newPlayer = new PlayerColor("Test2", anger, surprise, joy, sadness); ColorFileManager.EditPlayer(newPlayer, path); data = ColorFileManager.FindColors("Test", path); Assert.AreEqual(surprise, data["Anger"], string.Format("<color=#{0:X2}{1:X2}{2:X2}>{3}</color>", (byte)(255), (byte)(0), (byte)(0), "...FAILED : Wrong color!")); DeleteFile(); }
/** * Find the colors of the player */ void SetPlayerColors() { Dictionary <string, Color> temp = ColorFileManager.FindColors(PlayerPrefs.GetString("PlayerName")); if (temp != null) { playerColors = temp; } }
/** * Display the player addition menu */ public void AddPlayerScreen() { selectSound.Play(); SetPlayerMenuElementState(false); inputField.SetActive(true); colorPicker.SetActive(true); addPlayerButton.SetActive(true); Dictionary <string, Color> playerColor = ColorFileManager.FindColors(defaultPlayer); GUIColorPickerController.SetEmotionColors(playerColor); }
/** * Display the player settings screen */ public void SetPlayerScreen() { selectSound.Play(); string player = dropdown.options[dropdown.value].text; playerText.GetComponent <Text>().text = player; Dictionary <string, Color> playerColor = ColorFileManager.FindColors(player); SetPlayerMenuElementState(false); playerText.SetActive(true); colorPicker.SetActive(true); setPlayerButton.SetActive(true); GUIColorPickerController.SetEmotionColors(playerColor); }