浮漂脚本
This commit is contained in:
3
Assets/Scripts/Common/Config.meta
Normal file
3
Assets/Scripts/Common/Config.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 31917665a76642349dc8f420e9e69e10
|
||||
timeCreated: 1763900632
|
||||
26
Assets/Scripts/Common/Config/GoodsConfig.cs
Normal file
26
Assets/Scripts/Common/Config/GoodsConfig.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public partial class GoodsConfig
|
||||
{
|
||||
private List<AwardData> _awards;
|
||||
|
||||
public List<AwardData> Awards
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_awards == null)
|
||||
{
|
||||
_awards = new List<AwardData>();
|
||||
foreach (var item in Items)
|
||||
{
|
||||
_awards.Add(new AwardData(item));
|
||||
}
|
||||
}
|
||||
|
||||
return _awards;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Assets/Scripts/Common/Config/GoodsConfig.cs.meta
Normal file
3
Assets/Scripts/Common/Config/GoodsConfig.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f2ff9451a42f4d9e8ebec6b8c8088103
|
||||
timeCreated: 1763900639
|
||||
22
Assets/Scripts/Common/Data/AwardData.cs
Normal file
22
Assets/Scripts/Common/Data/AwardData.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
namespace NBF
|
||||
{
|
||||
public class AwardData
|
||||
{
|
||||
public uint Id;
|
||||
public int Amount;
|
||||
|
||||
public AwardData(string str)
|
||||
{
|
||||
string[] parts = str.Split('|');
|
||||
Id = uint.Parse(parts[0]);
|
||||
if (parts.Length > 1)
|
||||
{
|
||||
Amount = int.Parse(parts[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
Amount = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Assets/Scripts/Common/Data/AwardData.cs.meta
Normal file
3
Assets/Scripts/Common/Data/AwardData.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a62ec00b6df5428ca380168860d73a58
|
||||
timeCreated: 1763900506
|
||||
6
Assets/Scripts/Common/Enum/GoodsType.cs
Normal file
6
Assets/Scripts/Common/Enum/GoodsType.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace NBF
|
||||
{
|
||||
public enum GoodsType
|
||||
{
|
||||
}
|
||||
}
|
||||
3
Assets/Scripts/Common/Enum/GoodsType.cs.meta
Normal file
3
Assets/Scripts/Common/Enum/GoodsType.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b3636032a57e4125907ad7a1df411c52
|
||||
timeCreated: 1763892955
|
||||
@@ -3,18 +3,18 @@
|
||||
public enum ItemType
|
||||
{
|
||||
None,
|
||||
Currency,
|
||||
Item,
|
||||
Rod,
|
||||
Reel,
|
||||
Bobber,
|
||||
Line,
|
||||
Bait,
|
||||
Lure,
|
||||
Hook,
|
||||
Weight,
|
||||
Feeder,
|
||||
Ring
|
||||
Currency = 1,
|
||||
Item = 2,
|
||||
Rod = 3,
|
||||
Reel =4,
|
||||
Bobber = 5,
|
||||
Line = 6,
|
||||
Bait = 7,
|
||||
Lure = 8,
|
||||
Hook = 9,
|
||||
Weight = 10,
|
||||
Feeder = 11,
|
||||
|
||||
}
|
||||
|
||||
public enum ItemSubType
|
||||
|
||||
@@ -16,16 +16,7 @@ namespace NBF.Utils
|
||||
{
|
||||
return (ItemType)(id / 10000);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取物品子类型
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public static uint GetItemSubType(this uint id)
|
||||
{
|
||||
return (id / 1000) % 10;
|
||||
}
|
||||
|
||||
|
||||
public static string GetName(this uint id)
|
||||
{
|
||||
|
||||
@@ -27,13 +27,13 @@ namespace NBF.Fishing2
|
||||
/// <summary>
|
||||
/// 创建物品预制体
|
||||
/// </summary>
|
||||
/// <param name="itemInfo"></param>
|
||||
/// <param name="config"></param>
|
||||
/// <param name="isPreview">是否预览模式</param>
|
||||
/// <returns></returns>
|
||||
public static GameObject CreateItem(ItemInfo itemInfo, bool isPreview = false)
|
||||
public static GameObject CreateItem(ItemConfig config, bool isPreview = false)
|
||||
{
|
||||
//创建主物体
|
||||
var mainObject = LoadPrefab(itemInfo.Config.GetFullModelPath());
|
||||
var mainObject = LoadPrefab(config.GetFullModelPath());
|
||||
//创建配件
|
||||
|
||||
return mainObject;
|
||||
|
||||
170
Assets/Scripts/FloatBobberController.cs
Normal file
170
Assets/Scripts/FloatBobberController.cs
Normal file
@@ -0,0 +1,170 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class FloatBobberControllerPro : MonoBehaviour
|
||||
{
|
||||
[Header("Water")]
|
||||
public float waterLevel = 0f;
|
||||
public float waterDensity = 1f;
|
||||
|
||||
[Header("Bobber Physical")]
|
||||
public float bobberVolume = 30f; // 浮漂最大浮力 (cm³)
|
||||
public float bobberMass = 1f; // 浮漂自重 (g)
|
||||
public float bobberHeight = 0.25f; // 浮漂长度,用来决定躺漂角度
|
||||
|
||||
[Header("Tackle Weight")]
|
||||
public float sinkerWeight = 2f;
|
||||
public float baitWeight = 0.5f;
|
||||
public float hookWeight = 0.2f;
|
||||
|
||||
[Header("Behaviour")]
|
||||
public float fallSpeed = 8f;
|
||||
public float riseSpeed = 3f;
|
||||
public float angleLaySpeed = 2f; // 躺漂速度
|
||||
public float uprightSpeed = 2f; // 立漂速度
|
||||
public float bottomDrag = 1.2f; // 铅坠触底阻力(越大越难被浮漂拉起)
|
||||
|
||||
[Header("Angles")]
|
||||
public float maxLayAngle = 75f; // 最大躺漂角度
|
||||
float currentAngle = 0f;
|
||||
|
||||
[Header("Noise")]
|
||||
public float noiseAmp = 0.015f;
|
||||
public float noiseFreq = 1.5f;
|
||||
|
||||
float impulseForce = 0f;
|
||||
float impulseDecay = 4f;
|
||||
|
||||
void Update()
|
||||
{
|
||||
SimulateBobber();
|
||||
}
|
||||
|
||||
void SimulateBobber()
|
||||
{
|
||||
float totalWeight = bobberMass + sinkerWeight + baitWeight + hookWeight;
|
||||
float netBuoyancy = bobberVolume - totalWeight; // 正 → 上浮;负 → 下拉
|
||||
|
||||
// -----------------------------
|
||||
// ① 计算浮漂底部 Y 的高度
|
||||
// -----------------------------
|
||||
float bobberBottomY = transform.position.y - bobberHeight * 0.5f;
|
||||
float bottomY = waterLevel - 0.02f; // 水底高度(可替换真实地形)
|
||||
|
||||
bool sinkerOnBottom = (bobberBottomY <= bottomY);
|
||||
|
||||
// -----------------------------
|
||||
// ② 计算 targetY
|
||||
// -----------------------------
|
||||
float targetY;
|
||||
|
||||
if (!sinkerOnBottom)
|
||||
{
|
||||
// 铅坠悬浮 → 浮漂直立
|
||||
if (netBuoyancy > 0)
|
||||
{
|
||||
float rise = Mathf.Clamp01(netBuoyancy / bobberVolume) * 0.1f;
|
||||
targetY = waterLevel + rise;
|
||||
}
|
||||
else
|
||||
{
|
||||
float sink = Mathf.Abs(netBuoyancy) * 0.02f;
|
||||
targetY = waterLevel - sink;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 铅坠触底 → 浮漂无法再被向下拉
|
||||
if (netBuoyancy > bottomDrag)
|
||||
{
|
||||
// 浮漂浮力足够将其立起来
|
||||
float rise = Mathf.Clamp01((netBuoyancy - bottomDrag) / bobberVolume) * 0.1f;
|
||||
targetY = waterLevel + rise; // 轻轻立起
|
||||
}
|
||||
else
|
||||
{
|
||||
// 浮漂浮力不足 → 躺漂
|
||||
targetY = waterLevel + 0.01f; // 漂身贴水
|
||||
}
|
||||
}
|
||||
|
||||
// 水波噪声
|
||||
targetY += Mathf.Sin(Time.time * noiseFreq) * noiseAmp;
|
||||
|
||||
// 顿口/顶漂力
|
||||
if (impulseForce != 0f)
|
||||
{
|
||||
targetY += impulseForce * Time.deltaTime;
|
||||
impulseForce = Mathf.Lerp(impulseForce, 0, Time.deltaTime * impulseDecay);
|
||||
}
|
||||
|
||||
// -----------------------------
|
||||
// ③ 上浮 / 下沉差速
|
||||
// -----------------------------
|
||||
float y = transform.position.y;
|
||||
float diff = targetY - y;
|
||||
|
||||
if (diff > 0) // 上浮
|
||||
y += diff * Time.deltaTime * riseSpeed;
|
||||
else
|
||||
y += diff * Time.deltaTime * fallSpeed;
|
||||
|
||||
transform.position = new Vector3(transform.position.x, y, transform.position.z);
|
||||
|
||||
// -----------------------------
|
||||
// ④ 浮漂角度控制
|
||||
// -----------------------------
|
||||
float targetAngle = 0f;
|
||||
|
||||
if (sinkerOnBottom)
|
||||
{
|
||||
// 触底 → 判断是否能立漂
|
||||
if (netBuoyancy > bottomDrag)
|
||||
{
|
||||
targetAngle = 0f; // 立漂
|
||||
}
|
||||
else
|
||||
{
|
||||
// 躺漂
|
||||
targetAngle = maxLayAngle;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 铅坠在水中 → 漂直立
|
||||
targetAngle = 0f;
|
||||
}
|
||||
|
||||
// 平滑角度
|
||||
currentAngle = Mathf.Lerp(
|
||||
currentAngle,
|
||||
targetAngle,
|
||||
Time.deltaTime * (targetAngle == 0 ? uprightSpeed : angleLaySpeed)
|
||||
);
|
||||
|
||||
transform.rotation = Quaternion.Euler(currentAngle, 0, 0);
|
||||
}
|
||||
|
||||
// ----------------------------------------
|
||||
// 外部控制接口
|
||||
// ----------------------------------------
|
||||
|
||||
public void TriggerDownPulse(float s = 0.8f)
|
||||
{
|
||||
impulseForce -= Mathf.Abs(s);
|
||||
}
|
||||
|
||||
public void TriggerUpPulse(float s = 0.8f)
|
||||
{
|
||||
impulseForce += Mathf.Abs(s);
|
||||
}
|
||||
|
||||
public void AddFishPull(float v)
|
||||
{
|
||||
sinkerWeight += v;
|
||||
}
|
||||
|
||||
public void ReleaseFishPull(float v)
|
||||
{
|
||||
sinkerWeight -= v;
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/FloatBobberController.cs.meta
Normal file
2
Assets/Scripts/FloatBobberController.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 59f0b74408dbbfe44aee75e1ddf784d3
|
||||
298
Assets/Scripts/FloatBobberControllerBack.cs
Normal file
298
Assets/Scripts/FloatBobberControllerBack.cs
Normal file
@@ -0,0 +1,298 @@
|
||||
// using UnityEngine;
|
||||
//
|
||||
// public class FloatBobberController : MonoBehaviour
|
||||
// {
|
||||
// [Header("Water System")]
|
||||
// public bool useKWS = false;
|
||||
// public LayerMask waterLayer;
|
||||
// public float waterRaycastHeight = 10f;
|
||||
//
|
||||
// [Header("Spring Physics")]
|
||||
// public float stiffness = 0.35f; // 弹性力度
|
||||
// public float damping = 0.82f; // 阻尼
|
||||
// public float noiseStrength = 0.02f; // 自然颤动
|
||||
//
|
||||
// [Header("Tilt")]
|
||||
// public Transform lineAttachPoint; // 钓线连接点(让漂倾斜)
|
||||
// public float tiltStrength = 6f;
|
||||
//
|
||||
// private float targetOffsetY = 0f;
|
||||
// private float offsetY = 0f;
|
||||
// private float velocity = 0f;
|
||||
//
|
||||
// private float baseWaterHeight = 0f;
|
||||
//
|
||||
// // 随机噪声 seed
|
||||
// private float noiseSeed;
|
||||
//
|
||||
// void Start()
|
||||
// {
|
||||
// noiseSeed = Random.value * 100f;
|
||||
// }
|
||||
//
|
||||
// void Update()
|
||||
// {
|
||||
// UpdateWaterHeight();
|
||||
// UpdateSpringPhysics();
|
||||
// UpdateTilt();
|
||||
// ApplyFinalPosition();
|
||||
// }
|
||||
//
|
||||
// // -----------------------------------------------------------
|
||||
// // 1. 水面高度获取 (支持 KWS 或 Raycast)
|
||||
// // -----------------------------------------------------------
|
||||
// void UpdateWaterHeight()
|
||||
// {
|
||||
// if (useKWS)
|
||||
// {
|
||||
// // ⭐ 你自己替换为 KWS 的 API
|
||||
// baseWaterHeight = SampleWaterHeight_KWS();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// // 简单射线获取水面高度
|
||||
// Vector3 start = transform.position + Vector3.up * waterRaycastHeight;
|
||||
// if (Physics.Raycast(start, Vector3.down, out RaycastHit hit, 50f, waterLayer))
|
||||
// {
|
||||
// baseWaterHeight = hit.point.y;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// float SampleWaterHeight_KWS()
|
||||
// {
|
||||
// // ❗你需要替换成你的 KWS 接口,比如:
|
||||
// // return KWS.GetWaterHeight(transform.position);
|
||||
// return transform.position.y; // 临时占位
|
||||
// }
|
||||
//
|
||||
// // -----------------------------------------------------------
|
||||
// // 2. 弹簧-阻尼伪物理 (核心)
|
||||
// // -----------------------------------------------------------
|
||||
// void UpdateSpringPhysics()
|
||||
// {
|
||||
// // 弹簧吸附:朝向 targetOffsetY
|
||||
// velocity += (targetOffsetY - offsetY) * stiffness;
|
||||
//
|
||||
// // 阻尼
|
||||
// velocity *= damping;
|
||||
//
|
||||
// // 移动
|
||||
// offsetY += velocity;
|
||||
//
|
||||
// // 自然轻微噪声
|
||||
// float noise = (Mathf.PerlinNoise(Time.time * 1.2f, noiseSeed) - 0.5f) * noiseStrength;
|
||||
// offsetY += noise;
|
||||
// }
|
||||
//
|
||||
// // -----------------------------------------------------------
|
||||
// // 3. 漂倾斜(依据钓线方向)
|
||||
// // -----------------------------------------------------------
|
||||
// void UpdateTilt()
|
||||
// {
|
||||
// if (lineAttachPoint == null) return;
|
||||
//
|
||||
// Vector3 dir = lineAttachPoint.position - transform.position;
|
||||
// if (dir.magnitude > 0.001f)
|
||||
// {
|
||||
// Quaternion targetRot = Quaternion.LookRotation(dir, Vector3.up);
|
||||
// transform.rotation = Quaternion.Slerp(transform.rotation, targetRot, Time.deltaTime * tiltStrength);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // -----------------------------------------------------------
|
||||
// // 4. 应用最终位置
|
||||
// // -----------------------------------------------------------
|
||||
// void ApplyFinalPosition()
|
||||
// {
|
||||
// Vector3 pos = transform.position;
|
||||
// pos.y = baseWaterHeight + offsetY;
|
||||
// transform.position = pos;
|
||||
// }
|
||||
//
|
||||
// // ============================ 触发动作 API ============================
|
||||
//
|
||||
// /// <summary>小顿口:轻微上升 0.5~1.5 目</summary>
|
||||
// public void TriggerSmallDonk()
|
||||
// {
|
||||
// targetOffsetY = Random.Range(0.3f, 0.9f);
|
||||
// stiffness = 0.40f;
|
||||
// damping = 0.82f;
|
||||
// }
|
||||
//
|
||||
// /// <summary>顿口:快速上升,并轻微过冲</summary>
|
||||
// public void TriggerDonk()
|
||||
// {
|
||||
// targetOffsetY = Random.Range(1.0f, 1.8f);
|
||||
// stiffness = 0.55f;
|
||||
// damping = 0.78f;
|
||||
// }
|
||||
//
|
||||
// /// <summary>顶漂:慢慢上浮几目</summary>
|
||||
// public void TriggerTopLift()
|
||||
// {
|
||||
// targetOffsetY = Random.Range(1.0f, 3.0f);
|
||||
// stiffness = 0.18f;
|
||||
// damping = 0.90f;
|
||||
// }
|
||||
//
|
||||
// /// <summary>黑漂:快速下沉,并保持</summary>
|
||||
// public void TriggerBlackSink()
|
||||
// {
|
||||
// targetOffsetY = Random.Range(-3.0f, -6.0f);
|
||||
// stiffness = 0.45f;
|
||||
// damping = 0.75f;
|
||||
// }
|
||||
//
|
||||
// /// <summary>点动:轻微上下动</summary>
|
||||
// public void TriggerNibble()
|
||||
// {
|
||||
// targetOffsetY = Mathf.Sin(Time.time * Random.Range(6f, 12f)) * 0.1f;
|
||||
// stiffness = 0.25f;
|
||||
// damping = 0.88f;
|
||||
// }
|
||||
//
|
||||
// /// <summary>走漂(水层有流料或者风),水平漂移你用其他脚本控制即可</summary>
|
||||
// public void TriggerDrift(float amount)
|
||||
// {
|
||||
// targetOffsetY = 0f;
|
||||
// offsetY = 0f;
|
||||
// }
|
||||
//
|
||||
// /// <summary>恢复到 Idle 状态</summary>
|
||||
// public void ResetIdle()
|
||||
// {
|
||||
// targetOffsetY = 0f;
|
||||
// stiffness = 0.35f;
|
||||
// damping = 0.85f;
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
//
|
||||
//
|
||||
// using UnityEngine;
|
||||
//
|
||||
// public class FloatBobberControllerPro : MonoBehaviour
|
||||
// {
|
||||
// [Header("Water Settings")] public float waterLevel = 0f; // 水面高度世界坐标
|
||||
// public float waterDensity = 1f; // 水密度(默认1即可)
|
||||
//
|
||||
// [Header("Bobber Physical Settings")] public float bobberVolume = 30f; // 浮漂最大浮力(cm³)
|
||||
// public float bobberMass = 1f; // 浮漂自身重量(克)
|
||||
//
|
||||
// [Header("Tackle Weight Settings")] public float sinkerWeight = 2f; // 铅坠重量(克)
|
||||
// public float baitWeight = 0.5f; // 鱼饵重量(克)
|
||||
// public float hookWeight = 0.2f; // 鱼钩重量(克)
|
||||
//
|
||||
// [Header("Physics Behaviour")] public float riseSpeed = 1.2f; // 浮漂上浮速度
|
||||
// public float fallSpeed = 1.5f; // 浮漂下沉速度
|
||||
// public float smoothDamping = 8f; // 插值平滑
|
||||
//
|
||||
// [Header("Random Water Movements")] public float noiseAmplitude = 0.02f; // 微扰幅度
|
||||
// public float noiseFrequency = 1f; // 微扰频率
|
||||
//
|
||||
// float velocity = 0f;
|
||||
// float timeNoise = 0f;
|
||||
//
|
||||
// // 用于顿口、顶漂脉冲
|
||||
// float impulseForce = 0f;
|
||||
// float impulseDecay = 4f;
|
||||
//
|
||||
// void Update()
|
||||
// {
|
||||
// SimulateBobberPhysics();
|
||||
// }
|
||||
//
|
||||
// void SimulateBobberPhysics()
|
||||
// {
|
||||
// float totalDownwardWeight = bobberMass + sinkerWeight + baitWeight + hookWeight;
|
||||
//
|
||||
// float maxBuoyancy = bobberVolume; // 最大浮力 = 体积
|
||||
// float netBuoyancy = maxBuoyancy - totalDownwardWeight;
|
||||
//
|
||||
// float targetY;
|
||||
//
|
||||
// // -------------------------
|
||||
// // 1. 判断浮漂应该沉多少(吃水深度)
|
||||
// // -------------------------
|
||||
// if (netBuoyancy > 0)
|
||||
// {
|
||||
// float buoyPercent = Mathf.Clamp01(netBuoyancy / maxBuoyancy);
|
||||
// float rise = buoyPercent * 0.1f; // 浮漂露出水面的高度
|
||||
//
|
||||
// targetY = waterLevel + rise;
|
||||
//
|
||||
// targetY += Mathf.Sin(Time.time * noiseFrequency) * noiseAmplitude; // 微扰模拟波浪
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// // 净浮力为负 → 说明浮漂整体被拉下,沉入水中
|
||||
// float sinkDistance = Mathf.Abs(netBuoyancy) * 0.03f;
|
||||
// targetY = waterLevel - sinkDistance;
|
||||
// }
|
||||
//
|
||||
// // -------------------------
|
||||
// // 2. 顶漂 & 顿口 脉冲
|
||||
// // -------------------------
|
||||
// if (impulseForce != 0f)
|
||||
// {
|
||||
// targetY += impulseForce * Time.deltaTime;
|
||||
// impulseForce = Mathf.Lerp(impulseForce, 0f, Time.deltaTime * impulseDecay);
|
||||
// }
|
||||
//
|
||||
// // -------------------------
|
||||
// // 3. 平滑过渡到目标位置(核心)
|
||||
// // -------------------------
|
||||
// float currentY = transform.position.y;
|
||||
//
|
||||
// float newY = Mathf.Lerp(
|
||||
// currentY,
|
||||
// targetY,
|
||||
// Time.deltaTime * smoothDamping
|
||||
// );
|
||||
//
|
||||
// transform.position = new Vector3(
|
||||
// transform.position.x,
|
||||
// newY,
|
||||
// transform.position.z
|
||||
// );
|
||||
// }
|
||||
//
|
||||
// // ===========================
|
||||
// // 外部函数:模拟钓鱼动作
|
||||
// // ===========================
|
||||
//
|
||||
// /// <summary>
|
||||
// /// 顿口:浮漂瞬间被向下拉一下(鱼轻轻吸饵)
|
||||
// /// </summary>
|
||||
// public void TriggerDownPulse(float strength = 0.8f)
|
||||
// {
|
||||
// impulseForce -= Mathf.Abs(strength);
|
||||
// }
|
||||
//
|
||||
// /// <summary>
|
||||
// /// 顶漂:浮漂瞬间向上冒一下(鱼儿托饵)
|
||||
// /// </summary>
|
||||
// public void TriggerUpPulse(float strength = 0.8f)
|
||||
// {
|
||||
// impulseForce += Mathf.Abs(strength);
|
||||
// }
|
||||
//
|
||||
// /// <summary>
|
||||
// /// 模拟鱼儿吃饵 → 增加下拉力
|
||||
// /// </summary>
|
||||
// public void AddFishPull(float value)
|
||||
// {
|
||||
// sinkerWeight += value;
|
||||
// }
|
||||
//
|
||||
// /// <summary>
|
||||
// /// 模拟脱钩 → 拉力消失
|
||||
// /// </summary>
|
||||
// public void RemoveFishPull(float value)
|
||||
// {
|
||||
// sinkerWeight -= value;
|
||||
// }
|
||||
// }
|
||||
3
Assets/Scripts/FloatBobberControllerBack.cs.meta
Normal file
3
Assets/Scripts/FloatBobberControllerBack.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: aae942875a204e83b90e9713146caded
|
||||
timeCreated: 1763993650
|
||||
@@ -17,24 +17,20 @@ namespace NBF
|
||||
[ProtoMember(1)]
|
||||
public uint Id { get; set; } // Id
|
||||
[ProtoMember(2)]
|
||||
public uint Type { get; set; } // 子类型
|
||||
[ProtoMember(3)]
|
||||
public uint[] Shop { get; set; } = Array.Empty<uint>(); // 出现商店
|
||||
[ProtoMember(4)]
|
||||
[ProtoMember(3)]
|
||||
public uint Group { get; set; } // 组
|
||||
[ProtoMember(4)]
|
||||
public string[] Items { get; set; } = Array.Empty<string>(); // 物品
|
||||
[ProtoMember(5)]
|
||||
public uint[] Items { get; set; } = Array.Empty<uint>(); // 物品
|
||||
[ProtoMember(6)]
|
||||
public uint Amount { get; set; } // 获得数量
|
||||
[ProtoMember(7)]
|
||||
public uint Price1 { get; set; } // 银币价格
|
||||
[ProtoMember(8)]
|
||||
[ProtoMember(6)]
|
||||
public uint Price2 { get; set; } // 金币价格
|
||||
[ProtoMember(9)]
|
||||
[ProtoMember(7)]
|
||||
public uint[] Label { get; set; } = Array.Empty<uint>(); // 标签
|
||||
[ProtoMember(10)]
|
||||
[ProtoMember(8)]
|
||||
public uint Number { get; set; } // 可购买数量
|
||||
[ProtoMember(11)]
|
||||
[ProtoMember(9)]
|
||||
public uint Disable { get; set; } // 禁用状态
|
||||
[ProtoIgnore]
|
||||
public uint Key => Id;
|
||||
|
||||
@@ -31,9 +31,7 @@ namespace NBF
|
||||
[ProtoMember(8)]
|
||||
public uint Max { get; set; } // 最大堆叠数量
|
||||
[ProtoMember(9)]
|
||||
public uint AutoUse { get; set; } // 获得自动使用
|
||||
[ProtoMember(10)]
|
||||
public uint Deal { get; set; } // 交易类型
|
||||
public uint AutoUse { get; set; } // 获得自动使用
|
||||
[ProtoIgnore]
|
||||
public uint Key => Id;
|
||||
|
||||
|
||||
2
Assets/Scripts/UI/Bag/BagItem.Designer.cs
generated
2
Assets/Scripts/UI/Bag/BagItem.Designer.cs
generated
@@ -12,7 +12,6 @@ namespace NBF
|
||||
public const string URL = "ui://hxr7rc7puq3a1h";
|
||||
|
||||
public GImage back;
|
||||
public GImage Quality2;
|
||||
public GImage Quality;
|
||||
|
||||
public override void ConstructFromXML(XML xml)
|
||||
@@ -20,7 +19,6 @@ namespace NBF
|
||||
base.ConstructFromXML(xml);
|
||||
|
||||
back = (GImage)GetChild("back");
|
||||
Quality2 = (GImage)GetChild("Quality2");
|
||||
Quality = (GImage)GetChild("Quality");
|
||||
OnInited();
|
||||
UILanguage.TrySetComponentLanguage(this);
|
||||
|
||||
2
Assets/Scripts/UI/Bag/BagPanel.Designer.cs
generated
2
Assets/Scripts/UI/Bag/BagPanel.Designer.cs
generated
@@ -20,7 +20,7 @@ namespace NBF
|
||||
public BottomMenu BottomMenu;
|
||||
[AutoFind(Name = "ItemList")]
|
||||
public CommonItemList ItemList;
|
||||
public override string[] GetDependPackages(){ return new string[] {"Common"}; }
|
||||
public override string[] GetDependPackages(){ return new string[] {"Common","CommonNew"}; }
|
||||
|
||||
public static void Show(object param = null){ App.UI.OpenUI<BagPanel>(param); }
|
||||
|
||||
|
||||
@@ -38,7 +38,6 @@ namespace NBF
|
||||
ItemList.SetPanel(this);
|
||||
ItemList.SetData(tabItemList, true, true);
|
||||
|
||||
BagSlotPanel.Show();
|
||||
}
|
||||
|
||||
private void OnUICanceled(string action)
|
||||
|
||||
2
Assets/Scripts/UI/Bag/BagSelectPanel.Designer.cs
generated
2
Assets/Scripts/UI/Bag/BagSelectPanel.Designer.cs
generated
@@ -24,7 +24,7 @@ namespace NBF
|
||||
public BtnTitleInputControl BtnConfirm;
|
||||
[AutoFind(Name = "List")]
|
||||
public ClassifyList List;
|
||||
public override string[] GetDependPackages(){ return new string[] {"Common"}; }
|
||||
public override string[] GetDependPackages(){ return new string[] {"Common","CommonNew"}; }
|
||||
|
||||
public static void Show(object param = null){ App.UI.OpenUI<BagSelectPanel>(param); }
|
||||
|
||||
|
||||
2
Assets/Scripts/UI/Bag/BagSlotPanel.Designer.cs
generated
2
Assets/Scripts/UI/Bag/BagSlotPanel.Designer.cs
generated
@@ -26,7 +26,7 @@ namespace NBF
|
||||
public GImage SlotSeparator;
|
||||
[AutoFind(Name = "Test")]
|
||||
public GLoader Test;
|
||||
public override string[] GetDependPackages(){ return new string[] {"Common"}; }
|
||||
public override string[] GetDependPackages(){ return new string[] {"Common","CommonNew"}; }
|
||||
|
||||
public static void Show(object param = null){ App.UI.OpenUI<BagSlotPanel>(param); }
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace NBF
|
||||
public ItemDetailsContent Content;
|
||||
[AutoFind(Name = "Quality")]
|
||||
public GImage Quality;
|
||||
public override string[] GetDependPackages(){ return new string[] {"Common"}; }
|
||||
public override string[] GetDependPackages(){ return new string[] {"Common","CommonNew"}; }
|
||||
|
||||
public static void Show(object param = null){ App.UI.OpenUI<ItemDetailsPanel>(param); }
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
CommonBinder.BindAll();
|
||||
FishingBinder.BindAll();
|
||||
MainBinder.BindAll();
|
||||
ShopBinder.BindAll();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
/**注册组件绑定关系。本脚本为自动生成,每次生成会覆盖!请勿手动修改,生成插件文档及项目地址:https://git.whoot.com/whoot-games/whoot.fguieditorplugin**/
|
||||
|
||||
using FairyGUI;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public static class ShopBinder
|
||||
{
|
||||
[UIExtensionAutoBind]
|
||||
public static void BindAll()
|
||||
{
|
||||
UIObjectFactory.SetPackageItemExtension(ShopItem.URL, typeof(ShopItem));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f579b85674067d740ba424bcc5da406d
|
||||
2
Assets/Scripts/UI/ChatTestPanel.Designer.cs
generated
2
Assets/Scripts/UI/ChatTestPanel.Designer.cs
generated
@@ -34,7 +34,7 @@ namespace NBF
|
||||
public GButton BtnSendWorld;
|
||||
[AutoFind(Name = "ChatList")]
|
||||
public GList ChatList;
|
||||
public override string[] GetDependPackages(){ return new string[] {"Common"}; }
|
||||
public override string[] GetDependPackages(){ return new string[] {"Common","CommonNew"}; }
|
||||
|
||||
public static void Show(object param = null){ App.UI.OpenUI<ChatTestPanel>(param); }
|
||||
|
||||
|
||||
@@ -121,6 +121,10 @@ namespace NBF
|
||||
titleItem.SetData(itemData);
|
||||
titleItem.SetSize(List.width, 32);
|
||||
}
|
||||
else if (obj is ShopGearItem shopGearItem)
|
||||
{
|
||||
shopGearItem.SetData(itemData as GoodsConfig);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -128,17 +132,18 @@ namespace NBF
|
||||
string GetListItemResource(int index)
|
||||
{
|
||||
var itemData = _listData[index];
|
||||
|
||||
if (itemData is ShopItemInfo)
|
||||
{
|
||||
return ShopItem.URL;
|
||||
}
|
||||
|
||||
|
||||
if (itemData is ItemInfo itemInfo)
|
||||
{
|
||||
return BagItem.URL;
|
||||
}
|
||||
|
||||
if (itemData is GoodsConfig goodsConfig)
|
||||
{
|
||||
return ShopGearItem.URL;
|
||||
}
|
||||
|
||||
if (itemData is ClassifyListTitleData titleData)
|
||||
{
|
||||
return ListTitleItem.URL;
|
||||
|
||||
@@ -50,7 +50,6 @@ namespace NBF
|
||||
style.selectedIndex = 1; //有二级菜单
|
||||
}
|
||||
|
||||
|
||||
_tabList.AddRange(tabItemList);
|
||||
|
||||
if (showListTitle)
|
||||
|
||||
@@ -11,9 +11,7 @@ namespace NBF
|
||||
{
|
||||
public const string URL = "ui://6hgkvlaufcfggr";
|
||||
|
||||
public Controller showType;
|
||||
public GList List;
|
||||
public GButton BtnUserHead;
|
||||
public BtnInputControl BtnPrev;
|
||||
public BtnInputControl BtnNext;
|
||||
|
||||
@@ -21,9 +19,7 @@ namespace NBF
|
||||
{
|
||||
base.ConstructFromXML(xml);
|
||||
|
||||
showType = GetController("showType");
|
||||
List = (GList)GetChild("List");
|
||||
BtnUserHead = (GButton)GetChild("BtnUserHead");
|
||||
BtnPrev = (BtnInputControl)GetChild("BtnPrev");
|
||||
BtnNext = (BtnInputControl)GetChild("BtnNext");
|
||||
OnInited();
|
||||
|
||||
@@ -39,7 +39,12 @@ namespace NBF
|
||||
|
||||
public void SetData(ItemInfo itemInfo)
|
||||
{
|
||||
_renderImage.SetModel(PrefabsHelper.CreateItem(itemInfo), ModelViewerSettings.Load(itemInfo.ConfigId));
|
||||
_renderImage.SetModel(PrefabsHelper.CreateItem(itemInfo.Config), ModelViewerSettings.Load(itemInfo.ConfigId));
|
||||
}
|
||||
|
||||
public void SetData(ItemConfig itemConfig)
|
||||
{
|
||||
_renderImage.SetModel(PrefabsHelper.CreateItem(itemConfig), ModelViewerSettings.Load(itemConfig.Id));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace NBF
|
||||
public GImage back;
|
||||
[AutoFind(Name = "BottomMenu")]
|
||||
public BottomMenu BottomMenu;
|
||||
public override string[] GetDependPackages(){ return new string[] {"Common"}; }
|
||||
public override string[] GetDependPackages(){ return new string[] {"Common","CommonNew"}; }
|
||||
|
||||
public static void Show(object param = null){ App.UI.OpenUI<FishBagPanel>(param); }
|
||||
|
||||
|
||||
2
Assets/Scripts/UI/Home/HomePanel.Designer.cs
generated
2
Assets/Scripts/UI/Home/HomePanel.Designer.cs
generated
@@ -20,7 +20,7 @@ namespace NBF
|
||||
public GComponent Pages;
|
||||
[AutoFind(Name = "Menu")]
|
||||
public CommonMenu Menu;
|
||||
public override string[] GetDependPackages(){ return new string[] {"Common"}; }
|
||||
public override string[] GetDependPackages(){ return new string[] {"Common","CommonNew"}; }
|
||||
|
||||
public static void Show(object param = null){ App.UI.OpenUI<HomePanel>(param); }
|
||||
|
||||
|
||||
2
Assets/Scripts/UI/Login/LoginPanel.Designer.cs
generated
2
Assets/Scripts/UI/Login/LoginPanel.Designer.cs
generated
@@ -20,7 +20,7 @@ namespace NBF
|
||||
public CommonInput InputAccount;
|
||||
[AutoFind(Name = "BtnLogin")]
|
||||
public GButton BtnLogin;
|
||||
public override string[] GetDependPackages(){ return new string[] {"Common"}; }
|
||||
public override string[] GetDependPackages(){ return new string[] {"Common","CommonNew"}; }
|
||||
|
||||
public static void Show(object param = null){ App.UI.OpenUI<LoginPanel>(param); }
|
||||
|
||||
|
||||
2
Assets/Scripts/UI/Make/MakePanel.Designer.cs
generated
2
Assets/Scripts/UI/Make/MakePanel.Designer.cs
generated
@@ -20,7 +20,7 @@ namespace NBF
|
||||
public CommonMenu Menu;
|
||||
[AutoFind(Name = "BottomMenu")]
|
||||
public BottomMenu BottomMenu;
|
||||
public override string[] GetDependPackages(){ return new string[] {"Common"}; }
|
||||
public override string[] GetDependPackages(){ return new string[] {"Common","CommonNew"}; }
|
||||
|
||||
public static void Show(object param = null){ App.UI.OpenUI<MakePanel>(param); }
|
||||
|
||||
|
||||
2
Assets/Scripts/UI/MapPanel.Designer.cs
generated
2
Assets/Scripts/UI/MapPanel.Designer.cs
generated
@@ -18,7 +18,7 @@ namespace NBF
|
||||
public GImage back;
|
||||
[AutoFind(Name = "BottomMenu")]
|
||||
public BottomMenu BottomMenu;
|
||||
public override string[] GetDependPackages(){ return new string[] {"Common"}; }
|
||||
public override string[] GetDependPackages(){ return new string[] {"Common","CommonNew"}; }
|
||||
|
||||
public static void Show(object param = null){ App.UI.OpenUI<MapPanel>(param); }
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace NBF
|
||||
public GLabel Mask;
|
||||
[AutoFind(Name = "InputWait")]
|
||||
public GComponent InputWait;
|
||||
public override string[] GetDependPackages(){ return new string[] {"Common"}; }
|
||||
public override string[] GetDependPackages(){ return new string[] {"Common","CommonNew"}; }
|
||||
|
||||
public static void Show(object param = null){ App.UI.OpenUI<SettingPanel>(param); }
|
||||
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
// 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖
|
||||
|
||||
using UnityEngine;
|
||||
using FairyGUI;
|
||||
using NBC;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public partial class ShopGearItem : GButton
|
||||
{
|
||||
private void OnInited()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
10
Assets/Scripts/UI/Shops/FishingShopPanel.Designer.cs
generated
10
Assets/Scripts/UI/Shops/FishingShopPanel.Designer.cs
generated
@@ -14,13 +14,17 @@ namespace NBF
|
||||
public override string UIPackName => "Main";
|
||||
public override string UIResName => "FishingShopPanel";
|
||||
|
||||
[AutoFind(Name = "Currencys")]
|
||||
public GComponent Currencys;
|
||||
[AutoFind(Name = "BottomMenu")]
|
||||
public BottomMenu BottomMenu;
|
||||
[AutoFind(Name = "ItemList")]
|
||||
public CommonItemList ItemList;
|
||||
public override string[] GetDependPackages(){ return new string[] {"Common"}; }
|
||||
[AutoFind(Name = "Currencys")]
|
||||
public GComponent Currencys;
|
||||
[AutoFind(Name = "Loading")]
|
||||
public GLabel Loading;
|
||||
[AutoFind(Name = "Head")]
|
||||
public GButton Head;
|
||||
public override string[] GetDependPackages(){ return new string[] {"Common","CommonNew"}; }
|
||||
|
||||
public static void Show(object param = null){ App.UI.OpenUI<FishingShopPanel>(param); }
|
||||
|
||||
|
||||
@@ -14,42 +14,44 @@ namespace NBF
|
||||
protected override void OnInit()
|
||||
{
|
||||
base.OnInit();
|
||||
this.AutoAddClick(OnClick);
|
||||
IsShowCursor = true;
|
||||
|
||||
// List<TabItemData> tabItemList = new List<TabItemData>();
|
||||
// for (int i = 0; i < 10; i++)
|
||||
// {
|
||||
// TabItemData tabItem = new TabItemData();
|
||||
// tabItem.Key = $"Tab_{i}";
|
||||
// for (int j = 0; j < 5; j++)
|
||||
// {
|
||||
// TabItemData tabSubItem = new TabItemData();
|
||||
// tabSubItem.Key = $"SubTab_{j}";
|
||||
// var count = Random.Range(2, 5);
|
||||
// for (int k = 0; k < count; k++)
|
||||
// {
|
||||
// var item = new ShopGearData
|
||||
// {
|
||||
// title = $"Item:{i}-{j}-{k}"
|
||||
// };
|
||||
// tabSubItem.Items.Add(item);
|
||||
// }
|
||||
//
|
||||
// tabItem.Children.Add(tabSubItem);
|
||||
// }
|
||||
//
|
||||
// tabItemList.Add(tabItem);
|
||||
// }
|
||||
//
|
||||
// ItemList.SetPanel(this);
|
||||
// ItemList.SetData(tabItemList, true, true);
|
||||
GoodsConfigHelper.Init();
|
||||
}
|
||||
|
||||
protected override void OnShow()
|
||||
{
|
||||
base.OnShow();
|
||||
ItemList.List.OnClickItem += OnClickItem;
|
||||
Game.Input.OnUICanceled += OnUICanceled;
|
||||
UseBottomMenu();
|
||||
|
||||
List<TabItemData> tabItemList = GoodsConfigHelper.TabItemList;
|
||||
|
||||
ItemList.SetPanel(this);
|
||||
ItemList.SetData(tabItemList, true, true);
|
||||
}
|
||||
|
||||
private void OnUICanceled(string action)
|
||||
{
|
||||
if (!IsTop) return;
|
||||
if (action == InputDef.UI.SubPrev)
|
||||
{
|
||||
}
|
||||
else if (action == InputDef.UI.SubNext)
|
||||
{
|
||||
}
|
||||
else if (action == InputDef.UI.Up)
|
||||
{
|
||||
}
|
||||
else if (action == InputDef.UI.Down)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
private void OnClickItem(object item)
|
||||
{
|
||||
if (item is not ShopGearItem gearItem) return;
|
||||
// ItemDetailsPanel.s
|
||||
// ItemDetailsPanel.Show(bagItem.ItemInfo);
|
||||
ShopDetailsPanel.Show(gearItem.Config);
|
||||
}
|
||||
|
||||
private void UseBottomMenu()
|
||||
@@ -57,19 +59,10 @@ namespace NBF
|
||||
BottomMenu.Use(this);
|
||||
}
|
||||
|
||||
|
||||
private void OnClickItem(object item)
|
||||
protected override void OnHide()
|
||||
{
|
||||
if (item is not ShopItem shopGearItem) return;
|
||||
// Log.Info($"click item ={shopGearItem.GearData.title}");
|
||||
}
|
||||
|
||||
private void OnClick(GComponent btn)
|
||||
{
|
||||
// if (btn == BtnClose)
|
||||
// {
|
||||
// Hide();
|
||||
// }
|
||||
Game.Input.OnUICanceled -= OnUICanceled;
|
||||
ItemList.List.OnClickItem -= OnClickItem;
|
||||
}
|
||||
|
||||
protected override void OnDestroy()
|
||||
|
||||
74
Assets/Scripts/UI/Shops/GoodsConfigHelper.cs
Normal file
74
Assets/Scripts/UI/Shops/GoodsConfigHelper.cs
Normal file
@@ -0,0 +1,74 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NBF.Utils;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public static class GoodsConfigHelper
|
||||
{
|
||||
public static readonly List<TabItemData> TabItemList = new List<TabItemData>();
|
||||
|
||||
/// <summary>
|
||||
/// 组合和id映射关系
|
||||
/// </summary>
|
||||
private static readonly Dictionary<uint, List<uint>> _group2Id = new Dictionary<uint, List<uint>>();
|
||||
|
||||
private static readonly Dictionary<uint, GoodsConfig> _googs = new Dictionary<uint, GoodsConfig>();
|
||||
|
||||
// private static readonly Dictionary<>
|
||||
|
||||
|
||||
public static void Init()
|
||||
{
|
||||
var listGoods = GoodsConfig.GetList();
|
||||
TabItemList.Clear();
|
||||
|
||||
|
||||
foreach (var goodsConfig in listGoods)
|
||||
{
|
||||
if (goodsConfig.Group < 1)
|
||||
{
|
||||
goodsConfig.Group = goodsConfig.Id;
|
||||
}
|
||||
|
||||
if (!_group2Id.TryGetValue(goodsConfig.Group, out List<uint> ids))
|
||||
{
|
||||
ids = new List<uint>();
|
||||
_group2Id.Add(goodsConfig.Group, ids);
|
||||
}
|
||||
|
||||
ids.Add(goodsConfig.Id);
|
||||
_googs[goodsConfig.Id] = goodsConfig;
|
||||
}
|
||||
|
||||
Dictionary<ItemType, List<GoodsConfig>> tabDic = new Dictionary<ItemType, List<GoodsConfig>>();
|
||||
foreach (var goodsId in _group2Id.Keys)
|
||||
{
|
||||
var good = _googs[goodsId];
|
||||
var awards = good.Awards;
|
||||
var type = awards.First().Id.GetItemType();
|
||||
if (!tabDic.ContainsKey(type))
|
||||
{
|
||||
tabDic.Add(type, new List<GoodsConfig>());
|
||||
}
|
||||
|
||||
tabDic[type].Add(good);
|
||||
}
|
||||
|
||||
foreach (var (key, list) in tabDic)
|
||||
{
|
||||
list.Sort((x, y) => (int)(y.Price1 - x.Price1));
|
||||
}
|
||||
|
||||
foreach (var (type, list) in tabDic)
|
||||
{
|
||||
TabItemData tabItem = new TabItemData
|
||||
{
|
||||
Key = type.ToString()
|
||||
};
|
||||
tabItem.Items.AddRange(list);
|
||||
TabItemList.Add(tabItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Assets/Scripts/UI/Shops/GoodsConfigHelper.cs.meta
Normal file
3
Assets/Scripts/UI/Shops/GoodsConfigHelper.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 488efa1c587a4dc7a08fb18550e6f470
|
||||
timeCreated: 1763867799
|
||||
40
Assets/Scripts/UI/Shops/ShopDetailsPanel.Designer.cs
generated
Normal file
40
Assets/Scripts/UI/Shops/ShopDetailsPanel.Designer.cs
generated
Normal file
@@ -0,0 +1,40 @@
|
||||
/**本脚本为自动生成,每次生成会覆盖!请勿手动修改,生成插件文档及项目地址:https://git.whoot.com/whoot-games/whoot.fguieditorplugin**/
|
||||
|
||||
using FairyGUI;
|
||||
using FairyGUI.Utils;
|
||||
using NBC;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
/// <summary> </summary>
|
||||
public partial class ShopDetailsPanel
|
||||
{
|
||||
public GObject this[string aKey] => ContentPane.GetChild(aKey);
|
||||
public override string UIPackName => "Main";
|
||||
public override string UIResName => "ShopDetailsPanel";
|
||||
|
||||
[AutoFind(Name = "back")]
|
||||
public GLabel back;
|
||||
[AutoFind(Name = "BottomMenu")]
|
||||
public BottomMenu BottomMenu;
|
||||
[AutoFind(Name = "title")]
|
||||
public GComponent title;
|
||||
[AutoFind(Name = "modelBack")]
|
||||
public GImage modelBack;
|
||||
[AutoFind(Name = "Model")]
|
||||
public ModelViewer Model;
|
||||
[AutoFind(Name = "Content")]
|
||||
public GComponent Content;
|
||||
[AutoFind(Name = "Quality")]
|
||||
public GImage Quality;
|
||||
public override string[] GetDependPackages(){ return new string[] {"Common","CommonNew"}; }
|
||||
|
||||
public static void Show(object param = null){ App.UI.OpenUI<ShopDetailsPanel>(param); }
|
||||
|
||||
public static void Hide(){ App.UI.HideUI<ShopDetailsPanel>(); }
|
||||
|
||||
public static void Del(){ App.UI.DestroyUI<ShopDetailsPanel>(); }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 05068004b176c354aa41b3db4f299fce
|
||||
15
Assets/Scripts/UI/Shops/ShopDetailsPanel.cs
Normal file
15
Assets/Scripts/UI/Shops/ShopDetailsPanel.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
// 本脚本只在不存在时会生成一次。已存在不会再次生成覆盖
|
||||
|
||||
using UnityEngine;
|
||||
using NBC;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public partial class ShopDetailsPanel : UIPanel
|
||||
{
|
||||
protected override void OnShow()
|
||||
{
|
||||
// Model.SetData(ItemInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/Shops/ShopDetailsPanel.cs.meta
Normal file
2
Assets/Scripts/UI/Shops/ShopDetailsPanel.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b94c59d346c7a1d458f0bbdd72e12768
|
||||
@@ -12,14 +12,18 @@ namespace NBF
|
||||
public const string URL = "ui://hxr7rc7poome9";
|
||||
|
||||
public GImage back;
|
||||
public GImage ba;
|
||||
public GTextField TextPrice;
|
||||
public GImage Quality;
|
||||
public GTextField TextAmount;
|
||||
|
||||
public override void ConstructFromXML(XML xml)
|
||||
{
|
||||
base.ConstructFromXML(xml);
|
||||
|
||||
back = (GImage)GetChild("back");
|
||||
ba = (GImage)GetChild("ba");
|
||||
TextPrice = (GTextField)GetChild("TextPrice");
|
||||
Quality = (GImage)GetChild("Quality");
|
||||
TextAmount = (GTextField)GetChild("TextAmount");
|
||||
OnInited();
|
||||
UILanguage.TrySetComponentLanguage(this);
|
||||
}
|
||||
35
Assets/Scripts/UI/Shops/ShopGearItem.cs
Normal file
35
Assets/Scripts/UI/Shops/ShopGearItem.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
// 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖
|
||||
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using FairyGUI;
|
||||
using Fantasy;
|
||||
using NBC;
|
||||
using NBF.Utils;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public partial class ShopGearItem : GButton
|
||||
{
|
||||
public GoodsConfig Config;
|
||||
private void OnInited()
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void SetData(GoodsConfig goodsConfig)
|
||||
{
|
||||
Config = goodsConfig;
|
||||
var award = goodsConfig.Awards.First();
|
||||
title = award.Id.GetName();
|
||||
this.SetIcon(award.Id);
|
||||
|
||||
var cfg = ItemConfig.Get(award.Id);
|
||||
|
||||
Quality.SetQuality(cfg.Quality);
|
||||
this.SetTitleQuality(cfg.Quality);
|
||||
|
||||
TextAmount.text = $"个数:{award.Amount}";
|
||||
TextPrice.text = goodsConfig.Price1.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
33
Assets/Scripts/UI/Shops/ShopItem.Designer.cs
generated
33
Assets/Scripts/UI/Shops/ShopItem.Designer.cs
generated
@@ -1,33 +0,0 @@
|
||||
/**本脚本为自动生成,每次生成会覆盖!请勿手动修改,生成插件文档及项目地址:https://git.whoot.com/whoot-games/whoot.fguieditorplugin**/
|
||||
|
||||
|
||||
using FairyGUI;
|
||||
using FairyGUI.Utils;
|
||||
using NBC;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public partial class ShopItem
|
||||
{
|
||||
public const string URL = "ui://hxr7rc7poome9";
|
||||
|
||||
public GImage back;
|
||||
public GImage Quality;
|
||||
public GTextField TextCoin;
|
||||
public GLoader CoinIcon;
|
||||
public GTextField TextCoin_2;
|
||||
|
||||
public override void ConstructFromXML(XML xml)
|
||||
{
|
||||
base.ConstructFromXML(xml);
|
||||
|
||||
back = (GImage)GetChild("back");
|
||||
Quality = (GImage)GetChild("Quality");
|
||||
TextCoin = (GTextField)GetChild("TextCoin");
|
||||
CoinIcon = (GLoader)GetChild("CoinIcon");
|
||||
TextCoin_2 = (GTextField)GetChild("TextCoin");
|
||||
OnInited();
|
||||
UILanguage.TrySetComponentLanguage(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f1c9e707edc525b419a4d8469675a653
|
||||
@@ -1,23 +0,0 @@
|
||||
// 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖
|
||||
|
||||
using UnityEngine;
|
||||
using FairyGUI;
|
||||
using NBC;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public partial class ShopItem : ListItemBase
|
||||
{
|
||||
// public ShopGearData GearData;
|
||||
private void OnInited()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnSetData(object showData)
|
||||
{
|
||||
// GearData = showData as ShopGearData;
|
||||
// if(GearData == null) return;
|
||||
// title = GearData.title;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 88f8461d076edc549bc841c01f0e42a3
|
||||
Reference in New Issue
Block a user