Merge branch 'develop' of https://gitee.com/xlljc/DungeonShooting into develop

This commit is contained in:
王晗智 2024-03-08 11:57:24 +08:00
commit 6b6b01e977
7 changed files with 372 additions and 52 deletions

View File

@ -1,9 +1,10 @@
[gd_scene load_steps=7 format=3 uid="uid://dbjpknb3d5gfw"]
[gd_scene load_steps=8 format=3 uid="uid://dbjpknb3d5gfw"]
[ext_resource type="Script" path="res://src/game/ui/weaponRoulette/WeaponRoulettePanel.cs" id="1_1uvbk"]
[ext_resource type="Texture2D" uid="uid://e6krxgte01j3" path="res://resource/sprite/ui/roulette/RouletteBg.png" id="2_k6gjh"]
[ext_resource type="Script" path="res://src/game/ui/weaponRoulette/WeaponSlot.cs" id="3_8v011"]
[ext_resource type="Shader" path="res://resource/material/Outline.gdshader" id="4_p348k"]
[ext_resource type="Texture2D" uid="uid://dmm8jw06bhffh" path="res://resource/sprite/ui/commonIcon/Lock.png" id="6_7mog3"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_i1wmw"]
resource_local_to_scene = true
@ -21,6 +22,7 @@ anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_1uvbk")
metadata/_edit_vertical_guides_ = [960.0, 1220.0]
[node name="Bg" type="ColorRect" parent="."]
layout_mode = 1
@ -46,34 +48,47 @@ grow_horizontal = 2
grow_vertical = 2
[node name="RouletteBg" type="Sprite2D" parent="Control"]
position = Vector2(32.5, -27)
scale = Vector2(4, 4)
texture = ExtResource("2_k6gjh")
[node name="WeaponSlotNode" type="Node2D" parent="Control/RouletteBg"]
script = ExtResource("3_8v011")
[node name="Control" type="Control" parent="Control/RouletteBg/WeaponSlotNode"]
[node name="SlotUi" type="Control" parent="Control/RouletteBg/WeaponSlotNode"]
layout_mode = 3
anchors_preset = 0
offset_left = 65.25
offset_right = 66.25
offset_bottom = 1.0
[node name="WeaponIcon" type="Sprite2D" parent="Control/RouletteBg/WeaponSlotNode/Control"]
material = SubResource("ShaderMaterial_i1wmw")
[node name="AmmoLabel" type="Label" parent="Control/RouletteBg/WeaponSlotNode/Control"]
[node name="WeaponUi" type="Control" parent="Control/RouletteBg/WeaponSlotNode/SlotUi"]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -15.25
offset_top = 4.5
offset_right = 104.75
offset_bottom = 44.5
offset_left = -0.5
offset_top = -0.5
offset_right = 0.5
offset_bottom = 0.5
grow_horizontal = 2
grow_vertical = 2
[node name="WeaponIcon" type="Sprite2D" parent="Control/RouletteBg/WeaponSlotNode/SlotUi/WeaponUi"]
material = SubResource("ShaderMaterial_i1wmw")
[node name="AmmoLabel" type="Label" parent="Control/RouletteBg/WeaponSlotNode/SlotUi/WeaponUi"]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -15.375
offset_top = 8.5
offset_right = 104.625
offset_bottom = 48.5
grow_horizontal = 2
grow_vertical = 2
scale = Vector2(0.25, 0.25)
@ -81,6 +96,10 @@ text = "0/0"
horizontal_alignment = 1
vertical_alignment = 1
[node name="LockSprite" type="Sprite2D" parent="Control/RouletteBg/WeaponSlotNode/SlotUi"]
scale = Vector2(0.25, 0.25)
texture = ExtResource("6_7mog3")
[node name="SlotAreaNode" type="Area2D" parent="Control/RouletteBg/WeaponSlotNode"]
collision_layer = 0
collision_mask = 8192
@ -88,6 +107,56 @@ monitorable = false
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Control/RouletteBg/WeaponSlotNode/SlotAreaNode"]
[node name="ColorRect" type="ColorRect" parent="Control"]
layout_mode = 0
offset_left = -383.0
offset_top = -480.0
offset_right = 385.0
offset_bottom = -424.0
color = Color(0.184314, 0.184314, 0.184314, 0.784314)
[node name="Label" type="Label" parent="Control/ColorRect"]
layout_mode = 1
anchors_preset = 4
anchor_top = 0.5
anchor_bottom = 0.5
offset_left = 10.5
offset_top = -20.0
offset_right = 162.5
offset_bottom = 20.0
grow_vertical = 2
text = "按Q上一页"
[node name="Label2" type="Label" parent="Control/ColorRect"]
layout_mode = 1
anchors_preset = 6
anchor_left = 1.0
anchor_top = 0.5
anchor_right = 1.0
anchor_bottom = 0.5
offset_left = -162.5
offset_top = -20.0
offset_right = -10.5
offset_bottom = 20.0
grow_horizontal = 0
grow_vertical = 2
text = "按E下一页"
[node name="PageLabel" type="Label" parent="Control/ColorRect"]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -4.5
offset_top = -20.0
offset_right = 4.5
offset_bottom = 20.0
grow_horizontal = 2
grow_vertical = 2
text = "1/1"
[node name="MouseArea" type="Area2D" parent="."]
collision_layer = 8192
collision_mask = 0

View File

@ -1 +1 @@
[{"Name":"Preinstall1","Weight":100,"Remark":"","AutoFill":false,"WaveList":[[{"Position":{"X":39,"Y":8},"Size":{"X":0,"Y":0},"SpecialMarkType":1,"DelayTime":0,"MarkList":[]},{"Position":{"X":-16,"Y":-18},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0001","Weight":100,"Attr":{"CurrAmmon":"30","ResidueAmmo":"210"},"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":66,"Y":6},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0009","Weight":100,"Attr":{"CurrAmmon":"1","ResidueAmmo":"25"},"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":66,"Y":47},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0010","Weight":100,"Attr":{"CurrAmmon":"10","ResidueAmmo":"120"},"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":47,"Y":-32},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0008","Weight":100,"Attr":{"CurrAmmon":"10","ResidueAmmo":"120"},"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":23,"Y":37},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"prop0010","Weight":100,"Attr":null,"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":2,"Y":18},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"prop0005","Weight":100,"Attr":null,"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":24,"Y":-30},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0006","Weight":100,"Attr":{"CurrAmmon":"20","ResidueAmmo":"300"},"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":40,"Y":-10},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0003","Weight":100,"Attr":{"CurrAmmon":"12","ResidueAmmo":"90"},"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":2,"Y":-37},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0007","Weight":100,"Attr":{"CurrAmmon":"60","ResidueAmmo":"300"},"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":-2,"Y":47},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0002","Weight":100,"Attr":{"CurrAmmon":"7","ResidueAmmo":"70"},"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":29,"Y":63},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0013","Weight":100,"Attr":{"CurrAmmon":"50","ResidueAmmo":"250"},"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":-30,"Y":39},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"prop0003","Weight":100,"Attr":null,"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":-19,"Y":71},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"prop0003","Weight":100,"Attr":null,"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":48,"Y":29},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0004","Weight":100,"Attr":{"CurrAmmon":"180","ResidueAmmo":"90"},"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":20,"Y":94},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0014","Weight":100,"Attr":{"CurrAmmon":"5","ResidueAmmo":"60"},"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":-14,"Y":97},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0011","Weight":100,"Attr":{"CurrAmmon":"20","ResidueAmmo":"300"},"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":9,"Y":-7},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"prop0011","Weight":100,"Attr":null,"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":-41,"Y":61},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0016","Weight":100,"Attr":{"CurrAmmon":"5","ResidueAmmo":"60"},"Altitude":8,"VerticalSpeed":0}]}]]}]
[{"Name":"Preinstall1","Weight":100,"Remark":"","AutoFill":false,"WaveList":[[{"Position":{"X":39,"Y":8},"Size":{"X":0,"Y":0},"SpecialMarkType":1,"DelayTime":0,"MarkList":[]},{"Position":{"X":-16,"Y":-18},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0001","Weight":100,"Attr":{"CurrAmmon":"30","ResidueAmmo":"210"},"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":66,"Y":6},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0009","Weight":100,"Attr":{"CurrAmmon":"1","ResidueAmmo":"25"},"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":66,"Y":47},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0010","Weight":100,"Attr":{"CurrAmmon":"10","ResidueAmmo":"120"},"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":47,"Y":-32},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0008","Weight":100,"Attr":{"CurrAmmon":"10","ResidueAmmo":"120"},"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":23,"Y":37},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"prop0010","Weight":100,"Attr":null,"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":2,"Y":18},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"prop0005","Weight":100,"Attr":null,"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":24,"Y":-30},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0006","Weight":100,"Attr":{"CurrAmmon":"20","ResidueAmmo":"300"},"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":40,"Y":-10},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0003","Weight":100,"Attr":{"CurrAmmon":"12","ResidueAmmo":"90"},"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":2,"Y":-37},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0007","Weight":100,"Attr":{"CurrAmmon":"60","ResidueAmmo":"300"},"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":-2,"Y":47},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0002","Weight":100,"Attr":{"CurrAmmon":"7","ResidueAmmo":"70"},"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":29,"Y":63},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0013","Weight":100,"Attr":{"CurrAmmon":"50","ResidueAmmo":"250"},"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":-30,"Y":39},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"prop0003","Weight":100,"Attr":null,"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":-19,"Y":71},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"prop0003","Weight":100,"Attr":null,"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":48,"Y":29},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0004","Weight":100,"Attr":{"CurrAmmon":"180","ResidueAmmo":"90"},"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":20,"Y":94},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0014","Weight":100,"Attr":{"CurrAmmon":"5","ResidueAmmo":"60"},"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":-14,"Y":97},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0011","Weight":100,"Attr":{"CurrAmmon":"20","ResidueAmmo":"300"},"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":9,"Y":-7},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"prop0011","Weight":100,"Attr":null,"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":-41,"Y":61},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0016","Weight":100,"Attr":{"CurrAmmon":"5","ResidueAmmo":"60"},"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":73,"Y":-19},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0005","Weight":100,"Attr":{"CurrAmmon":"10","ResidueAmmo":"40"},"Altitude":8,"VerticalSpeed":5.551115E-14}]}]]}]

View File

@ -73,6 +73,8 @@ public partial class Player : Role
//InitSubLine();
_brushData2 = new BrushImageData(ExcelConfig.LiquidMaterial_Map["0001"]);
WeaponPack.SetCapacity(10);
}
private void DebugSet()

View File

@ -62,7 +62,7 @@ public partial class RoomMapPanel : RoomMap
//按下地图按键
if (InputManager.Map && !_isMagnifyMap && !_pressMapFlag) //展开小地图
{
if (UiManager.GetUiInstanceCount(UiManager.UiNames.PauseMenu) == 0)
if (UiManager.GetUiInstanceCount(UiManager.UiNames.PauseMenu) == 0 && !InputManager.Roulette)
{
ExpandMap();
}

View File

@ -65,7 +65,7 @@ public abstract partial class WeaponRoulette : UiBase
}
/// <summary>
/// 类型: <see cref="Godot.Sprite2D"/>, 路径: WeaponRoulette.Control.RouletteBg.WeaponSlotNode.Control.WeaponIcon
/// 类型: <see cref="Godot.Sprite2D"/>, 路径: WeaponRoulette.Control.RouletteBg.WeaponSlotNode.SlotUi.WeaponUi.WeaponIcon
/// </summary>
public class WeaponIcon : UiNode<WeaponRoulettePanel, Godot.Sprite2D, WeaponIcon>
{
@ -74,7 +74,7 @@ public abstract partial class WeaponRoulette : UiBase
}
/// <summary>
/// 类型: <see cref="Godot.Label"/>, 路径: WeaponRoulette.Control.RouletteBg.WeaponSlotNode.Control.AmmoLabel
/// 类型: <see cref="Godot.Label"/>, 路径: WeaponRoulette.Control.RouletteBg.WeaponSlotNode.SlotUi.WeaponUi.AmmoLabel
/// </summary>
public class AmmoLabel : UiNode<WeaponRoulettePanel, Godot.Label, AmmoLabel>
{
@ -83,12 +83,12 @@ public abstract partial class WeaponRoulette : UiBase
}
/// <summary>
/// 类型: <see cref="Godot.Control"/>, 路径: WeaponRoulette.Control.RouletteBg.WeaponSlotNode.Control
/// 类型: <see cref="Godot.Control"/>, 路径: WeaponRoulette.Control.RouletteBg.WeaponSlotNode.SlotUi.WeaponUi
/// </summary>
public class Control_1 : UiNode<WeaponRoulettePanel, Godot.Control, Control_1>
public class WeaponUi : UiNode<WeaponRoulettePanel, Godot.Control, WeaponUi>
{
/// <summary>
/// 使用 Instance 属性获取当前节点实例对象, 节点类型: <see cref="Godot.Sprite2D"/>, 节点路径: WeaponRoulette.Control.RouletteBg.WeaponSlotNode.WeaponIcon
/// 使用 Instance 属性获取当前节点实例对象, 节点类型: <see cref="Godot.Sprite2D"/>, 节点路径: WeaponRoulette.Control.RouletteBg.WeaponSlotNode.SlotUi.WeaponIcon
/// </summary>
public WeaponIcon L_WeaponIcon
{
@ -101,7 +101,7 @@ public abstract partial class WeaponRoulette : UiBase
private WeaponIcon _L_WeaponIcon;
/// <summary>
/// 使用 Instance 属性获取当前节点实例对象, 节点类型: <see cref="Godot.Label"/>, 节点路径: WeaponRoulette.Control.RouletteBg.WeaponSlotNode.AmmoLabel
/// 使用 Instance 属性获取当前节点实例对象, 节点类型: <see cref="Godot.Label"/>, 节点路径: WeaponRoulette.Control.RouletteBg.WeaponSlotNode.SlotUi.AmmoLabel
/// </summary>
public AmmoLabel L_AmmoLabel
{
@ -113,8 +113,52 @@ public abstract partial class WeaponRoulette : UiBase
}
private AmmoLabel _L_AmmoLabel;
public Control_1(WeaponRoulettePanel uiPanel, Godot.Control node) : base(uiPanel, node) { }
public override Control_1 Clone() => new (UiPanel, (Godot.Control)Instance.Duplicate());
public WeaponUi(WeaponRoulettePanel uiPanel, Godot.Control node) : base(uiPanel, node) { }
public override WeaponUi Clone() => new (UiPanel, (Godot.Control)Instance.Duplicate());
}
/// <summary>
/// 类型: <see cref="Godot.Sprite2D"/>, 路径: WeaponRoulette.Control.RouletteBg.WeaponSlotNode.SlotUi.LockSprite
/// </summary>
public class LockSprite : UiNode<WeaponRoulettePanel, Godot.Sprite2D, LockSprite>
{
public LockSprite(WeaponRoulettePanel uiPanel, Godot.Sprite2D node) : base(uiPanel, node) { }
public override LockSprite Clone() => new (UiPanel, (Godot.Sprite2D)Instance.Duplicate());
}
/// <summary>
/// 类型: <see cref="Godot.Control"/>, 路径: WeaponRoulette.Control.RouletteBg.WeaponSlotNode.SlotUi
/// </summary>
public class SlotUi : UiNode<WeaponRoulettePanel, Godot.Control, SlotUi>
{
/// <summary>
/// 使用 Instance 属性获取当前节点实例对象, 节点类型: <see cref="Godot.Control"/>, 节点路径: WeaponRoulette.Control.RouletteBg.WeaponSlotNode.WeaponUi
/// </summary>
public WeaponUi L_WeaponUi
{
get
{
if (_L_WeaponUi == null) _L_WeaponUi = new WeaponUi(UiPanel, Instance.GetNode<Godot.Control>("WeaponUi"));
return _L_WeaponUi;
}
}
private WeaponUi _L_WeaponUi;
/// <summary>
/// 使用 Instance 属性获取当前节点实例对象, 节点类型: <see cref="Godot.Sprite2D"/>, 节点路径: WeaponRoulette.Control.RouletteBg.WeaponSlotNode.LockSprite
/// </summary>
public LockSprite L_LockSprite
{
get
{
if (_L_LockSprite == null) _L_LockSprite = new LockSprite(UiPanel, Instance.GetNode<Godot.Sprite2D>("LockSprite"));
return _L_LockSprite;
}
}
private LockSprite _L_LockSprite;
public SlotUi(WeaponRoulettePanel uiPanel, Godot.Control node) : base(uiPanel, node) { }
public override SlotUi Clone() => new (UiPanel, (Godot.Control)Instance.Duplicate());
}
/// <summary>
@ -154,17 +198,17 @@ public abstract partial class WeaponRoulette : UiBase
public class WeaponSlotNode : UiNode<WeaponRoulettePanel, UI.WeaponRoulette.WeaponSlot, WeaponSlotNode>
{
/// <summary>
/// 使用 Instance 属性获取当前节点实例对象, 节点类型: <see cref="Godot.Control"/>, 节点路径: WeaponRoulette.Control.RouletteBg.Control
/// 使用 Instance 属性获取当前节点实例对象, 节点类型: <see cref="Godot.Control"/>, 节点路径: WeaponRoulette.Control.RouletteBg.SlotUi
/// </summary>
public Control_1 L_Control
public SlotUi L_SlotUi
{
get
{
if (_L_Control == null) _L_Control = new Control_1(UiPanel, Instance.GetNode<Godot.Control>("Control"));
return _L_Control;
if (_L_SlotUi == null) _L_SlotUi = new SlotUi(UiPanel, Instance.GetNode<Godot.Control>("SlotUi"));
return _L_SlotUi;
}
}
private Control_1 _L_Control;
private SlotUi _L_SlotUi;
/// <summary>
/// 使用 Instance 属性获取当前节点实例对象, 节点类型: <see cref="Godot.Area2D"/>, 节点路径: WeaponRoulette.Control.RouletteBg.SlotAreaNode
@ -205,6 +249,81 @@ public abstract partial class WeaponRoulette : UiBase
public override RouletteBg Clone() => new (UiPanel, (Godot.Sprite2D)Instance.Duplicate());
}
/// <summary>
/// 类型: <see cref="Godot.Label"/>, 路径: WeaponRoulette.Control.ColorRect.Label
/// </summary>
public class Label : UiNode<WeaponRoulettePanel, Godot.Label, Label>
{
public Label(WeaponRoulettePanel uiPanel, Godot.Label node) : base(uiPanel, node) { }
public override Label Clone() => new (UiPanel, (Godot.Label)Instance.Duplicate());
}
/// <summary>
/// 类型: <see cref="Godot.Label"/>, 路径: WeaponRoulette.Control.ColorRect.Label2
/// </summary>
public class Label2 : UiNode<WeaponRoulettePanel, Godot.Label, Label2>
{
public Label2(WeaponRoulettePanel uiPanel, Godot.Label node) : base(uiPanel, node) { }
public override Label2 Clone() => new (UiPanel, (Godot.Label)Instance.Duplicate());
}
/// <summary>
/// 类型: <see cref="Godot.Label"/>, 路径: WeaponRoulette.Control.ColorRect.PageLabel
/// </summary>
public class PageLabel : UiNode<WeaponRoulettePanel, Godot.Label, PageLabel>
{
public PageLabel(WeaponRoulettePanel uiPanel, Godot.Label node) : base(uiPanel, node) { }
public override PageLabel Clone() => new (UiPanel, (Godot.Label)Instance.Duplicate());
}
/// <summary>
/// 类型: <see cref="Godot.ColorRect"/>, 路径: WeaponRoulette.Control.ColorRect
/// </summary>
public class ColorRect : UiNode<WeaponRoulettePanel, Godot.ColorRect, ColorRect>
{
/// <summary>
/// 使用 Instance 属性获取当前节点实例对象, 节点类型: <see cref="Godot.Label"/>, 节点路径: WeaponRoulette.Control.Label
/// </summary>
public Label L_Label
{
get
{
if (_L_Label == null) _L_Label = new Label(UiPanel, Instance.GetNode<Godot.Label>("Label"));
return _L_Label;
}
}
private Label _L_Label;
/// <summary>
/// 使用 Instance 属性获取当前节点实例对象, 节点类型: <see cref="Godot.Label"/>, 节点路径: WeaponRoulette.Control.Label2
/// </summary>
public Label2 L_Label2
{
get
{
if (_L_Label2 == null) _L_Label2 = new Label2(UiPanel, Instance.GetNode<Godot.Label>("Label2"));
return _L_Label2;
}
}
private Label2 _L_Label2;
/// <summary>
/// 使用 Instance 属性获取当前节点实例对象, 节点类型: <see cref="Godot.Label"/>, 节点路径: WeaponRoulette.Control.PageLabel
/// </summary>
public PageLabel L_PageLabel
{
get
{
if (_L_PageLabel == null) _L_PageLabel = new PageLabel(UiPanel, Instance.GetNode<Godot.Label>("PageLabel"));
return _L_PageLabel;
}
}
private PageLabel _L_PageLabel;
public ColorRect(WeaponRoulettePanel uiPanel, Godot.ColorRect node) : base(uiPanel, node) { }
public override ColorRect Clone() => new (UiPanel, (Godot.ColorRect)Instance.Duplicate());
}
/// <summary>
/// 类型: <see cref="Godot.Control"/>, 路径: WeaponRoulette.Control
/// </summary>
@ -223,6 +342,19 @@ public abstract partial class WeaponRoulette : UiBase
}
private RouletteBg _L_RouletteBg;
/// <summary>
/// 使用 Instance 属性获取当前节点实例对象, 节点类型: <see cref="Godot.ColorRect"/>, 节点路径: WeaponRoulette.ColorRect
/// </summary>
public ColorRect L_ColorRect
{
get
{
if (_L_ColorRect == null) _L_ColorRect = new ColorRect(UiPanel, Instance.GetNode<Godot.ColorRect>("ColorRect"));
return _L_ColorRect;
}
}
private ColorRect _L_ColorRect;
public Control(WeaponRoulettePanel uiPanel, Godot.Control node) : base(uiPanel, node) { }
public override Control Clone() => new (UiPanel, (Godot.Control)Instance.Duplicate());
}
@ -265,14 +397,29 @@ public abstract partial class WeaponRoulette : UiBase
public Bg S_Bg => L_Bg;
/// <summary>
/// 场景中唯一名称的节点, 节点类型: <see cref="Godot.Sprite2D"/>, 节点路径: WeaponRoulette.Control.RouletteBg.WeaponSlotNode.Control.WeaponIcon
/// 场景中唯一名称的节点, 节点类型: <see cref="Godot.Sprite2D"/>, 节点路径: WeaponRoulette.Control.RouletteBg.WeaponSlotNode.SlotUi.WeaponUi.WeaponIcon
/// </summary>
public WeaponIcon S_WeaponIcon => L_Control.L_RouletteBg.L_WeaponSlotNode.L_Control.L_WeaponIcon;
public WeaponIcon S_WeaponIcon => L_Control.L_RouletteBg.L_WeaponSlotNode.L_SlotUi.L_WeaponUi.L_WeaponIcon;
/// <summary>
/// 场景中唯一名称的节点, 节点类型: <see cref="Godot.Label"/>, 节点路径: WeaponRoulette.Control.RouletteBg.WeaponSlotNode.Control.AmmoLabel
/// 场景中唯一名称的节点, 节点类型: <see cref="Godot.Label"/>, 节点路径: WeaponRoulette.Control.RouletteBg.WeaponSlotNode.SlotUi.WeaponUi.AmmoLabel
/// </summary>
public AmmoLabel S_AmmoLabel => L_Control.L_RouletteBg.L_WeaponSlotNode.L_Control.L_AmmoLabel;
public AmmoLabel S_AmmoLabel => L_Control.L_RouletteBg.L_WeaponSlotNode.L_SlotUi.L_WeaponUi.L_AmmoLabel;
/// <summary>
/// 场景中唯一名称的节点, 节点类型: <see cref="Godot.Control"/>, 节点路径: WeaponRoulette.Control.RouletteBg.WeaponSlotNode.SlotUi.WeaponUi
/// </summary>
public WeaponUi S_WeaponUi => L_Control.L_RouletteBg.L_WeaponSlotNode.L_SlotUi.L_WeaponUi;
/// <summary>
/// 场景中唯一名称的节点, 节点类型: <see cref="Godot.Sprite2D"/>, 节点路径: WeaponRoulette.Control.RouletteBg.WeaponSlotNode.SlotUi.LockSprite
/// </summary>
public LockSprite S_LockSprite => L_Control.L_RouletteBg.L_WeaponSlotNode.L_SlotUi.L_LockSprite;
/// <summary>
/// 场景中唯一名称的节点, 节点类型: <see cref="Godot.Control"/>, 节点路径: WeaponRoulette.Control.RouletteBg.WeaponSlotNode.SlotUi
/// </summary>
public SlotUi S_SlotUi => L_Control.L_RouletteBg.L_WeaponSlotNode.L_SlotUi;
/// <summary>
/// 场景中唯一名称的节点, 节点类型: <see cref="Godot.CollisionPolygon2D"/>, 节点路径: WeaponRoulette.Control.RouletteBg.WeaponSlotNode.SlotAreaNode.CollisionPolygon2D
@ -294,6 +441,31 @@ public abstract partial class WeaponRoulette : UiBase
/// </summary>
public RouletteBg S_RouletteBg => L_Control.L_RouletteBg;
/// <summary>
/// 场景中唯一名称的节点, 节点类型: <see cref="Godot.Label"/>, 节点路径: WeaponRoulette.Control.ColorRect.Label
/// </summary>
public Label S_Label => L_Control.L_ColorRect.L_Label;
/// <summary>
/// 场景中唯一名称的节点, 节点类型: <see cref="Godot.Label"/>, 节点路径: WeaponRoulette.Control.ColorRect.Label2
/// </summary>
public Label2 S_Label2 => L_Control.L_ColorRect.L_Label2;
/// <summary>
/// 场景中唯一名称的节点, 节点类型: <see cref="Godot.Label"/>, 节点路径: WeaponRoulette.Control.ColorRect.PageLabel
/// </summary>
public PageLabel S_PageLabel => L_Control.L_ColorRect.L_PageLabel;
/// <summary>
/// 场景中唯一名称的节点, 节点类型: <see cref="Godot.ColorRect"/>, 节点路径: WeaponRoulette.Control.ColorRect
/// </summary>
public ColorRect S_ColorRect => L_Control.L_ColorRect;
/// <summary>
/// 场景中唯一名称的节点, 节点类型: <see cref="Godot.Control"/>, 节点路径: WeaponRoulette.Control
/// </summary>
public Control S_Control => L_Control;
/// <summary>
/// 场景中唯一名称的节点, 节点类型: <see cref="Godot.CollisionShape2D"/>, 节点路径: WeaponRoulette.MouseArea.CollisionShape2D
/// </summary>

View File

@ -24,10 +24,14 @@ public partial class WeaponRoulettePanel : WeaponRoulette
//所有武器插槽
private List<WeaponSlotNode> _slotNodes = new List<WeaponSlotNode>();
//当前页索引
private int _pageIndex = 0;
//最大页数
private int _maxPageIndex = 0;
public override void OnCreateUi()
{
S_RouletteBg.Instance.Visible = false;
L_Control.Instance.Visible = false;
S_Bg.Instance.Visible = false;
//创建武器插槽
@ -39,8 +43,9 @@ public partial class WeaponRoulettePanel : WeaponRoulette
var sectorPolygon = Utils.CreateSectorPolygon(0, 100, 360f / SlotCount, 4);
collisionPolygon2D.Polygon = sectorPolygon;
clone.Instance.RotationDegrees = angle;
clone.L_Control.Instance.RotationDegrees = -angle;
clone.L_Control.L_WeaponIcon.Instance.Material = (Material)S_WeaponSlotNode.L_Control.L_WeaponIcon.Instance.Material.Duplicate();
clone.L_SlotUi.Instance.RotationDegrees = -angle;
clone.L_SlotUi.L_WeaponUi.L_WeaponIcon.Instance.Material =
(Material)S_WeaponSlotNode.L_SlotUi.L_WeaponUi.L_WeaponIcon.Instance.Material.Duplicate();
_slotNodes.Add(clone);
}
@ -64,7 +69,7 @@ public partial class WeaponRoulettePanel : WeaponRoulette
//按下地图按键
if (InputManager.Roulette && !_isMagnifyRoulette) //打开轮盘
{
if (UiManager.GetUiInstanceCount(UiManager.UiNames.PauseMenu) == 0)
if (UiManager.GetUiInstanceCount(UiManager.UiNames.PauseMenu) == 0 && !InputManager.Map)
{
ExpandRoulette();
}
@ -78,6 +83,32 @@ public partial class WeaponRoulettePanel : WeaponRoulette
if (InputManager.Roulette)
{
S_MouseArea.Instance.GlobalPosition = GetGlobalMousePosition();
if (_maxPageIndex > 0)
{
if (InputManager.ExchangeWeapon) //上一页
{
_pageIndex--;
if (_pageIndex < 0)
{
_pageIndex = _maxPageIndex;
}
RefreshPageLabel();
RefreshWeapon();
}
else if (InputManager.Interactive) //下一页
{
_pageIndex++;
if (_pageIndex > _maxPageIndex)
{
_pageIndex = 0;
}
RefreshPageLabel();
RefreshWeapon();
}
}
}
else
{
@ -85,21 +116,25 @@ public partial class WeaponRoulettePanel : WeaponRoulette
}
}
//打开轮盘
private void ExpandRoulette()
{
World.Current.Pause = true;
_pressRouletteFlag = true;
_isMagnifyRoulette = true;
S_RouletteBg.Instance.Visible = true;
L_Control.Instance.Visible = true;
S_Bg.Instance.Visible = true;
SetEnableSectorCollision(true);
RefreshSlotPage();
RefreshPageLabel();
RefreshWeapon();
}
//关闭轮盘
private void ShrinkRoulette()
{
S_RouletteBg.Instance.Visible = false;
L_Control.Instance.Visible = false;
S_Bg.Instance.Visible = false;
_isMagnifyRoulette = false;
@ -122,16 +157,51 @@ public partial class WeaponRoulettePanel : WeaponRoulette
weaponSlotNode.L_SlotAreaNode.Instance.Monitorable = enable;
}
}
//刷新页码文本
private void RefreshPageLabel()
{
S_PageLabel.Instance.Text = $"{_pageIndex + 1}/{_maxPageIndex + 1}";
}
//刷新页码
private void RefreshSlotPage()
{
var current = Player.Current;
if (current == null)
{
return;
}
var weapons = current.WeaponPack.ItemSlot;
//判断是否显示上一页下一页提示
var lastIndex = 0;
for (var i = weapons.Length - 1; i >= 0; i--)
{
if (weapons[i] != null)
{
lastIndex = i;
break;
}
}
_maxPageIndex = Mathf.CeilToInt((lastIndex + 1f) / SlotCount) - 1;
S_ColorRect.Instance.Visible = _maxPageIndex > 0;
if (_pageIndex > _maxPageIndex)
{
_pageIndex = _maxPageIndex;
}
}
//更新显示的武器
private void RefreshWeapon()
{
var current = Player.Current;
if (current == null)
if (current == null) //没有玩家对象,这是异常情况
{
foreach (var slotNode in _slotNodes)
{
slotNode.L_Control.Instance.Visible = false;
slotNode.L_SlotUi.Instance.Visible = false;
}
return;
@ -141,27 +211,34 @@ public partial class WeaponRoulettePanel : WeaponRoulette
for (var i = 0; i < _slotNodes.Count; i++)
{
var slotNode = _slotNodes[i];
slotNode.L_Control.Instance.Visible = true;
if (weapons.Length > i)
slotNode.L_SlotUi.Instance.Visible = true;
slotNode.L_SlotUi.L_LockSprite.Instance.Visible = false;
var weaponIndex = i + _pageIndex * SlotCount;
if (weapons.Length > weaponIndex)
{
var weapon = weapons[i];
if (weapon != null)
var weapon = weapons[weaponIndex];
if (weapon != null) //有武器
{
slotNode.L_Control.Instance.Visible = true;
slotNode.L_Control.L_WeaponIcon.Instance.Texture = weapon.GetDefaultTexture();
slotNode.L_Control.L_AmmoLabel.Instance.Text =
slotNode.L_SlotUi.L_WeaponUi.Instance.Visible = true;
slotNode.L_SlotUi.L_WeaponUi.L_WeaponIcon.Instance.Texture = weapon.GetDefaultTexture();
slotNode.L_SlotUi.L_WeaponUi.L_AmmoLabel.Instance.Text =
(weapon.CurrAmmo + weapon.ResidueAmmo).ToString() + "/" + weapon.Attribute.MaxAmmoCapacity;
slotNode.Instance.SetWeapon(weapon);
slotNode.L_SlotAreaNode.Instance.Monitoring = true;
}
else
else //已经解锁,但是没有武器
{
slotNode.L_Control.Instance.Visible = false;
slotNode.L_SlotUi.L_WeaponUi.Instance.Visible = false;
slotNode.L_SlotAreaNode.Instance.Monitoring = false;
slotNode.Instance.ClearWeapon();
}
}
else
else //未解锁
{
slotNode.L_Control.Instance.Visible = false;
slotNode.L_SlotUi.L_LockSprite.Instance.Visible = true;
slotNode.L_SlotUi.L_WeaponUi.Instance.Visible = false;
slotNode.L_SlotAreaNode.Instance.Monitoring = false;
slotNode.Instance.ClearWeapon();
}
}

View File

@ -32,12 +32,12 @@ public partial class WeaponSlot : Node2D, IUiNodeScript
{
_node.UiPanel.ActiveWeapon = _weapon;
_node.Instance.Scale = new Vector2(1.1f, 1.1f);
_node.L_Control.L_WeaponIcon.Instance.Material.SetShaderMaterialParameter(ShaderParamNames.OutlineColor, Colors.White);
_node.L_SlotUi.L_WeaponUi.L_WeaponIcon.Instance.Material.SetShaderMaterialParameter(ShaderParamNames.OutlineColor, Colors.White);
}
private void OnAreaExited(Area2D other)
{
_node.Instance.Scale = Vector2.One;
_node.L_Control.L_WeaponIcon.Instance.Material.SetShaderMaterialParameter(ShaderParamNames.OutlineColor, Colors.Black);
_node.L_SlotUi.L_WeaponUi.L_WeaponIcon.Instance.Material.SetShaderMaterialParameter(ShaderParamNames.OutlineColor, Colors.Black);
}
}