This commit is contained in:
2026-07-05 18:52:09 +08:00
parent ab5f2f1876
commit 2350899944
13 changed files with 477 additions and 167 deletions
@@ -2,12 +2,12 @@
%TAG !u! tag:unity3d.com,2011:
--- !u!91 &9100000
AnimatorController:
serializedVersion: 5
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: 6005
serializedVersion: 5
m_AnimatorParameters: []
m_AnimatorLayers:
- serializedVersion: 5
@@ -22,27 +22,18 @@ AnimatorController:
m_IKPass: 0
m_SyncedLayerAffectsTiming: 0
m_Controller: {fileID: 9100000}
--- !u!1107 &1107792756698689120
AnimatorStateMachine:
serializedVersion: 6
--- !u!114 &114365373386673845
MonoBehaviour:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Base Layer
m_ChildStates:
- m_State: {fileID: 1102027198591866211}
m_Position: {x: 0, y: 0, z: 0}
m_ChildStateMachines: []
m_AnyStateTransitions: []
m_EntryTransitions: []
m_StateMachineTransitions: {}
m_StateMachineBehaviours: []
m_AnyStatePosition: {x: 0, y: -100, z: 0}
m_EntryPosition: {x: 250, y: -100, z: 0}
m_ExitPosition: {x: 500, y: -100, z: 0}
m_ParentStateMachinePosition: {x: 0, y: -200, z: 0}
m_DefaultState: {fileID: 1102027198591866211}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 562193290, guid: aca38bdffd9260a086cd2d8812275791, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1102 &1102027198591866211
AnimatorState:
serializedVersion: 6
@@ -54,8 +45,7 @@ AnimatorState:
m_Speed: 1
m_CycleOffset: 0
m_Transitions: []
m_StateMachineBehaviours:
- {fileID: 114365373386673845}
m_StateMachineBehaviours: []
m_Position: {x: 0, y: 0, z: 0}
m_IKOnFeet: 0
m_WriteDefaultValues: 1
@@ -70,15 +60,25 @@ AnimatorState:
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:
--- !u!114 &114365373386673845
MonoBehaviour:
--- !u!1107 &1107792756698689120
AnimatorStateMachine:
serializedVersion: 6
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 562193290, guid: aca38bdffd9260a086cd2d8812275791, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Name: Base Layer
m_ChildStates:
- serializedVersion: 1
m_State: {fileID: 1102027198591866211}
m_Position: {x: 240, y: 90, z: 0}
m_ChildStateMachines: []
m_AnyStateTransitions: []
m_EntryTransitions: []
m_StateMachineTransitions: {}
m_StateMachineBehaviours: []
m_AnyStatePosition: {x: 0, y: -100, z: 0}
m_EntryPosition: {x: 250, y: -100, z: 0}
m_ExitPosition: {x: 500, y: -100, z: 0}
m_ParentStateMachinePosition: {x: 0, y: -200, z: 0}
m_DefaultState: {fileID: 1102027198591866211}
@@ -61,7 +61,7 @@ public class BotSkillConfig
[Space]
[Header("双倍炮 - 消耗翻倍")]
[Range(0f, 1f)] public float doubleProb = 1f;
[Range(0f, 1f)] public float doubleProb = 0f;
public float doubleMinTime = 3f;
public float doubleMaxTime = 6f;
}
@@ -1,6 +1,6 @@
神龙转盘1;-555.8911,862.1623;-605.461,603.6906;-573.5946,359.3818;-481.53622,157.5615;-308.04156,-33.636723;-88.517685,-125.695114;116.843346,-182.34644;258.47165,-210.6721;396.55923,-221.29422;531.10614,-217.75351;658.5716,-214.2128;747.0893,-210.6721;846.2291,-203.59068;927.66534,-203.59068;1023.26447,-196.50926;1140.1078,-185.88715;1359.6317,-164.6429
神龙转盘2;697.5194,915.2729;740.0079,621.39417;672.73444,316.8933;393.01852,115.073;240.76811,23.014599;131.00618,-37.17743;-3.5407076,-83.20663;-120.384056,-118.6137;-251.39023,-150.48007;-364.69287,-168.18361;-467.37338,-171.72432;-591.29816,-175.26503;-672.73444,-171.72432;-757.7114,-157.5615;-839.1477,-132.77654;-952.4503,-97.36945;-1055.1309,-65.50309;-1154.2706,-30.096014;-1278.1954,5.3110614
神龙转盘3;-1278.1954,19.473892;-1005.5609,19.473892;-810.822,19.473892;-637.32733,26.555307;-474.4548,26.555307;-297.41943,30.096014;-134.54689,30.096014;-21.244246,33.636723;81.43627,33.636723;184.11679,33.636723;279.71588,40.718136;350.53006,33.636723;414.2628,33.636723;520.484,33.636723;605.461,33.636723;697.5194,33.636723;754.1707,33.636723;807.2813,33.636723;913.50256,30.096014;1019.72375,40.718136;1125.945,40.718136;1203.8406,40.718136;1359.6317,37.17743
神龙转盘3;-1304.3854,-62.807915;-1053.1538,-58.321632;-857.65283,-59.476074;-674.9596,-56.866173;-490.96136,-54.25627;-310.87802,-52.951317;-139.92928,-46.42655;-36.838074,-49.036453;64.94818,-45.121597;168.03937,-41.20674;269.8256,-38.596832;345.51282,-37.291878;401.62573,-35.98693;456.43372,-35.98693;545.1705,-34.681976;623.4676,-32.072075;701.7647,-32.072075;786.58655,-28.157219;871.40845,-29.462166;982.32935,-30.76712;1076.2859,-33.37702;1183.292,-34.681976;1352.9357,-33.37702
玲珑宝塔1;-407.18137,876.32513;-410.72208,713.4526;-414.2628,554.1207;-421.3442,377.08536;-428.4256,242.53847;-435.50702,107.99158;-449.66986,-12.392476;-308.04156,-19.473892;-166.41325,-19.473892;-67.273445,-12.392476;35.407074,-15.933184;131.00618,-8.8517685;201.82033,-8.8517685;276.1752,-5.3110614;350.53006,-5.3110614;428.4256,-5.3110614;509.86188,-5.3110614;566.5132,-1.7703538;612.5424,1.7703538;679.81586,5.3110614;729.38574,5.3110614;775.415,8.8517685;832.0663,8.8517685;899.3397,8.8517685;963.07245,8.8517685;1040.968,12.392476;1125.945,1.7703538;1218.0034,5.3110614;1295.8989,1.7703538;1359.6317,1.7703538
玲珑宝塔2;1359.6317,-47.799553;1086.9972,-51.34026;878.09546,-47.799553;665.653,-40.718136;439.04773,-40.718136;173.49467,-40.718136;-38.947784,-37.17743;-265.55307,-33.636723;-396.55923,-33.636723;-524.0247,-26.555307;-651.4902,-26.555307;-757.7114,-30.096014;-871.01404,-26.555307;-1005.5609,-30.096014;-1274.6547,-37.17743
玲珑宝塔3;-1302.9803,-423.11456;-1086.9972,-370.00394;-909.96185,-313.35263;-736.46716,-242.53847;-577.1353,-182.34644;-435.50702,-132.77654;-311.58228,-86.74734;-219.52386,-44.258842;-123.92477,-1.7703538;-21.244246,40.718136;84.97698,93.82875;173.49467,132.77654;262.01236,178.80573;368.23358,214.2128;449.66986,256.7013;524.0247,288.56766;605.461,323.97473;701.0601,359.3818;814.36273,416.03314;934.74677,465.60303;1033.8866,518.7137;1218.0034,621.39417;1288.8175,663.8827
@@ -163,7 +163,7 @@
曲线162;1274.7909,-435.47058;1150.6489,-337.93045;1050.1531,-269.94794;952.6129,-201.96541;869.85156,-131.02711;793.0018,-83.734924;665.904,-24.619694;559.4966,52.230114;432.3988,114.30112;308.25684,164.54906;157.51297,208.88548;48.149796,226.62006;-96.68254,229.57582;-238.55911,220.70854;-350.87805,179.32787;-433.6394,75.87621;-492.75464,-12.796644;-569.60443,-36.442738;-667.14453,-71.91188;-761.72894,-89.64645;-888.8267,-107.38102;-1010.01294,-122.15983;-1113.4646,-136.93864;-1228.7394,-148.76169;-1338.1025,-157.62898
曲线163;-1234.6509,-716.26794;-1116.4204,-636.46234;-1042.5264,-559.61255;-930.2074,-467.98398;-809.0211,-376.35535;-708.52527,-311.32858;-548.91406,-255.16911;-418.8606,-193.09811;-282.89554,-139.89441;-132.15169,-92.60221;-5.0539246,-33.486977;133.86688,22.672497;269.83194,75.87621;376.23938,126.12417;497.4256,188.19516;609.7445,247.3104;707.28467,297.55835;819.60364,359.62933;946.7014,433.52338;1035.3743,495.5944;1144.7374,578.3558;1230.4545,649.294
曲线164;1348.6849,-187.1866;1159.5162,-175.36356;1026.507,-175.36356;902.365,-181.27507;763.44415,-178.3193;630.4349,-166.49626;473.77948,-169.45203;340.7702,-160.58475;216.6282,-163.5405;59.97284,-160.58475;-102.59406,-151.71745;-253.33792,-157.62898;-398.17023,-163.5405;-569.60443,-148.76169;-732.1713,-133.98288;-879.9594,-133.98288;-1072.084,-136.93864;-1222.8278,-125.11559;-1352.8813,-119.20407
曲线165;-1252.3854,90.65502;-1083.907,114.30112;-918.38434,132.03568;-773.552,167.50482;-596.2063,208.88548;-433.6394,229.57582;-282.89554,241.39886;-114.417114,241.39886;0.857605,232.53159;148.64569,235.48735;293.47803,232.53159;444.22186,250.26614;580.1869,262.0892;739.79803,270.95648;849.16125,288.69107;979.2147,306.42563;1097.4452,330.07172;1248.1891,365.54086;1366.4196,409.8773
曲线165;-1306.1277,-5.9011793;-1152.697,9.835299;-983.5299,17.703537;-806.4945,29.505896;-609.7885,29.505896;-436.68726,45.242374;-228.17894,68.84709;-82.61651,88.51769;70.81415,96.385925;220.3107,112.122406;369.80725,127.85889;515.3696,155.39772;653.06384,163.26596;763.2192,182.93655;885.1769,226.21187;999.26636,269.48718;1125.1582,304.89426;1248.1891,365.54086;1366.4196,409.8773
曲线166;1192.0297,-683.7546;1059.0204,-568.47986;952.6129,-467.98398;840.29395,-379.31113;680.6828,-255.16911;532.8947,-136.93864;361.46057,-18.708168;190.02637,75.87621;24.503693,117.25688;-173.53235,152.72601;-353.8338,182.28363;-510.4892,211.84125;-664.18884,247.3104;-773.552,288.69107;-891.7825,350.76205;-1027.7476,401.01;-1160.7568,466.03677;-1237.6066,516.2847;-1344.014,593.1346
曲线167;-1296.7218,-293.59402;-1125.2876,-266.99216;-992.2784,-237.43456;-829.7115,-196.05388;-708.52527,-160.58475;-575.516,-119.20407;-454.3297,-68.956116;-306.54163,-18.708168;-155.79778,19.716736;-31.655777,64.05317;86.57471,111.34535;195.93787,191.15092;272.7877,282.77954;355.549,392.14273;435.3546,498.55014;494.46985,607.9134;541.762,693.63043;597.9215,802.99365
曲线168;704.3289,-734.0025;606.78876,-615.77203;509.24866,-503.45312;438.31036,-429.55908;308.25684,-305.41708;213.67245,-240.3903;86.57471,-160.58475;-34.61154,-86.69069;-179.44388,-9.840883;-294.71857,46.318592;-386.3472,84.7435;-540.0468,120.21264;-699.65796,149.77025;-814.9327,176.3721;-947.94196,202.97397;-1086.8628,226.62006;-1193.2703,241.39886;-1338.1025,268.00073
@@ -161,6 +161,8 @@ public class GameMainPanel_FishBase : GameMainPanel_Base
private Dictionary<int, string> botTargetGuid = new Dictionary<int, string>();
// bot 状态计时:开火后持续 Attack 动画,空闲 0.3s 切回 Idle
private Dictionary<int, float> botIdleTimer = new Dictionary<int, float>();
// bot 最近的 FrameData_FireBullet(给其他客户端还原技能状态)
private Dictionary<string, FrameData_FireBullet> botLastFireData = new Dictionary<string, FrameData_FireBullet>();
public GameObject bullet_Test;
public GameObject bulletParent;
float changeTurretTime = 0f;
@@ -1663,7 +1665,7 @@ public class GameMainPanel_FishBase : GameMainPanel_Base
public void SyncGameData_FireBullit(FireCannonSendData sync)
{
// 机器人开火:extra 中可能没有 angle 数据,从 botLastAngle 取
// 机器人开火:extra 中可能没有完整 fireData,从 botLastFireData 还原
if (sync.extra == null || sync.extra.frameData == null)
{
SitPosData botSit = list_Sits.Find(s => s.user == sync.userId);
@@ -1671,7 +1673,17 @@ public class GameMainPanel_FishBase : GameMainPanel_Base
float angle = botLastAngle.TryGetValue(sync.userId, out float a) ? a : botSit.currentAngle;
if (sync.bulletIds == null || sync.bulletIds.Count == 0) return;
// 从 botLastFireData 还原完整技能参数
if (botLastFireData.TryGetValue(sync.userId, out var fireData))
{
FireBullet(botSit, angle, fireData.isSanShe, fireData.twoRTruuect,
fireData.isSuoDing, sync.bulletIds, fireData.monsterIDs);
}
else
{
FireBullet(botSit, angle, false, false, false, sync.bulletIds, null);
}
return;
}
@@ -1695,6 +1707,7 @@ public class GameMainPanel_FishBase : GameMainPanel_Base
if (fireData == null) return;
botLastAngle[sit.user] = fireData.angle;
botLastFireData[sit.user] = fireData; // 存储完整 fireData 供 SyncGameData_FireBullit 还原技能状态
}
public void SyncGameData_ChangeTargetMonster(SyncGameData sync)
@@ -1984,18 +1997,38 @@ public class GameMainPanel_FishBase : GameMainPanel_Base
float angle = sit.currentAngle;
botLastAngle[sit.user] = angle;
int count = 1;
long gold = sit.consumeGoldNum;
if (skill != null)
// 技能参数(模仿真人 SyncFire 的行为)
bool isSanShe = skill != null && skill.tripleActive;
bool isDouble = skill != null && skill.doubleActive;
bool isLock = skill != null && skill.lockActive;
int count = isSanShe ? 3 : 1;
long gold = isDouble ? sit.consumeGoldNum * 2 : sit.consumeGoldNum;
// 三发+锁定 → 找 N 个目标鱼的 GUID
List<string> monsterIDs = null;
if (isSanShe && isLock && target != null)
{
if (skill.tripleActive) count = 3;
if (skill.doubleActive) gold *= 2;
monsterIDs = new List<string> { target.guid };
// 额外找 2 个目标(按优先级)
var extraTargets = FindBotLockTargets(sit, target, 2);
foreach (var m in extraTargets) monsterIDs.Add(m.guid);
}
// 存储完整 fireData 供其他客户端还原
botLastFireData[sit.user] = new FrameData_FireBullet
{
angle = angle,
gold = gold,
isSanShe = isSanShe,
twoRTruuect = isDouble,
isSuoDing = isLock,
monsterIDs = monsterIDs
};
WebSocketSendList.BotFireCannon(
GameManager.Instance.gameData.currRoomData.roomId,
sit.user, gold, count);
SyncFire_ForBot(sit, angle, gold, count);
SyncFire_ForBot(sit, angle, gold, isSanShe, isDouble, isLock, monsterIDs);
}
// 空闲超时切回 Idle 动画
@@ -2015,12 +2048,17 @@ public class GameMainPanel_FishBase : GameMainPanel_Base
/// </summary>
private MonsterContral GetOrFindBotTarget(SitPosData sit, CreateFishManager fishList, Vector3 turretPos, BotSkillRuntime skill)
{
bool isLocked = skill != null && skill.lockActive;
// 1. 检查记忆目标是否还有效
if (botTargetGuid.TryGetValue(sit.posID, out string guid))
{
if (fishList.fishDatas_hashCodekey.TryGetValue(guid, out var m)
&& m != null && m.gameObject.activeInHierarchy)
{
// 锁定时不检查 inFront,始终跟踪目标
if (isLocked) return m;
Vector3 fp = m.transform.position;
bool inFront = sit.IsFlipped ? fp.y < turretPos.y : fp.y > turretPos.y;
if (inFront) return m;
@@ -2081,6 +2119,44 @@ public class GameMainPanel_FishBase : GameMainPanel_Base
}
}
/// <summary>找 bot 三发锁定额外目标(排除已选中的)</summary>
private List<MonsterContral> FindBotLockTargets(SitPosData sit, MonsterContral exclude, int count)
{
var result = new List<MonsterContral>();
if (CreateFishManager.Instance == null) return result;
var fishList = CreateFishManager.Instance;
Vector3 turretPos = sit.tra_CurrTurret.position;
foreach (var kv in fishList.fishDatas_hashCodekey)
{
var m = kv.Value;
if (m == null || !m.gameObject.activeInHierarchy) continue;
if (m == exclude) continue;
Vector3 fishPos = m.transform.position;
if (sit.IsFlipped && fishPos.y >= turretPos.y) continue;
if (!sit.IsFlipped && fishPos.y <= turretPos.y) continue;
result.Add(m);
if (result.Count >= count) break;
}
// 按优先级排序取前 count 个
result.Sort((a, b) =>
{
int pa = GetFishPriority((int)a.fishenum);
int pb = GetFishPriority((int)b.fishenum);
if (pa != pb) return pa.CompareTo(pb);
float da = (a.transform.position - turretPos).sqrMagnitude;
float db = (b.transform.position - turretPos).sqrMagnitude;
return da.CompareTo(db);
});
if (result.Count > count)
result.RemoveRange(count, result.Count - count);
return result;
}
/// <summary>根据 aiState 取对应行为参数,cfg 为 null 时返回 null</summary>
private BotBehaviorConfig GetBotBehavior(BotConfig cfg)
{
@@ -2157,21 +2233,27 @@ public class GameMainPanel_FishBase : GameMainPanel_Base
}
/// <summary>人机开火同步(房主代发)</summary>
private void SyncFire_ForBot(SitPosData botSit, float angle, long gold, int count)
private void SyncFire_ForBot(SitPosData botSit, float angle, long gold,
bool isSanShe, bool isDouble, bool isLock, List<string> monsterIDs)
{
var fireData = new FrameData_FireBullet
{
angle = angle,
gold = gold,
isSanShe = isSanShe,
twoRTruuect = isDouble,
isSuoDing = isLock,
};
if (monsterIDs != null && monsterIDs.Count > 0)
fireData.monsterIDs = monsterIDs;
SyncGameData sgd = new SyncGameData
{
sitPos = botSit.posID,
frameType = FrameDataType.fireBullet,
time = BeijingTimeManager.Instance.CurrentTimestampMs,
frameData = new FrameData_FireBullet
{
angle = angle,
gold = gold,
isSanShe = count >= 3,
twoRTruuect = false,
isSuoDing = false,
}
frameData = fireData
};
WebSocketSendList.SyncGameData(sgd);
}
@@ -1836,7 +1836,7 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: \ue0011200000000
m_text: "1200000000<sprite name=\"\u91D1\u5E01\">\n1200000000<sprite name=\"\u94BB\u77F3\">"
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 5d4a713fdd931db4c9ce49f068b54e0a, type: 2}
m_sharedMaterial: {fileID: 3593458263369068374, guid: 5d4a713fdd931db4c9ce49f068b54e0a,
@@ -1856,7 +1856,7 @@ MonoBehaviour:
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 11400000, guid: c41005c129ba4d66911b75229fd70b45, type: 2}
m_spriteAsset: {fileID: 11400000, guid: a50c2d68004a30a4a949fd0014586cfb, type: 2}
m_tintAllSprites: 0
m_StyleSheet: {fileID: 0}
m_TextStyleHashCode: -1183493901
@@ -24,6 +24,7 @@ public class UIHome_BY_ShopPanel : SubUIBase
Dictionary<string, GoldShopConfig> dic_GoldItems = new Dictionary<string, GoldShopConfig>();
Dictionary<string, DiamondShopConfig> dic_DiamondItems = new Dictionary<string, DiamondShopConfig>();
Dictionary<string, BasePropInfo> dic_PropItems = new Dictionary<string, BasePropInfo>();
public override void Awake()
{
base.Awake();
@@ -33,9 +34,9 @@ public class UIHome_BY_ShopPanel : SubUIBase
for (int i = tra_PrefabParent.childCount - 1; i >= 0; i--)
{
Destroy(tra_PrefabParent.GetChild(i).gameObject);
}
// 金币商城配置已从 GameConfig 迁移至 ActivityConfig API
// ==================== 金币商城 ====================
APIRequestList.GetGoldShopList(goldList =>
{
foreach (var item in goldList)
@@ -49,7 +50,6 @@ public class UIHome_BY_ShopPanel : SubUIBase
item.sprite_Icon = Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), new Vector2(0.5f, 0.5f));
obj.GetChild(0).GetComponent<Image>().sprite = item.sprite_Icon;
});
}
else
{
@@ -59,11 +59,9 @@ public class UIHome_BY_ShopPanel : SubUIBase
dic_GoldItems[item.number] = item;
obj.GetChild(2).GetComponent<Button>().onClick.AddListener(() =>
{
//这里调用api
APIRequestList.BuyGold(new BuyGoldParam { number = item.number, count = 1 }, (response) =>
{
UIManager.Instance.ShowBoardError(response);
APIRequestList.GetUser(GameManager.Instance.user.id, (a) =>
{
GameManager.Instance.UpdataUserData(a);
@@ -71,22 +69,17 @@ public class UIHome_BY_ShopPanel : SubUIBase
});
});
obj.GetChild(2).GetChild(0).GetComponent<TextMeshProUGUI>().text = "\ue002" + item.diamond.ToString();
obj.GetChild(2).GetChild(0).GetComponent<TextMeshProUGUI>().text = item.diamond + "<sprite name=\"钻石\">";
obj.GetChild(3).GetComponent<TextMeshProUGUI>().text = item.gold.ToString();
}
});
btn_GlodCoins.onValueChanged.AddListener((a) =>
{
if (!a)
{
return;
}
if (!a) return;
for (int i = tra_PrefabParent.childCount - 1; i >= 0; i--)
{
Destroy(tra_PrefabParent.GetChild(i).gameObject);
}
// 金币商城配置已从 GameConfig 迁移至 ActivityConfig API
APIRequestList.GetGoldShopList(goldList =>
{
foreach (var item in goldList)
@@ -100,7 +93,6 @@ public class UIHome_BY_ShopPanel : SubUIBase
item.sprite_Icon = Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), new Vector2(0.5f, 0.5f));
obj.GetChild(0).GetComponent<Image>().sprite = item.sprite_Icon;
});
}
else
{
@@ -110,39 +102,30 @@ public class UIHome_BY_ShopPanel : SubUIBase
dic_GoldItems[item.number] = item;
obj.GetChild(2).GetComponent<Button>().onClick.AddListener(() =>
{
//这里调用api
APIRequestList.BuyGold(new BuyGoldParam { number = item.number, count = 1 }, (response) =>
{
UIManager.Instance.ShowBoardError(response);
APIRequestList.GetUser(GameManager.Instance.user.id, (a) =>
{
GameManager.Instance.UpdataUserData(a);
tMP_GoldCoinNum.text = GameManager.Instance.user.assets.gold.ToString();
tMP_DiamondNum.text = GameManager.Instance.user.assets.diamond.ToString();
RefreshUI();
});
});
});
obj.GetChild(2).GetChild(0).GetComponent<TextMeshProUGUI>().text ="\ue002"+item.diamond.ToString();
obj.GetChild(2).GetChild(0).GetComponent<TextMeshProUGUI>().text = item.diamond + "<sprite name=\"钻石\">";
obj.GetChild(3).GetComponent<TextMeshProUGUI>().text = item.gold.ToString();
}
});
//
});
// ==================== 钻石商城 ====================
btn_Diamond.onValueChanged.AddListener((a) =>
{
if (!a)
{
return;
}
if (!a) return;
for (int i = tra_PrefabParent.childCount - 1; i >= 0; i--)
{
Destroy(tra_PrefabParent.GetChild(i).gameObject);
}
// 钻石商城配置已从 GameConfig 迁移至 ActivityConfig API
APIRequestList.GetDiamondShopList(diamondList =>
{
foreach (var item in diamondList)
@@ -156,7 +139,6 @@ public class UIHome_BY_ShopPanel : SubUIBase
item.sprite_Icon = Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), new Vector2(0.5f, 0.5f));
obj.GetChild(0).GetComponent<Image>().sprite = item.sprite_Icon;
});
}
else
{
@@ -166,45 +148,35 @@ public class UIHome_BY_ShopPanel : SubUIBase
dic_DiamondItems[item.number] = item;
obj.GetChild(2).GetComponent<Button>().onClick.AddListener(() =>
{
//这里调用api
APIRequestList.BuyDiamond(new BuyDiamondParam { number = item.number, count = 1 }, (response) =>
{
UIManager.Instance.ShowBoardError(response);
APIRequestList.GetUser(GameManager.Instance.user.id, (a) =>
{
GameManager.Instance.UpdataUserData(a);
tMP_GoldCoinNum.text = GameManager.Instance.user.assets.gold.ToString();
tMP_DiamondNum.text = GameManager.Instance.user.assets.diamond.ToString();
RefreshUI();
});
});
});
obj.GetChild(2).GetChild(0).GetComponent<TextMeshProUGUI>().text = item.money.ToString()+"元";
obj.GetChild(2).GetChild(0).GetComponent<TextMeshProUGUI>().text = item.money + "¥";
obj.GetChild(3).GetComponent<TextMeshProUGUI>().text = item.diamond.ToString();
}
});
//
});
// ==================== 道具商城 ====================
btn_Prop.onValueChanged.AddListener((a) =>
{
if (!a)
{
return;
}
if (!a) return;
for (int i = tra_PrefabParent.childCount - 1; i >= 0; i--)
{
Destroy(tra_PrefabParent.GetChild(i).gameObject);
}
foreach (var item in gameConfig.propConfig)
{
if (item.isSale == false || item.isEnable == false)
{
continue;
}
var obj = Instantiate(obj_ItemPrefab, tra_PrefabParent).transform;
if (item.isSale == false || item.isEnable == false) continue;
var obj = Instantiate(obj_ItemPrefab, tra_PrefabParent).transform;
if (item.sprite_Icon == null)
{
WebTool.DownImage(APIManager.baseURL + item.imageUrl, (texture) =>
@@ -212,7 +184,6 @@ public class UIHome_BY_ShopPanel : SubUIBase
item.sprite_Icon = Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), new Vector2(0.5f, 0.5f));
obj.GetChild(0).GetComponent<Image>().sprite = item.sprite_Icon;
});
}
else
{
@@ -222,11 +193,9 @@ public class UIHome_BY_ShopPanel : SubUIBase
dic_PropItems[item.number] = item;
obj.GetChild(2).GetComponent<Button>().onClick.AddListener(() =>
{
//这里调用api
APIRequestList.BuyProp(new BuyPropParam { propNumber = item.number, count = 1 }, (response) =>
{
UIManager.Instance.ShowBoardError(response);
APIRequestList.GetUser(GameManager.Instance.user.id, (a) =>
{
GameManager.Instance.UpdataUserData(a);
@@ -234,26 +203,18 @@ public class UIHome_BY_ShopPanel : SubUIBase
});
});
obj.GetChild(3).GetComponent<TextMeshProUGUI>().text = item.name.ToString();
obj.GetChild(3).GetComponent<TextMeshProUGUI>().text = item.name;
if (item.saleType == 1)
{
obj.GetChild(2).GetChild(0).GetComponent<TextMeshProUGUI>().text = "\ue001" + item.price.ToString();
}
obj.GetChild(2).GetChild(0).GetComponent<TextMeshProUGUI>().text = item.price + "<sprite name=\"金币\">";
else if (item.saleType == 2)
{
obj.GetChild(2).GetChild(0).GetComponent<TextMeshProUGUI>().text = "\ue002" + item.price.ToString();
obj.GetChild(2).GetChild(0).GetComponent<TextMeshProUGUI>().text = item.price + "<sprite name=\"钻石\">";
}
}
}
foreach (var item in gameConfig.propFragments)
{
if (item.isSale==false||item.isEnable==false)
{
continue;
}
var obj = Instantiate(obj_ItemPrefab, tra_PrefabParent).transform;
if (item.isSale == false || item.isEnable == false) continue;
var obj = Instantiate(obj_ItemPrefab, tra_PrefabParent).transform;
if (item.sprite_Icon == null)
{
WebTool.DownImage(APIManager.baseURL + item.imageUrl, (texture) =>
@@ -261,7 +222,6 @@ public class UIHome_BY_ShopPanel : SubUIBase
item.sprite_Icon = Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), new Vector2(0.5f, 0.5f));
obj.GetChild(0).GetComponent<Image>().sprite = item.sprite_Icon;
});
}
else
{
@@ -271,11 +231,9 @@ public class UIHome_BY_ShopPanel : SubUIBase
dic_PropItems[item.number] = item;
obj.GetChild(2).GetComponent<Button>().onClick.AddListener(() =>
{
//这里调用api
APIRequestList.BuyProp(new BuyPropParam { propNumber = item.number, count = 1 }, (response) =>
{
UIManager.Instance.ShowBoardError(response);
APIRequestList.GetUser(GameManager.Instance.user.id, (a) =>
{
GameManager.Instance.UpdataUserData(a);
@@ -283,21 +241,15 @@ public class UIHome_BY_ShopPanel : SubUIBase
});
});
obj.GetChild(3).GetComponent<TextMeshProUGUI>().text = item.name.ToString();
obj.GetChild(3).GetComponent<TextMeshProUGUI>().text = item.name;
if (item.saleType == 1)
{
obj.GetChild(2).GetChild(0).GetComponent<TextMeshProUGUI>().text = "\ue001" + item.price.ToString();
}
obj.GetChild(2).GetChild(0).GetComponent<TextMeshProUGUI>().text = item.price + "<sprite name=\"金币\">";
else if (item.saleType == 2)
{
obj.GetChild(2).GetChild(0).GetComponent<TextMeshProUGUI>().text = "\ue002" + item.price.ToString();
obj.GetChild(2).GetChild(0).GetComponent<TextMeshProUGUI>().text = item.price + "<sprite name=\"钻石\">";
}
}
//
});
}
protected override void OnShow(object args = null)
{
base.OnShow(args);
@@ -310,9 +262,4 @@ public class UIHome_BY_ShopPanel : SubUIBase
tMP_GoldCoinNum.text = GameManager.Instance.user.assets.gold.ToString();
tMP_DiamondNum.text = GameManager.Instance.user.assets.diamond.ToString();
}
// Update is called once per frame
void Update()
{
}
}
@@ -13,7 +13,7 @@ MonoBehaviour:
m_Name: "\u91D1\u5E01"
m_EditorClassIdentifier:
hashCode: 1218032
material: {fileID: 181237239853305123}
material: {fileID: 6085042629901392331}
materialHashCode: 0
m_Version: 1.1.0
m_FaceInfo:
@@ -38,10 +38,10 @@ MonoBehaviour:
m_StrikethroughOffset: 0
m_StrikethroughThickness: 0
m_TabWidth: 0
spriteSheet: {fileID: 2800000, guid: 9a470331983b4fd43aeab7f03e4d8626, type: 3}
spriteSheet: {fileID: 2800000, guid: afbde54fc770bda40927bdbbf6cb48fb, type: 3}
m_SpriteCharacterTable:
- m_ElementType: 2
m_Unicode: 57345
m_Unicode: 65534
m_GlyphIndex: 0
m_Scale: 1
m_Name: "\u91D1\u5E01"
@@ -52,7 +52,7 @@ MonoBehaviour:
m_Width: 65
m_Height: 64
m_HorizontalBearingX: 5
m_HorizontalBearingY: 45
m_HorizontalBearingY: 50
m_HorizontalAdvance: 65
m_GlyphRect:
m_X: 0
@@ -62,10 +62,11 @@ MonoBehaviour:
m_Scale: 1
m_AtlasIndex: 0
m_ClassDefinitionType: 0
sprite: {fileID: 21300000, guid: 9a470331983b4fd43aeab7f03e4d8626, type: 3}
sprite: {fileID: 21300000, guid: afbde54fc770bda40927bdbbf6cb48fb, type: 3}
spriteInfoList: []
fallbackSpriteAssets: []
--- !u!21 &181237239853305123
fallbackSpriteAssets:
- {fileID: 11400000, guid: cb17c1fb6440079409f9eb8dcf603e15, type: 2}
--- !u!21 &6085042629901392331
Material:
serializedVersion: 8
m_ObjectHideFlags: 1
@@ -89,7 +90,7 @@ Material:
serializedVersion: 3
m_TexEnvs:
- _MainTex:
m_Texture: {fileID: 2800000, guid: 9a470331983b4fd43aeab7f03e4d8626, type: 3}
m_Texture: {fileID: 2800000, guid: afbde54fc770bda40927bdbbf6cb48fb, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

@@ -0,0 +1,140 @@
fileFormatVersion: 2
guid: afbde54fc770bda40927bdbbf6cb48fb
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:
@@ -13,7 +13,7 @@ MonoBehaviour:
m_Name: "\u94BB\u77F3"
m_EditorClassIdentifier:
hashCode: 1268712
material: {fileID: 836814841754923933}
material: {fileID: 7414701031854816449}
materialHashCode: 0
m_Version: 1.1.0
m_FaceInfo:
@@ -38,10 +38,10 @@ MonoBehaviour:
m_StrikethroughOffset: 0
m_StrikethroughThickness: 0
m_TabWidth: 0
spriteSheet: {fileID: 2800000, guid: 7beced180abacbf4198b320934b7227d, type: 3}
spriteSheet: {fileID: 2800000, guid: 702998df1faa56b49a0b3ca75bd8049d, type: 3}
m_SpriteCharacterTable:
- m_ElementType: 2
m_Unicode: 57346
m_Unicode: 65533
m_GlyphIndex: 0
m_Scale: 1
m_Name: "\u94BB\u77F3"
@@ -49,23 +49,23 @@ MonoBehaviour:
m_SpriteGlyphTable:
- m_Index: 0
m_Metrics:
m_Width: 65
m_Height: 58
m_HorizontalBearingX: -32.5
m_HorizontalBearingY: 46
m_HorizontalAdvance: 35
m_Width: 44
m_Height: 39
m_HorizontalBearingX: 5
m_HorizontalBearingY: 33
m_HorizontalAdvance: 44
m_GlyphRect:
m_X: 0
m_Y: 0
m_Width: 65
m_Height: 58
m_Width: 44
m_Height: 39
m_Scale: 1
m_AtlasIndex: 0
m_ClassDefinitionType: 0
sprite: {fileID: 21300000, guid: 7beced180abacbf4198b320934b7227d, type: 3}
sprite: {fileID: 21300000, guid: 702998df1faa56b49a0b3ca75bd8049d, type: 3}
spriteInfoList: []
fallbackSpriteAssets: []
--- !u!21 &836814841754923933
--- !u!21 &7414701031854816449
Material:
serializedVersion: 8
m_ObjectHideFlags: 1
@@ -89,7 +89,7 @@ Material:
serializedVersion: 3
m_TexEnvs:
- _MainTex:
m_Texture: {fileID: 2800000, guid: 7beced180abacbf4198b320934b7227d, type: 3}
m_Texture: {fileID: 2800000, guid: 702998df1faa56b49a0b3ca75bd8049d, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

@@ -0,0 +1,140 @@
fileFormatVersion: 2
guid: 702998df1faa56b49a0b3ca75bd8049d
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant: