private void update_panel() { Rect window_rect = calculate_window_rect(); float content_margin_left = 10.0f; float content_margin_right = 10.0f; float content_scroll_bar_width = 20.0f; float content_width = window_rect.width - (content_margin_left + content_margin_right + content_scroll_bar_width); float content_x = content_margin_left; int[] int_array = m_control_color_value.to_int_array(); { GUIStyle label_style = GUI.skin.GetStyle("Label"); int default_label_font_size = label_style.fontSize; TextAnchor default_label_alignment = label_style.alignment; Color default_label_text_color = label_style.normal.textColor; GUIStyle button_style = GUI.skin.GetStyle("Button"); int default_button_font_size = button_style.fontSize; TextAnchor default_button_alignment = button_style.alignment; Color default_button_text_color = button_style.normal.textColor; GUIStyle toggle_style = GUI.skin.GetStyle("Toggle"); int default_toggle_font_size = toggle_style.fontSize; TextAnchor default_toggle_alignment = toggle_style.alignment; Color default_toggle_text_color = toggle_style.normal.textColor; label_style.fontSize = ConstValues.LABEL_FONT_SIZE; label_style.alignment = ConstValues.LABEL_ALIGNMENT; label_style.normal.textColor = ConstValues.LABEL_TEXT_COLOR; button_style.fontSize = ConstValues.BUTTON_FONT_SIZE; button_style.alignment = ConstValues.BUTTON_ALIGNMENT; button_style.normal.textColor = ConstValues.BUTTON_TEXT_COLOR; toggle_style.fontSize = ConstValues.TOGGLE_FONT_SIZE; toggle_style.alignment = ConstValues.TOGGLE_ALIGNMENT; toggle_style.normal.textColor = ConstValues.TOGGLE_TEXT_COLOR; float content_main_y = 0; GUI.BeginGroup(window_rect); GUI.Box(new Rect(0.0f, 0.0f, window_rect.width, window_rect.height), ""); { GUI.Label(new Rect(content_x, content_main_y, 200.0f, 20.0f), ConstValues.PLUGIN_NAME + "(ver" + ConstValues.PLUGIN_VERSION + ")"); content_main_y += 20.0f; } { { m_color_information_switch = GUI.Toggle(new Rect(content_x - 5.0f, content_main_y, content_width, 20.0f), m_color_information_switch, ConstValues.COLOR_INFORMATION_TITLE); content_main_y += 20.0f; } if(m_color_information_switch != false) { if(m_color_edit_switch != false) { { GUIStyle style = GUI.skin.GetStyle("Button"); Texture2D default_normal_background = style.normal.background; Texture2D default_hover_background = style.hover.background; Texture2D default_active_background = style.active.background; style.normal.background = null; style.hover.background = null; style.active.background = null; if(GUI.Button(new Rect(content_x, content_main_y, 85.0f, 150.0f), "")) { m_color_edit_color_switch[0] = true; m_color_edit_color_switch[1] = false; } style.normal.background = default_normal_background; style.hover.background = default_hover_background; style.active.background = default_active_background; } { GUIStyle style = GUI.skin.GetStyle("Button"); Texture2D default_normal_background = style.normal.background; Texture2D default_hover_background = style.hover.background; Texture2D default_active_background = style.active.background; style.normal.background = null; style.hover.background = null; style.active.background = null; if(GUI.Button(new Rect(content_x + 90.0f, content_main_y, 85.0f, 150.0f), "")) { m_color_edit_color_switch[0] = false; m_color_edit_color_switch[1] = true; } style.normal.background = default_normal_background; style.hover.background = default_hover_background; style.active.background = default_active_background; } } { { GUI.Label(new Rect(content_x, content_main_y, 90.0f, 20.0f), ConstValues.COLOR_INFORMATION_MAIN_COLOR); Color default_background_color = GUI.backgroundColor; GUIStyle style = GUI.skin.GetStyle("Box"); Texture2D default_normal_background = style.normal.background; style.normal.background = Texture2D.whiteTexture; GUI.backgroundColor = multiple_brightness_and_chroma(hue_to_rgb(int_array[0] * (360.0f / (float)ConstValues.COLOR_PARAMETERS[0].m_max)), int_array[2], int_array[1]); GUI.Box(new Rect(content_x, content_main_y + 25.0f, 90.0f, 20.0f), ""); style.normal.background = default_normal_background; GUI.backgroundColor = default_background_color; } { GUI.Label(new Rect(content_x + 95.0f, content_main_y, 90.0f, 20.0f), ConstValues.COLOR_INFORMATION_SHADOW_COLOR); Color default_background_color = GUI.backgroundColor; GUIStyle style = GUI.skin.GetStyle("Box"); Texture2D default_normal_background = style.normal.background; style.normal.background = Texture2D.whiteTexture; GUI.backgroundColor = multiple_brightness_and_chroma(hue_to_rgb(int_array[4] * (360.0f / (float)ConstValues.COLOR_PARAMETERS[4].m_max)), int_array[6], int_array[5]); GUI.Box(new Rect(content_x + 95.0f, content_main_y + 25.0f, 90.0f, 20.0f), ""); style.normal.background = default_normal_background; GUI.backgroundColor = default_background_color; } content_main_y += 50; } { for(int i = 0; i < 8; i++) { int r = i % 4; int c = i / 4; GUI.Label(new Rect(content_x + (95.0f * c), content_main_y + (20.0f * r), 90.0f, 20.0f), ConstValues.COLOR_PARAMETERS[i].m_name + ":" + int_array[i]); } { int i = 8; GUI.Label(new Rect(content_x, content_main_y + 80.0f, 90.0f, 20.0f), ConstValues.COLOR_PARAMETERS[i].m_name + ":" + int_array[i]); } } content_main_y += 100.0f; } content_main_y += 5.0f; } { float content_sub_y = 0; m_scroll_position = GUI.BeginScrollView(new Rect(0.0f, content_main_y, window_rect.width, window_rect.height - content_main_y), m_scroll_position, new Rect(0.0f, 0.0f, window_rect.width - content_scroll_bar_width, calculate_sub_content_height())); { { m_color_edit_switch = GUI.Toggle(new Rect(content_x - 5.0f, content_sub_y, content_width, 20.0f), m_color_edit_switch, ConstValues.COLOR_EDIT_TITLE); content_sub_y += 20.0f; } if(m_color_edit_switch != false) { { { GUI.Label(new Rect(content_x, content_sub_y, content_width, 20.0f), ConstValues.COLOR_EDIT_SETTING_TITLE); content_sub_y += 20.0f; } { m_color_edit_setting_switch[0] = GUI.Toggle(new Rect(content_x, content_sub_y, content_width, 20.0f), m_color_edit_setting_switch[0], ConstValues.COLOR_EDIT_SETTING_USE_SLIDER); m_color_edit_setting_switch[1] = GUI.Toggle(new Rect(content_x, content_sub_y + 20.0f, content_width, 20.0f), m_color_edit_setting_switch[1], ConstValues.COLOR_EDIT_SETTING_USE_COLOR_SET); content_sub_y += 45.0f; } } { { GUI.Label(new Rect(content_x, content_sub_y, content_width, 20.0f), ConstValues.COLOR_EDIT_COLOR_TITLE); content_sub_y += 20.0f; } { bool[] color_edit_color_switch = new bool[2]; color_edit_color_switch[0] = GUI.Toggle(new Rect(content_x, content_sub_y, 85.0f, 20.0f), m_color_edit_color_switch[0], ConstValues.COLOR_EDIT_COLOR_MAIN); color_edit_color_switch[1] = GUI.Toggle(new Rect(content_x + 90.0f, content_sub_y, 85.0f, 20.0f), m_color_edit_color_switch[1], ConstValues.COLOR_EDIT_COLOR_SHADOW); if((color_edit_color_switch[0] != m_color_edit_color_switch[0]) && (color_edit_color_switch[0] == true)) { m_color_edit_color_switch[0] = true; m_color_edit_color_switch[1] = false; } else if((color_edit_color_switch[1] != m_color_edit_color_switch[1]) && (color_edit_color_switch[1] == true)) { m_color_edit_color_switch[0] = false; m_color_edit_color_switch[1] = true; } content_sub_y += 25.0f; } } { { int i_begin = 0; int i_end = 4; int h = 0; if(m_color_edit_color_switch[1] != false) { i_begin = 4; i_end = 8; h = 4; } for(int i = i_begin; i < i_end; i++) { int r = i % 4; { m_color_edit_control_switch[r] = GUI.Toggle(new Rect(content_x, content_sub_y, content_width, 20.0f), m_color_edit_control_switch[r], ConstValues.COLOR_PARAMETERS[i].m_name + ":" + int_array[i]); content_sub_y += 25.0f; } if(m_color_edit_control_switch[r] != false) { if(m_color_edit_setting_switch[0] != false) { int_array[i] = update_color_slider(ConstValues.COLOR_PARAMETERS[i], int_array[i], content_x, content_sub_y, content_width); content_sub_y += 20.0f; } { int_array[i] = update_color_adjust_set(ConstValues.COLOR_PARAMETERS[i], int_array[i], content_x, content_sub_y, content_width); content_sub_y += 25.0f; } if(m_color_edit_setting_switch[1] != false) { if(r == 0) { int_array[i] = update_hue_color_set(ConstValues.COLOR_PARAMETERS[i], int_array[i], content_x, content_sub_y, content_width); content_sub_y += 150.0f; } else if(r == 1) { int_array[i] = update_chroma_color_set(ConstValues.COLOR_PARAMETERS[i], int_array[h], int_array[i], content_x, content_sub_y, content_width); content_sub_y += 100.0f; } else if(r == 2) { int_array[i] = update_brightness_color_set(ConstValues.COLOR_PARAMETERS[i], int_array[h], int_array[i], content_x, content_sub_y, content_width); content_sub_y += 100.0f; } else if(r == 3) { int_array[i] = update_contrast_color_set(ConstValues.COLOR_PARAMETERS[i], int_array[i], content_x, content_sub_y, content_width); content_sub_y += 50.0f; } } } } } { int i = 8; int r = 4; { m_color_edit_control_switch[r] = GUI.Toggle(new Rect(content_x, content_sub_y, content_width, 20.0f), m_color_edit_control_switch[r], ConstValues.COLOR_PARAMETERS[i].m_name + ":" + int_array[i]); content_sub_y += 25.0f; } if(m_color_edit_control_switch[r] != false) { if(m_color_edit_setting_switch[0] != false) { int_array[i] = update_color_slider(ConstValues.COLOR_PARAMETERS[i], int_array[i], content_x, content_sub_y, content_width); content_sub_y += 20.0f; } { int_array[i] = update_color_adjust_set(ConstValues.COLOR_PARAMETERS[i], int_array[i], content_x, content_sub_y, content_width); content_sub_y += 25.0f; } if(m_color_edit_setting_switch[1] != false) { int_array[i] = update_shadow_rate_color_set(ConstValues.COLOR_PARAMETERS[i], int_array[i], content_x, content_sub_y, content_width); content_sub_y += 50.0f; } } } } } content_sub_y += 5.0f; } { { m_random_edit_switch = GUI.Toggle(new Rect(content_x - 5.0f, content_sub_y, content_width, 20.0f), m_random_edit_switch, ConstValues.RANDOM_EDIT_TITLE); content_sub_y += 20.0f; } if(m_random_edit_switch != false) { for(int i = 0; i < 8; i++) { int r = i % 4; int c = i / 4; m_random_edit_control_switch[i] = GUI.Toggle(new Rect(content_x + (85.0f * c), content_sub_y + (20.0f * r), 80.0f, 20.0f), m_random_edit_control_switch[i], ConstValues.COLOR_PARAMETERS[i].m_name); } { int i = 8; m_random_edit_control_switch[i] = GUI.Toggle(new Rect(content_x, content_sub_y + 80.0f, content_width, 20.0f), m_random_edit_control_switch[i], ConstValues.COLOR_PARAMETERS[i].m_name); } if(GUI.Button(new Rect(content_x, content_sub_y + 105.0f, content_width, 20.0f), ConstValues.RANDOM_EDIT_EXECUTE)) { for(int i = 0; i < m_random_edit_control_switch.Length; i++) { if(m_random_edit_control_switch[i]) { ConstValues.COLOR_PARAMETER param = ConstValues.COLOR_PARAMETERS[i]; int_array[i] = UnityEngine.Random.Range(param.m_min, param.m_max); } } } content_sub_y += 130.0f; } content_sub_y += 5.0f; } { { m_utility_edit_switch = GUI.Toggle(new Rect(content_x - 5.0f, content_sub_y, content_width, 20.0f), m_utility_edit_switch, ConstValues.UTILITY_EDIT_TITLE); content_sub_y += 20.0f; } if(m_utility_edit_switch != false) { { bool[] utility_edit_control_switch = new bool[3]; utility_edit_control_switch[0] = GUI.Toggle(new Rect(content_x, content_sub_y, content_width, 20.0f), m_utility_edit_control_switch[0], ConstValues.UTILITY_EDIT_COPY_MAIN_TO_SHADOW); utility_edit_control_switch[1] = GUI.Toggle(new Rect(content_x, content_sub_y + 20.0f, content_width, 20.0f), m_utility_edit_control_switch[1], ConstValues.UTILITY_EDIT_COPY_SHADOW_TO_MAIN); utility_edit_control_switch[2] = GUI.Toggle(new Rect(content_x, content_sub_y + 40.0f, content_width, 20.0f), m_utility_edit_control_switch[2], ConstValues.UTILITY_EDIT_SWAP_MAIN_FOR_SHADOW); if((utility_edit_control_switch[0] != m_utility_edit_control_switch[0]) && (utility_edit_control_switch[0] == true)) { m_utility_edit_control_switch[0] = true; m_utility_edit_control_switch[1] = false; m_utility_edit_control_switch[2] = false; } else if((utility_edit_control_switch[1] != m_utility_edit_control_switch[1]) && (utility_edit_control_switch[1] == true)) { m_utility_edit_control_switch[0] = false; m_utility_edit_control_switch[1] = true; m_utility_edit_control_switch[2] = false; } else if((utility_edit_control_switch[2] != m_utility_edit_control_switch[2]) && (utility_edit_control_switch[2] == true)) { m_utility_edit_control_switch[0] = false; m_utility_edit_control_switch[1] = false; m_utility_edit_control_switch[2] = true; } content_sub_y += 65.0f; } if(GUI.Button(new Rect(content_x, content_sub_y, content_width, 20.0f), ConstValues.UTILITY_EDIT_EXECUTE)) { if(m_utility_edit_control_switch[0] != false) { int_array[4] = int_array[0]; int_array[5] = int_array[1]; int_array[6] = int_array[2]; int_array[7] = int_array[3]; } if(m_utility_edit_control_switch[1] != false) { int_array[0] = int_array[4]; int_array[1] = int_array[5]; int_array[2] = int_array[6]; int_array[3] = int_array[7]; } if(m_utility_edit_control_switch[2] != false) { int t1 = int_array[4]; int t2 = int_array[5]; int t3 = int_array[6]; int t4 = int_array[7]; int_array[4] = int_array[0]; int_array[5] = int_array[1]; int_array[6] = int_array[2]; int_array[7] = int_array[3]; int_array[0] = t1; int_array[1] = t2; int_array[2] = t3; int_array[3] = t4; } } content_sub_y += 25.0f; } content_sub_y += 5.0f; } { { m_other_setting_switch = GUI.Toggle(new Rect(content_x - 5.0f, content_sub_y, content_width, 20.0f), m_other_setting_switch, ConstValues.OTHER_SETTING_TITLE); content_sub_y += 20.0f; } if(m_other_setting_switch != false) { m_other_setting_control_switch[0] = GUI.Toggle(new Rect(content_x, content_sub_y, content_width, 20.0f), m_other_setting_control_switch[0], ConstValues.OTHER_SETTING_DISABLE_GAME_CONTROL); content_sub_y += 20.0f; } content_sub_y += 5.0f; } GUI.EndScrollView(); } GUI.EndGroup(); label_style.fontSize = default_label_font_size; label_style.alignment = default_label_alignment; label_style.normal.textColor = default_label_text_color; button_style.fontSize = default_button_font_size; button_style.alignment = default_button_alignment; button_style.normal.textColor = default_button_text_color; toggle_style.fontSize = default_toggle_font_size; toggle_style.alignment = default_toggle_alignment; toggle_style.normal.textColor = default_toggle_text_color; } COLOR_VALUE color_value = COLOR_VALUE.FromIntArray(int_array); if(color_value.equals(m_control_color_value) == false) { update_color_palette(color_value); m_control_color_value = color_value; } }
private void update_color_palette(COLOR_VALUE param_color_value) { m_set_parts_color.Invoke(m_color_palette_ctrl, new object[] { param_color_value.to_parts_color() }); m_color_palette_ctrl.LoadPaletteData(param_color_value.to_parts_color()); m_color_value = COLOR_VALUE.FromPartsColor((MaidParts.PartsColor)m_get_parts_color.Invoke(m_color_palette_ctrl, null)); }
public static COLOR_VALUE FromIntArray(int[] param_value) { COLOR_VALUE retval; if((param_value != null) && (param_value.Length == 9)) { retval.m_main_hue = param_value[0]; retval.m_main_chroma = param_value[1]; retval.m_main_brightness = param_value[2]; retval.m_main_contrast = param_value[3]; retval.m_shadow_hue = param_value[4]; retval.m_shadow_chroma = param_value[5]; retval.m_shadow_brightness = param_value[6]; retval.m_shadow_contrast = param_value[7]; retval.m_shadow_rate = param_value[8]; } else { retval = new COLOR_VALUE(); } return retval; }
public bool equals(COLOR_VALUE param_value) { return ( (m_main_hue == param_value.m_main_hue) && (m_main_chroma == param_value.m_main_chroma) && (m_main_brightness == param_value.m_main_brightness) && (m_main_contrast == param_value.m_main_contrast) && (m_shadow_hue == param_value.m_shadow_hue) && (m_shadow_chroma == param_value.m_shadow_chroma) && (m_shadow_brightness == param_value.m_shadow_brightness) && (m_shadow_contrast == param_value.m_shadow_contrast) && (m_shadow_rate == param_value.m_shadow_rate) ); }
public void Update() { if(is_scene_edit_level()) { return; } if(m_color_palette_panel == null) { m_color_palette_panel = GameObject.Find("UI Root/ColorPalettePanel"); } if((m_color_palette_panel != null) && (m_color_palette_ctrl == null)) { m_color_palette_ctrl = m_color_palette_panel.GetComponent<ColorPaletteCtrl>(); } if(is_available() == false) { return; } bool is_visible; if(ConfigMgr.Instance.IsOpenConfigPanel()) { is_visible = false; } else { is_visible = m_color_palette_panel.activeInHierarchy; } if(is_visible == false) { m_is_visible = is_visible; return; } if((is_visible != m_is_visible) || ((int)ColorPaletteState.m_eCurrentParts != m_current_parts) || ((int)ColorPaletteState.m_eCurrentColorTab != m_current_color_tab) || ((int)ColorPaletteState.m_eCurrentEyePartsTab != m_current_eye_parts_tab)) { update_color_palette(COLOR_VALUE.FromPartsColor((MaidParts.PartsColor)m_get_parts_color.Invoke(m_color_palette_ctrl, null))); m_control_color_value = m_color_value; } else { COLOR_VALUE color_value = COLOR_VALUE.FromPartsColor((MaidParts.PartsColor)m_get_parts_color.Invoke(m_color_palette_ctrl, null)); if(color_value.equals(m_color_value) == false) { m_color_value = color_value; m_control_color_value = color_value; } } m_is_visible = is_visible; m_current_parts = (int)ColorPaletteState.m_eCurrentParts; m_current_color_tab = (int)ColorPaletteState.m_eCurrentColorTab; m_current_eye_parts_tab = (int)ColorPaletteState.m_eCurrentEyePartsTab; { bool state; if(m_other_setting_control_switch[0] != false) { state = calculate_window_rect().Contains(new Vector2(Input.mousePosition.x, (Screen.height - 1) - Input.mousePosition.y)) == false; } else { state = true; } if(GameMain.Instance.MainCamera.GetControl() != state) { GameMain.Instance.MainCamera.SetControl(state); } if(UICamera.InputEnable != state) { UICamera.InputEnable = state; } } }