This commit is contained in:
2026-09-06 15:51:51 +08:00
parent a5a26714e4
commit 0887d61c5e
18 changed files with 343 additions and 1455 deletions
@@ -7009,7 +7009,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2202994275601626415}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalRotation: {x: 0, y: 0, z: 0.7071068, w: 0.7071068}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0.7, y: 1, z: 1}
m_ConstrainProportionsScale: 0
@@ -7022,7 +7022,7 @@ Transform:
- {fileID: 3122417861231297320}
- {fileID: 1888482946497413280}
m_Father: {fileID: 9068781256090722184}
m_LocalEulerAnglesHint: {x: 0, y: -0, z: -0}
m_LocalEulerAnglesHint: {x: 0, y: -0, z: 90}
--- !u!1 &4471339292961239833
GameObject:
m_ObjectHideFlags: 0
@@ -16410,7 +16410,7 @@ Transform:
m_LocalRotation: {x: -0.000000015890757, y: -0.00000032782552, z: -0.000000035510983,
w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 0.999998}
m_LocalScale: {x: 1, y: 2, z: 0.999998}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 8101731493252368859}
@@ -71,7 +71,6 @@ MonoBehaviour:
m_Scale3D: {x: 10, y: 10, z: 10}
m_AnimatableProperties: []
m_Particles:
- {fileID: 8106755085163116203}
- {fileID: 2761749364946528661}
- {fileID: 3100310087577128612}
- {fileID: 6614605102306004990}
@@ -2463,7 +2462,7 @@ Transform:
serializedVersion: 2
m_LocalRotation: {x: -0.4226183, y: 0, z: 0, w: 0.9063078}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 2.5, y: 2.5, z: 2.5}
m_LocalScale: {x: 1.5, y: 1.5, z: 1.5}
m_ConstrainProportionsScale: 1
m_Children:
- {fileID: 75254570390358182}
@@ -4677,7 +4676,7 @@ ParticleSystemRenderer:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5020808015505471155}
m_Enabled: 0
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
@@ -26,7 +26,7 @@ Transform:
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_LocalScale: {x: 3, y: 3, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 4602256425977988424}
@@ -11735,7 +11735,7 @@ Transform:
serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_LocalScale: {x: 3, y: 3, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 3450969322148793143}
@@ -79,7 +79,7 @@ LineRenderer:
- {x: 0, y: 0, z: -7}
m_Parameters:
serializedVersion: 3
widthMultiplier: 6
widthMultiplier: 12
widthCurve:
serializedVersion: 2
m_Curve:
@@ -351,7 +351,7 @@ LineRenderer:
- {x: 0, y: 0, z: -7}
m_Parameters:
serializedVersion: 3
widthMultiplier: 3
widthMultiplier: 6
widthCurve:
serializedVersion: 2
m_Curve:
@@ -487,7 +487,7 @@ LineRenderer:
- {x: 0, y: 0, z: -7}
m_Parameters:
serializedVersion: 3
widthMultiplier: 5
widthMultiplier: 10
widthCurve:
serializedVersion: 2
m_Curve:
@@ -18908,7 +18908,7 @@ Transform:
serializedVersion: 2
m_LocalRotation: {x: -0.7071068, y: 0, z: 0, w: 0.7071068}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_LocalScale: {x: 2, y: 2, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 8876878966390754402}
@@ -76,10 +76,10 @@ LineRenderer:
m_SortingOrder: 1
m_Positions:
- {x: 0, y: 0, z: 0}
- {x: -2.256836, y: 0, z: 2.9524384}
- {x: 0, y: 0, z: 1}
m_Parameters:
serializedVersion: 3
widthMultiplier: 3
widthMultiplier: 6
widthCurve:
serializedVersion: 2
m_Curve:
@@ -212,10 +212,10 @@ LineRenderer:
m_SortingOrder: 3
m_Positions:
- {x: 0, y: 0, z: 0}
- {x: -2.256836, y: 0, z: 2.9524384}
- {x: 0, y: 0, z: 1}
m_Parameters:
serializedVersion: 3
widthMultiplier: 1.5
widthMultiplier: 3
widthCurve:
serializedVersion: 2
m_Curve:
@@ -348,10 +348,10 @@ LineRenderer:
m_SortingOrder: 2
m_Positions:
- {x: 0, y: 0, z: 0}
- {x: -2.256836, y: 0, z: 2.9524384}
- {x: 0, y: 0, z: 1}
m_Parameters:
serializedVersion: 3
widthMultiplier: 2.5
widthMultiplier: 5
widthCurve:
serializedVersion: 2
m_Curve:
@@ -484,10 +484,10 @@ LineRenderer:
m_SortingOrder: 2
m_Positions:
- {x: 0, y: 0, z: 0}
- {x: -2.256836, y: 0, z: 2.9524384}
- {x: 0, y: 0, z: 1}
m_Parameters:
serializedVersion: 3
widthMultiplier: 3
widthMultiplier: 6
widthCurve:
serializedVersion: 2
m_Curve:
@@ -652,10 +652,10 @@ LineRenderer:
m_SortingOrder: 1
m_Positions:
- {x: 0, y: 0, z: 0}
- {x: -2.256836, y: 0, z: 2.9524384}
- {x: 0, y: 0, z: 1}
m_Parameters:
serializedVersion: 3
widthMultiplier: 1.2
widthMultiplier: 2.4
widthCurve:
serializedVersion: 2
m_Curve:
@@ -736,7 +736,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7822299184040054704}
serializedVersion: 2
m_LocalRotation: {x: 0.7071068, y: 0, z: 0, w: 0.7071068}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
@@ -747,4 +747,4 @@ Transform:
- {fileID: 649510477359111152}
- {fileID: 2848377205242279173}
m_Father: {fileID: 9170579408037849450}
m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
File diff suppressed because it is too large Load Diff
+12 -12
View File
@@ -951,7 +951,8 @@ public class SitPosData : MonoBehaviour, IPointerDownHandler, IPointerUpHandler
}
/// <summary>
/// 显示文字表情:先激活 ziObj,延迟一帧再设置 child0(TextMeshProUGUI)的文字,
/// 显示文字表情:先设置文字再激活 ziObj,激活后立即强制刷新两级 ContentSizeFitter
/// (child0 的 TMP 自身 + 父物体),避免宽度延迟一帧才更新。
/// biaoQingDuration 秒后自动隐藏。与 spine 表情互斥(同时只显示一种)。
/// </summary>
/// <param name="text">文字内容</param>
@@ -967,19 +968,18 @@ public class SitPosData : MonoBehaviour, IPointerDownHandler, IPointerUpHandler
if (spineObj != null) spineObj.SetActive(false);
if (_biaoQingCoroutine != null) { StopCoroutine(_biaoQingCoroutine); _biaoQingCoroutine = null; }
// ⭐ 先激活,延迟一帧再设置字体:TMP 激活当帧设置 text 可能不刷新(显示旧字/默认字)
// ⭐ 先设置字,再激活:TMP 非激活时改字不会向布局系统注册重建,激活后统一处理
tmp.text = text;
ziObj.SetActive(true);
_biaoQingCoroutine = StartCoroutine(ShowBiaoQingZiRoutine(tmp, text));
}
/// <summary>文字表情协程:延迟一帧设置文字 → 显示 biaoQingDuration 秒 → 自动隐藏</summary>
private IEnumerator ShowBiaoQingZiRoutine(TextMeshProUGUI tmp, string text)
{
yield return null; // 等一帧,激活完成后再改字
if (tmp != null) tmp.text = text;
yield return new WaitForSeconds(biaoQingDuration);
if (ziObj != null) ziObj.SetActive(false);
_biaoQingCoroutine = null;
// ⭐ 激活后立即按"先子后父"顺序强制刷新两级 ContentSizeFitter:
// 子级 TMP 先算出新宽度,父级 Fitter 再根据子级新宽度收缩,
// 否则布局要等帧末才重建,当帧读到的还是旧宽度
LayoutRebuilder.ForceRebuildLayoutImmediate(tmp.rectTransform);
LayoutRebuilder.ForceRebuildLayoutImmediate(ziObj.transform as RectTransform);
Canvas.ForceUpdateCanvases();
_biaoQingCoroutine = StartCoroutine(HideBiaoQingAfter(ziObj));
}
/// <summary>表情显示 biaoQingDuration 秒后自动隐藏</summary>
@@ -607,7 +607,7 @@ MonoBehaviour:
type: 3}
laserWidth: 3
laserColor: {r: 1, g: 0.3, b: 0.3, a: 0.9}
laserLengthCorrect: 1
laserLengthCorrect: 0.1
turretNumber: 0
turretType: 1
displayName:
@@ -576,12 +576,12 @@ PrefabInstance:
- target: {fileID: 3368964918331985250, guid: ffe5b917cd8f21941adf54c437e9a701,
type: 3}
propertyPath: m_LocalRotation.w
value: 0.49999994
value: 0.64278764
objectReference: {fileID: 0}
- target: {fileID: 3368964918331985250, guid: ffe5b917cd8f21941adf54c437e9a701,
type: 3}
propertyPath: m_LocalRotation.x
value: -0.86602545
value: -0.7660445
objectReference: {fileID: 0}
- target: {fileID: 3368964918331985250, guid: ffe5b917cd8f21941adf54c437e9a701,
type: 3}
@@ -596,7 +596,7 @@ PrefabInstance:
- target: {fileID: 3368964918331985250, guid: ffe5b917cd8f21941adf54c437e9a701,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: -120
value: -100
objectReference: {fileID: 0}
- target: {fileID: 3368964918331985250, guid: ffe5b917cd8f21941adf54c437e9a701,
type: 3}
@@ -1522,7 +1522,7 @@ MonoBehaviour:
bulletPrefab_Two: {fileID: 0}
bulletPrefab: {fileID: 6670333658430945950, guid: 8fe85e61b2779ff49a78511b999887b7,
type: 3}
laserPrefab: {fileID: 5897679978818280078, guid: f968506c49fa41842bb684eb1e7016ac,
laserPrefab: {fileID: 5294742924000077673, guid: 4e8a4d64710e62e4cb4eb4d0bb55758f,
type: 3}
laserWidth: 3
laserColor: {r: 1, g: 0.3, b: 0.3, a: 0.9}
@@ -1556,7 +1556,7 @@ MonoBehaviour:
type: 3}
JGHitFXPrefab: {fileID: 7295806364047431194, guid: 080eb186e56776942b012e4f8177f4f7,
type: 3}
selfOffsetJGStart: {x: 90, y: 400}
selfOffsetJGStart: {x: 30, y: 170}
buttomOffsetZSRotateInit: {x: 0, y: 0, z: 0}
topOffsetZSRotateInit: {x: -125, y: 0, z: 0}
--- !u!95 &8661363738911940257 stripped
@@ -71,12 +71,12 @@ PrefabInstance:
- target: {fileID: 73765426979110781, guid: 83f830ab856bfc642b235330651c6513,
type: 3}
propertyPath: m_LocalRotation.w
value: 0.49999994
value: 0.7071068
objectReference: {fileID: 0}
- target: {fileID: 73765426979110781, guid: 83f830ab856bfc642b235330651c6513,
type: 3}
propertyPath: m_LocalRotation.x
value: -0.86602545
value: -0.7071068
objectReference: {fileID: 0}
- target: {fileID: 73765426979110781, guid: 83f830ab856bfc642b235330651c6513,
type: 3}
@@ -91,7 +91,7 @@ PrefabInstance:
- target: {fileID: 73765426979110781, guid: 83f830ab856bfc642b235330651c6513,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: -120
value: -90
objectReference: {fileID: 0}
- target: {fileID: 73765426979110781, guid: 83f830ab856bfc642b235330651c6513,
type: 3}
@@ -3761,7 +3761,7 @@ MonoBehaviour:
type: 3}
laserWidth: 3
laserColor: {r: 1, g: 0.3, b: 0.3, a: 0.9}
laserLengthCorrect: 0.145
laserLengthCorrect: 0.16
turretNumber: 0
turretType: 1
displayName:
@@ -3791,7 +3791,7 @@ MonoBehaviour:
type: 3}
JGHitFXPrefab: {fileID: 8868472629103351600, guid: 7710811b4a7a0c247b198169050755fe,
type: 3}
selfOffsetJGStart: {x: 55, y: 480}
selfOffsetJGStart: {x: 15, y: 150}
buttomOffsetZSRotateInit: {x: 0, y: 0, z: 0}
topOffsetZSRotateInit: {x: -125, y: 0, z: 0}
--- !u!95 &3827418405087986554 stripped
@@ -933,11 +933,11 @@ MonoBehaviour:
bulletPrefab_Two: {fileID: 0}
bulletPrefab: {fileID: 6300000819753586713, guid: b8f336cf2aed76541ae9e48d99280a5b,
type: 3}
laserPrefab: {fileID: 5897679978818280078, guid: f968506c49fa41842bb684eb1e7016ac,
laserPrefab: {fileID: 8282812116592331526, guid: 011d6daac6096ee4c80a7b2e7c8731bf,
type: 3}
laserWidth: 3
laserColor: {r: 1, g: 0.3, b: 0.3, a: 0.9}
laserLengthCorrect: 1
laserLengthCorrect: 0.143
turretNumber: 0
turretType: 1
displayName:
@@ -3882,6 +3882,10 @@ MonoBehaviour:
dalaba: {fileID: 0}
zhanhuanka: {fileID: 0}
huojianpao: {fileID: 0}
obj_DaLaBaPanel: {fileID: 0}
tmp_DaLaBaInput: {fileID: 0}
btn_DaLaBaSend: {fileID: 0}
btn_DaLaBaClose: {fileID: 0}
btn_SettingList: {fileID: 8183400499693274360}
SittingListParent: {fileID: 3985212453111435068}
btn_TuJian: {fileID: 8299373129192596900}
@@ -7410,7 +7414,7 @@ PrefabInstance:
- target: {fileID: 3429558903206714841, guid: 6c8512965de208f498306fbdfeb8eb5b,
type: 3}
propertyPath: m_AnchorMax.y
value: 1
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3783151213167614958, guid: 6c8512965de208f498306fbdfeb8eb5b,
type: 3}
@@ -7420,7 +7424,7 @@ PrefabInstance:
- target: {fileID: 3783151213167614958, guid: 6c8512965de208f498306fbdfeb8eb5b,
type: 3}
propertyPath: m_IsActive
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 5494969937974881520, guid: 6c8512965de208f498306fbdfeb8eb5b,
type: 3}
@@ -120,6 +120,7 @@ public class GameMainPanel_FishBase : GameMainPanel_Base
public string sceneName;
public GameTypeEnum gameType;
[Header("Left")]
public PropConfigData propConfigData; // 道具菜单配置(Assets右键 Create → MyGame → 左侧道具配置)
public Button btn_Prop;
public GameObject obj_PropItemParent;
public GameObject obj_PropPanel;
@@ -132,6 +133,12 @@ public class GameMainPanel_FishBase : GameMainPanel_Base
public Button zhanhuanka;
public Button huojianpao;
[Header("大喇叭弹幕输入")]
public GameObject obj_DaLaBaPanel; // 大喇叭弹幕输入面板
public TMP_InputField tmp_DaLaBaInput; // 弹幕输入框
public Button btn_DaLaBaSend; // 发送按钮
public Button btn_DaLaBaClose; // 关闭按钮
[Header("Right")]
[Header("设置")]
protected bool isOpenSetting;
@@ -580,15 +587,39 @@ public class GameMainPanel_FishBase : GameMainPanel_Base
if (btn_ChangeRoom != null)
btn_ChangeRoom.onClick.AddListener(StartChangeRoom);
// ⭐ 左侧道具按钮:只做开启/关闭 obj_PropPanel
// (第二层 tmp_PropTwoPanel/tmp_PropTwoItem 等暂不实现,字段先留着)
// ⭐ 左侧道具按钮:开启/关闭 obj_PropPanel(一级列表由 PropConfigData 配置构建,
// 点击一级道具在 tmp_PropTwoPanel 展开二级子道具)
if (btn_Prop != null)
btn_Prop.onClick.AddListener(() =>
{
if (obj_PropPanel != null)
obj_PropPanel.SetActive(!obj_PropPanel.activeSelf);
if (obj_PropPanel == null) return;
bool open = !obj_PropPanel.activeSelf;
obj_PropPanel.SetActive(open);
if (open)
BuildPropList();
else if (tmp_PropTwoPanel != null)
tmp_PropTwoPanel.SetActive(false);
});
// ⭐ 大喇叭:开/关弹幕输入面板
if (dalaba != null)
dalaba.onClick.AddListener(() =>
{
if (obj_DaLaBaPanel != null)
obj_DaLaBaPanel.SetActive(!obj_DaLaBaPanel.activeSelf);
});
if (btn_DaLaBaSend != null)
btn_DaLaBaSend.onClick.AddListener(OnClickDaLaBaSend);
if (btn_DaLaBaClose != null)
btn_DaLaBaClose.onClick.AddListener(() =>
{
if (obj_DaLaBaPanel != null) obj_DaLaBaPanel.SetActive(false);
});
// ⭐ 召唤卡:使用召唤卡召唤Boss
if (zhanhuanka != null)
zhanhuanka.onClick.AddListener(OnClickZhanHuanKa);
// 服务器广播监听
EventCenter.Instance.AddEventListener<SyncGameData>(ConstEventString.SyncGameData_Rotate, SyncGameData_Rotate);
EventCenter.Instance.AddEventListener<FireCannonSendData>(ConstEventString.SyncGameData_FireBullet, SyncGameData_FireBullit);
@@ -1394,6 +1425,174 @@ public class GameMainPanel_FishBase : GameMainPanel_Base
#endregion
#region 大喇叭/召唤卡(Left道具快捷按钮)
/// <summary>
/// 大喇叭发送:输入弹幕 → /api/Hall/SendBroadcast 全服广播
/// (与背包大喇叭 OnClickFaSong 流程一致),发送成功后清空输入框并关闭面板。
/// </summary>
private void OnClickDaLaBaSend()
{
string msg = tmp_DaLaBaInput?.text?.Trim();
if (string.IsNullOrEmpty(msg))
{
UIManager.Instance.ShowBoardError("请输入广播内容");
return;
}
APIRequestList.SendBroadcast("广播:" + msg, (result) =>
{
// 发送成功:清空输入框并关闭面板(广播内容会通过 LoginBroadcast 全服弹幕显示)
if (tmp_DaLaBaInput != null) tmp_DaLaBaInput.text = "";
if (obj_DaLaBaPanel != null) obj_DaLaBaPanel.SetActive(false);
});
}
/// <summary>
/// 使用召唤卡:从背包找到召唤卡道具(type=11)拿道具编号
/// → /api/SummonCard/use 召唤Boss(Boss鱼由服务端 OnFishSpawn 下发给房间所有人)
/// → 显示服务器返回消息 + 拉取最新用户数据同步道具数量。
/// </summary>
private void OnClickZhanHuanKa()
{
var props = GameManager.Instance.user?.props;
if (props != null)
{
foreach (var p in props)
{
if (p.type == (int)PropEnum.召唤卡 && p.count > 0)
{
APIRequestList.UseSummonCard(
new Assets.MyGame.Scripts.Net.APIRequest.Params.SummonCardUseParam { cardNumber = p.number },
(msg) =>
{
UIManager.Instance.ShowBoardError(string.IsNullOrEmpty(msg) ? "使用成功" : msg);
// 刷新用户数据,同步召唤卡剩余数量
APIRequestList.GetUser((user) =>
{
if (user != null)
GameManager.Instance.UpdataUserData(user);
});
});
return;
}
}
}
UIManager.Instance.ShowBoardError("召唤卡数量不足");
}
#endregion
#region 左侧道具菜单(PropConfigData 一级道具 + 二级展开子道具)
private bool _propListBuilt;
/// <summary>
/// 按 PropConfigData 构建一级道具列表(只在首次打开时构建一次)
/// </summary>
private void BuildPropList()
{
if (_propListBuilt) return;
_propListBuilt = true;
if (propConfigData == null || tmp_PropItem == null || obj_PropItemParent == null) return;
// ⭐ 模板是场景内对象时先隐藏(引用指向预制体资产时 scene 无效,不能 SetActive 以免改资产)
if (tmp_PropItem.scene.IsValid()) tmp_PropItem.SetActive(false);
for (int i = 0; i < propConfigData.props.Count; i++)
{
var cfg = propConfigData.props[i];
if (cfg == null) continue;
var item = Instantiate(tmp_PropItem, obj_PropItemParent.transform);
SetPropItemText(item, cfg.name);
SetPropItemIcon(item, cfg.icon);
var data = cfg; // 闭包捕获当前项,避免循环变量被覆盖
var btn = GetPropItemButton(item);
if (btn != null) btn.onClick.AddListener(() => ShowPropTwo(data));
}
}
/// <summary>
/// 点击一级道具:在 tmp_PropTwoPanel 内按配置展开二级子道具列表
/// </summary>
private void ShowPropTwo(PropItemData cfg)
{
if (cfg == null || tmp_PropTwoPanel == null || tmp_PropTwoItem == null || tmp_PropTwoItemParent == null) return;
// 清空上次克隆的子道具(模板本身若是该父对象的子节点则跳过)
for (int i = tmp_PropTwoItemParent.transform.childCount - 1; i >= 0; i--)
{
var child = tmp_PropTwoItemParent.transform.GetChild(i).gameObject;
if (child == tmp_PropTwoItem) continue;
Destroy(child);
}
// ⚠ 注意:这里判断的是 tmp_PropTwoItem(不是 tmp_PropItem)
if (tmp_PropTwoItem.scene.IsValid()) tmp_PropTwoItem.SetActive(false);
foreach (var sub in cfg.subProps)
{
if (sub == null) continue;
var item = Instantiate(tmp_PropTwoItem, tmp_PropTwoItemParent.transform);
SetPropItemText(item, sub.name);
SetPropItemIcon(item, sub.icon);
var data = sub;
var btn = GetPropItemButton(item);
if (btn != null) btn.onClick.AddListener(() => UsePropEffect(data));
}
tmp_PropTwoPanel.SetActive(true);
}
/// <summary>
/// 点击二级子道具:按枚举 effectType 分发效果(未接入的类型统一提示)
/// </summary>
private void UsePropEffect(SubPropData sub)
{
if (sub == null) return;
switch (sub.effectType)
{
case PropEffectType.大喇叭:
if (obj_DaLaBaPanel != null) obj_DaLaBaPanel.SetActive(true);
break;
case PropEffectType.召唤卡:
OnClickZhanHuanKa();
break;
default:
UIManager.Instance.ShowBoardError($"[{sub.effectType}] 效果暂未接入");
break;
}
}
/// <summary>克隆项文本:优先取 child0 的 TMP,再退回自身/子级查找(与表情列表同惯例)</summary>
private void SetPropItemText(GameObject item, string text)
{
if (string.IsNullOrEmpty(text)) return;
var tmp = item.transform.childCount > 0 ? item.transform.GetChild(0).GetComponent<TextMeshProUGUI>() : null;
if (tmp == null) tmp = item.GetComponent<TextMeshProUGUI>();
if (tmp == null) tmp = item.GetComponentInChildren<TextMeshProUGUI>();
if (tmp != null) tmp.text = text;
}
/// <summary>克隆项图标:优先取 child0 的 Image,再退回自身/子级查找(icon 不填则跳过)</summary>
private void SetPropItemIcon(GameObject item, Sprite icon)
{
if (icon == null) return;
var img = item.transform.childCount > 0 ? item.transform.GetChild(0).GetComponent<Image>() : null;
if (img == null) img = item.GetComponent<Image>();
if (img == null) img = item.GetComponentInChildren<Image>();
if (img != null) img.sprite = icon;
}
/// <summary>克隆项按钮:自身优先,其次子级查找</summary>
private Button GetPropItemButton(GameObject item)
{
var btn = item.GetComponent<Button>();
if (btn == null) btn = item.GetComponentInChildren<Button>();
return btn;
}
#endregion
#region 输入系统(InputModule)
private bool IsPointerOverUI(Vector2 pos)
{
@@ -0,0 +1,73 @@
using System;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// 道具效果类型(一级/二级道具共用,配置时下拉选择),
/// 具体效果在 GameMainPanel_FishBase.UsePropEffect 按枚举分发。
/// </summary>
public enum PropEffectType
{
无 = 0,
火箭炮 = 1,
激光炮 = 2,
冰冻 = 3,
锁定 = 4,
闪电 = 5,
护盾 = 6,
速射 = 7,
召唤卡 = 8,
大喇叭 = 9,
}
/// <summary>一级道具条目(左侧道具菜单主列表)</summary>
[Serializable]
public class PropItemData
{
[Tooltip("道具名(克隆项上 TextMeshProUGUI 显示)")]
public string name;
[Tooltip("图标(克隆项上 Image 显示,可不填)")]
public Sprite icon;
[Tooltip("描述(备用字段)")]
[TextArea] public string desc;
[Tooltip("效果类型(枚举选择)")]
public PropEffectType effectType = PropEffectType.无;
[Tooltip("二级子道具(点击一级道具后展开的细节列表)")]
public List<SubPropData> subProps = new List<SubPropData>();
}
/// <summary>二级子道具条目(细节)</summary>
[Serializable]
public class SubPropData
{
[Tooltip("子道具名")]
public string name;
[Tooltip("图标(可不填)")]
public Sprite icon;
[Tooltip("描述(备用字段)")]
[TextArea] public string desc;
[Tooltip("效果类型(枚举选择,点击子道具时按此分发效果)")]
public PropEffectType effectType = PropEffectType.无;
[Tooltip("效果参数(次数/时长/倍率等,按效果自定义含义)")]
public int param;
}
/// <summary>
/// 左侧道具菜单配置资产(ScriptableObject),手动配置:
/// Assets 右键 → Create → MyGame → 左侧道具配置 生成 .asset,
/// 填好一级道具与二级子道具后,拖到 GameMainPanel_FishBase 的 propConfigData 字段。
/// </summary>
[CreateAssetMenu(fileName = "PropConfigData", menuName = "MyGame/左侧道具配置", order = 0)]
public class PropConfigData : ScriptableObject
{
[Header("一级道具列表(顺序 = 菜单显示顺序)")]
public List<PropItemData> props = new List<PropItemData>();
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 7af095737098abf4a82d9f3aec2acd56
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+2 -2
View File
@@ -642,7 +642,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3}
m_Name:
m_EditorClassIdentifier:
m_HorizontalFit: 2
m_HorizontalFit: 1
m_VerticalFit: 0
--- !u!114 &8998155242034225900
MonoBehaviour:
@@ -3177,7 +3177,7 @@ RectTransform:
m_GameObject: {fileID: 7345554179386239971}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 2149982692187042854}