guanghuispark
3 年前
当前提交
961ad0d2
共有 7 个文件被更改,包括 982 次插入 和 81 次删除
-
885AwesomeUIWidgets/Assets/Scenes/ShowRoom.unity
-
6AwesomeUIWidgets/Assets/Scripts/DateAndTimePicker.cs
-
20AwesomeUIWidgets/Assets/Scripts/Widgets/input.cs
-
6AwesomeUIWidgets/Assets/Scripts/Widgets/send_button.cs
-
20AwesomeUIWidgets/Assets/Scripts/chat_theme.cs
-
91AwesomeUIWidgets/Assets/ChatPanelManager.cs
-
35AwesomeUIWidgets/Assets/Scripts/ChatPanelDemo.cs
885
AwesomeUIWidgets/Assets/Scenes/ShowRoom.unity
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
|
|||
using System.Collections; |
|||
using System.Collections.Generic; |
|||
using UnityEngine; |
|||
|
|||
public class ChatPanelManager : MonoBehaviour |
|||
{ |
|||
|
|||
public RectTransform transformPosition; |
|||
public RectTransform transformedPosition; |
|||
public RectTransform canvasPosition; |
|||
public RectTransform imagePosition; |
|||
public Vector2 standerdImageSize; |
|||
public GameObject panel; |
|||
public GameObject dateAndTimePicker; |
|||
private bool isLerp = false; |
|||
private bool isOpenPanel = false; |
|||
public float speed = 5.0f; |
|||
private bool isFirstTime = true; |
|||
private bool wait = false; |
|||
void Update() |
|||
{ |
|||
if(Input.GetKeyDown(KeyCode.Space)) |
|||
{ |
|||
isLerp = true; |
|||
isOpenPanel = !isOpenPanel; |
|||
isFirstTime = true; |
|||
} |
|||
|
|||
if (isLerp) |
|||
{ |
|||
|
|||
if (isOpenPanel) |
|||
{ |
|||
canvasPosition.anchoredPosition3D = Vector3.Lerp(canvasPosition.anchoredPosition3D, |
|||
transformedPosition.anchoredPosition3D, speed * Time.deltaTime); |
|||
canvasPosition.localRotation = Quaternion.Lerp(canvasPosition.localRotation, |
|||
transformedPosition.localRotation, speed * Time.deltaTime); |
|||
canvasPosition.localScale = Vector3.Lerp(canvasPosition.localScale, transformedPosition.localScale, |
|||
speed * Time.deltaTime); |
|||
if(canvasPosition.anchoredPosition3D == transformedPosition.anchoredPosition3D) |
|||
{ |
|||
isLerp = false; |
|||
canvasPosition.GetComponent<Canvas>().renderMode = RenderMode.ScreenSpaceOverlay; |
|||
imagePosition.sizeDelta = standerdImageSize; |
|||
panel.SetActive(false); |
|||
dateAndTimePicker.SetActive(false); |
|||
} |
|||
} |
|||
else |
|||
{ |
|||
if (isFirstTime) |
|||
{ |
|||
canvasPosition.GetComponent<Canvas>().renderMode = RenderMode.WorldSpace; |
|||
canvasPosition.anchoredPosition3D = transformedPosition.anchoredPosition3D; |
|||
canvasPosition.localRotation = transformedPosition.localRotation; |
|||
canvasPosition.localScale = transformedPosition.localScale; |
|||
panel.SetActive(true); |
|||
dateAndTimePicker.SetActive(true); |
|||
isFirstTime = false; |
|||
wait = true; |
|||
StartCoroutine(SkipForAFrame()); |
|||
} |
|||
|
|||
if (!wait) |
|||
{ |
|||
canvasPosition.anchoredPosition3D = Vector3.Lerp(canvasPosition.anchoredPosition3D, |
|||
transformPosition.anchoredPosition3D, speed * Time.deltaTime); |
|||
canvasPosition.localRotation = Quaternion.Lerp(canvasPosition.localRotation, |
|||
transformPosition.localRotation, speed * Time.deltaTime); |
|||
canvasPosition.localScale = Vector3.Lerp(canvasPosition.localScale, transformPosition.localScale, |
|||
speed * Time.deltaTime); |
|||
if(canvasPosition.anchoredPosition3D == transformedPosition.anchoredPosition3D) |
|||
{ |
|||
isLerp = false; |
|||
} |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
} |
|||
} |
|||
} |
|||
|
|||
IEnumerator SkipForAFrame() |
|||
{ |
|||
yield return 0; |
|||
wait = false; |
|||
} |
|||
|
|||
} |
|
|||
using System.Collections.Generic; |
|||
using uiwidgets; |
|||
using Unity.UIWidgets.cupertino; |
|||
using Unity.UIWidgets.engine; |
|||
using Unity.UIWidgets.ui; |
|||
using Unity.UIWidgets.widgets; |
|||
using Text = Unity.UIWidgets.widgets.Text; |
|||
using ui_ = Unity.UIWidgets.widgets.ui_; |
|||
using TextStyle = Unity.UIWidgets.painting.TextStyle; |
|||
|
|||
namespace UIWidgetsSample |
|||
{ |
|||
public class ChatPanelDemo : UIWidgetsPanel |
|||
{ |
|||
protected void OnEnable() |
|||
{ |
|||
base.OnEnable(); |
|||
} |
|||
|
|||
protected override void main() |
|||
{ |
|||
ui_.runApp(new ChatRoomApp()); |
|||
} |
|||
|
|||
class ChatRoomApp : StatelessWidget |
|||
{ |
|||
public override Widget build(BuildContext context) |
|||
{ |
|||
return new CupertinoApp( |
|||
home: new ChatPage() |
|||
); |
|||
} |
|||
} |
|||
} |
|||
} |
撰写
预览
正在加载...
取消
保存
Reference in new issue