public static generateActiveColor ( String str ) : Color | ||
str | String | |
리턴 | Color |
public static void enqueueChatLine(String line) { ChatLine chat_line = new ChatLine(line); //Check if the message has a name if (line.Length > 3 && line.First() == '[') { int name_length = line.IndexOf(']'); if (name_length > 0) { name_length = name_length - 1; String name = line.Substring(1, name_length); if (name == "Server") { chat_line.color = new Color(0.65f, 1.0f, 1.0f); } else { chat_line.color = KMPVessel.generateActiveColor(name) * NAME_COLOR_SATURATION_FACTOR + Color.white * (1.0f - NAME_COLOR_SATURATION_FACTOR); } } } chatLineQueue.Enqueue(chat_line); while (chatLineQueue.Count > MAX_CHAT_LINES) { chatLineQueue.Dequeue(); } scrollPos.y += 100; }
public ChatLine(String line) { this.color = Color.yellow; this.name = ""; this.message = line; //Check if the message has a name if (line.Length > 3 && line.First() == '[') { int name_length = line.IndexOf(']'); if (name_length > 0) { name_length = name_length - 1; this.name = line.Substring(1, name_length); this.message = line.Substring(name_length + 2); if (this.name == "Server") { this.color = Color.magenta; } else { this.color = KMPVessel.generateActiveColor(name) * NAME_COLOR_SATURATION_FACTOR + Color.white * (1.0f - NAME_COLOR_SATURATION_FACTOR); } } } }
public ChatLine(String line) { this.color = Color.yellow; this.name = ""; this.message = line; this.isAdmin = false; //Check if the message has a name if (line.Length > 3 && (line.First() == '<' || (line.StartsWith("[" + KMPCommon.ADMIN_MARKER + "]") && line.Contains('<')))) { int name_start = line.IndexOf('<'); int name_end = line.IndexOf('>'); int name_length = name_end - name_start - 1; if (name_length > 0) { this.name = line.Substring(name_start + 1, name_length); this.message = line.Substring(name_end + 1); if (this.name == "Server") { this.color = Color.magenta; } else if (line.StartsWith("[" + KMPCommon.ADMIN_MARKER + "]")) { this.color = Color.red; this.isAdmin = true; } else { this.color = KMPVessel.generateActiveColor(name) * NAME_COLOR_SATURATION_FACTOR + Color.white * (1.0f - NAME_COLOR_SATURATION_FACTOR); } } } }