UI相关逻辑
This commit is contained in:
parent
f0b9f206aa
commit
f122a2e268
@ -1,5 +1,81 @@
|
|||||||
%YAML 1.1
|
%YAML 1.1
|
||||||
%TAG !u! tag:unity3d.com,2011:
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!1 &2158431407994726238
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 5033446575465077021}
|
||||||
|
- component: {fileID: 5297364674608509923}
|
||||||
|
- component: {fileID: 5572458955095898403}
|
||||||
|
m_Layer: 5
|
||||||
|
m_Name: Mask
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!224 &5033446575465077021
|
||||||
|
RectTransform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 2158431407994726238}
|
||||||
|
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: 2368487730057768969}
|
||||||
|
m_RootOrder: 0
|
||||||
|
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: 0, y: 0}
|
||||||
|
m_SizeDelta: {x: 1920, y: 1080}
|
||||||
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
|
--- !u!222 &5297364674608509923
|
||||||
|
CanvasRenderer:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 2158431407994726238}
|
||||||
|
m_CullTransparentMesh: 1
|
||||||
|
--- !u!114 &5572458955095898403
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 2158431407994726238}
|
||||||
|
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: 0}
|
||||||
|
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: 0}
|
||||||
|
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 &2368487729476630031
|
--- !u!1 &2368487729476630031
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -432,7 +508,7 @@ RectTransform:
|
|||||||
- {fileID: 2368487730193097937}
|
- {fileID: 2368487730193097937}
|
||||||
- {fileID: 2368487730510273619}
|
- {fileID: 2368487730510273619}
|
||||||
m_Father: {fileID: 2368487730057768969}
|
m_Father: {fileID: 2368487730057768969}
|
||||||
m_RootOrder: 1
|
m_RootOrder: 2
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||||
@ -468,6 +544,7 @@ RectTransform:
|
|||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_ConstrainProportionsScale: 0
|
m_ConstrainProportionsScale: 0
|
||||||
m_Children:
|
m_Children:
|
||||||
|
- {fileID: 5033446575465077021}
|
||||||
- {fileID: 2368487730631202383}
|
- {fileID: 2368487730631202383}
|
||||||
- {fileID: 2368487730040724335}
|
- {fileID: 2368487730040724335}
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
@ -866,7 +943,7 @@ RectTransform:
|
|||||||
- {fileID: 2368487729981570270}
|
- {fileID: 2368487729981570270}
|
||||||
- {fileID: 2368487729488031803}
|
- {fileID: 2368487729488031803}
|
||||||
m_Father: {fileID: 2368487730057768969}
|
m_Father: {fileID: 2368487730057768969}
|
||||||
m_RootOrder: 0
|
m_RootOrder: 1
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||||
@ -902,7 +979,7 @@ PrefabInstance:
|
|||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 2855068880506871865, guid: 29c73bc687a198749af78a190ec7e6a0, type: 3}
|
- target: {fileID: 2855068880506871865, guid: 29c73bc687a198749af78a190ec7e6a0, type: 3}
|
||||||
propertyPath: m_AnchorMax.y
|
propertyPath: m_AnchorMax.y
|
||||||
value: 0
|
value: 1
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 2855068880506871865, guid: 29c73bc687a198749af78a190ec7e6a0, type: 3}
|
- target: {fileID: 2855068880506871865, guid: 29c73bc687a198749af78a190ec7e6a0, type: 3}
|
||||||
propertyPath: m_AnchorMin.x
|
propertyPath: m_AnchorMin.x
|
||||||
@ -910,11 +987,11 @@ PrefabInstance:
|
|||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 2855068880506871865, guid: 29c73bc687a198749af78a190ec7e6a0, type: 3}
|
- target: {fileID: 2855068880506871865, guid: 29c73bc687a198749af78a190ec7e6a0, type: 3}
|
||||||
propertyPath: m_AnchorMin.y
|
propertyPath: m_AnchorMin.y
|
||||||
value: 0
|
value: 1
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 2855068880506871865, guid: 29c73bc687a198749af78a190ec7e6a0, type: 3}
|
- target: {fileID: 2855068880506871865, guid: 29c73bc687a198749af78a190ec7e6a0, type: 3}
|
||||||
propertyPath: m_SizeDelta.x
|
propertyPath: m_SizeDelta.x
|
||||||
value: 0
|
value: 354
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 2855068880506871865, guid: 29c73bc687a198749af78a190ec7e6a0, type: 3}
|
- target: {fileID: 2855068880506871865, guid: 29c73bc687a198749af78a190ec7e6a0, type: 3}
|
||||||
propertyPath: m_SizeDelta.y
|
propertyPath: m_SizeDelta.y
|
||||||
@ -950,11 +1027,11 @@ PrefabInstance:
|
|||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 2855068880506871865, guid: 29c73bc687a198749af78a190ec7e6a0, type: 3}
|
- target: {fileID: 2855068880506871865, guid: 29c73bc687a198749af78a190ec7e6a0, type: 3}
|
||||||
propertyPath: m_AnchoredPosition.x
|
propertyPath: m_AnchoredPosition.x
|
||||||
value: 0
|
value: 177
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 2855068880506871865, guid: 29c73bc687a198749af78a190ec7e6a0, type: 3}
|
- target: {fileID: 2855068880506871865, guid: 29c73bc687a198749af78a190ec7e6a0, type: 3}
|
||||||
propertyPath: m_AnchoredPosition.y
|
propertyPath: m_AnchoredPosition.y
|
||||||
value: 0
|
value: -32.2326
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 2855068880506871865, guid: 29c73bc687a198749af78a190ec7e6a0, type: 3}
|
- target: {fileID: 2855068880506871865, guid: 29c73bc687a198749af78a190ec7e6a0, type: 3}
|
||||||
propertyPath: m_LocalEulerAnglesHint.x
|
propertyPath: m_LocalEulerAnglesHint.x
|
||||||
|
@ -2572,6 +2572,17 @@ RectTransform:
|
|||||||
m_CorrespondingSourceObject: {fileID: 943987600507664405, guid: 8485410a940aaf94693bababc9830569, type: 3}
|
m_CorrespondingSourceObject: {fileID: 943987600507664405, guid: 8485410a940aaf94693bababc9830569, type: 3}
|
||||||
m_PrefabInstance: {fileID: 199344180}
|
m_PrefabInstance: {fileID: 199344180}
|
||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
--- !u!114 &206701638 stripped
|
||||||
|
MonoBehaviour:
|
||||||
|
m_CorrespondingSourceObject: {fileID: 2613237551241946214, guid: 452c94fdff2ec8b4b8e900c3582bd8d9, type: 3}
|
||||||
|
m_PrefabInstance: {fileID: 1584174919}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 0}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
--- !u!1001 &212712606
|
--- !u!1001 &212712606
|
||||||
PrefabInstance:
|
PrefabInstance:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -7557,6 +7568,24 @@ Transform:
|
|||||||
m_CorrespondingSourceObject: {fileID: 471554, guid: 1f0f0623e0b71f84c91c1b6c3c25f82a, type: 3}
|
m_CorrespondingSourceObject: {fileID: 471554, guid: 1f0f0623e0b71f84c91c1b6c3c25f82a, type: 3}
|
||||||
m_PrefabInstance: {fileID: 792124631}
|
m_PrefabInstance: {fileID: 792124631}
|
||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
--- !u!1 &801112008 stripped
|
||||||
|
GameObject:
|
||||||
|
m_CorrespondingSourceObject: {fileID: 2613237552098030621, guid: 452c94fdff2ec8b4b8e900c3582bd8d9, type: 3}
|
||||||
|
m_PrefabInstance: {fileID: 1584174919}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
--- !u!114 &801112010
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 801112008}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 2cec67bcf19f051428de7a00ba1091a1, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
pingText: {fileID: 206701638}
|
||||||
--- !u!1 &810501276
|
--- !u!1 &810501276
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -20718,6 +20747,7 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: cbbd01de5b390ce43acc02c7496a905f, type: 3}
|
m_Script: {fileID: 11500000, guid: cbbd01de5b390ce43acc02c7496a905f, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
|
connectBtn: {fileID: 0}
|
||||||
timerText: {fileID: 510191599}
|
timerText: {fileID: 510191599}
|
||||||
--- !u!1 &1584174923 stripped
|
--- !u!1 &1584174923 stripped
|
||||||
GameObject:
|
GameObject:
|
||||||
|
@ -1,12 +1,14 @@
|
|||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEditor.Build.Reporting;
|
using UnityEditor.Build.Reporting;
|
||||||
|
using UnityEditor.UI;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
|
||||||
public class FreePanel01 : MonoBehaviour
|
public class FreePanel01 : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
|
||||||
|
public Button connectBtn;
|
||||||
|
|
||||||
//这里是计时器相关变量
|
//这里是计时器相关变量
|
||||||
public Text timerText;
|
public Text timerText;
|
||||||
@ -19,10 +21,14 @@ public class FreePanel01 : MonoBehaviour
|
|||||||
{
|
{
|
||||||
timeElapsed = 0f;
|
timeElapsed = 0f;
|
||||||
|
|
||||||
|
connectBtn.onClick.AddListener(OnClickConnectBtn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//当点击连接通话按钮
|
||||||
|
public void OnClickConnectBtn()
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
44
xiaofang/Assets/Script/hylScripts/PingDisplay.cs
Normal file
44
xiaofang/Assets/Script/hylScripts/PingDisplay.cs
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
|
||||||
|
public class PingDisplay : MonoBehaviour
|
||||||
|
{
|
||||||
|
public Text pingText; // 显示延迟的UI Text
|
||||||
|
private int pingValue = 100; // 模拟网络延迟值
|
||||||
|
|
||||||
|
void Update()
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
// 更新延迟显示的文字
|
||||||
|
pingText.text = $"网络延迟:{pingValue}ms";
|
||||||
|
|
||||||
|
// 设置文字颜色
|
||||||
|
if (pingValue <= 149)
|
||||||
|
{
|
||||||
|
pingText.color = Color.green; // 绿色
|
||||||
|
}
|
||||||
|
else if (pingValue <= 399)
|
||||||
|
{
|
||||||
|
pingText.color = new Color(1f, 0.92f, 0.016f); // 黄色 (RGB近似)
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pingText.color = Color.red; // 红色
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetPingValue(int _pingValue)
|
||||||
|
{
|
||||||
|
pingValue = _pingValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 模拟获取网络延迟的方法,实际项目中请替换为真实延迟获取逻辑
|
||||||
|
int GetPingValue()
|
||||||
|
{
|
||||||
|
// 示例:随机模拟网络延迟
|
||||||
|
return Random.Range(1, 500);
|
||||||
|
}
|
||||||
|
}
|
11
xiaofang/Assets/Script/hylScripts/PingDisplay.cs.meta
Normal file
11
xiaofang/Assets/Script/hylScripts/PingDisplay.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 2cec67bcf19f051428de7a00ba1091a1
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
Loading…
Reference in New Issue
Block a user