// Resets the contents of the container public void Reset() { // Set the name to an empty string name = string.Empty; // Set the colour to black color = InterfaceColors.Black; // Set the position to be zero. position = Vector3.zero; // Set the entity ID's to negative one merchantId = -1; allyId = -1; // Clear the list itemIds.Clear(); }
// Returns the colour representative to the enumeration value. If the colour can't be parsed, it returns white public static Color InterfaceColorToColor(InterfaceColors interfaceColor) { string hexValue = string.Empty; // The string for the hex value Color result; // The resulting colour // Switch over the InterfaceColors switch (interfaceColor) { case InterfaceColors.Black: { // Set the hex string hexValue = "484848FF"; break; } // end case Black case InterfaceColors.Blue: { // Set the hex string hexValue = "579FF9FF"; break; } // end case Blue case InterfaceColors.Green: { // Set the hex string hexValue = "038000FF"; break; } // end case Green case InterfaceColors.Orange: { // Set the hex string hexValue = "FF7611FF"; break; } // end case Orange case InterfaceColors.Pink: { // Set the hex string hexValue = "FF9DFFFF"; break; } // end case Pink case InterfaceColors.Purple: { // Set the hex string hexValue = "B502C4FF"; break; } // end case Purple case InterfaceColors.Red: { // Set the hex string hexValue = "F40000FF"; break; } // end case Red case InterfaceColors.Yellow: { // Set the hex string hexValue = "F9FE18FF"; break; } // end case Yellow } // end switch interfaceColor if (Color.TryParseHexString(hexValue, out result)) { // Return the resulting colour return result; } // end if else { return Color.white; } // end else }
// Sets the player's inventory colour to their interface colour void SetInventoryColor(InterfaceColors interfaceColor) { // Get the colour for the player's interface colour Color color = Utility.InterfaceColorToColor(interfaceColor); // Get the Image component of the inventory and set its colour GetComponent<Image>().color = color; // Get the Image component of the tooltip and set its colour tooltip.GetComponent<Image>().color = color; }