This commit is contained in:
2026-07-06 04:06:56 +08:00
parent ef78ab8abd
commit 4268393ed0
10 changed files with 213 additions and 301 deletions
+92
View File
@@ -2898,6 +2898,8 @@ MonoBehaviour:
btn_SafeBox: {fileID: 9010730796721823750}
btn_Service: {fileID: 829266072426131008}
btn_Shop: {fileID: 1163927380232624049}
btn_ShopDiamond: {fileID: 2594643537672439286}
btn_ShopGlod: {fileID: 934234532213621675}
--- !u!1 &2058276183421344508
GameObject:
m_ObjectHideFlags: 0
@@ -6674,6 +6676,7 @@ GameObject:
- component: {fileID: 6349130931462666412}
- component: {fileID: 7334254453930187447}
- component: {fileID: 564016687369540094}
- component: {fileID: 934234532213621675}
m_Layer: 0
m_Name: Image (1)
m_TagString: Untagged
@@ -6738,6 +6741,50 @@ MonoBehaviour:
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!114 &934234532213621675
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4947614310876206362}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_SelectedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_SelectedTrigger: Selected
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 564016687369540094}
m_OnClick:
m_PersistentCalls:
m_Calls: []
--- !u!1 &5061706179239590706
GameObject:
m_ObjectHideFlags: 0
@@ -7745,6 +7792,7 @@ GameObject:
- component: {fileID: 4481632732788159625}
- component: {fileID: 7316898727301261907}
- component: {fileID: 857100229292099671}
- component: {fileID: 2594643537672439286}
m_Layer: 0
m_Name: Image (3)
m_TagString: Untagged
@@ -7809,6 +7857,50 @@ MonoBehaviour:
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!114 &2594643537672439286
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5980666311781441333}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_SelectedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_SelectedTrigger: Selected
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 857100229292099671}
m_OnClick:
m_PersistentCalls:
m_Calls: []
--- !u!1 &5989754516371443902
GameObject:
m_ObjectHideFlags: 0
@@ -14,11 +14,18 @@ public class SelectGameLeave_DefaultUIItem : MonoBehaviour
public Button btn_StartQuickly;
public Button btn_FanHui;
public Button btn_SheZhi;
[Header("跳转商城")]
public Button btn_ShopDiamond;
public Button btn_ShopGlod;
private void OnEnable()
{
GameManager.Instance.OnAvatarChanged += OnAvatarChanged;
GameManager.Instance.OnAvatarFrameChanged += OnAvatarFrameChanged;
if (btn_ShopDiamond != null)
btn_ShopDiamond.onClick.AddListener(OnClickShopDiamond);
if (btn_ShopGlod != null)
btn_ShopGlod.onClick.AddListener(OnClickShopGlod);
}
private void OnDisable()
@@ -28,8 +35,17 @@ public class SelectGameLeave_DefaultUIItem : MonoBehaviour
GameManager.Instance.OnAvatarChanged -= OnAvatarChanged;
GameManager.Instance.OnAvatarFrameChanged -= OnAvatarFrameChanged;
}
if (btn_ShopDiamond != null)
btn_ShopDiamond.onClick.RemoveListener(OnClickShopDiamond);
if (btn_ShopGlod != null)
btn_ShopGlod.onClick.RemoveListener(OnClickShopGlod);
}
private void OnClickShopDiamond() => UIManager.Instance.Get<UIHomeMain>(UIPanel.HomeMainPanel)
.subUIManager.ShowAsync(UIPanel.ShopPanel, ShopTab.Diamond);
private void OnClickShopGlod() => UIManager.Instance.Get<UIHomeMain>(UIPanel.HomeMainPanel)
.subUIManager.ShowAsync(UIPanel.ShopPanel, ShopTab.Gold);
private void OnAvatarChanged(Sprite sprite)
{
if (sprite != null) sprite_Avatar.sprite = sprite;
@@ -651,6 +651,8 @@ MonoBehaviour:
btn_StartQuickly: {fileID: 0}
btn_FanHui: {fileID: 1812939530559643933}
btn_SheZhi: {fileID: 0}
btn_ShopDiamond: {fileID: 0}
btn_ShopGlod: {fileID: 0}
--- !u!1 &343120649183011430
GameObject:
m_ObjectHideFlags: 0
@@ -2595,6 +2597,8 @@ MonoBehaviour:
btn_StartQuickly: {fileID: 576442742318188492}
btn_FanHui: {fileID: 978803263054816126}
btn_SheZhi: {fileID: 3794423129905778094}
btn_ShopDiamond: {fileID: 2059803831635030881}
btn_ShopGlod: {fileID: 7160767474031777080}
--- !u!222 &773810440980272660
CanvasRenderer:
m_ObjectHideFlags: 0
@@ -3502,6 +3506,8 @@ MonoBehaviour:
btn_StartQuickly: {fileID: 5123782565920707592}
btn_FanHui: {fileID: 7232152364893536774}
btn_SheZhi: {fileID: 9051061082824550903}
btn_ShopDiamond: {fileID: 2331916713734236765}
btn_ShopGlod: {fileID: 3737370395051907048}
--- !u!222 &4958600916722264664
CanvasRenderer:
m_ObjectHideFlags: 0
@@ -20798,7 +20804,6 @@ GameObject:
- component: {fileID: 5272030444220040528}
- component: {fileID: 5360097821714526924}
- component: {fileID: 8723069038909797926}
- component: {fileID: 3059635429268451430}
m_Layer: 5
m_Name: Image (2)
m_TagString: Untagged
@@ -20863,50 +20868,6 @@ MonoBehaviour:
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!114 &3059635429268451430
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3268171534627904549}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_SelectedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_SelectedTrigger: Selected
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 8723069038909797926}
m_OnClick:
m_PersistentCalls:
m_Calls: []
--- !u!1 &3405815909814794411
GameObject:
m_ObjectHideFlags: 0
@@ -22201,7 +22162,6 @@ GameObject:
- component: {fileID: 838507831760552503}
- component: {fileID: 4494033909850022461}
- component: {fileID: 5316010612701403465}
- component: {fileID: 7995665577710727891}
m_Layer: 5
m_Name: Image (1)
m_TagString: Untagged
@@ -22266,50 +22226,6 @@ MonoBehaviour:
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!114 &7995665577710727891
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3802443441378447310}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_SelectedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_SelectedTrigger: Selected
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 5316010612701403465}
m_OnClick:
m_PersistentCalls:
m_Calls: []
--- !u!1 &3838167484870507728
GameObject:
m_ObjectHideFlags: 0
@@ -114708,7 +114624,6 @@ GameObject:
- component: {fileID: 796498848773345856}
- component: {fileID: 6295372819494463335}
- component: {fileID: 8983908493096282731}
- component: {fileID: 4879660099216042190}
m_Layer: 5
m_Name: Image (2)
m_TagString: Untagged
@@ -114773,50 +114688,6 @@ MonoBehaviour:
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!114 &4879660099216042190
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5765946162201669741}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_SelectedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_SelectedTrigger: Selected
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 8983908493096282731}
m_OnClick:
m_PersistentCalls:
m_Calls: []
--- !u!1 &5781803683771353582
GameObject:
m_ObjectHideFlags: 0
@@ -199564,7 +199435,6 @@ GameObject:
- component: {fileID: 8314237941475532380}
- component: {fileID: 747979535908280386}
- component: {fileID: 3082849150626077251}
- component: {fileID: 510063383300854361}
m_Layer: 5
m_Name: Image (1)
m_TagString: Untagged
@@ -199629,50 +199499,6 @@ MonoBehaviour:
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!114 &510063383300854361
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8796344789037050625}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_SelectedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_SelectedTrigger: Selected
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 3082849150626077251}
m_OnClick:
m_PersistentCalls:
m_Calls: []
--- !u!1 &8821034805675886532
GameObject:
m_ObjectHideFlags: 0
@@ -1,4 +1,4 @@
using System.Collections;
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
@@ -6,22 +6,29 @@ using UnityEngine.UI;
public class DialogItem : MonoBehaviour
{
public TextMeshProUGUI tMP_content_Top;
public TextMeshProUGUI tMP_content_Bottom;
public TextMeshProUGUI tMP_content;
public GameObject waitMessage;
public GameObject messageDefeated;
public Image title;
public Image avatar;
public Image avatarFrame;
int top_buttonIndex = 0;
int maxWidth = 650;
public bool showAvatar = true;
private void OnEnable()
{
GameManager.Instance.OnAvatarChanged += OnAvatarChanged;
GameManager.Instance.OnAvatarFrameChanged += OnAvatarFrameChanged;
RefreshAvatar();
RefreshAvatarFrame();
if (showAvatar)
{
RefreshAvatar();
RefreshAvatarFrame();
}
else
{
if (avatar != null) avatar.gameObject.SetActive(false);
if (avatarFrame != null) avatarFrame.gameObject.SetActive(false);
}
}
private void OnDisable()
@@ -38,6 +45,7 @@ public class DialogItem : MonoBehaviour
if (avatar == null) return;
var sprite = GameManager.Instance.GetAvatarSprite(GameManager.Instance.user.BaseInfo.avatarUrl);
if (sprite != null) avatar.sprite = sprite;
avatar.gameObject.SetActive(true);
}
private void RefreshAvatarFrame()
@@ -45,99 +53,24 @@ public class DialogItem : MonoBehaviour
if (avatarFrame == null) return;
var sprite = GameManager.Instance.GetAvatarFrameSprite(GameManager.Instance.user.BaseInfo.avatarFrame);
if (sprite != null) avatarFrame.sprite = sprite;
avatarFrame.gameObject.SetActive(sprite != null);
}
private void OnAvatarChanged(Sprite sprite)
{
if (avatar != null && sprite != null) avatar.sprite = sprite;
if (!showAvatar || avatar == null || sprite == null) return;
avatar.sprite = sprite;
}
private void OnAvatarFrameChanged(Sprite sprite)
{
if (avatarFrame != null && sprite != null) avatarFrame.sprite = sprite;
if (!showAvatar || avatarFrame == null || sprite == null) return;
avatarFrame.sprite = sprite;
}
public void SetMessage(string str)
{
List<string> msgBottom = new List<string>();
msgBottom.Add("");
int tempindex = 0;
for (int i = str.Length - 1; i >= 0; i--)
{
if (tempindex < 2)
{
if (tMP_content_Bottom.GetPreferredValues(msgBottom[tempindex]).x >= maxWidth)
{
tempindex++;
msgBottom.Add("");
}
}
else
{
if (tMP_content_Top.GetPreferredValues(msgBottom[tempindex]).x >= maxWidth)
{
tempindex++;
msgBottom.Add("");
}
}
msgBottom[tempindex] += str[i];
}
string temp = "";
bool istop = true;
int tempCount = 0;
if (msgBottom.Count >2)
{
for (int i = 0; i < str.Length; i++)
{
temp += str[i];
if (istop)
{
if (tMP_content_Top.GetPreferredValues(temp).x >= maxWidth)
{
temp += "\n";
tMP_content_Top.text += temp;
temp = "";
tempCount++;
if (tempCount>= msgBottom.Count - 2)
{
istop = false;
}
}
}
else
{
if (tMP_content_Bottom.GetPreferredValues(temp).x >= maxWidth|| i== str.Length-1)
{
temp += "\n";
tMP_content_Bottom.text += temp;
temp = "";
}
}
}
}
else
{
for (int i = 0; i < str.Length; i++)
{
temp += str[i];
if (tMP_content_Bottom.GetPreferredValues(temp).x >= maxWidth|| i==str.Length-1)
{
temp += "\n";
tMP_content_Bottom.text += temp;
temp = "";
}
}
}
if (tMP_content != null)
tMP_content.text = str;
}
}
}
@@ -1098,8 +1098,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 0, y: -21.72}
m_SizeDelta: {x: 108.79, y: 43.44}
m_AnchoredPosition: {x: 0, y: -0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 0.5}
--- !u!222 &8403337047529264072
CanvasRenderer:
@@ -2014,7 +2014,7 @@ RectTransform:
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 49.999664, y: 82.16998}
m_SizeDelta: {x: 817.67, y: 83.44}
m_SizeDelta: {x: 817.67, y: 40}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &252125706651711539
CanvasRenderer:
@@ -2050,13 +2050,13 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: cdc6cb5e9df522f4a86cea06f1e40226, type: 3}
m_Name:
m_EditorClassIdentifier:
tMP_content_Top: {fileID: 0}
tMP_content_Bottom: {fileID: 6310819021334984224}
tMP_content: {fileID: 6310819021334984224}
waitMessage: {fileID: 1761464183961034063}
messageDefeated: {fileID: 5360207957792688605}
title: {fileID: 5120087257419851217}
avatar: {fileID: 0}
avatarFrame: {fileID: 0}
avatar: {fileID: 5120087257419851217}
avatarFrame: {fileID: 3302071961866447170}
showAvatar: 0
--- !u!114 &598616052371914426
MonoBehaviour:
m_ObjectHideFlags: 0
@@ -2124,8 +2124,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 208.79, y: -61.72}
m_SizeDelta: {x: 108.79, y: 43.44}
m_AnchoredPosition: {x: 100, y: -40}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.9999999, y: 0.5}
--- !u!222 &2899027811091310297
CanvasRenderer:
@@ -2413,7 +2413,7 @@ RectTransform:
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 49.999664, y: 82.16998}
m_SizeDelta: {x: 817.67, y: 83.44}
m_SizeDelta: {x: 817.67, y: 40}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &752927480624469016
CanvasRenderer:
@@ -2449,13 +2449,13 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: cdc6cb5e9df522f4a86cea06f1e40226, type: 3}
m_Name:
m_EditorClassIdentifier:
tMP_content_Top: {fileID: 0}
tMP_content_Bottom: {fileID: 1108614690594346404}
tMP_content: {fileID: 1108614690594346404}
waitMessage: {fileID: 4901081416388548652}
messageDefeated: {fileID: 5476529868094260494}
title: {fileID: 9218488169075870843}
avatar: {fileID: 9218488169075870843}
avatarFrame: {fileID: 8594967183270027656}
showAvatar: 1
--- !u!114 &7381443315458241373
MonoBehaviour:
m_ObjectHideFlags: 0
@@ -6534,8 +6534,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 717.67, y: -61.72}
m_SizeDelta: {x: 108.79, y: 43.44}
m_AnchoredPosition: {x: 717.67, y: -40}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.9999999, y: 0.5}
--- !u!222 &2130314133588970263
CanvasRenderer:
@@ -7197,8 +7197,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 0, y: -21.72}
m_SizeDelta: {x: 108.79, y: 43.44}
m_AnchoredPosition: {x: 0, y: -0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 0.5}
--- !u!222 &3515175731842939980
CanvasRenderer:
@@ -8,6 +8,14 @@ using TMPro;
using UnityEngine;
using UnityEngine.UI;
/// <summary>商城 Tab 类型</summary>
public enum ShopTab
{
Gold = 0, // 金币
Diamond = 1, // 钻石
Prop = 2 // 道具
}
public class UIHome_BY_ShopPanel : SubUIBase
{
public GameObject obj_ItemPrefab; // 0-图标 1-首充 2-购买按钮 2-0-价值 3-名字
@@ -264,6 +272,29 @@ public class UIHome_BY_ShopPanel : SubUIBase
{
base.OnShow(args);
RefreshUI();
// 根据参数切换 Tab(默认金币)
var tab = ShopTab.Gold;
if (args is ShopTab st) tab = st;
else if (args is int i) tab = (ShopTab)i;
SwitchTab(tab);
}
private void SwitchTab(ShopTab tab)
{
switch (tab)
{
case ShopTab.Gold:
if (btn_GlodCoins != null) btn_GlodCoins.isOn = true;
break;
case ShopTab.Diamond:
if (btn_Diamond != null) btn_Diamond.isOn = true;
break;
case ShopTab.Prop:
if (btn_Prop != null) btn_Prop.isOn = true;
break;
}
}
private void RefreshUI()
@@ -314,7 +345,7 @@ public class UIHome_BY_ShopPanel : SubUIBase
{
int nextLevel = vipLevel + 1;
bool hasNext = configs.Exists(v => v.level == nextLevel);
double need = curCfg.expMax > currentExp ? curCfg.expMax - currentExp : 0;
double need = curCfg.expMax > currentExp ? (curCfg.expMax - currentExp) / 100.0 : 0;
if (need > 0 && hasNext)
tmp_UpLevel.text = $"再充值<color=yellow><b>{need}</b></color>元升级至<color=yellow><b>贵族{nextLevel}</b></color>";
@@ -19,6 +19,9 @@ public class UIHome_BY_VIPPanel : SubUIBase
public Toggle btn_LeaveItemPrefab;
public Transform btn_LeaveItemParent;
[Header("跳转商城")]
public Button btn_Shop;
[Header("Vip领取奖励选项")]
public BackPackPropItem btn_AwardItemPrefab;
public Transform btn_AwardItemParent_Top;
@@ -39,6 +42,10 @@ public class UIHome_BY_VIPPanel : SubUIBase
base.Awake();
vipConfigs = GameManager.Instance.gameConfig.vipLevelConfigs;
GameManager.Instance.OnUserDataChanged += OnUserDataChanged;
// 跳转商城(默认金币页,可传 ShopTab)
if (btn_Shop != null)
btn_Shop.onClick.AddListener(() => uIManager.ShowAsync(UIPanel.ShopPanel, ShopTab.Diamond));
}
private void OnUserDataChanged()
@@ -131,10 +138,11 @@ public class UIHome_BY_VIPPanel : SubUIBase
// 经验文本:当前经验 / 选中等级上限
txt_VIPEXP.text = $"{currentExp}/{config.expMax}";
// 升到下一级所需的金额
double needAmount = config.expMax > currentExp ? config.expMax - currentExp : 0;
// 升到下一级所需的经验 → 换成金额(1元=100经验)
double needExp = config.expMax > currentExp ? config.expMax - currentExp : 0;
double needAmount = needExp / 100.0;
int nextLevel = vipLevel + 1;
int nextLevel = level + 1;
bool hasNextLevel = vipConfigs.Exists(v => v.level == nextLevel);
if (needAmount > 0 && hasNextLevel)
+6
View File
@@ -63,6 +63,9 @@ public class UIHomeMain : UIBase
public Button btn_Service;
public Button btn_Shop;
#endregion
[Header("跳转商城")]
public Button btn_ShopDiamond;
public Button btn_ShopGlod;
private void Awake()
{
// 订阅事件
@@ -190,6 +193,9 @@ public class UIHomeMain : UIBase
});
#endregion
btn_ShopDiamond.onClick.AddListener(() => subUIManager.ShowAsync(UIPanel.ShopPanel, ShopTab.Diamond));
btn_ShopGlod.onClick.AddListener(() => subUIManager.ShowAsync(UIPanel.ShopPanel, ShopTab.Gold));
btn_UserInfo.onClick.AddListener(()=>subUIManager.ShowAsync(UIPanel.UserInfo));
}
protected override void OnShow(object args = null)
@@ -121,7 +121,7 @@ Material:
- _DstBlend: 0
- _DstBlendAlpha: 0
- _EnvironmentReflections: 1
- _FaceDilate: 0.132
- _FaceDilate: 0.3
- _FaceUVSpeedX: 0
- _FaceUVSpeedY: 0
- _GlossMapScale: 0
@@ -137,18 +137,18 @@ Material:
- _MaskSoftnessY: 0
- _Metallic: 0
- _OcclusionStrength: 1
- _OutlineSoftness: 0.117
- _OutlineSoftness: 0
- _OutlineUVSpeedX: 0
- _OutlineUVSpeedY: 0
- _OutlineWidth: 0
- _OutlineWidth: 0.416
- _Parallax: 0.005
- _PerspectiveFilter: 0.875
- _QueueOffset: 0
- _ReceiveShadows: 1
- _Reflectivity: 10
- _ScaleRatioA: 0.75
- _ScaleRatioB: 0.08850002
- _ScaleRatioC: 0.08850002
- _ScaleRatioA: 0.51159614
- _ScaleRatioB: 0
- _ScaleRatioC: 0
- _ScaleX: 1
- _ScaleY: 1
- _ShaderFlags: 0
@@ -186,7 +186,7 @@ Material:
- _FaceColor: {r: 1, g: 1, b: 1, a: 1}
- _GlowColor: {r: 0, g: 0, b: 0, a: 0.5}
- _MaskCoord: {r: 0, g: 0, b: 32767, a: 32767}
- _OutlineColor: {r: 0.47353154, g: 0.22322798, b: 0.05448028, a: 1}
- _OutlineColor: {r: 0, g: 0, b: 0, a: 1}
- _ReflectFaceColor: {r: 0, g: 0, b: 0, a: 1}
- _ReflectOutlineColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
@@ -49,7 +49,7 @@ Material:
- _GlowPower: 0.75
- _GradientScale: 10
- _OutlineSoftness: 0
- _OutlineWidth: 0.229
- _OutlineWidth: 0
- _ScaleRatioA: 0.9
- _ScaleRatioB: 1.1835
- _ScaleRatioC: 1.1835
@@ -61,5 +61,5 @@ Material:
- _WeightNormal: 0
m_Colors:
- _GlowColor: {r: 0.14126332, g: 0.89626956, b: 0.9559735, a: 1}
- _OutlineColor: {r: 1, g: 1, b: 1, a: 1}
- _OutlineColor: {r: 0, g: 0, b: 0, a: 1}
m_BuildTextureStacks: []