diff --git a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room1/Room1_preinstall.json b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room1/Room1_preinstall.json index 65519d9..54d97a5 100644 --- a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room1/Room1_preinstall.json +++ b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room1/Room1_preinstall.json @@ -1 +1 @@ -[{"Name":"test1","Weight":100,"Remark":"","WaveList":[[{"Position":{"X":-44,"Y":-58},"Size":{"X":20,"Y":10},"DelayTime":0,"MarkList":[{"Id":"weapon0001","Weight":100,"Attr":{"CurrAmmon":"0","ResidueAmmo":"0"}}]},{"Position":{"X":0,"Y":-53},"Size":{"X":50,"Y":20},"DelayTime":0,"MarkList":[{"Id":"weapon0002","Weight":100,"Attr":{"CurrAmmon":"0","ResidueAmmo":"0"}}]}],[{"Position":{"X":-43,"Y":-20},"Size":{"X":40,"Y":23},"DelayTime":0,"MarkList":[{"Id":"weapon0005","Weight":100,"Attr":{"CurrAmmon":"0","ResidueAmmo":"0"}}]},{"Position":{"X":9,"Y":-20},"Size":{"X":30,"Y":30},"DelayTime":0,"MarkList":[{"Id":"weapon0006","Weight":100,"Attr":{"CurrAmmon":"0","ResidueAmmo":"0"}}]}]]}] \ No newline at end of file +[{"Name":"test1","Weight":100,"Remark":"","WaveList":[[{"Position":{"X":-44,"Y":-58},"Size":{"X":20,"Y":10},"DelayTime":0,"MarkList":[{"Id":"weapon0001","Weight":100,"Attr":{"CurrAmmon":"15","ResidueAmmo":"45"}}]},{"Position":{"X":113,"Y":-31},"Size":{"X":8,"Y":74},"DelayTime":0,"MarkList":[{"Id":"weapon0002","Weight":100,"Attr":{"CurrAmmon":"0","ResidueAmmo":"0"}}]},{"Position":{"X":64,"Y":28},"Size":{"X":106,"Y":65},"DelayTime":0,"MarkList":[{"Id":"weapon0001","Weight":100,"Attr":{"CurrAmmon":"0","ResidueAmmo":"0"}}]}],[{"Position":{"X":-42,"Y":-23},"Size":{"X":48,"Y":33},"DelayTime":0,"MarkList":[{"Id":"weapon0005","Weight":100,"Attr":{"CurrAmmon":"0","ResidueAmmo":"0"}}]},{"Position":{"X":23,"Y":18},"Size":{"X":22,"Y":82},"DelayTime":0,"MarkList":[{"Id":"weapon0006","Weight":100,"Attr":{"CurrAmmon":"0","ResidueAmmo":"0"}}]},{"Position":{"X":5,"Y":-46},"Size":{"X":61,"Y":40},"DelayTime":3,"MarkList":[{"Id":"weapon0007","Weight":100,"Attr":{"CurrAmmon":"60","ResidueAmmo":"300"}},{"Id":"enemy0001","Weight":100,"Attr":{"Weapon":"0","CurrAmmon":"100","ResidueAmmo":"50"}}]}]]}] \ No newline at end of file diff --git a/DungeonShooting_Godot/src/framework/map/data/MarkInfo.cs b/DungeonShooting_Godot/src/framework/map/data/MarkInfo.cs index 8d1900f..610f639 100644 --- a/DungeonShooting_Godot/src/framework/map/data/MarkInfo.cs +++ b/DungeonShooting_Godot/src/framework/map/data/MarkInfo.cs @@ -30,4 +30,15 @@ /// [JsonInclude] public List MarkList; + + /// + /// 从指定 MarkInfo 克隆数据, 浅拷贝 + /// + public void CloneFrom(MarkInfo mark) + { + Position = mark.Position; + Size = mark.Size; + DelayTime = mark.DelayTime; + MarkList = mark.MarkList; + } } \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/event/EventEnum.cs b/DungeonShooting_Godot/src/game/event/EventEnum.cs index f597e42..0fae09b 100644 --- a/DungeonShooting_Godot/src/game/event/EventEnum.cs +++ b/DungeonShooting_Godot/src/game/event/EventEnum.cs @@ -98,7 +98,7 @@ /// OnSelectPreinstall, /// - /// 选中波数, 参数或者null + /// 选中波数, 参数 /// OnSelectWave, /// @@ -106,6 +106,10 @@ /// OnCreateMark, /// + /// 修改标记, 参数 + /// + OnEditMark, + /// /// 选中标记, 参数或者null /// OnSelectMark, diff --git a/DungeonShooting_Godot/src/game/manager/EditorWindowManager.cs b/DungeonShooting_Godot/src/game/manager/EditorWindowManager.cs index 80860cd..1d17f07 100644 --- a/DungeonShooting_Godot/src/game/manager/EditorWindowManager.cs +++ b/DungeonShooting_Godot/src/game/manager/EditorWindowManager.cs @@ -166,9 +166,10 @@ /// 打开创建标记页面 /// /// 创建标记回调 - public static void ShowCreateMark(Action onCreateMarkInfo) + /// 所属父级Ui + public static void ShowCreateMark(Action onCreateMarkInfo, UiBase parentUi = null) { - var window = UiManager.Open_EditorWindow(); + var window = CreateWindowInstance(parentUi); window.SetWindowTitle("创建标记"); window.SetWindowSize(new Vector2I(1400, 900)); var body = window.OpenBody(UiManager.UiName.MapEditorCreateMark); @@ -188,6 +189,36 @@ }) ); } + + /// + /// 打开编辑标记页面 + /// + /// 标记数据对象 + /// 保存时回调 + /// 所属父级Ui + public static void ShowEditMark(MarkInfo data, Action onSaveMarkInfo, UiBase parentUi = null) + { + var window = CreateWindowInstance(parentUi); + window.SetWindowTitle("编辑标记"); + window.SetWindowSize(new Vector2I(1400, 900)); + var body = window.OpenBody(UiManager.UiName.MapEditorCreateMark); + body.InitData(data); + window.SetButtonList( + new EditorWindowPanel.ButtonData("确定", () => + { + var markInfo = body.GetMarkInfo(); + if (markInfo != null) + { + window.CloseWindow(); + onSaveMarkInfo(markInfo); + } + }), + new EditorWindowPanel.ButtonData("取消", () => + { + window.CloseWindow(); + }) + ); + } /// /// 打开选中的物体 diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/MapEditorCreateMarkPanel.cs b/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/MapEditorCreateMarkPanel.cs index 4709a66..a01628d 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/MapEditorCreateMarkPanel.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/MapEditorCreateMarkPanel.cs @@ -28,6 +28,19 @@ { _grid.Destroy(); } + + /// + /// 初始化面板数据 + /// + public void InitData(MarkInfo data) + { + S_SizeX.Instance.Value = data.Size.X; + S_SizeY.Instance.Value = data.Size.Y; + S_PosX.Instance.Value = data.Position.X; + S_PosY.Instance.Value = data.Position.Y; + S_DelayInput.Instance.Value = data.DelayTime; + _grid.SetDataList(data.MarkList.ToArray()); + } /// /// 获取填写的标记数据 @@ -63,13 +76,13 @@ /// /// 属性字符串名称 /// 属性名称 - public NumberAttribute CreateNumberBar(string attrName, string attrLabel) + public NumberBar CreateNumberBar(string attrName, string attrLabel) { var numberBar = S_NumberBar.Clone(); numberBar.Instance.AttrName = attrName; numberBar.L_AttrName.Instance.Text = attrLabel; numberBar.Instance.Visible = true; - return numberBar.Instance; + return numberBar; } //点击添加标记按钮 diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/MarkObjectCell.cs b/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/MarkObjectCell.cs index 975fce2..9356f59 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/MarkObjectCell.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/MarkObjectCell.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using Config; namespace UI.MapEditorCreateMark; @@ -9,7 +10,7 @@ //是否展开 private bool _isExpand = false; private MapEditorCreateMark.ExpandPanel _expandPanel; - private List _attributeBases; + private List _attributeBases; private ExcelConfig.ActivityObject _activityObject; public override void OnInit() @@ -20,7 +21,7 @@ public override void OnSetData(MarkInfoItem data) { - //记得判断随机对象, 后面在做 + //记得判断随机对象, 后面再做 _activityObject = ExcelConfig.ActivityObject_Map[data.Id]; @@ -74,7 +75,7 @@ markInfoItem.Attr = new Dictionary(); foreach (var attributeBase in _attributeBases) { - markInfoItem.Attr.Add(attributeBase.AttrName, attributeBase.GetAttributeValue()); + markInfoItem.Attr.Add(attributeBase.Instance.AttrName, attributeBase.Instance.GetAttributeValue()); } } return markInfoItem; @@ -131,13 +132,38 @@ var numberBar2 = CellNode.UiPanel.CreateNumberBar("ResidueAmmo", "剩余弹药量:"); _expandPanel.L_ExpandGrid.AddChild(numberBar); _expandPanel.L_ExpandGrid.AddChild(numberBar2); - _attributeBases = new List(); + _attributeBases = new List(); _attributeBases.Add(numberBar); _attributeBases.Add(numberBar2); - + if (markInfoItem != null) //初始化数据 { - + numberBar.L_NumInput.Instance.MinValue = 0; + numberBar2.L_NumInput.Instance.MinValue = 0; + //武器配置数据 + var weapon = ExcelConfig.Weapon_List.Find(weapon => weapon.WeaponId == activityObject.Id); + if (weapon != null) + { + numberBar.L_NumInput.Instance.MaxValue = weapon.AmmoCapacity; //弹夹上限 + numberBar2.L_NumInput.Instance.MaxValue = weapon.MaxAmmoCapacity; //容量上限 + } + + if (markInfoItem.Attr != null) + { + if (markInfoItem.Attr.TryGetValue("CurrAmmon", out var currAmmon)) //弹夹弹药量 + { + numberBar.L_NumInput.Instance.Value = float.Parse(currAmmon); + } + if (markInfoItem.Attr.TryGetValue("ResidueAmmo", out var residueAmmo)) //剩余弹药量 + { + numberBar2.L_NumInput.Instance.Value = float.Parse(residueAmmo); + } + } + else + { + numberBar.L_NumInput.Instance.Value = numberBar.L_NumInput.Instance.MaxValue; + numberBar2.L_NumInput.Instance.Value = (int)(numberBar2.L_NumInput.Instance.MaxValue / 2); + } } } else if (activityObject.Type == 4) //敌人 @@ -148,14 +174,39 @@ _expandPanel.L_ExpandGrid.AddChild(numberBar); _expandPanel.L_ExpandGrid.AddChild(numberBar2); _expandPanel.L_ExpandGrid.AddChild(numberBar3); - _attributeBases = new List(); + _attributeBases = new List(); _attributeBases.Add(numberBar); _attributeBases.Add(numberBar2); _attributeBases.Add(numberBar3); if (markInfoItem != null) //初始化数据 { + numberBar2.L_NumInput.Instance.MinValue = 0; + numberBar3.L_NumInput.Instance.MinValue = 0; + //武器配置数据 + var weapon = ExcelConfig.Weapon_List.Find(weapon => weapon.WeaponId == activityObject.Id); + if (weapon != null) + { + numberBar2.L_NumInput.Instance.MaxValue = weapon.AmmoCapacity; //弹夹上限 + numberBar3.L_NumInput.Instance.MaxValue = weapon.MaxAmmoCapacity; //容量上限 + } + if (markInfoItem.Attr != null) + { + if (markInfoItem.Attr.TryGetValue("CurrAmmon", out var currAmmon)) //弹夹弹药量 + { + numberBar2.L_NumInput.Instance.Value = float.Parse(currAmmon); + } + if (markInfoItem.Attr.TryGetValue("ResidueAmmo", out var residueAmmo)) //剩余弹药量 + { + numberBar3.L_NumInput.Instance.Value = float.Parse(residueAmmo); + } + } + else + { + numberBar2.L_NumInput.Instance.Value = numberBar2.L_NumInput.Instance.MaxValue; + numberBar3.L_NumInput.Instance.Value = (int)(numberBar3.L_NumInput.Instance.MaxValue / 2); + } } } } diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/MapEditorMapMarkPanel.cs b/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/MapEditorMapMarkPanel.cs index 9f80c35..6e3e576 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/MapEditorMapMarkPanel.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/MapEditorMapMarkPanel.cs @@ -339,7 +339,19 @@ /// public void OnEditMark() { - + if (SelectCell is EditorMarkCell markCell) + { + var dataMarkInfo = markCell.Data.MarkInfo; + //打开编辑面板 + EditorWindowManager.ShowEditMark(dataMarkInfo, (mark) => + { + //为了引用不变, 所以这里使用克隆数据 + dataMarkInfo.CloneFrom(mark); + //刷新 Cell + markCell.SetData(markCell.Data); + EventManager.EmitEvent(EventEnum.OnEditMark, dataMarkInfo); + }); + } } /// diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorTools/MapEditorToolsPanel.cs b/DungeonShooting_Godot/src/game/ui/mapEditorTools/MapEditorToolsPanel.cs index ed3d20c..05a4f17 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditorTools/MapEditorToolsPanel.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditorTools/MapEditorToolsPanel.cs @@ -91,9 +91,11 @@ public override void OnShowUi() { _eventFactory = EventManager.CreateEventFactory(); + _eventFactory.AddEventListener(EventEnum.OnSelectWave, OnSelectWaveTool); _eventFactory.AddEventListener(EventEnum.OnCreateMark, OnCreateMarkTool); _eventFactory.AddEventListener(EventEnum.OnSelectMark, OnSelectMarkTool); _eventFactory.AddEventListener(EventEnum.OnDeleteMark, OnDeleteMarkTool); + _eventFactory.AddEventListener(EventEnum.OnEditMark, OnEditMarkTool); _eventFactory.AddEventListener(EventEnum.OnSelectPreinstall, RefreshMark); } @@ -145,6 +147,31 @@ } } + //选中波数 + private void OnSelectWaveTool(object arg) + { + var selectIndex = (int)arg; + var waveList = EditorMap.Instance.SelectPreinstall.WaveList; + for (var i = 0; i < waveList.Count; i++) + { + var wave = waveList[i]; + foreach (var markInfo in wave) + { + if (_currMarkToolsMap.TryGetValue(markInfo, out var markTemplate)) + { + if (i == selectIndex) //选中当前波数, 透明度改为1 + { + markTemplate.Instance.SetModulateAlpha(1f); + } + else //未选中当前波数, 透明度改为0.6 + { + markTemplate.Instance.SetModulateAlpha(0.45f); + } + } + } + } + } + //创建标记 private void OnCreateMarkTool(object arg) { @@ -198,6 +225,19 @@ } } } + + //编辑标记 + private void OnEditMarkTool(object arg) + { + if (arg is MarkInfo markInfo) + { + if (_currMarkToolsMap.TryGetValue(markInfo, out var markTemplate)) + { + //更新坐标 + markTemplate.Instance.Position = markInfo.Position.AsVector2(); + } + } + } /// /// 获取门区域对象 diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorTools/MarkAreaTool.cs b/DungeonShooting_Godot/src/game/ui/mapEditorTools/MarkAreaTool.cs index b55ac19..671ce3a 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditorTools/MarkAreaTool.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditorTools/MarkAreaTool.cs @@ -70,28 +70,28 @@ { var offset = globalMousePosition - _startMousePosition; offset = offset / _toolRoot.Instance.Scale * 2f; - var newWidth = Mathf.Max(2, (int)(_startWidth - offset.X)); + var newWidth = Mathf.Max(0, (int)(_startWidth - offset.X)); _markInfo.Size = new SerializeVector2(newWidth, _markInfo.Size.Y); } else if (_mouseInR) { var offset = _startMousePosition - globalMousePosition; offset = offset / _toolRoot.Instance.Scale * 2f; - var newWidth = Mathf.Max(2, (int)(_startWidth - offset.X)); + var newWidth = Mathf.Max(0, (int)(_startWidth - offset.X)); _markInfo.Size = new SerializeVector2(newWidth, _markInfo.Size.Y); } else if (_mouseInT) { var offset = globalMousePosition - _startMousePosition; offset = offset / _toolRoot.Instance.Scale * 2f; - var newHeight = Mathf.Max(2, (int)(_startHeight - offset.Y)); + var newHeight = Mathf.Max(0, (int)(_startHeight - offset.Y)); _markInfo.Size = new SerializeVector2(_markInfo.Size.X, newHeight); } else if (_mouseInB) { var offset = _startMousePosition - globalMousePosition; offset = offset / _toolRoot.Instance.Scale * 2f; - var newHeight = Mathf.Max(2, (int)(_startHeight - offset.Y)); + var newHeight = Mathf.Max(0, (int)(_startHeight - offset.Y)); _markInfo.Size = new SerializeVector2(_markInfo.Size.X, newHeight); } //---------------------------------------------------------------------------------- @@ -99,32 +99,32 @@ { var offset = globalMousePosition - _startMousePosition; offset = offset / _toolRoot.Instance.Scale * 2f; - var newWidth = Mathf.Max(2, (int)(_startWidth - offset.X)); - var newHeight = Mathf.Max(2, (int)(_startHeight - offset.Y)); + var newWidth = Mathf.Max(0, (int)(_startWidth - offset.X)); + var newHeight = Mathf.Max(0, (int)(_startHeight - offset.Y)); _markInfo.Size = new SerializeVector2(newWidth, newHeight); } else if (_mouseInLB) { var offsetX = (globalMousePosition.X - _startMousePosition.X) / _toolRoot.Instance.Scale.X * 2f; var offsetY = (_startMousePosition.Y - globalMousePosition.Y) / _toolRoot.Instance.Scale.Y * 2f; - var newWidth = Mathf.Max(2, (int)(_startWidth - offsetX)); - var newHeight = Mathf.Max(2, (int)(_startHeight - offsetY)); + var newWidth = Mathf.Max(0, (int)(_startWidth - offsetX)); + var newHeight = Mathf.Max(0, (int)(_startHeight - offsetY)); _markInfo.Size = new SerializeVector2(newWidth, newHeight); } else if (_mouseInRT) { var offsetX = (_startMousePosition.X - globalMousePosition.X) / _toolRoot.Instance.Scale.X * 2f; var offsetY = (globalMousePosition.Y - _startMousePosition.Y) / _toolRoot.Instance.Scale.Y * 2f; - var newWidth = Mathf.Max(2, (int)(_startWidth - offsetX)); - var newHeight = Mathf.Max(2, (int)(_startHeight - offsetY)); + var newWidth = Mathf.Max(0, (int)(_startWidth - offsetX)); + var newHeight = Mathf.Max(0, (int)(_startHeight - offsetY)); _markInfo.Size = new SerializeVector2(newWidth, newHeight); } else if (_mouseInRB) { var offset = _startMousePosition - globalMousePosition; offset = offset / _toolRoot.Instance.Scale * 2f; - var newWidth = Mathf.Max(2, (int)(_startWidth - offset.X)); - var newHeight = Mathf.Max(2, (int)(_startHeight - offset.Y)); + var newWidth = Mathf.Max(0, (int)(_startWidth - offset.X)); + var newHeight = Mathf.Max(0, (int)(_startHeight - offset.Y)); _markInfo.Size = new SerializeVector2(newWidth, newHeight); } _prevMousePosition = pos; @@ -229,41 +229,41 @@ private Rect2 GetTopRect() { - return new Rect2(-_markInfo.Size.X / 2f + 0.5f, -_markInfo.Size.Y / 2f - 0.5f, _markInfo.Size.X - 1, 1); + return new Rect2(-(_markInfo.Size.X + 2) / 2f + 0.5f, -(_markInfo.Size.Y + 2) / 2f - 0.5f, (_markInfo.Size.X + 2) - 1, 1); } private Rect2 GetBottomRect() { - return new Rect2(-_markInfo.Size.X / 2f + 0.5f, _markInfo.Size.Y / 2f - 0.5f, _markInfo.Size.X - 1, 1); + return new Rect2(-(_markInfo.Size.X + 2) / 2f + 0.5f, (_markInfo.Size.Y + 2) / 2f - 0.5f, (_markInfo.Size.X + 2) - 1, 1); } private Rect2 GetLeftRect() { - return new Rect2(-_markInfo.Size.X / 2f - 0.5f, -_markInfo.Size.Y / 2f + 0.5f, 1, _markInfo.Size.Y - 1); + return new Rect2(-(_markInfo.Size.X + 2) / 2f - 0.5f, -(_markInfo.Size.Y + 2) / 2f + 0.5f, 1, (_markInfo.Size.Y + 2) - 1); } private Rect2 GetRightRect() { - return new Rect2(_markInfo.Size.X / 2f - 0.5f, -_markInfo.Size.Y / 2f + 0.5f, 1, _markInfo.Size.Y - 1); + return new Rect2((_markInfo.Size.X + 2) / 2f - 0.5f, -(_markInfo.Size.Y + 2) / 2f + 0.5f, 1, (_markInfo.Size.Y + 2) - 1); } private Rect2 GetLeftTopRect() { - return new Rect2(-_markInfo.Size.X / 2f - 1.5f, -_markInfo.Size.Y / 2f - 1.5f, 3, 3); + return new Rect2(-(_markInfo.Size.X + 2) / 2f - 1.5f, -(_markInfo.Size.Y + 2) / 2f - 1.5f, 3, 3); } private Rect2 GetLeftBottomRect() { - return new Rect2(-_markInfo.Size.X / 2f - 1.5f, _markInfo.Size.Y / 2f - 1.5f, 3, 3); + return new Rect2(-(_markInfo.Size.X + 2) / 2f - 1.5f, (_markInfo.Size.Y + 2) / 2f - 1.5f, 3, 3); } private Rect2 GetRightTopRect() { - return new Rect2(_markInfo.Size.X / 2f - 1.5f, -_markInfo.Size.Y / 2f - 1.5f, 3, 3); + return new Rect2((_markInfo.Size.X + 2) / 2f - 1.5f, -(_markInfo.Size.Y + 2) / 2f - 1.5f, 3, 3); } private Rect2 GetRightBottomRect() { - return new Rect2(_markInfo.Size.X / 2f - 1.5f, _markInfo.Size.Y / 2f - 1.5f, 3, 3); + return new Rect2((_markInfo.Size.X + 2) / 2f - 1.5f, (_markInfo.Size.Y + 2) / 2f - 1.5f, 3, 3); } } \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorTools/MarkTool.cs b/DungeonShooting_Godot/src/game/ui/mapEditorTools/MarkTool.cs index ce482f4..3c71246 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditorTools/MarkTool.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditorTools/MarkTool.cs @@ -79,7 +79,7 @@ } //只有选中物体才会显示拖拽区域 - if (_toolNode.UiPanel.ActiveMark == this && MarkInfo.Size.X > 0 && MarkInfo.Size.Y > 0) + if (_toolNode.UiPanel.ActiveMark == this) { _markAreaToolUp.Visible = true; } @@ -113,10 +113,10 @@ public override void _Draw() { - if (MarkInfo != null && MarkInfo.Size.X > 0 && MarkInfo.Size.Y > 0 && !_markAreaToolUp.Visible) + if (MarkInfo != null && !_markAreaToolUp.Visible) { - var size = MarkInfo.Size.AsVector2(); - DrawRect(new Rect2(-size / 2 + Size / 2, size.X, size.Y), new Color(1, 1, 1, 0.3f), false, 1); + var size = new Vector2(MarkInfo.Size.X + 2, MarkInfo.Size.Y + 2); + DrawRect(new Rect2(-size / 2 + Size / 2, size.X, size.Y), new Color(1, 1, 1, 0.7f), false, 1); } } @@ -137,4 +137,14 @@ var a = Modulate.A; Modulate = new Color(1, 1, 1, a); } + + /// + /// 设置透明度值 + /// + public void SetModulateAlpha(float a) + { + var m = Modulate; + m.A = a; + Modulate = m; + } } \ No newline at end of file