/* * Methods */ private void ParseTheme(string[] lines) { if (lines[0] == "--<thm>--") { CEUI.Type type = CEUI.Type.None; string img = ""; string imgChecked = ""; foreach (string line in lines) { if (line != "") { string[] parts = line.Split(' '); // means "type : <type>" if (parts[0] == "type") { if (parts[1] == ":") { if (parts[2] == "checkbox") { type = CEUI.Type.CheckBox; } } } // means "background : <bg>" if (parts[0] == "background") { if (parts[1] == ":") { img = parts[2]; } } // means "background-checked : <bg>" if (parts[0] == "background-checked") { if (parts[1] == ":") { imgChecked = parts[2]; } } } } if (type == CEUI.Type.CheckBox && img != "" && imgChecked != "") { ImgPath = img; ImgCheckedPath = imgChecked; } else { throw new Exception("Theme file incorrect! File : " + ThemePath); } } }
/* * Methods */ private void ParseTheme(string[] lines) { if (lines[0] == "--<thm>--") { CEUI.Type type = CEUI.Type.None; string img = ""; string imgHover = ""; string imgPressed = ""; string font = ""; string sndHover = ""; foreach (string line in lines) { if (line != "") { string[] parts = line.Split(' '); // means "type : <type>" if (parts[0] == "type") { if (parts[1] == ":") { if (parts[2] == "button") { type = CEUI.Type.Button; } } } // means "background : <bg>" if (parts[0] == "background") { if (parts[1] == ":") { img = parts[2]; } } // means "background-hover : <bg>" if (parts[0] == "background-hover") { if (parts[1] == ":") { imgHover = parts[2]; } } // means "background-pressed : <bg>" if (parts[0] == "background-pressed") { if (parts[1] == ":") { imgPressed = parts[2]; } } // means "font : <font>" if (parts[0] == "font") { if (parts[1] == ":") { font = parts[2]; } } // means "sound-hover : <sound>" if (parts[0] == "sound-hover") { if (parts[1] == ":") { sndHover = parts[2]; } } } } if (type == CEUI.Type.Button && img != "" && imgHover != "" && imgPressed != "" && font != "" && sndHover != "") { ImgPath = img; ImgHoverPath = imgHover; ImgPressedPath = imgPressed; FontPath = font; SndHoverPath = sndHover; } else { throw new Exception("Theme file incorrect! File : " + ThemePath); } } }