notebook实装功能,galgame继续,一些bug修复
This commit is contained in:
@@ -28,6 +28,7 @@ public class UI_Panel_Main : Singleton_Mono<UI_Panel_Main>
|
||||
[SerializeField] GameObject ui_Panel_Character;
|
||||
[SerializeField] Button button_Encyclopendia;
|
||||
[SerializeField] GameObject ui_Panel_Encyclopendia;
|
||||
[SerializeField] Transform notebook_father;
|
||||
[SerializeField] Image image_Character;
|
||||
[SerializeField] Button button_Mail;
|
||||
[SerializeField] GameObject ui_Panel_Mail;
|
||||
@@ -41,6 +42,9 @@ public class UI_Panel_Main : Singleton_Mono<UI_Panel_Main>
|
||||
[SerializeField] GameObject ui_Panel_Story;
|
||||
[SerializeField] Button button_Setting;
|
||||
[SerializeField] GameObject ui_Panel_Setting;
|
||||
[SerializeField] float prefab_Enter_Time = 0.35f;
|
||||
[SerializeField] float prefab_Enter_Scale_From = 0.92f;
|
||||
[SerializeField] Ease prefab_Enter_Ease = Ease.OutCubic;
|
||||
|
||||
[SerializeField] Button button_Idol;
|
||||
[SerializeField] Button button_Select_Music;
|
||||
@@ -240,6 +244,7 @@ public class UI_Panel_Main : Singleton_Mono<UI_Panel_Main>
|
||||
readonly List<Tween> jiantou_Flash_Tweens = new();
|
||||
readonly List<UI_ButtonTween> button_Tweeners = new();
|
||||
bool selectScene_Loading;
|
||||
GameObject encyclopedia_Instance;
|
||||
|
||||
protected override void In_Init()
|
||||
{
|
||||
@@ -302,8 +307,7 @@ public class UI_Panel_Main : Singleton_Mono<UI_Panel_Main>
|
||||
button_Encyclopendia.onClick.AddListener(
|
||||
() =>
|
||||
{
|
||||
gNotice.warning.display("此版本未开放该功能");
|
||||
//Try_Open_Panel(ui_Panel_Encyclopendia);
|
||||
Try_Open_Prefab(ui_Panel_Encyclopendia, ref encyclopedia_Instance);
|
||||
});
|
||||
if (button_Story != null)
|
||||
button_Story.onClick.AddListener(
|
||||
@@ -350,6 +354,56 @@ public class UI_Panel_Main : Singleton_Mono<UI_Panel_Main>
|
||||
panel.SetActive(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
GameObject Try_Open_Prefab(GameObject prefab, ref GameObject instance)
|
||||
{
|
||||
if (prefab == null) return null;
|
||||
if (instance == null)
|
||||
{
|
||||
var parent = notebook_father != null ? notebook_father : (transform.parent != null ? transform.parent : transform);
|
||||
instance = Instantiate(prefab, parent);
|
||||
}
|
||||
AssignPrefabCanvasCamera(instance);
|
||||
if (!instance.activeSelf) instance.SetActive(true);
|
||||
Play_Prefab_Enter(instance);
|
||||
return instance;
|
||||
}
|
||||
|
||||
void AssignPrefabCanvasCamera(GameObject instance)
|
||||
{
|
||||
if (instance == null) return;
|
||||
var canvases = instance.GetComponentsInChildren<Canvas>(true);
|
||||
if (canvases == null || canvases.Length == 0) return;
|
||||
Camera targetCamera = Camera.main;
|
||||
if (targetCamera == null)
|
||||
{
|
||||
var cams = Camera.allCameras;
|
||||
if (cams != null && cams.Length > 0) targetCamera = cams[0];
|
||||
}
|
||||
if (targetCamera == null) return;
|
||||
for (int i = 0; i < canvases.Length; i++)
|
||||
{
|
||||
var canvas = canvases[i];
|
||||
if (canvas == null) continue;
|
||||
canvas.worldCamera = targetCamera;
|
||||
}
|
||||
}
|
||||
|
||||
void Play_Prefab_Enter(GameObject panel)
|
||||
{
|
||||
if (panel == null) return;
|
||||
var rect = panel.transform as RectTransform;
|
||||
if (rect == null) rect = panel.GetComponent<RectTransform>();
|
||||
if (rect == null) return;
|
||||
rect.DOKill();
|
||||
var cg = panel.GetComponent<CanvasGroup>();
|
||||
if (cg == null) cg = panel.AddComponent<CanvasGroup>();
|
||||
cg.DOKill();
|
||||
rect.localScale = Vector3.one * prefab_Enter_Scale_From;
|
||||
cg.alpha = 0f;
|
||||
rect.DOScale(Vector3.one, prefab_Enter_Time).SetEase(prefab_Enter_Ease);
|
||||
cg.DOFade(1f, prefab_Enter_Time).SetEase(prefab_Enter_Ease);
|
||||
}
|
||||
void Try_Load_Select_Scene()
|
||||
{
|
||||
if (selectScene_Loading)
|
||||
|
||||
@@ -782,6 +782,7 @@ RectTransform:
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 1348388220439716234}
|
||||
- {fileID: 426449599693635662}
|
||||
- {fileID: 61400346345022494}
|
||||
- {fileID: 6615900629953045265}
|
||||
- {fileID: 2643255568127914845}
|
||||
@@ -1555,7 +1556,7 @@ GameObject:
|
||||
- component: {fileID: 5251759494279331112}
|
||||
- component: {fileID: 162749160094985193}
|
||||
m_Layer: 5
|
||||
m_Name: UI outline
|
||||
m_Name: steamID
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
@@ -1577,8 +1578,8 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 11.061996, y: -6.6999993}
|
||||
m_SizeDelta: {x: -22.123108, y: 10.828098}
|
||||
m_AnchoredPosition: {x: 0.00010681152, y: -0.023700237}
|
||||
m_SizeDelta: {x: 0.0005, y: 3.0473}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &5251759494279331112
|
||||
CanvasRenderer:
|
||||
@@ -1609,19 +1610,19 @@ MonoBehaviour:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_FontData:
|
||||
m_Font: {fileID: 12800000, guid: dfa10de3e2846524089b5073175cd151, type: 3}
|
||||
m_Font: {fileID: 12800000, guid: 2dfc162c344875b4da01e6a15073dce5, type: 3}
|
||||
m_FontSize: 9
|
||||
m_FontStyle: 0
|
||||
m_BestFit: 0
|
||||
m_MinSize: 6
|
||||
m_MaxSize: 40
|
||||
m_Alignment: 0
|
||||
m_Alignment: 4
|
||||
m_AlignByGeometry: 0
|
||||
m_RichText: 1
|
||||
m_HorizontalOverflow: 0
|
||||
m_VerticalOverflow: 0
|
||||
m_LineSpacing: 1
|
||||
m_Text: SteamID_1145141919810
|
||||
m_Text: 'UID: 76561199232899044'
|
||||
--- !u!1 &1510303709083861045
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -3668,7 +3669,7 @@ GameObject:
|
||||
- component: {fileID: 4939770655549592904}
|
||||
- component: {fileID: 2825520287440328854}
|
||||
m_Layer: 5
|
||||
m_Name: UI outline
|
||||
m_Name: online status
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
@@ -3690,8 +3691,8 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: -5}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: -0.0000019073}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &4939770655549592904
|
||||
CanvasRenderer:
|
||||
@@ -3722,13 +3723,13 @@ MonoBehaviour:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_FontData:
|
||||
m_Font: {fileID: 12800000, guid: dfa10de3e2846524089b5073175cd151, type: 3}
|
||||
m_FontSize: 11
|
||||
m_Font: {fileID: 12800000, guid: 0f48904603cd9d74a8012b17a278cecc, type: 3}
|
||||
m_FontSize: 12
|
||||
m_FontStyle: 0
|
||||
m_BestFit: 0
|
||||
m_MinSize: 7
|
||||
m_MinSize: 1
|
||||
m_MaxSize: 40
|
||||
m_Alignment: 1
|
||||
m_Alignment: 4
|
||||
m_AlignByGeometry: 0
|
||||
m_RichText: 1
|
||||
m_HorizontalOverflow: 0
|
||||
@@ -4886,6 +4887,11 @@ MonoBehaviour:
|
||||
- sceneName:
|
||||
backTargetScene:
|
||||
depth: 4
|
||||
steamMaterial: {fileID: 2100000, guid: 7701c15f96b443d408ac83222c9b869a, type: 2}
|
||||
steamUserNameText: {fileID: 1863233853179500241}
|
||||
steamUserID64Text: {fileID: 162749160094985193}
|
||||
steamStatusText: {fileID: 2825520287440328854}
|
||||
steamUserAvatarImage: {fileID: 8705733007173679835}
|
||||
--- !u!114 &3093056817030257919
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -5523,8 +5529,8 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: -68.0999, y: -29.900002}
|
||||
m_SizeDelta: {x: 222.8, y: 50}
|
||||
m_AnchoredPosition: {x: -93.44745, y: -31.391098}
|
||||
m_SizeDelta: {x: 273.4951, y: 26.8889}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &6137481741208887361
|
||||
CanvasRenderer:
|
||||
@@ -5555,19 +5561,19 @@ MonoBehaviour:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_FontData:
|
||||
m_Font: {fileID: 12800000, guid: bc54bd51ea8b84448ba1b65311872862, type: 3}
|
||||
m_Font: {fileID: 12800000, guid: 2dfc162c344875b4da01e6a15073dce5, type: 3}
|
||||
m_FontSize: 24
|
||||
m_FontStyle: 0
|
||||
m_BestFit: 0
|
||||
m_MinSize: 1
|
||||
m_MaxSize: 40
|
||||
m_BestFit: 1
|
||||
m_MinSize: 12
|
||||
m_MaxSize: 24
|
||||
m_Alignment: 5
|
||||
m_AlignByGeometry: 0
|
||||
m_RichText: 1
|
||||
m_HorizontalOverflow: 0
|
||||
m_VerticalOverflow: 0
|
||||
m_LineSpacing: 1
|
||||
m_Text: username
|
||||
m_Text: USERNAME
|
||||
--- !u!1 &5909026714256705340
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -6308,8 +6314,8 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 1, y: 1}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: -39.499794, y: -39.500084}
|
||||
m_SizeDelta: {x: 79, y: 79}
|
||||
m_AnchoredPosition: {x: -42.5, y: -42.5}
|
||||
m_SizeDelta: {x: 73, y: 73}
|
||||
m_Pivot: {x: 1, y: 1}
|
||||
--- !u!222 &1811290883119729690
|
||||
CanvasRenderer:
|
||||
@@ -6642,6 +6648,81 @@ MonoBehaviour:
|
||||
m_Spacing: {x: 20, y: 20}
|
||||
m_Constraint: 1
|
||||
m_ConstraintCount: 4
|
||||
--- !u!1 &7164294745953147232
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 426449599693635662}
|
||||
- component: {fileID: 5634685933390596799}
|
||||
- component: {fileID: 8500724824802082929}
|
||||
m_Layer: 5
|
||||
m_Name: boarder
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &426449599693635662
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7164294745953147232}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 3166511394318740470}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 1, y: 1}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: -39.499794, y: -39.500084}
|
||||
m_SizeDelta: {x: 79, y: 79}
|
||||
m_Pivot: {x: 1, y: 1}
|
||||
--- !u!222 &5634685933390596799
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7164294745953147232}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &8500724824802082929
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7164294745953147232}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 21300000, guid: b118510512d10e94a87b7abe45f5af8e, type: 3}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!1 &7302066207285333480
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@@ -6,6 +6,7 @@ using UnityEngine.EventSystems;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine.Audio;
|
||||
using Bansonic;
|
||||
using Steamworks;
|
||||
|
||||
public class btmandtopController : MonoBehaviour, ICancelHandler
|
||||
{
|
||||
@@ -75,6 +76,13 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
|
||||
public int depth;
|
||||
}
|
||||
|
||||
[Header("Steam Integration")]
|
||||
public Material steamMaterial;
|
||||
public Text steamUserNameText;
|
||||
public Text steamUserID64Text;
|
||||
public Text steamStatusText;
|
||||
public Image steamUserAvatarImage;
|
||||
|
||||
private UnityAction instantiateSettings;
|
||||
private UnityAction instantiateUserInfo;
|
||||
private UnityAction instantiateStore;
|
||||
@@ -164,6 +172,8 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
|
||||
if (button_Music != null)
|
||||
button_Music.onClick.AddListener(ToggleMusicPicLocal);
|
||||
|
||||
UpdateSteamUserInfo();
|
||||
|
||||
var binder = BgmUiBinder.Instance != null ? BgmUiBinder.Instance : Object.FindAnyObjectByType<BgmUiBinder>();
|
||||
if (binder != null && musicPicRoot != null)
|
||||
{
|
||||
@@ -869,4 +879,74 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
|
||||
}
|
||||
navSceneLoading = false;
|
||||
}
|
||||
|
||||
public void UpdateSteamUserInfo()
|
||||
{
|
||||
if (!SteamManager.Initialized)
|
||||
{
|
||||
Debug.LogWarning("[Steam] SteamManager not initialized.");
|
||||
if (steamStatusText != null)
|
||||
steamStatusText.text = "Unknown Server";
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
CSteamID steamID = SteamUser.GetSteamID();
|
||||
|
||||
if (steamUserNameText != null)
|
||||
steamUserNameText.text = SteamFriends.GetPersonaName();
|
||||
|
||||
if (steamUserID64Text != null)
|
||||
steamUserID64Text.text = "Uid : " + steamID.m_SteamID.ToString();
|
||||
|
||||
// Online status check
|
||||
EPersonaState state = SteamFriends.GetPersonaState();
|
||||
bool isOffline = (state == EPersonaState.k_EPersonaStateOffline);
|
||||
|
||||
if (steamStatusText != null)
|
||||
{
|
||||
steamStatusText.text = isOffline ? "Steam Offline" : "Steam Online";
|
||||
}
|
||||
|
||||
if (steamUserAvatarImage != null)
|
||||
{
|
||||
// Assign material if offline, otherwise set to null (default)
|
||||
steamUserAvatarImage.material = isOffline ? steamMaterial : null;
|
||||
|
||||
int iImage = SteamFriends.GetMediumFriendAvatar(steamID);
|
||||
if (iImage != -1)
|
||||
{
|
||||
uint width, height;
|
||||
if (SteamUtils.GetImageSize(iImage, out width, out height))
|
||||
{
|
||||
byte[] imageBuffer = new byte[width * height * 4];
|
||||
if (SteamUtils.GetImageRGBA(iImage, imageBuffer, (int)(width * height * 4)))
|
||||
{
|
||||
Texture2D texture = new Texture2D((int)width, (int)height, TextureFormat.RGBA32, false);
|
||||
texture.LoadRawTextureData(imageBuffer);
|
||||
texture.Apply();
|
||||
|
||||
// Flip the texture vertically because Steam returns it upside down
|
||||
Texture2D flipped = new Texture2D((int)width, (int)height, TextureFormat.RGBA32, false);
|
||||
for (int y = 0; y < (int)height; y++)
|
||||
{
|
||||
Color[] pixels = texture.GetPixels(0, y, (int)width, 1);
|
||||
flipped.SetPixels(0, (int)height - 1 - y, (int)width, 1, pixels);
|
||||
}
|
||||
flipped.Apply();
|
||||
|
||||
steamUserAvatarImage.sprite = Sprite.Create(flipped, new Rect(0, 0, width, height), new Vector2(0.5f, 0.5f));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (System.Exception e)
|
||||
{
|
||||
Debug.LogError("[Steam] Error updating steam info: " + e);
|
||||
if (steamStatusText != null)
|
||||
steamStatusText.text = "Unknown Server";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user