This commit is contained in:
2026-07-03 04:47:39 +08:00
parent 1dd4f6b050
commit 5c61b93c9c
21 changed files with 14832 additions and 11245 deletions
@@ -1460,6 +1460,12 @@ MonoBehaviour:
m_ReadOnly: 0
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
- m_GUID: f206f68250e35c54481406a83c165790
m_Address: Assets/MyGame/aa/UI/Home/Sub/ZhanLing.prefab
m_ReadOnly: 0
m_SerializedLabels:
- Default
FlaggedDuringContentUpdateRestriction: 0
- m_GUID: f26a5b78050def843a39dd018a06768a
m_Address: paotai11038
m_ReadOnly: 0
+166 -161
View File
@@ -3027,7 +3027,7 @@ RectTransform:
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 1819495571}
- {fileID: 1603640442}
- {fileID: 4683725053833302880}
- {fileID: 1804551267}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@@ -4283,165 +4283,6 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1592942946}
m_CullTransparentMesh: 1
--- !u!1001 &1603640441
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 1096182889}
m_Modifications:
- target: {fileID: 38416299894665467, guid: f206f68250e35c54481406a83c165790,
type: 3}
propertyPath: m_VerticalScrollbar
value:
objectReference: {fileID: 0}
- target: {fileID: 38416299894665467, guid: f206f68250e35c54481406a83c165790,
type: 3}
propertyPath: m_HorizontalScrollbar
value:
objectReference: {fileID: 0}
- target: {fileID: 4683725052380794649, guid: f206f68250e35c54481406a83c165790,
type: 3}
propertyPath: m_Pivot.x
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 4683725052380794649, guid: f206f68250e35c54481406a83c165790,
type: 3}
propertyPath: m_Pivot.y
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 4683725052380794649, guid: f206f68250e35c54481406a83c165790,
type: 3}
propertyPath: m_AnchorMax.x
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4683725052380794649, guid: f206f68250e35c54481406a83c165790,
type: 3}
propertyPath: m_AnchorMax.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4683725052380794649, guid: f206f68250e35c54481406a83c165790,
type: 3}
propertyPath: m_AnchorMin.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4683725052380794649, guid: f206f68250e35c54481406a83c165790,
type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4683725052380794649, guid: f206f68250e35c54481406a83c165790,
type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4683725052380794649, guid: f206f68250e35c54481406a83c165790,
type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4683725052380794649, guid: f206f68250e35c54481406a83c165790,
type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4683725052380794649, guid: f206f68250e35c54481406a83c165790,
type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4683725052380794649, guid: f206f68250e35c54481406a83c165790,
type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4683725052380794649, guid: f206f68250e35c54481406a83c165790,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4683725052380794649, guid: f206f68250e35c54481406a83c165790,
type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4683725052380794649, guid: f206f68250e35c54481406a83c165790,
type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4683725052380794649, guid: f206f68250e35c54481406a83c165790,
type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4683725052380794649, guid: f206f68250e35c54481406a83c165790,
type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4683725052380794649, guid: f206f68250e35c54481406a83c165790,
type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4683725052380794649, guid: f206f68250e35c54481406a83c165790,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4683725052380794649, guid: f206f68250e35c54481406a83c165790,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4683725052380794649, guid: f206f68250e35c54481406a83c165790,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7033739248829094286, guid: f206f68250e35c54481406a83c165790,
type: 3}
propertyPath: m_Name
value: ZhanLing
objectReference: {fileID: 0}
- target: {fileID: 7033739248829094286, guid: f206f68250e35c54481406a83c165790,
type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7233990729787806940, guid: f206f68250e35c54481406a83c165790,
type: 3}
propertyPath: m_VerticalScrollbar
value:
objectReference: {fileID: 0}
- target: {fileID: 7233990729787806940, guid: f206f68250e35c54481406a83c165790,
type: 3}
propertyPath: m_HorizontalScrollbar
value:
objectReference: {fileID: 0}
- target: {fileID: 8853973258410788898, guid: f206f68250e35c54481406a83c165790,
type: 3}
propertyPath: m_VerticalScrollbar
value:
objectReference: {fileID: 0}
- target: {fileID: 8853973258410788898, guid: f206f68250e35c54481406a83c165790,
type: 3}
propertyPath: m_HorizontalScrollbar
value:
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: f206f68250e35c54481406a83c165790, type: 3}
--- !u!224 &1603640442 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 4683725052380794649, guid: f206f68250e35c54481406a83c165790,
type: 3}
m_PrefabInstance: {fileID: 1603640441}
m_PrefabAsset: {fileID: 0}
--- !u!1 &1663842062
GameObject:
m_ObjectHideFlags: 0
@@ -5447,7 +5288,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: afce420be78fe7e45bf80ca49529e276, type: 3}
m_Name:
m_EditorClassIdentifier:
enableBot: 0
enableBot: 1
gameConfig:
id:
isDelete: 0
@@ -5697,6 +5538,170 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
audioMixer: {fileID: 24100000, guid: ca43f9a7549657a49a2978e97c7a621a, type: 2}
--- !u!224 &4683725053833302880 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 4683725052380794649, guid: f206f68250e35c54481406a83c165790,
type: 3}
m_PrefabInstance: {fileID: 7443518001627018692}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &7443518001627018692
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 1096182889}
m_Modifications:
- target: {fileID: 4683725052380794649, guid: f206f68250e35c54481406a83c165790,
type: 3}
propertyPath: m_Pivot.x
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 4683725052380794649, guid: f206f68250e35c54481406a83c165790,
type: 3}
propertyPath: m_Pivot.y
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 4683725052380794649, guid: f206f68250e35c54481406a83c165790,
type: 3}
propertyPath: m_AnchorMax.x
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4683725052380794649, guid: f206f68250e35c54481406a83c165790,
type: 3}
propertyPath: m_AnchorMax.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4683725052380794649, guid: f206f68250e35c54481406a83c165790,
type: 3}
propertyPath: m_AnchorMin.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4683725052380794649, guid: f206f68250e35c54481406a83c165790,
type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4683725052380794649, guid: f206f68250e35c54481406a83c165790,
type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4683725052380794649, guid: f206f68250e35c54481406a83c165790,
type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4683725052380794649, guid: f206f68250e35c54481406a83c165790,
type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4683725052380794649, guid: f206f68250e35c54481406a83c165790,
type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4683725052380794649, guid: f206f68250e35c54481406a83c165790,
type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4683725052380794649, guid: f206f68250e35c54481406a83c165790,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4683725052380794649, guid: f206f68250e35c54481406a83c165790,
type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4683725052380794649, guid: f206f68250e35c54481406a83c165790,
type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4683725052380794649, guid: f206f68250e35c54481406a83c165790,
type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4683725052380794649, guid: f206f68250e35c54481406a83c165790,
type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4683725052380794649, guid: f206f68250e35c54481406a83c165790,
type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4683725052380794649, guid: f206f68250e35c54481406a83c165790,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4683725052380794649, guid: f206f68250e35c54481406a83c165790,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4683725052380794649, guid: f206f68250e35c54481406a83c165790,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6568873253317409902, guid: f206f68250e35c54481406a83c165790,
type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7032782682867687973, guid: f206f68250e35c54481406a83c165790,
type: 3}
propertyPath: m_AnchorMax.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 7032782682867687973, guid: f206f68250e35c54481406a83c165790,
type: 3}
propertyPath: m_AnchorMin.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 7032782682867687973, guid: f206f68250e35c54481406a83c165790,
type: 3}
propertyPath: m_SizeDelta.x
value: 235.37
objectReference: {fileID: 0}
- target: {fileID: 7032782682867687973, guid: f206f68250e35c54481406a83c165790,
type: 3}
propertyPath: m_AnchoredPosition.x
value: 117.685
objectReference: {fileID: 0}
- target: {fileID: 7032782682867687973, guid: f206f68250e35c54481406a83c165790,
type: 3}
propertyPath: m_AnchoredPosition.y
value: -25
objectReference: {fileID: 0}
- target: {fileID: 7033739248829094286, guid: f206f68250e35c54481406a83c165790,
type: 3}
propertyPath: m_Name
value: ZhanLing
objectReference: {fileID: 0}
- target: {fileID: 7077596146806315097, guid: f206f68250e35c54481406a83c165790,
type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8876291267844903025, guid: f206f68250e35c54481406a83c165790,
type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: f206f68250e35c54481406a83c165790, type: 3}
--- !u!1001 &8406649690848505089
PrefabInstance:
m_ObjectHideFlags: 0
+7
View File
@@ -68,6 +68,13 @@ namespace Assets.MyGame.Scripts.Net
dic_API[APIType.Hall_GetUserTaskList] = "/api/Hall/GetUserTaskList";
dic_API[APIType.Hall_DistributeRewards] = "/api/Hall/DistributeRewards";
// ---------------- BattleOrder ----------------
dic_API[APIType.Hall_GetBattleOrder] = "/api/Hall/GetBattleOrder";
dic_API[APIType.Hall_ReceiveAllBattleOrderRewards] = "/api/Hall/ReceiveAllBattleOrderRewards";
dic_API[APIType.Hall_ReceiveBattleOrderLevelReward] = "/api/Hall/ReceiveBattleOrderLevelReward";
dic_API[APIType.Hall_BuyBattleOrderLevel] = "/api/Hall/BuyBattleOrderLevel";
dic_API[APIType.Hall_BuyBattleOrderAdvance] = "/api/Hall/BuyBattleOrderAdvance";
// ---------------- ScratchCard ----------------
dic_API[APIType.Hall_ScratchCardDraw] = "/api/ScratchCard/draw";
@@ -166,4 +166,25 @@ namespace Assets.MyGame.Scripts.Net.APIRequest.Params
public int rewardId; // 奖励ID
}
/// <summary>领取战令等级奖励(GET)</summary>
[Serializable]
public class ReceiveBattleOrderLevelRewardParam : RequestParamBase
{
public int level; // 等级
}
/// <summary>购买战令等级(GET)</summary>
[Serializable]
public class BuyBattleOrderLevelParam : RequestParamBase
{
public int levelCount; // 购买等级数
}
/// <summary>购买战令进阶(GET)</summary>
[Serializable]
public class BuyBattleOrderAdvanceParam : RequestParamBase
{
public int type; // 进阶类型 1=精英 2=至尊
}
}
@@ -1,4 +1,5 @@
using Assets.MyGame.Scripts.Net.API;
using Assets.MyGame.Scripts.Net.API.GameConfig_SubClass;
using Assets.MyGame.Scripts.Net.APIRequest.Objs;
using Assets.MyGame.Scripts.Net.APIRequest.Params;
using Assets.MyGame.Scripts.Net.APIResponses;
@@ -241,6 +242,38 @@ namespace Assets.MyGame.Scripts.Net
APIManager.Response<List<UserRewardDto>>(APIType.Hall_GetUserRewardList, req, callback);
}
// ==================== 战令 ====================
/// <summary>获取用户战令信息(GET)</summary>
public static void GetBattleOrder(Action<BattleOrderResponse> callback)
{
APIManager.Response<BattleOrderResponse>(APIType.Hall_GetBattleOrder, callback);
}
/// <summary>一键领取战令奖励(GET)</summary>
public static void ReceiveAllBattleOrderRewards(Action<List<GiftConfig>> callback)
{
APIManager.Response<List<GiftConfig>>(APIType.Hall_ReceiveAllBattleOrderRewards, callback);
}
/// <summary>领取指定等级战令奖励(GET)</summary>
public static void ReceiveBattleOrderLevelReward(ReceiveBattleOrderLevelRewardParam req, Action<List<GiftConfig>> callback)
{
APIManager.Response<List<GiftConfig>>(APIType.Hall_ReceiveBattleOrderLevelReward, req, callback);
}
/// <summary>购买战令等级(GET)</summary>
public static void BuyBattleOrderLevel(BuyBattleOrderLevelParam req, Action<BuyBattleOrderLevelResponse> callback)
{
APIManager.Response<BuyBattleOrderLevelResponse>(APIType.Hall_BuyBattleOrderLevel, req, callback);
}
/// <summary>购买战令进阶(GET)</summary>
public static void BuyBattleOrderAdvance(BuyBattleOrderAdvanceParam req, Action<BuyBattleOrderAdvanceResponse> callback)
{
APIManager.Response<BuyBattleOrderAdvanceResponse>(APIType.Hall_BuyBattleOrderAdvance, req, callback);
}
#endregion
}
}
@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using Assets.MyGame.Scripts.Net.API.GameConfig_SubClass;
namespace Assets.MyGame.Scripts.Net.APIResponses
@@ -208,4 +209,79 @@ namespace Assets.MyGame.Scripts.Net.APIResponses
public string recommend;
public long createTime;
}
// ==================== 战令 ====================
/// <summary>获取战令信息响应(/api/Hall/GetBattleOrder)</summary>
[Serializable]
public class BattleOrderResponse
{
public bool isOpen;
public string message;
public UserBattleOrderInfo userBattleOrder;
public BattleOrderConfigInfo config;
}
[Serializable]
public class UserBattleOrderInfo
{
public string userId;
public int level;
public int exp;
public bool isLuxury;
public bool isSupreme;
public List<int> receivedLevels;
public List<int> purchasedAdvances;
}
[Serializable]
public class BattleOrderConfigInfo
{
public long endTime;
public string ruleDesc;
public string buyDesc;
public string advanceGiftDesc;
public List<BattleOrderLevelInfo> levelConfig;
public List<BattleOrderAdvanceInfo> advanceGift;
}
[Serializable]
public class BattleOrderLevelInfo
{
public int level;
public int exp;
public int normalGiftType;
public int normalGiftCount;
public int luxuryGiftType;
public int luxuryGiftCount;
public int supremeGiftType;
public int supremeGiftCount;
}
[Serializable]
public class BattleOrderAdvanceInfo
{
public int type;
public string name;
public int count;
public int payType;
public int payCount;
}
/// <summary>购买战令等级响应(/api/Hall/BuyBattleOrderLevel)</summary>
[Serializable]
public class BuyBattleOrderLevelResponse
{
public int newLevel;
public int cost;
}
/// <summary>购买战令进阶响应(/api/Hall/BuyBattleOrderAdvance)</summary>
[Serializable]
public class BuyBattleOrderAdvanceResponse
{
public bool success;
public string message;
public List<int> purchasedAdvances;
}
}
+14
View File
@@ -105,6 +105,20 @@ namespace Assets.MyGame.Scripts.Net
/// <summary>发放奖励(GET)</summary>
Hall_DistributeRewards,
/// <summary>获取用户战令信息(GET)</summary>
Hall_GetBattleOrder,
/// <summary>一键领取战令奖励(GET)</summary>
Hall_ReceiveAllBattleOrderRewards,
/// <summary>领取指定等级战令奖励(GET)</summary>
Hall_ReceiveBattleOrderLevelReward,
/// <summary>购买战令等级(GET)</summary>
Hall_BuyBattleOrderLevel,
/// <summary>购买战令进阶(GET)</summary>
Hall_BuyBattleOrderAdvance,
// ---------------- ScratchCard ----------------
/// <summary>使用刮刮卡抽奖(GET)</summary>
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: c27109324655b434e9d1a68e0896b291
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,69 @@
using Assets.Framework.Tool;
using Assets.MyGame.Scripts.Net;
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public enum LevelGiftType
{
MianFei=1,
JingYing=2,
ZhiZun=4
}
public class LevelGiftitem : MonoBehaviour
{
public Image img_MianFei;
public Image img_MianFeiDuiGou;
public TextMeshProUGUI tmp_MianFeiPropCount;
public Image img_JingYing;
public Image img_JingYingDuiGou;
public Image img_JingYingLocal;
public TextMeshProUGUI tmp_JingYingPropCount;
public Image img_ZhiZun;
public Image img_ZhiZunDuiGou;
public Image img_ZhiZunLocal;
public TextMeshProUGUI tmp_ZhiZunPropCount;
public TextMeshProUGUI tmp_currLevel;
public void Init(string urlMianFei,int mianFeiPropCount, string urlJingYing,int jingYingPropCount, string urlZhiZun,int zhiZunPropCount,int currLevel, LevelGiftType giftType,bool showDuiGou)
{
WebTool.DownImage(APIManager.baseURL+ urlMianFei, (texture) =>
{
img_MianFei.sprite = Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), Vector2.zero);
});
WebTool.DownImage(APIManager.baseURL + urlJingYing, (texture) =>
{
img_JingYing.sprite = Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), Vector2.zero);
});
WebTool.DownImage(APIManager.baseURL + urlZhiZun, (texture) =>
{
img_ZhiZun.sprite = Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), Vector2.zero);
});
tmp_MianFeiPropCount.text = mianFeiPropCount.ToString();
tmp_JingYingPropCount.text = jingYingPropCount.ToString();
tmp_ZhiZunPropCount.text = zhiZunPropCount.ToString();
if ((giftType & LevelGiftType.MianFei) != 0)
{
if (showDuiGou)
img_MianFeiDuiGou.gameObject.SetActive(true);
}
if ((giftType & LevelGiftType.JingYing) != 0)
{
img_JingYingLocal.gameObject.SetActive(true);
if (showDuiGou)
img_JingYingDuiGou.gameObject.SetActive(true);
}
if ((giftType & LevelGiftType.ZhiZun) != 0)
{
img_ZhiZunLocal.gameObject.SetActive(true);
if (showDuiGou)
img_ZhiZunDuiGou.gameObject.SetActive(true);
}
tmp_currLevel.text = currLevel.ToString();
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c6001cc50f3448a4c8e9fea48fb4e7fb
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,25 @@
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class RenWuItem : MonoBehaviour
{
public TextMeshProUGUI tmp_ExpCount;
public TextMeshProUGUI tmp_RenWoLabel;
public Slider jinDu;
public Button lingQu;
public Button qianWang;
public void Init(int expCount, string renWoLabel,float jinDuValue,UIPanel uIPanel,SubUIManager subUIManager)
{
tmp_ExpCount.text = expCount.ToString();
tmp_RenWoLabel.text = renWoLabel;
jinDu.value = jinDuValue;
lingQu.onClick.RemoveAllListeners();
lingQu.onClick.AddListener(() =>
{
subUIManager.ShowAsync(uIPanel);
});
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 08e318966267f2642b933bb76e87d5ff
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,295 @@
using Assets.MyGame.Scripts.Net;
using Assets.MyGame.Scripts.Net.API.GameConfig_SubClass;
using Assets.MyGame.Scripts.Net.APIRequest.Params;
using Assets.MyGame.Scripts.Net.APIResponses;
using System.Collections.Generic;
using System.Linq;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class ZhanLing_Panel : SubUIBase
{
[Header("战令等级奖励页面")]
public TextMeshProUGUI tmp_Level;
public TextMeshProUGUI tmp_Exp;
public Slider slider_LevelExp;
public LevelGiftitem levelGiftitemPrefab;
public Transform levelGiftitemParent;
public LevelGiftitem levelGiftitem_100;
public Button btn_GetAllGift;
public Button btn_BuyJinJieZhanLing;
public TextMeshProUGUI btn_BuyZhanLing_Label;
[Header("任务页面")]
public RenWuItem renWuItemPrefab;
public Transform renWuItemParent;
[Header("购买等级礼包页面")]
public BackPackPropItem buyLevelGiftitemPrefab;
public Transform buyLevelGiftitemMianFeiParent;
public Transform buyLevelGiftitemJingYingParent;
public Transform buyLevelGiftitemZhiZunParent;
public Slider slider_BuyLevelExpCount;
public Button btn_Buy;
public TextMeshProUGUI tmp_PriceNum;
[Header("活动切换项")]
public GameObject huoDongToggleItemPrefab;
public Transform huoDongToggleItemParent;
[Header("购买进阶战令页面")]
public Button btn_JinJie;
public Button btn_ZhiZun;
public Button btn_ZhiZunAndJinJie;
private BattleOrderConfigInfo _config;
private UserBattleOrderInfo _userData;
private int _selectedBuyLevel;
// ==================== 生命周期 ====================
protected override void OnShow(object args = null)
{
base.OnShow(args);
RefreshAll();
}
private void RefreshAll()
{
APIRequestList.GetBattleOrder(res =>
{
if (res == null || !res.isOpen) return;
_config = res.config;
_userData = res.userBattleOrder;
RefreshLevelPage();
RefreshTasksPage();
RefreshBuyPage();
RefreshBtnLabels();
});
}
// ==================== 等级奖励页面 ====================
private int _maxLevel = 100;
private void RefreshLevelPage()
{
if (_config?.levelConfig == null || _userData == null) return;
int level = _userData.level;
int exp = _userData.exp;
var lvCfg = _config.levelConfig.Find(c => c.level == level);
int expNeeded = lvCfg?.exp ?? 100;
tmp_Level.text = $"Lv.{level}";
tmp_Exp.text = $"<color=yellow>{exp}</color>/{expNeeded}";
slider_LevelExp.maxValue = expNeeded;
slider_LevelExp.value = Mathf.Clamp(exp, 0, expNeeded);
// 清空旧列表
for (int i = levelGiftitemParent.childCount - 1; i >= 0; i--)
Destroy(levelGiftitemParent.GetChild(i).gameObject);
// 已领取的等级集合
var claimedSet = _userData.receivedLevels != null
? new HashSet<int>(_userData.receivedLevels)
: new HashSet<int>();
// 构建等级礼包列表(1-99级)
foreach (var lv in _config.levelConfig)
{
if (lv.level >= _maxLevel) continue;
var item = Instantiate(levelGiftitemPrefab, levelGiftitemParent);
item.gameObject.SetActive(true);
bool showDuiGou = claimedSet.Contains(lv.level);
bool reachedLevel = lv.level <= level;
// 用 level 作为"已达成+已领取"的组合标记:达成则显示礼包类型,已领取则显示对勾
LevelGiftType giftType = 0;
if (lv.normalGiftType > 0) giftType |= LevelGiftType.MianFei;
if (lv.luxuryGiftType > 0 && _userData.isLuxury) giftType |= LevelGiftType.JingYing;
if (lv.supremeGiftType > 0 && _userData.isSupreme) giftType |= LevelGiftType.ZhiZun;
item.Init(
GetIconUrl(lv.normalGiftType), lv.normalGiftCount,
GetIconUrl(lv.luxuryGiftType), lv.luxuryGiftCount,
GetIconUrl(lv.supremeGiftType), lv.supremeGiftCount,
lv.level, giftType, reachedLevel && showDuiGou);
}
// 100级礼包
var lv100 = _config.levelConfig.Find(c => c.level == _maxLevel);
if (lv100 != null && levelGiftitem_100 != null)
{
bool showDuiGou = claimedSet.Contains(_maxLevel);
levelGiftitem_100.Init(
GetIconUrl(lv100.normalGiftType), lv100.normalGiftCount,
"", 0, "", 0,
_maxLevel, LevelGiftType.MianFei, level >= _maxLevel && showDuiGou);
levelGiftitem_100.gameObject.SetActive(true);
}
}
// ==================== 任务页面 ====================
private void RefreshTasksPage()
{
if (renWuItemPrefab == null || renWuItemParent == null) return;
for (int i = renWuItemParent.childCount - 1; i >= 0; i--)
Destroy(renWuItemParent.GetChild(i).gameObject);
// 示例任务(后续对接任务列表 API)
CreateTaskItem(10, "每日登录", 1f, UIPanel.None);
CreateTaskItem(20, "捕鱼10条", 0.5f, UIPanel.None);
CreateTaskItem(30, "充值任意金额", 0f, UIPanel.None);
}
private void CreateTaskItem(int expCount, string label, float progress, UIPanel targetPanel)
{
var item = Instantiate(renWuItemPrefab, renWuItemParent);
item.gameObject.SetActive(true);
item.Init(expCount, label, progress, targetPanel, uIManager);
}
// ==================== 购买等级页面 ====================
private void RefreshBuyPage()
{
if (_config?.levelConfig == null) return;
slider_BuyLevelExpCount.minValue = 1;
slider_BuyLevelExpCount.maxValue = _maxLevel;
slider_BuyLevelExpCount.value = _userData.level;
slider_BuyLevelExpCount.wholeNumbers = true;
slider_BuyLevelExpCount.onValueChanged.RemoveAllListeners();
slider_BuyLevelExpCount.onValueChanged.AddListener(OnBuyLevelSliderChanged);
_selectedBuyLevel = _userData.level;
UpdateBuyLevelGifts(_selectedBuyLevel);
UpdateBuyPrice();
}
private void OnBuyLevelSliderChanged(float value)
{
_selectedBuyLevel = Mathf.RoundToInt(value);
UpdateBuyLevelGifts(_selectedBuyLevel);
UpdateBuyPrice();
}
private void UpdateBuyLevelGifts(int level)
{
ClearBuyGiftParent(buyLevelGiftitemMianFeiParent);
ClearBuyGiftParent(buyLevelGiftitemJingYingParent);
ClearBuyGiftParent(buyLevelGiftitemZhiZunParent);
var cfg = _config?.levelConfig?.Find(c => c.level == level);
if (cfg == null) return;
AddBuyGiftByType(buyLevelGiftitemMianFeiParent, cfg.normalGiftType, cfg.normalGiftCount);
AddBuyGiftByType(buyLevelGiftitemJingYingParent, cfg.luxuryGiftType, cfg.luxuryGiftCount);
AddBuyGiftByType(buyLevelGiftitemZhiZunParent, cfg.supremeGiftType, cfg.supremeGiftCount);
}
private void ClearBuyGiftParent(Transform parent)
{
if (parent == null) return;
for (int i = parent.childCount - 1; i >= 0; i--)
Destroy(parent.GetChild(i).gameObject);
}
private void AddBuyGiftByType(Transform parent, int giftType, int giftCount)
{
if (parent == null || giftType <= 0) return;
var obj = Instantiate(buyLevelGiftitemPrefab, parent);
// 1=金币 2=钻石 3=道具,金钻用本地图标
string url = "";
PropEnum pe = PropEnum.none;
obj.Init(url, giftCount, pe);
}
private void UpdateBuyPrice()
{
int levelsToBuy = _selectedBuyLevel - _userData.level;
if (levelsToBuy <= 0)
{
tmp_PriceNum.text = "已达成";
btn_Buy.interactable = false;
}
else
{
tmp_PriceNum.text = $"{levelsToBuy * 100}钻石";
btn_Buy.interactable = true;
}
}
// ==================== 按钮事件 ====================
private void RefreshBtnLabels()
{
if (btn_BuyZhanLing_Label != null)
{
btn_BuyZhanLing_Label.text = (_userData.isLuxury || _userData.isSupreme) ? "已购买" : "购买战令";
}
btn_GetAllGift.onClick.RemoveAllListeners();
btn_GetAllGift.onClick.AddListener(() =>
{
APIRequestList.ReceiveAllBattleOrderRewards(res =>
{
Debug.Log($"[ZhanLing] 一键领取完成, 获得 {res?.Count ?? 0} 件奖励");
RefreshAll();
});
});
btn_Buy.onClick.RemoveAllListeners();
btn_Buy.onClick.AddListener(() =>
{
int levelsToBuy = _selectedBuyLevel - _userData.level;
if (levelsToBuy <= 0) return;
APIRequestList.BuyBattleOrderLevel(new BuyBattleOrderLevelParam { levelCount = levelsToBuy }, res =>
{
Debug.Log($"[ZhanLing] 购买等级完成: 新等级={res.newLevel}, 花费={res.cost}");
RefreshAll();
});
});
btn_JinJie.onClick.RemoveAllListeners();
btn_JinJie.onClick.AddListener(() => BuyAdvance(1));
btn_ZhiZun.onClick.RemoveAllListeners();
btn_ZhiZun.onClick.AddListener(() => BuyAdvance(2));
btn_ZhiZunAndJinJie.onClick.RemoveAllListeners();
btn_ZhiZunAndJinJie.onClick.AddListener(() => BuyAdvance(3));
}
private void BuyAdvance(int type)
{
APIRequestList.BuyBattleOrderAdvance(new BuyBattleOrderAdvanceParam { type = type }, res =>
{
Debug.Log($"[ZhanLing] 购买进阶 type={type}, success={res.success}");
RefreshAll();
});
}
// ==================== 工具 ====================
/// <summary>根据礼物类型返回图标路径(空串=金币/钻石用本地Sprite)</summary>
private static string GetIconUrl(int giftType)
{
return giftType switch
{
1 => "", // 金币 - 本地图标
2 => "", // 钻石 - 本地图标
_ => "", // 道具 - 本地图标
};
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 83dd1a9e97ba93c43bf542637a5d407e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+3
View File
@@ -61,3 +61,6 @@ MonoBehaviour:
- name: "\u522E\u522E\u5361"
type: 900
address: Assets/MyGame/aa/UI/DefaultPanel/GGL.prefab
- name: "\u6D3B\u52A8"
type: 153
address: Assets/MyGame/aa/UI/Home/Sub/ZhanLing.prefab
@@ -49,7 +49,7 @@ Material:
- _GlowPower: 0.75
- _GradientScale: 10
- _OutlineSoftness: 0
- _OutlineWidth: 0.282
- _OutlineWidth: 0.229
- _ScaleRatioA: 0.9
- _ScaleRatioB: 1.1835
- _ScaleRatioC: 1.1835
@@ -49,7 +49,7 @@ TextureImporter:
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteBorder: {x: 4, y: 0, z: 8, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
@@ -113,7 +113,7 @@ TextureImporter:
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
internalID: 1537655665
vertices: []
indices:
edges: []
@@ -49,7 +49,7 @@ TextureImporter:
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteBorder: {x: 3, y: 0, z: 4, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
@@ -113,7 +113,7 @@ TextureImporter:
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
internalID: 1537655665
vertices: []
indices:
edges: []
@@ -49,7 +49,7 @@ TextureImporter:
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteBorder: {x: 1, y: 0, z: 3, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
@@ -113,7 +113,7 @@ TextureImporter:
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
internalID: 1537655665
vertices: []
indices:
edges: []
@@ -49,7 +49,7 @@ TextureImporter:
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteBorder: {x: 11, y: 0, z: 11, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
@@ -113,7 +113,7 @@ TextureImporter:
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
internalID: 1537655665
vertices: []
indices:
edges: []