备份CatanBuilding瘦身独立工程

This commit is contained in:
JSD\13999
2026-05-26 16:15:54 +08:00
commit 2d0e6a61b7
12001 changed files with 2431925 additions and 0 deletions

View File

@@ -0,0 +1,64 @@
using asap.core;
using cfg;
using GameCore;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class GradeAquariumFishUI : MonoBehaviour
{
public enum FishDirection
{
Left,
Right
}
public FishDirection fishDirection;
public Button button;
public GameObject fish;
public Transform model;
public TMP_Text text_name;
public TMP_Text text_weight;
public TMP_Text text_pts;
//public GameObject empty;
public Image empty_icon;
public GameObject loading;
public FishData fishData { set; get; }
public Transform AvatarPos { set; get; }
public Fish FishGo { set; get; }
public bool isAvatar { set; get; }
public int index { set; get; }
private void Reset()
{
button = GetComponent<Button>();
fish = transform.Find("fish").gameObject;
model = transform.Find("model").GetComponent<Transform>();
text_name = transform.Find("fish/text_name").GetComponent<TMP_Text>();
text_weight = transform.Find("fish/info/text_weight").GetComponent<TMP_Text>();
text_pts = transform.Find("fish/info/text_pts").GetComponent<TMP_Text>();
//empty = transform.Find("empty").gameObject;
empty_icon = transform.Find("empty/icon").GetComponent<Image>();
loading = transform.Find("loading").gameObject;
}
public void SetData(FishData fishData, int index)
{
this.index = index;
this.fishData = fishData;
var playerFishData = GContext.container.Resolve<PlayerFishData>();
float maxWeight = playerFishData.GetDataMaxWeight(fishData.ID);
int maxMastery = playerFishData.GetMaxMastery(fishData.ID);
fish.gameObject.SetActive(true);
loading.SetActive(true);
//empty.SetActive(false);
button.enabled = false;
text_name.text = LocalizationMgr.GetText(fishData.Name_l10n_key);
text_pts.text = LocalizationMgr.GetFormatTextValue("UI_FishingRewardPanel_101014", ConvertTools.GetNumberString2(maxMastery));
text_weight.text = LocalizationMgr.GetWeight(maxWeight);
isAvatar = maxWeight > 0;
}
public Vector3 FishModelPos()
{
return transform.localPosition + model.localPosition;
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ca552e2d7bf29dc42a39fb2ce88786c2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,136 @@
using asap.core;
using cfg;
using GameCore;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class GradeItem : PanelItemBase<GradeItemData>
{
GameObject bar_root;
Image bar;
GameObject bg_normal;
GameObject bg_gray;
GameObject bg_next;
RewardItemNew[] rewardItems;
Image[] rewardBg;
TMP_Text text_grade;
IUIService uiService;
private void Awake()
{
uiService = GContext.container.Resolve<IUIService>();
bar_root = transform.Find("bg_bar").gameObject;
bar = transform.Find("bg_bar/bar").GetComponent<Image>();
bg_normal = transform.Find("bg_normal").gameObject;
bg_gray = transform.Find("bg_gray").gameObject;
bg_next = transform.Find("bg_next").gameObject;
rewardItems = transform.Find("reward").GetComponentsInChildren<RewardItemNew>();
rewardBg = new Image[rewardItems.Length];
for (int i = 0; i < rewardItems.Length; i++)
{
rewardBg[i] = rewardItems[i].transform.Find("bg").GetComponent<Image>();
}
text_grade = transform.Find("text_grade").GetComponent<TMP_Text>();
}
public void SetData(AccountMM account)
{
text_grade.text = account.ID.ToString();
int len = 0;
if (!string.IsNullOrEmpty(account.Icon))
{
uiService.SetImageSprite(rewardBg[len], "bg_shop_gift1");
rewardItems[len].SetData(account.Icon, LocalizationMgr.GetText(account.Title_l10n_key), LocalizationMgr.GetText("UI_PlayerGradePanel_1"));
len++;
}
var DisplaySwitch = account.DisplaySwitch;
var levels = new List<int>
{
account.CashMag,
account.CashMagLimited,
account.EnergyLimit,
account.EnergyRecover,
account.EventFishCashMag,
account.EventFishDamage,
account.AquariumLimit,
account.AquariumCashMag,
};
var table = GContext.container.Resolve<cfg.Tables>();
int id;
Item item;
for (int i = 0; i < DisplaySwitch.Count; i++)
{
if (len >= rewardItems.Length || i >= levels.Count)
{
break;
}
if (DisplaySwitch[i] > 0)
{
id = 12001 + i;
item = table.TbItem.GetOrDefault(id);
uiService.SetImageSprite(rewardBg[len], "bg_grade_benefit");
rewardItems[len].SetData(item, levels[i], true);
len++;
}
}
if (account.Rewards > 0)
{
var itemDatas = GContext.container.Resolve<PlayerItemData>().GetItemDataByDropId(account.Rewards);
if (itemDatas != null)
{
for (int i = 0; i < itemDatas.Count; i++)
{
if (len >= rewardItems.Length)
{
break;
}
uiService.SetImageSprite(rewardBg[len], "bg_shop_gift1");
rewardItems[len].SetData(itemDatas[i]);
len++;
}
}
}
for (int i = len; i < rewardItems.Length; i++)
{
rewardItems[i].gameObject.SetActive(false);
}
bg_next.SetActive(data.next);
if (GContext.container.Resolve<PlayerData>().lv >= account.ID)
{
bar.fillAmount = 1;
bg_gray.SetActive(true);
bg_normal.SetActive(false);
}
else
{
bar.fillAmount = 0;
bg_gray.SetActive(false);
bg_normal.SetActive(!data.next);
}
for (int i = 0; i < rewardItems.Length; i++)
{
rewardItems[i].SetReceived(GContext.container.Resolve<PlayerData>().lv >= account.ID);
}
if (data.nextIndex - 1 == index)
{
bar.fillAmount = data.fillAmount;
}
bar_root.SetActive(data.bar);
}
public override void OnInit()
{
SetData(data.account);
}
}
public class GradeItemData
{
public AccountMM account;
public int nextIndex;
public float fillAmount;
public bool next;
public bool bar = true;
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: fcb7a59e5b325b542968415fa8b51225
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,85 @@
using asap.core;
using cfg;
using GameCore;
using System;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class GradeMapItem : MonoBehaviour
{
public Button button;
[SerializeField]
GameObject go_lock,
pts,
redpoints;
[SerializeField]
Image img_bg;
[SerializeField]
TMP_Text
txt_levelRequired,
txt_mapName,
text_pts;
public MapData mapData;
Action<GradeMapItem> _action;
int allPTS;
bool isLock;
private void Start()
{
button.onClick.AddListener(OnClick);
}
public void SetData(MapData mapData, int requiredLevel, Action<GradeMapItem> action)
{
_action = action;
this.mapData = mapData;
gameObject.SetActive(true);
txt_mapName.text = LocalizationMgr.GetText(mapData.Name_l10n_key);
allPTS = GContext.container.Resolve<PlayerFishData>().GetAllPTSByMap(mapData.ID);
GContext.container.Resolve<IUIService>().SetImageSprite(img_bg, mapData.Bg);
isLock = GContext.container.Resolve<PlayerData>().lv < requiredLevel;
if (isLock)
{
redpoints.SetActive(false);
go_lock.SetActive(true);
pts.SetActive(false);
txt_levelRequired.text = requiredLevel.ToString();
}
else
{
text_pts.text = allPTS.ToString();
go_lock.SetActive(false);
pts.SetActive(true);
Refresh();
}
}
//刷新
public void Refresh()
{
int progress = GContext.container.Resolve<PlayerFishData>().GetMapProgress(mapData.ID);
var pointsRequire = mapData.PointsRequire;
if (progress >= pointsRequire.Count)
{
redpoints.SetActive(false);
}
else
{
redpoints.SetActive(allPTS >= pointsRequire[progress]);
}
}
void OnClick()
{
if (isLock)
{
var mapdata = GContext.container.Resolve<Tables>().TbMapData.GetOrDefault(mapData.ID - 1);
if (mapdata != null)
{
ToastPanel.Show(LocalizationMgr.GetFormatTextValue("UI_ToastPanel_4", mapdata.LevelRequired));
}
}
else
{
_action?.Invoke(this);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2434b1dadf6b6384682e944d0eaad562
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,42 @@
using asap.core;
using cfg;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
public class PlayerGradeAchievement : MonoBehaviour
{
GameObject item;
Transform content;
List<StatisticItem> statisticItems = new List<StatisticItem>();
private void Awake()
{
item = transform.Find("ScrollView/Viewport/Content/item").gameObject;
content = transform.Find("ScrollView/Viewport/Content");
item.SetActive(false);
}
private void Start()
{
List<Statistics> dataList = GContext.container.Resolve<Tables>().TbStatistics.DataList;
List<Statistics> dataTable = dataList.Where(x => x.Sort != 0).ToList();
dataTable.Sort((a, b) => a.Sort.CompareTo(b.Sort));
for (int i = 0; i < dataTable.Count; i += 3)
{
var go = Instantiate(item, content);
go.SetActive(true);
for (int j = 0; j < 3; j++)
{
StatisticItem statisticItem = go.transform.GetChild(j).GetComponent<StatisticItem>();
if (i + j < dataTable.Count)
{
statisticItem.Init(dataTable[i + j]);
statisticItems.Add(statisticItem);
}
else
{
statisticItem.gameObject.SetActive(false);
}
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 852b025d184d8fa47a98cc9c4213740c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,31 @@
using asap.core;
using GameCore;
using UnityEngine;
using UnityEngine.UI;
public class PlayerGradeAquariumInfoPanel : MonoBehaviour
{
Button mask;
Button btn_close;
RewardItemNew rewardItemNew;
private void Awake()
{
rewardItemNew = transform.Find("root/info2/reward").GetComponent<RewardItemNew>();
mask = transform.Find("mask").GetComponent<Button>();
btn_close = transform.Find("btn_close").GetComponent<Button>();
}
private void Start()
{
mask.onClick.AddListener(Close);
btn_close.onClick.AddListener(Close);
}
public void Init(int dorpID)
{
ItemData drop = GContext.container.Resolve<PlayerItemData>().GetItemDataOne(dorpID);
rewardItemNew.SetData(drop);
}
void Close()
{
UIManager.Instance.DestroyUI(UITypes.PlayerGradeAquariumInfoPanel);
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 893dc22000cff4d458b7846c6b425832
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,699 @@
using asap.core;
using cfg;
using DG.Tweening;
using game;
using Game;
using GameCore;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.EventSystems;
using UnityEngine.UI;
public class InGradeAquariumEvent
{
public int type;
}
public class PlayerGradeAquariumPanel : MonoBehaviour
{
IUIService uiService;
Transform bg;
Transform bgbg;
Button btn_close;
Button btn_location;
Animation root_aquarium;
CanvasGroup root_aquarium_canvasGroup;
Animation root_fish;
Transform iconRoot;
TMP_Text bg_title;
Button btn_questionmark_reward;
Button btn_questionmark;
GameObject info_tips;
TMP_Text text_pts;
Image bar;
GameObject effect_jiman;
RewardItemNew rewardItemNew;
Transform claim;
Button btn_claim;
MapData mapData;
GetCurSelectMapEvent getCurSelectMapEvent;
PlayerFishData playerFishData;
/// <summary>
/// 鱼的模型
/// </summary>
ScrollRect scrollRect;
Transform content;
RectTransform viewport;
List<GradeAquariumFishUI> gradeAquariumFishUIs;
GradeAquariumFishUI curAquariumFishUI;
Camera _camera;
//模型存放节点
Transform avatar;
RenderTexture rt;
private List<GameObject> fishPrefab = new List<GameObject>();
/// <summary>
///
/// </summary>
UIDrag uiDrag;
RawImage rawImage;
CanvasGroup rawImageGroup;
Transform model;
Image icon_rate;
TMP_Text text_name;
TMP_Text info_text_weight;
TMP_Text info_text_pts;
TMP_Text text_tag1;
TMP_Text text_tag2;
TMP_Text text_detail;
int AllPTS;
int progress;
int rtWidth = 2048;
int rtHeight = 4096;
Vector3 rawImage2Size;
public int fieldOfView = 60;
//鱼距离相机的位置
public int fishPosZ = 50;
//特写时鱼距离相机的位置
public int fishPosZ2 = 20;
public float inTime = 0.7f;
public float outTime = 0.7f;
public float rewImageDOFadeTime = 0.7f;
//左初始高度
public float leftHeight = 217;
//右初始高度
public float rightHeight = 437;
public float[] heights = new float[] { 400, 450, 500, 550, 600 };
public float moveXLeft = 20;
public float moveXRight = 40;
//随机时间
public float randomTime = 0.5f;
//相机y轴旋转参数
public float rotateY = 25;
float leftAllHeight = 0;
float rightAllHeight = 0;
Transform curFishTran;
FishData curFishData;
//位移比例
float scale = 0.5f;
string DotweenId = "PlayerGradeAquariumPanel";
bool enableFog;
private void Awake()
{
uiService = GContext.container.Resolve<IUIService>();
playerFishData = GContext.container.Resolve<PlayerFishData>();
btn_questionmark = transform.Find("root/title/btn_questionmark").GetComponent<Button>();
bg = transform.Find("bg");
btn_close = transform.Find("root/btn_close").GetComponent<Button>();
btn_location = transform.Find("root/title/btn_location").GetComponent<Button>();
root_aquarium = transform.Find("root/root_aquarium").GetComponent<Animation>();
root_aquarium_canvasGroup = root_aquarium.GetComponent<CanvasGroup>();
root_fish = transform.Find("root/root_fish").GetComponent<Animation>();
bg_title = transform.Find("root/title/text_title").GetComponent<TMP_Text>();
btn_questionmark_reward = transform.Find("root/root_aquarium/reward/btn_questionmark").GetComponent<Button>();
info_tips = transform.Find("root/root_aquarium/reward/info_tips").gameObject;
text_pts = transform.Find("root/root_aquarium/reward/text_pts").GetComponent<TMP_Text>();
bar = transform.Find("root/root_aquarium/reward/bg_bar/bar").GetComponent<Image>();
effect_jiman = transform.Find("root/root_aquarium/reward/bg_bar/effect_jiman").gameObject;
rewardItemNew = transform.Find("root/root_aquarium/reward/reward").GetComponent<RewardItemNew>();
claim = transform.Find("root/root_aquarium/reward/reward/claim");
btn_claim = claim.Find("effect_up_loop/claim/btn_common_green_c/btn_green_c").GetComponent<Button>();
scrollRect = transform.Find("root/root_aquarium/ScrollView").GetComponent<ScrollRect>();
viewport = transform.Find("root/root_aquarium/ScrollView/Viewport").GetComponent<RectTransform>();
content = transform.Find("root/root_aquarium/ScrollView/Viewport/Content");
gradeAquariumFishUIs = new List<GradeAquariumFishUI>();
for (int i = 1; i < 13; i++)
{
gradeAquariumFishUIs.Add(content.Find($"Item{i}").GetComponent<GradeAquariumFishUI>());
}
model = transform.Find("root/ScrollView/Viewport/model");
icon_rate = transform.Find("root/root_fish/icon_rate").GetComponent<Image>();
text_name = transform.Find("root/root_fish/text_name").GetComponent<TMP_Text>();
info_text_weight = transform.Find("root/root_fish/info/text_weight").GetComponent<TMP_Text>();
info_text_pts = transform.Find("root/root_fish/info/text_pts").GetComponent<TMP_Text>();
text_tag1 = transform.Find("root/root_fish/layout_tag/tag1/text_tag1").GetComponent<TMP_Text>();
text_tag2 = transform.Find("root/root_fish/layout_tag/tag2/text_tag2").GetComponent<TMP_Text>();
text_detail = transform.Find("root/root_fish/text_detail").GetComponent<TMP_Text>();
rawImage = transform.Find("root/Viewport/RawImage").GetComponent<RawImage>();
uiDrag = rawImage.transform.GetComponent<UIDrag>();
rawImageGroup = rawImage.GetComponent<CanvasGroup>();
rawImage2Size = rawImage.rectTransform.rect.size;
rtWidth = (int)rawImage2Size.x;
rtHeight = (int)rawImage2Size.y;
iconRoot = transform.Find("IconRoot");
avatar = transform.Find("IconRoot/Avatar");
_camera = transform.Find("IconRoot/Camera").GetComponent<Camera>();
rt = new RenderTexture(rtWidth, rtHeight, 24, RenderTextureFormat.ARGB32);
_camera.targetTexture = rt;
_camera.Render();
rawImage.texture = rt;
enableFog = RenderSettings.fog;
RenderSettings.fog = false;
GContext.Publish(new InGradeAquariumEvent());
}
private void Start()
{
_camera.fieldOfView = fieldOfView;
root_aquarium.gameObject.SetActive(true);
root_fish.gameObject.SetActive(false);
info_tips.SetActive(false);
getCurSelectMapEvent = new GetCurSelectMapEvent();
getCurSelectMapEvent.type = 0;
GContext.Publish(getCurSelectMapEvent);
mapData = getCurSelectMapEvent.selectMap;
bgbg = transform.Find($"bg/{mapData.AquariumBg}");
bgbg.gameObject.SetActive(true);
AllPTS = playerFishData.GetAllPTSByMap(mapData.ID);
InitFishAvatar();
InitBar();
bg_title.text = $"{mapData.ID % 100}.{LocalizationMgr.GetText(mapData.Name_l10n_key)}";
btn_questionmark.onClick.AddListener(OpenQuestionmark);
btn_close.onClick.AddListener(OnClickClose);
btn_location.onClick.AddListener(OnClickClose);
btn_claim.onClick.AddListener(OnClickClaim);
btn_questionmark_reward.onClick.AddListener(() =>
{
info_tips.SetActive(!info_tips.activeSelf);
});
rewardItemNew.btn_click.onClick.AddListener(HideTips);
uiDrag.OnDragCall += OnDragFishing;
rawImageGroup.alpha = 0;
rawImageGroup.DOFade(1, rewImageDOFadeTime);
GContext.container.Resolve<GuideDataCenter>().InspectTriggerGuide(name);
}
async void OpenQuestionmark()
{
GameObject go = await UIManager.Instance.ShowUI(UITypes.PlayerGradeAquariumInfoPanel);
PlayerGradeAquariumInfoPanel playerGradeAquariumInfoPanel = go.GetComponent<PlayerGradeAquariumInfoPanel>();
int dorpID = mapData.PointsReward[0];
playerGradeAquariumInfoPanel.Init(dorpID);
}
void InitCameraPos()
{
Vector3 posWorld = UIToWorldPoint(new Vector3(0, 1000, 0), rawImage2Size);
scale = -posWorld.y / 1000;
SetCameraPos();
scrollRect.onValueChanged.AddListener((v) =>
{
SetCameraPos();
});
}
void SetCameraPos()
{
_camera.transform.position = new Vector3(0, scale * content.localPosition.y, 0);
}
void OnDragFishing(PointerEventData eventData)
{
if (curFishTran != null)
{
curFishTran.Rotate(Vector3.up, -eventData.delta.x * 0.5f);
}
}
void InitFishAvatar()
{
iconRoot.localScale = Vector3.one / iconRoot.lossyScale.x;
iconRoot.position = new Vector3(0, 0, 0);
viewport.pivot = new Vector2(0.5f, 0.5f);
RectTransform contentRect = content.GetComponent<RectTransform>();
contentRect.pivot = new Vector2(0.5f, 0.5f);
//rawImage2.color = Color.clear;
//显示当前地图的鱼
var fishes = mapData.FishList;
var count = fishes.Count;
var Tables = GContext.container.Resolve<Tables>();
bool isLeft = false, isRight = false;
float curHigh = 0;
RectTransform fishRectTransform;
for (int i = 0; i < count; i++)
{
FishData fishData = Tables.TbFishData.GetOrDefault(fishes[i]);
gradeAquariumFishUIs[i].SetData(fishData, i);
if (fishData.Quality > heights.Length)
{
curHigh = heights[^1];
}
else
{
curHigh = heights[fishData.Quality - 1];
}
fishRectTransform = gradeAquariumFishUIs[i].GetComponent<RectTransform>();
float posX = fishRectTransform.anchoredPosition.x;
if (gradeAquariumFishUIs[i].fishDirection == GradeAquariumFishUI.FishDirection.Left)
{
if (!isLeft)
{
isLeft = true;
fishRectTransform.anchoredPosition = new Vector2(posX, -leftHeight);
leftAllHeight = leftHeight + curHigh / 2;
}
else
{
fishRectTransform.anchoredPosition = new Vector2(posX, -leftAllHeight - curHigh / 2);
leftAllHeight += curHigh;
}
}
else
{
if (!isRight)
{
isRight = true;
fishRectTransform.anchoredPosition = new Vector2(posX, -rightHeight);
rightAllHeight = rightHeight + curHigh / 2;
}
else
{
fishRectTransform.anchoredPosition = new Vector2(posX, -rightAllHeight - curHigh / 2);
rightAllHeight += curHigh;
}
}
int index = i;
gradeAquariumFishUIs[i].button.onClick.AddListener(() =>
{
HideTips();
SetFishDetail(index);
});
}
contentRect.sizeDelta = new Vector2(contentRect.sizeDelta.x, Mathf.Max(leftAllHeight, rightAllHeight));
scrollRect.verticalNormalizedPosition = 1f;
for (int i = 0; i < count; i++)
{
LoadAvatar(gradeAquariumFishUIs[i]);
}
InitCameraPos();
}
void SetFishDetail(int index)
{
btn_close.onClick.RemoveAllListeners();
curAquariumFishUI = gradeAquariumFishUIs[index];
curFishData = curAquariumFishUI.fishData;
text_name.text = curAquariumFishUI.text_name.text;
info_text_weight.text = curAquariumFishUI.text_weight.text;
info_text_pts.text = curAquariumFishUI.text_pts.text;
text_detail.text = LocalizationMgr.GetText(curFishData.Story_l10n_key);
text_tag1.text = LocalizationMgr.GetText(curFishData.VerticalDistribution.ToString());
text_tag2.text = LocalizationMgr.GetText(curFishData.Categories.ToString());
uiService.SetImageSprite(icon_rate, $"icon_fish_rate_tag_{curFishData.Quality}", BasePanel.PanelName);
PlayDetail();
}
async void PlayDetail()
{
ShowFish(true);
scrollRect.enabled = false;
Vector3 pos = curAquariumFishUI.AvatarPos.localPosition;
Vector3 offsetPos = curAquariumFishUI.model.position;
root_fish.gameObject.SetActive(true);
root_aquarium_canvasGroup.blocksRaycasts = false;
root_aquarium.Play("root_out");
root_fish.Play("root_show");
float zOffset = fishPosZ - fishPosZ2;
float xOffset = Mathf.Tan(rotateY * Mathf.Deg2Rad) * zOffset;
if (curAquariumFishUI.fishDirection == GradeAquariumFishUI.FishDirection.Left)
{
pos.x += xOffset;
_camera.transform.DOLocalRotate(new Vector3(0, -rotateY, 0), inTime).SetEase(Ease.Linear);
}
else
{
pos.x -= xOffset;
_camera.transform.DOLocalRotate(new Vector3(0, rotateY, 0), inTime).SetEase(Ease.Linear);
}
_camera.transform.DOLocalMove(new Vector3(pos.x, pos.y, fishPosZ2), inTime).SetEase(Ease.Linear);
bg.transform.DOScale(Vector3.one * 1.5f, inTime).SetEase(Ease.Linear);
bgbg.transform.DOLocalMove(bg.position - offsetPos, inTime).SetEase(Ease.Linear);
await new WaitForSeconds(inTime);
root_aquarium.gameObject.SetActive(false);
btn_close.onClick.AddListener(CloseDetail);
if (curAquariumFishUI.FishGo)
{
curFishTran = curAquariumFishUI.FishGo.transform;
}
else
{
curFishTran = null;
}
}
void ShowFish(bool isOut)
{
int index = curAquariumFishUI.index;
if (isOut)
{
GContext.Publish(new EventUISound("audio_ui_whoosh_in"));
for (int i = 0; i < gradeAquariumFishUIs.Count; i++)
{
if (i != index)
{
GradeAquariumFishUI gradeAquariumFishUI = gradeAquariumFishUIs[i];
bool isLeft = gradeAquariumFishUI.fishDirection == 0;
float moveX = isLeft ? moveXLeft : moveXRight;
float moveX2 = isLeft ? moveXRight : moveXLeft;
if (gradeAquariumFishUI.FishGo != null)
{
Transform fishTrans = gradeAquariumFishUI.FishGo.transform;
fishTrans.DOLocalMoveX(-moveX, inTime).OnComplete(() =>
{
fishTrans.localPosition = Vector3.right * moveX2;
}).SetEase(Ease.OutSine).SetDelay(Random.Range(0, randomTime)).SetId(DotweenId);
if (gradeAquariumFishUI.isAvatar)
{
gradeAquariumFishUI.FishGo.animator.SetTrigger("Swim01");
}
}
}
}
}
else
{
GContext.Publish(new EventUISound("audio_ui_whoosh_out"));
for (int i = 0; i < gradeAquariumFishUIs.Count; i++)
{
if (i != index)
{
GradeAquariumFishUI gradeAquariumFishUI = gradeAquariumFishUIs[i];
if (gradeAquariumFishUI.FishGo != null)
{
gradeAquariumFishUI.FishGo.transform.DOLocalMoveX(0, outTime).
OnComplete(() =>
{
if (gradeAquariumFishUI.isAvatar)
{
gradeAquariumFishUI.FishGo.animator.SetTrigger("Show01");
}
}).SetEase(Ease.OutSine).SetDelay(Random.Range(0, randomTime)).SetId(DotweenId);
}
}
}
}
}
async void CloseDetail()
{
ShowFish(false);
Quaternion rot = Quaternion.Euler(curFishData.TankRotation[0], curFishData.TankRotation[1], curFishData.TankRotation[2]);
if (curFishTran != null)
{
curFishTran.DORotateQuaternion(rot, outTime);
curFishTran = null;
}
root_aquarium.gameObject.SetActive(true);
btn_close.onClick.RemoveAllListeners();
_camera.transform.DOLocalRotate(Vector3.zero, outTime).SetEase(Ease.Linear);
_camera.transform.DOLocalMove(new Vector3(0, scale * content.localPosition.y, 0), outTime).SetEase(Ease.Linear);
bg.transform.DOScale(Vector3.one, outTime).SetEase(Ease.Linear);
bgbg.transform.DOLocalMove(Vector3.zero, outTime).SetEase(Ease.Linear);
root_aquarium.Play("root_show");
root_fish.Play("root_out");
await new WaitForSeconds(outTime);
root_fish.gameObject.SetActive(false);
btn_close.onClick.AddListener(OnClickClose);
scrollRect.enabled = true;
curAquariumFishUI = null;
root_aquarium_canvasGroup.blocksRaycasts = true;
}
async void LoadAvatar(GradeAquariumFishUI gradeAquariumFishUI)
{
FishData fishData = gradeAquariumFishUI.fishData;
bool isAvatar = gradeAquariumFishUI.isAvatar;
//先计算位置,以免查看详情时,模型位置不对
Vector3 pos = gradeAquariumFishUI.FishModelPos();
Vector3 posWorld = UIToWorldPoint(pos, rawImage2Size);
Transform avatarPos = new GameObject(fishData.Fbx).transform;
avatarPos.SetParent(avatar);
posWorld.x += fishData.TankPosition[0];
posWorld.y += fishData.TankPosition[1];
posWorld.z += fishData.TankPosition[2];
avatarPos.localPosition = posWorld;
avatarPos.localScale = Vector3.one;
avatarPos.localRotation = Quaternion.identity;
gradeAquariumFishUI.AvatarPos = avatarPos;
var goPrefab = await Addressables.LoadAssetAsync<GameObject>(fishData.Fbx).Task;
if (rt == null)
{
Addressables.Release(goPrefab);
}
else if (goPrefab != null)
{
fishPrefab.Add(goPrefab);
var go = Instantiate(goPrefab, avatarPos);
Fish fish = go.GetComponent<Fish>();
fish.animator.transform.localPosition = Vector3.zero;
go.transform.rotation = Quaternion.Euler(fishData.TankRotation[0], fishData.TankRotation[1], fishData.TankRotation[2]);
go.transform.localScale = Vector3.one * fishData.TankScale;
gradeAquariumFishUI.loading.SetActive(false);
gradeAquariumFishUI.FishGo = fish;
gradeAquariumFishUI.button.enabled = true;
//游入场中
bool isLeft = gradeAquariumFishUI.fishDirection == 0;
float moveX2 = isLeft ? moveXRight : moveXLeft;
go.transform.localPosition = Vector3.right * moveX2;
go.transform.DOLocalMoveX(0, outTime).OnComplete(() =>
{
if (isAvatar)
{
fish.animator.SetTrigger("Show01");
}
}).SetEase(Ease.OutSine).SetDelay(Random.Range(0, randomTime)).SetId(DotweenId);
if (!isAvatar)
{
fish.animator.speed = 0;
Renderer[] meshRenderer = go.GetComponentsInChildren<Renderer>();
if (meshRenderer != null && meshRenderer.Length > 0)
{
var render = meshRenderer[0];
var materials = render.materials;
for (int i = 0; i < materials.Length; i++)
{
var material = new Material(materials[i]);
material.SetColor("_BaseColor", Color.black);
material.SetFloat("_Smoothness", 0);
materials[i] = material;
}
render.materials = materials;
}
}
}
}
#if UNITY_EDITOR
string Mode = "prop_buckethat";
string Bone = "Head";
string FishAnimationName = "Swim01";
bool isShowMode = false;
private void OnGUI()
{
int fontSize = 40; // Replace with your desired font size
// Set the font size for text fields, buttons, and labels
GUI.skin.textField.fontSize = fontSize;
GUI.skin.button.fontSize = fontSize;
GUI.skin.label.fontSize = fontSize;
GUILayout.Label("Mode:");
Mode = GUILayout.TextField(Mode);
GUILayout.Label("Bone:");
Bone = GUILayout.TextField(Bone);
if (GUILayout.Button("ShowMode"))
{
ShowMode();
}
FishAnimationName = GUILayout.TextField(FishAnimationName);
if (GUILayout.Button("FishAnimation"))
{
FishAnimation();
}
}
async void ShowMode()
{
if (isShowMode)
{
return;
}
isShowMode = true;
string mode = Mode;
string bone = Bone;
var modego = await Addressables.LoadAssetAsync<GameObject>(mode).Task;
var _tables = GContext.container.Resolve<Tables>();
if (modego != null)
{
Debug.Log("ShowMode Bone");
for (int i = 0; i < gradeAquariumFishUIs.Count; i++)
{
var modeGo = Instantiate(modego);
GradeAquariumFishUI gradeAquariumFishUI = gradeAquariumFishUIs[i];
var dropAfterDropParent = gradeAquariumFishUI.FishGo.Find(bone);
CollectingPropScale collectingPropScale = _tables.TbCollectingPropScale[gradeAquariumFishUI.fishData.Quality];
var eulerAngles = modeGo.transform.localEulerAngles;
var localPosition = modeGo.transform.localPosition;
modeGo.transform.SetParent(dropAfterDropParent);
modeGo.transform.localScale *= collectingPropScale.Scale * 4.25f;
modeGo.transform.localEulerAngles = eulerAngles;
modeGo.transform.localPosition = localPosition;
}
}
Debug.Log("ShowMode");
Addressables.Release(modego);
isShowMode = false;
}
void FishAnimation()
{
for (int i = 0; i < gradeAquariumFishUIs.Count; i++)
{
GradeAquariumFishUI gradeAquariumFishUI = gradeAquariumFishUIs[i];
if (gradeAquariumFishUI != null && gradeAquariumFishUI.FishGo != null)
{
gradeAquariumFishUI.FishGo.animator.Play(FishAnimationName);
}
}
}
void Update()
{
if (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl))
{
if (Input.GetKeyDown(KeyCode.UpArrow))
{
LocalizationMgr.SetLanguageAsync((LocalizationMgr.LanguageIndex - 1 + LocalizationMgr.enumLanguage.Count) % LocalizationMgr.enumLanguage.Count);
OnClickClose();
}
else if (Input.GetKeyDown(KeyCode.DownArrow))
{
LocalizationMgr.SetLanguageAsync((LocalizationMgr.LanguageIndex + 1) % LocalizationMgr.enumLanguage.Count);
OnClickClose();
}
}
}
#endif
Vector3 UIToWorldPoint(Vector3 pos, Vector3 pos2)
{
pos.x += pos2.x * 0.5f;
pos.y += pos2.y * 0.5f;
pos.z = fishPosZ;
Vector3 targetPos = _camera.ScreenToWorldPoint(pos);
return targetPos;
}
void InitBar()
{
progress = playerFishData.GetMapProgress(mapData.ID);
bool isMax = progress >= mapData.PointsRequire.Count;
if (isMax)
{
OnProgressMax();
}
else
{
OnProgress();
}
}
void OnProgress()
{
int pointsRequire = mapData.PointsRequire[progress];
claim.gameObject.SetActive(AllPTS >= pointsRequire);
text_pts.text = $"{AllPTS}/{pointsRequire}";
if (AllPTS >= pointsRequire)
{
bar.fillAmount = 1;
}
else
{
bar.fillAmount = (float)AllPTS / pointsRequire;
}
int dorpID = mapData.PointsReward[progress];
ItemData drop = GContext.container.Resolve<PlayerItemData>().GetItemDataOne(dorpID);
rewardItemNew.SetData(drop);
}
void OnProgressMax()
{
int pointsRequire = mapData.PointsRequire[^1];
claim.gameObject.SetActive(false);
text_pts.text = $"{pointsRequire}/{pointsRequire}";
bar.fillAmount = 1;
int dorpID = mapData.PointsReward[^1];
ItemData drop = GContext.container.Resolve<PlayerItemData>().GetItemDataOne(dorpID);
rewardItemNew.SetData(drop);
}
void HideTips()
{
info_tips.SetActive(false);
}
async void OnClickClaim()
{
HideTips();
playerFishData.GetMapProgressReward(mapData);
claim.gameObject.SetActive(false);
effect_jiman.gameObject.SetActive(false);
btn_close.enabled = false;
await rewardItemNew.ParticleAttractor();
GContext.Publish(new ShowData());
await SetBarUp();
btn_close.enabled = true;
}
async System.Threading.Tasks.Task SetBarUp()
{
progress = playerFishData.GetMapProgress(mapData.ID);
bool isMax = progress >= mapData.PointsRequire.Count;
if (isMax)
{
OnProgressMax();
}
else
{
int pointsRequire = mapData.PointsRequire[progress];
int dorpID = mapData.PointsReward[progress];
ItemData drop = GContext.container.Resolve<PlayerItemData>().GetItemDataOne(dorpID);
rewardItemNew.SetData(drop);
bar.DOKill();
bar.fillAmount = 0;
text_pts.text = $"{AllPTS}/{pointsRequire}";
if (AllPTS >= pointsRequire)
{
bar.DOFillAmount(1, 0.5f);
effect_jiman.gameObject.SetActive(true);
}
else
{
bar.DOFillAmount((float)AllPTS / pointsRequire, 0.5f);
}
await new WaitForSeconds(0.5f);
claim.gameObject.SetActive(AllPTS >= pointsRequire);
}
}
void OnClickClose()
{
bar.DOKill();
getCurSelectMapEvent.type = 1;
GContext.Publish(getCurSelectMapEvent);
UIManager.Instance.DestroyUI(UITypes.PlayerGradeAquariumPanel);
}
private void OnDestroy()
{
DOTween.Kill(DotweenId);
if (enableFog)
{
RenderSettings.fog = true;
}
GContext.Publish(new InGradeAquariumEvent() { type = 1 });
if (rt != null)
{
rt.Release();
Destroy(rt);
rt = null;
}
for (int i = 0; i < fishPrefab.Count; i++)
{
Addressables.Release(fishPrefab[i]);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b1d09f79f74a11048ab4880055e57be9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,132 @@
using asap.core;
using cfg;
using GameCore;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class PlayerGradeBenefitInfoPopupPanel : MonoBehaviour
{
public Button btn_close;
public TMP_Text text_title;
public RewardItemNew reward;
public TMP_Text text_info;
public GameObject _level;
public TMP_Text _level_level;
public TMP_Text _level_num;
public GameObject current_level;
public TMP_Text current_level_level;
public TMP_Text current_level_num;
public GameObject next_level;
public TMP_Text next_level_level;
public TMP_Text next_level_num;
public GameObject max_level;
public TMP_Text max_level_level;
public TMP_Text max_level_num;
Tables table;
PlayerData playerData;
#if UNITY_EDITOR
private void Reset()
{
btn_close = transform.Find("btn_close").GetComponent<Button>();
text_title = transform.Find("root/bg/text_title").GetComponent<TMP_Text>();
reward = transform.Find("root/bg/reward_1").GetComponent<RewardItemNew>();
text_info = transform.Find("root/bg/text_info").GetComponent<TMP_Text>();
_level = transform.Find("root/bg/level").gameObject;
_level_level = transform.Find("root/bg/level/text_level").GetComponent<TMP_Text>();
_level_num = transform.Find("root/bg/level/text_num").GetComponent<TMP_Text>();
current_level = transform.Find("root/bg/current_level").gameObject;
current_level_level = transform.Find("root/bg/current_level/text_level").GetComponent<TMP_Text>();
current_level_num = transform.Find("root/bg/current_level/text_num").GetComponent<TMP_Text>();
next_level = transform.Find("root/bg/next_level").gameObject;
next_level_level = transform.Find("root/bg/next_level/text_level").GetComponent<TMP_Text>();
next_level_num = transform.Find("root/bg/next_level/text_num").GetComponent<TMP_Text>();
max_level = transform.Find("root/bg/max_level").gameObject;
max_level_level = transform.Find("root/bg/max_level/text_level").GetComponent<TMP_Text>();
max_level_num = transform.Find("root/bg/max_level/text_num").GetComponent<TMP_Text>();
}
#endif
private void Start()
{
btn_close.onClick.AddListener(() =>
{
UIManager.Instance.DestroyUI(UITypes.PlayerGradeBenefitInfoPopupPanel);
});
}
public void Init(Item item, int level)
{
table = GContext.container.Resolve<Tables>();
playerData = GContext.container.Resolve<PlayerData>();
text_title.text = LocalizationMgr.GetText(item.Name_l10n_key);
text_info.text = LocalizationMgr.GetText(item.Desc_l10n_key);
//if (level < 0)
//{
// level = playerData.benefitsLevel[item.SubType - 1];
//}
reward.SetData(item, level);
var benefits = table.TBBenefits.GetOrDefault(item.SubType);
CurBenefitPanelEvent curBenefitPanelEvent = new CurBenefitPanelEvent();
GContext.Publish(curBenefitPanelEvent);
if (curBenefitPanelEvent.panelName != "PlayerGradeBenefitPopupPanel")
{
_level.SetActive(true);
current_level.SetActive(false);
next_level.SetActive(false);
max_level.SetActive(false);
if (item.SubType == 3 || item.SubType == 4 || item.SubType == 7)
{
_level_num.text = benefits.BenefitsValue[level].ToString("F0");
}
else
{
_level_num.text = benefits.BenefitsValue[level].ToPercentageString();
}
_level_level.text = LocalizationMgr.GetFormatTextValue("UI_PlayerGradePanel_8", level);
return;
}
_level.SetActive(false);
bool isMax = level >= benefits.BenefitsValue.Count - 1;
current_level.SetActive(!isMax);
next_level.SetActive(!isMax);
max_level.SetActive(isMax);
if (isMax)
{
if (item.SubType == 3 || item.SubType == 4 || item.SubType == 7)
{
max_level_num.text = benefits.BenefitsValue[level].ToString("F0");
}
else
{
max_level_num.text = benefits.BenefitsValue[level].ToPercentageString();
}
max_level_level.text = LocalizationMgr.GetFormatTextValue("UI_PlayerGradePanel_4", level);
}
else
{
if (item.SubType == 3 || item.SubType == 4 || item.SubType == 7)
{
current_level_num.text = benefits.BenefitsValue[level].ToString("F0");
next_level_num.text = benefits.BenefitsValue[level + 1].ToString("F0");
}
else
{
current_level_num.text = benefits.BenefitsValue[level].ToPercentageString();
next_level_num.text = benefits.BenefitsValue[level + 1].ToPercentageString();
}
current_level_level.text = LocalizationMgr.GetFormatTextValue("UI_PlayerGradePanel_4", level);
next_level_level.text = LocalizationMgr.GetFormatTextValue("UI_PlayerGradePanel_5", level + 1);
}
}
}
public class CurBenefitPanelEvent
{
public string panelName;
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 470f65d6afea9094d8ba7f058d4817dd
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,76 @@
using asap.core;
using cfg;
using game;
using GameCore;
using System;
using UnityEngine;
using UnityEngine.UI;
using UniRx;
public class PlayerGradeBenefitPopupPanel : MonoBehaviour
{
RewardItemNew[] rewardItemNews;
Button btn_close;
Button btn_go;
IDisposable disposable;
private void Awake()
{
rewardItemNews = transform.Find("root/info").GetComponentsInChildren<RewardItemNew>();
btn_close = transform.Find("btn_close").GetComponent<Button>();
btn_go = transform.Find("root/btn_go/btn_green").GetComponent<Button>();
}
private void Start()
{
btn_close.onClick.AddListener(() =>
{
UIManager.Instance.DestroyUI(UITypes.PlayerGradeBenefitPopupPanel);
});
btn_go.onClick.AddListener(OnGoBuild);
var table = GContext.container.Resolve<Tables>();
var playerData = GContext.container.Resolve<PlayerData>();
int id;
Item item;
for (int i = 0; i < rewardItemNews.Length; i++)
{
if (i >= playerData.benefitsLevel.Count)
{
break;
}
id = 12001 + i;
item = table.TbItem.GetOrDefault(id);
rewardItemNews[i].SetData(item, playerData.benefitsLevel[i], true);
}
disposable = GContext.OnEvent<CurBenefitPanelEvent>().Subscribe(_ => _.panelName = name);
}
async void OnGoBuild()
{
var campData = GContext.container.Resolve<CampDataMM>();
ILoadResourceService loadResourceService = GContext.container.Resolve<ILoadResourceService>();
bool isCanEnter = await loadResourceService.Loads(campData.AllPrefabs);
if (isCanEnter)
{
EnterBuild();
}
else
{
var panel = await UIManager.Instance.ShowUI(UITypes.CloudTransitionPanel);
panel.GetComponent<CloudTransitionPanel>().SetBtn(true, EnterBuild);
//var panel = await UIManager.Instance.ShowUI(UITypes.FishingDownLoadPopupPanel);
//panel.GetComponent<FishingDownLoadPopupPanel>().SetBtn(null, EnterBuild);
}
}
void EnterBuild()
{
GContext.Publish(new HideHomePanelEvent());
GContext.Publish(new VibrationData(HapticTypes.LightImpact));
UIManager.Instance.DestroyUI(UITypes.PlayerGradeBenefitPopupPanel);
UIManager.Instance.DestroyUI(UITypes.PlayerGradePanel);
GContext.Publish(new UnloadActToNextAct("BuildAct"));
}
private void OnDisable()
{
disposable?.Dispose();
disposable = null;
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 7d1a80dfa09180f47ab12cec7f81b463
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,102 @@
using asap.core;
using game;
using GameCore;
using TMPro;
using UnityEngine.UI;
using UniRx;
using System.Collections.Generic;
using UnityEngine;
public class ChangeTabEvent
{
public int index;
}
public class PlayerGradePanel : BasePanel
{
Button btn_close;
TMP_Text text_grade;
TMP_Text text_skyscraper;
GameObject skyscraper;
TMP_Text text_name;
TMP_Text text_id;
Button btn_edit;
Head head;
Button btn_benefit;
List<Toggle> toggles = new List<Toggle>();
List<GameObject> selected_tab = new List<GameObject>();
List<GameObject> root = new List<GameObject>();
List<GameObject> redpoint = new List<GameObject>();
private void Awake()
{
btn_close = transform.Find("root/btn_close").GetComponent<Button>();
text_grade = transform.Find("root/bg_title/text_grade").GetComponent<TMP_Text>();
skyscraper = transform.Find("root/bg_title/icon_skyscraper").gameObject;
text_skyscraper = transform.Find("root/bg_title/icon_skyscraper/text_num").GetComponent<TMP_Text>();
head = transform.Find("root/bg_title/btn_head").GetComponent<Head>();
text_name = transform.Find("root/bg_title/text_name").GetComponent<TMP_Text>();
text_id = transform.Find("root/bg_title/text_grade/text_id").GetComponent<TMP_Text>();
btn_edit = transform.Find("root/bg_title/text_name/btn_edit").GetComponent<Button>();
btn_benefit = transform.Find("root/bg_title/btn_benefit").GetComponent<Button>();
root.Add(transform.Find("root/root_reward").gameObject);
root.Add(transform.Find("root/root_progress").gameObject);
root.Add(transform.Find("root/root_achievement").gameObject);
for (int i = 0; i < 3; i++)
{
redpoint.Add(transform.Find($"root/tab/redpoint_tab{i + 1}").gameObject);
selected_tab.Add(transform.Find($"root/tab/selected_tab{i + 1}").gameObject);
toggles.Add(transform.Find($"root/tab/text_tab{i + 1}").GetComponent<Toggle>());
Toggle toggle = toggles[i];
int index = i;
toggle.onValueChanged.AddListener((isOn) =>
{
selected_tab[index].SetActive(isOn);
root[index].SetActive(isOn);
});
root[i].SetActive(i == 0);
selected_tab[i].SetActive(i == 0);
toggle.isOn = i == 0;
}
}
void ShowTab(int index)
{
toggles[index].isOn = true;
}
protected override void Start()
{
GContext.OnEvent<GetCurSelectMapEvent>().Subscribe(GetCurSelectMap).AddTo(disposables);
GContext.OnEvent<ChangeTabEvent>().Subscribe((e) => ShowTab(e.index)).AddTo(disposables);
oldPanelName = PanelName;
base.Start();
btn_close.onClick.AddListener(() => { UIManager.Instance.DestroyUI(UITypes.PlayerGradePanel); });
btn_edit.onClick.AddListener(() => { _ = UIManager.Instance.GetUIAsync(UITypes.PlayerHeadPopupPanel); });
btn_benefit.onClick.AddListener(() => { _ = UIManager.Instance.GetUIAsync(UITypes.PlayerGradeBenefitPopupPanel); });
text_id.text = $"ID: {GContext.container.Resolve<IUserService>().CustomId}";
text_name.text = GContext.container.Resolve<IUserService>().DisplayName;
head.SetData(GContext.container.Resolve<IUserService>().AvatarUrl);
text_grade.text = GContext.container.Resolve<PlayerData>().lv.ToString();
GContext.OnEvent<ChangeAvatarEvent>().Subscribe(OnChangeAvatar).AddTo(disposables);
redpoint[1].SetActive(GContext.container.Resolve<PlayerFishData>().PTSRed());
string InfiniteBuildingLevel = GContext.container.Resolve<PlayerData>().InfiniteBuildingLevel;
skyscraper.gameObject.SetActive(InfiniteBuildingLevel != "0");
text_skyscraper.text = InfiniteBuildingLevel;
//新手引导
GContext.container.Resolve<GuideDataCenter>().InspectTriggerGuide(name);
}
void GetCurSelectMap(GetCurSelectMapEvent getCurSelectMapEvent)
{
if (getCurSelectMapEvent.type != 0)
{
redpoint[1].SetActive(GContext.container.Resolve<PlayerFishData>().PTSRed());
}
}
void OnChangeAvatar(ChangeAvatarEvent data)
{
head.SetData(GContext.container.Resolve<IUserService>().AvatarUrl);
text_name.text = GContext.container.Resolve<IUserService>().DisplayName;
}
private void OnDisable()
{
RestartShowHomeUIEvent restartShowHomeUIEvent = new RestartShowHomeUIEvent();
GContext.Publish(restartShowHomeUIEvent);
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4119c2aab31468f439d5adc93f139b21
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,61 @@
using asap.core;
using cfg;
using GameCore;
using System;
using System.Collections.Generic;
using UnityEngine;
using UniRx;
public class GetCurSelectMapEvent
{
public int type;//0获得当前选中的地图1更新当前选中的地图
public MapData selectMap;
}
public class PlayerGradeProgress : MonoBehaviour
{
GameObject item;
Transform content;
List<GradeMapItem> gradeMapItems = new List<GradeMapItem>();
GradeMapItem selectMap;
IDisposable disposable;
private void Awake()
{
disposable = GContext.OnEvent<GetCurSelectMapEvent>().Subscribe(GetCurSelectMap);
item = transform.Find("ScrollView/Viewport/Content/Item").gameObject;
content = transform.Find("ScrollView/Viewport/Content");
item.SetActive(false);
}
private void Start()
{
var DataMap = GContext.container.Resolve<Tables>().TbMapData.DataMap;
int requireLevel = 0;
foreach (var mapData in DataMap.Values)
{
GameObject go = Instantiate(item, content);
GradeMapItem gradeMapItem = go.GetComponent<GradeMapItem>();
gradeMapItems.Add(gradeMapItem);
gradeMapItem.GetComponent<GradeMapItem>().SetData(mapData, requireLevel, OnClickMap);
requireLevel = mapData.LevelRequired;
}
}
async void OnClickMap(GradeMapItem gradeMapItem)
{
selectMap = gradeMapItem;
await UIManager.Instance.ShowUI(UITypes.PlayerGradeAquariumPanel);
}
void GetCurSelectMap(GetCurSelectMapEvent getCurSelectMapEvent)
{
if (getCurSelectMapEvent.type == 0)
{
getCurSelectMapEvent.selectMap = selectMap.mapData;
}
else
{
selectMap.Refresh();
}
}
private void OnDestroy()
{
disposable?.Dispose();
disposable = null;
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1aa2a1abe05fcc04794070ffdec40816
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,63 @@
using asap.core;
using cfg;
using GameCore;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class PlayerGradeReward : MonoBehaviour
{
PanelScroll scrollRect;
Image bar;
GameObject gradeItem;
List<GradeItemData> gradeDatas = new List<GradeItemData>();
float itemHigh = 250;
private void Awake()
{
bar = transform.Find("ScrollView/Viewport/Content/bg_bar/bar").GetComponent<Image>();
scrollRect = transform.Find("ScrollView").GetComponent<PanelScroll>();
gradeItem = transform.Find("ScrollView/Viewport/Content/item").gameObject;
gradeItem.SetActive(false);
itemHigh = gradeItem.GetComponent<RectTransform>().sizeDelta.y;
scrollRect.isReversal = true;
}
private void Start()
{
gradeDatas.Clear();
var account = GContext.container.Resolve<Tables>().TBAccount.DataList;
int nextIndex = account.Count - 1;
for (int i = 0; i < account.Count; i++)
{
if (GContext.container.Resolve<PlayerData>().lv < account[i].ID)
{
nextIndex = i;
break;
}
}
bar.fillAmount = (GContext.container.Resolve<PlayerData>().lv - 1) / ((float)account[0].ID - 1);
int showCount = nextIndex + 10;
if (showCount > account.Count)
{
showCount = account.Count;
}
for (int i = 0; i < showCount; i++)
{
gradeDatas.Add(new GradeItemData() { account = account[i], nextIndex = nextIndex });
}
if (nextIndex > 0)
{
int startLv = account[nextIndex - 1].ID;
var nextAccountData = account[nextIndex];
gradeDatas[nextIndex - 1].fillAmount = (GContext.container.Resolve<PlayerData>().lv - startLv) / (float)(nextAccountData.ID - startLv);
gradeDatas[nextIndex].next = true;
nextIndex--;
}
else if (GContext.container.Resolve<PlayerData>().lv < account[0].ID)
{
gradeDatas[0].next = true;
}
gradeDatas[^1].bar = false;
scrollRect.Init<GradeItem, GradeItemData>(itemHigh, gradeItem, null, gradeDatas, _currentIndex: nextIndex, _minShowAdd: 3);
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 60e85322285fb67479fa1bac30051942
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,47 @@
using asap.core;
using cfg;
using GameCore;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class StatisticItem : MonoBehaviour
{
public Button button;
public Image icon;
public TMP_Text text_title;
public TMP_Text text_num;
public GameObject text_none;
public GameObject redpoints;
private void Reset()
{
button = transform.Find("btn_green").GetComponent<Button>();
icon = transform.Find("btn_green/icon").GetComponent<Image>();
text_title = transform.Find("btn_green/text_title").GetComponent<TMP_Text>();
text_num = transform.Find("btn_green/text_num").GetComponent<TMP_Text>();
text_none = transform.Find("btn_green/text_none").gameObject;
redpoints = transform.Find("btn_green/redpoints").gameObject;
}
public void Init(Statistics statistics)
{
text_title.text = LocalizationMgr.GetFormatTextValue(statistics.Text_l10n_key);
IUIService uiService = GContext.container.Resolve<IUIService>();
uiService.SetImageSprite(icon, statistics.Icon);
AchievementDataManager achievementDataManager = GContext.container.Resolve<AchievementDataManager>();
ulong num = achievementDataManager.GetAchievementDatas(statistics.ConditionType);
text_none.SetActive(num == 0);
text_num.gameObject.SetActive(num > 0);
if (num > 0)
{
if (ConditionType.GetFishWeight == statistics.ConditionType)
{
double fishWeight = num / 1000;
text_num.text = LocalizationMgr.GetWeight(fishWeight);
}
else
{
text_num.text = ConvertTools.GetNumberString(num);
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4ab51a98b8e66d04484bfe8923cb0c81
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: