/// <summary> /// 设置当前页面所有控件的选中状态 /// </summary> /// <param Name="enabled">true表示所有控件选中,false表示所有控件反选</param> public void selectAll(Boolean enabled) { List <SVPanel> vList = new List <SVPanel>(); foreach (Control item in this.Controls) { SVPanel panel = item as SVPanel; if (panel == null) { continue; } if (enabled) { if (panel.IsMoved) { vList.Add(panel); } } else { vList.Add(panel); } } RedoUndo.setEnabled(false); foreach (var item in vList) { item.Selected = enabled; } RedoUndo.setEnabled(true); this.Refresh(); }
private static void EntityCheck(Entity entity) { if (!_positions.ContainsKey(entity)) { _positions.Add(entity, new UserData()); } if (!_undoData.ContainsKey(entity.PlayerEntityLogic.Uid())) { var data = new RedoUndo(); var pause = false; if (FoxCore.SaveDirectory.FileExists($"{entity.PlayerEntityLogic.Uid()}.dat")) { pause = true; FoxCore.SaveDirectory.ReadFile <RedoUndo>($"{entity.PlayerEntityLogic.Uid()}.dat", data1 => { data = data1; var dir = FoxCore.SaveDirectory.FetchDirectory(entity.PlayerEntityLogic.Uid()); var files = dir.Files; foreach (var id in new List <Guid>(data.ID.Keys)) { if (!files.Contains(id.ToString())) { data.ID.Remove(id); if (data.Redo.Contains(id)) { data.Redo.Remove(id); } if (data.Undo.Remove(id)) { data.Undo.Remove(id); } } } if (!UndoClone().ContainsKey(entity.PlayerEntityLogic.Uid())) { _undoData.Add(entity.PlayerEntityLogic.Uid(), data); } pause = false; }); } else { _undoData.Add(entity.PlayerEntityLogic.Uid(), new RedoUndo()); } while (pause) { } } }
/// <summary> /// 重写函数initalizeRedoUndo /// 当按钮属性被修改的时候,执行记录 /// 撤销和重做操作执行的时候,主窗口中控件刷新 /// </summary> override public void initalizeRedoUndo() { this.RedoUndo.UpdateOperator += () => { refreshPropertyToPanel(); }; Attrib.UpdateControl += new UpdateControl((item) => { RedoUndo.recordOper(item); }); }
void setCurrentColor(Button button) { if (!col2) { DropdownDataProvider.currentSelected.GetComponent <MeshRenderer>().material.SetColor("_Color", button.colors.normalColor); RedoUndo.addToHistory(DropdownDataProvider.currentSelected, "_Color", button.colors.normalColor); SliderApply.printToCSV(DropdownDataProvider.currentSelected.name.ToString(), "Color", button.colors.normalColor.ToString()); } else { DropdownDataProvider.currentSelected.GetComponent <MeshRenderer>().material.SetColor("_Color2", button.colors.normalColor); RedoUndo.addToHistory(DropdownDataProvider.currentSelected, "_Color2", button.colors.normalColor); SliderApply.printToCSV(DropdownDataProvider.currentSelected.name.ToString(), "Color2", button.colors.normalColor.ToString()); } }
/// <summary> /// 页面默认值初始化 /// </summary> void initalize() { this._isModify = false; ///允许接收拖拽 this.AllowDrop = true; ///初始化框选功能 initRectSelect(); ///刷新控件 refreshPropertyToPanel(); /////////////////////启用双缓冲/////////////////////// SetStyle(ControlStyles.UserPaint, true); /// 禁止擦除背景. SetStyle(ControlStyles.AllPaintingInWmPaint, true); SetStyle(ControlStyles.DoubleBuffer, true); ///当有撤销和恢复操作发生的时候 ///将当前页面设置为已经被修改状态 RedoUndo.operChanged += new OperatorChanged(() => { IsModify = true; }); //只要是执行撤销和恢复操作,就更新界面显示 RedoUndo.UpdateOperator += new DoFunction(() => { refreshPropertyToPanel(); }); //只要属性值发生变化,就记录,将来进行恢复操作 Attrib.UpdateControl += new UpdateControl((item) => { RedoUndo.recordOper(item); //refreshPropertyToPanel(); }); ///鼠标拖入控件事件 ///判断并过滤不是预期的控件类型 this.DragEnter += new DragEventHandler((sender, e) => { if (!e.Data.GetDataPresent(typeof(SVSelectItem))) { return; } e.Effect = DragDropEffects.Copy | DragDropEffects.Move; }); }
public void DrawOnMap(customRectangle rectangle, Point click) { int defaultY = rectangle.Y; if (QueueChecked) { for (int x = 0; x < rectangle.Width; x++) { for (int y = 0; y < rectangle.Height; y++) { RedoUndo newAction = new RedoUndo(rectangle, this); undoHistory.Push(newAction); Queue tempQueue = new Queue(rectangle.X, rectangle.Y, Convert.ToInt32(rectangle.TypeBlock), this); tempQueue.QueueTask(); rectangle.Y += 1; } rectangle.Y = defaultY; rectangle.X += 1; } } else { for (int x = 0; x < rectangle.Width; x++) { for (int y = 0; y < rectangle.Height; y++) { RedoUndo newAction = new RedoUndo(rectangle, this); undoHistory.Push(newAction); currentMap.SetElement(rectangle.X, rectangle.Y, Convert.ToInt32(rectangle.TypeBlock)); RenderMap(); rectangle.Y += 1; } rectangle.Y = defaultY; rectangle.X += 1; } } }
public void DrawOnMap(Block blok, Point click) { if (QueueChecked) { //checkbox is checked if (CurrentMap.GetElement(blok.X, blok.Y) != Convert.ToInt32(blok.TypeBlock)) { RedoUndo newAction = new RedoUndo(blok, this); UndoHistory.Push(newAction); Queue tempQueue = new Queue(blok.X, blok.Y, Convert.ToInt32(blok.TypeBlock), this); tempQueue.QueueTask(); } } else { if (CurrentMap.GetElement(blok.X, blok.Y) != Convert.ToInt32(blok.TypeBlock)) { RedoUndo newAction = new RedoUndo(blok, this); UndoHistory.Push(newAction); CurrentMap.SetElement(blok.X, blok.Y, Convert.ToInt32(blok.TypeBlock)); //if ((int)click.X % BlockScale == 0 || (int)click.Y % BlockScale == 0) //{ RenderMap(); //} } } }
public void UpSetSpecular(Slider slider) { setSpecular(slider); RedoUndo.addToHistory(DropdownDataProvider.currentSelected, "_Glossiness", slider.value * 0.4f); printToCSV(DropdownDataProvider.currentSelected.name.ToString(), "Specularity", slider.value.ToString()); }
public void UpSetTranparancyFalloff(Slider slider) { setTranparancyFalloff(slider); RedoUndo.addToHistory(DropdownDataProvider.currentSelected, "_AlphaFalloff", slider.value * 0.2f); printToCSV(DropdownDataProvider.currentSelected.name.ToString(), "Falloff", slider.value.ToString()); }
public void UpSetTrancparancy(Slider slider) { setTranparancy(slider); RedoUndo.addToHistory(DropdownDataProvider.currentSelected, "_Alpha", slider.value * 0.1f); printToCSV(DropdownDataProvider.currentSelected.name.ToString(), "Opacity", slider.value.ToString()); }
public void UpSetDepthWeight(Slider slider) { setDepthWeight(slider); RedoUndo.addToHistory(DropdownDataProvider.currentSelected, "_Depth_Weight", slider.value * 0.2f); printToCSV(DropdownDataProvider.currentSelected.name.ToString(), "Depth", slider.value.ToString()); }