/// <summary>R /// Record down the GUI component once. /// </summary> private void RecordOnce() { if (mIsFocused) { mIsFocused = false; if (CheckSameData(GetCurrentUIPrevData())) { return; } } if (!IsRecording()) { return; } mUndoRedoSystem.ClearRedoComp(); ClearAllRedo(); switch (mGUIType) { case JCS_GUIType.INPUT_FIELD: { mIF_Undo.Add(mPrevInputFieldData); JCS_InputFieldData ifd = new JCS_InputFieldData { text = mInputField.text }; mPrevInputFieldData = ifd; mIF_Redo.Add(ifd); } break; case JCS_GUIType.DROP_DOWN: { mDD_Undo.Add(mPrevDropdownData); JCS_DropdownData ddd = new JCS_DropdownData { value = mDropdown.value }; mPrevDropdownData = ddd; mDD_Redo.Add(ddd); } break; case JCS_GUIType.SLIDER: { mSli_Undo.Add(mPrevSliderData); JCS_SliderData sd = new JCS_SliderData { value = mSlider.value }; mPrevSliderData = sd; mSli_Redo.Add(sd); } break; case JCS_GUIType.SCROLL_BAR: { mSB_Undo.Add(mPrevScrollbarData); JCS_ScrollbarData sbd = new JCS_ScrollbarData { value = mScrollBar.value }; mPrevScrollbarData = sbd; mSB_Redo.Add(sbd); } break; case JCS_GUIType.TOGGLE: { mTog_Undo.Add(mPrevToggleData); JCS_ToggleData td = new JCS_ToggleData(); if (mToggle != null) { td.isOn = mToggle.isOn; } else if (mJCSToggle != null) { td.isOn = mJCSToggle.IsOn; } else { JCS_Debug.LogError("Cannot record toggle object " + "without any toggle object component attached.."); } mPrevToggleData = td; mTog_Redo.Add(td); } break; } // Add it to next undo component. mUndoRedoSystem.AddUndoComponent(this); }
/// <summary>R /// Record down the GUI component once. /// </summary> private void RecordOnce() { if (mIgnoreRecord) { return; } mUndoRedoSystem.ClearRedoComp(); ClearAllRedo(); switch (mGUIType) { case JCS_GUIType.INPUT_FIELD: { mIF_Undo.Add(mPrevInputFieldData); JCS_InputFieldData ifd = new JCS_InputFieldData { text = mInputField.text }; mPrevInputFieldData = ifd; mIF_Redo.Add(ifd); } break; case JCS_GUIType.DROP_DOWN: { mDD_Undo.Add(mPrevDropdownData); JCS_DropdownData ddd = new JCS_DropdownData { value = mDropdown.value }; mPrevDropdownData = ddd; mDD_Redo.Add(ddd); } break; case JCS_GUIType.SLIDER: { mSli_Undo.Add(mPrevSliderData); JCS_SliderData sd = new JCS_SliderData { value = mSlider.value }; mPrevSliderData = sd; mSli_Redo.Add(sd); } break; case JCS_GUIType.SCROLL_BAR: { mSB_Undo.Add(mPrevScrollbarData); JCS_ScrollbarData sbd = new JCS_ScrollbarData { value = mScrollBar.value }; mPrevScrollbarData = sbd; mSB_Redo.Add(sbd); } break; case JCS_GUIType.TOGGLE: { mTog_Undo.Add(mPrevToggleData); JCS_ToggleData td = new JCS_ToggleData { isOn = mToggle.isOn }; mPrevToggleData = td; mTog_Redo.Add(td); } break; } // Add it to next undo component. mUndoRedoSystem.AddUndoComponent(this); }