PC-20230316NUNE\Administrator 8932528f5e 提交bug 艰难先这样
2024-08-22 20:37:39 +08:00

55 lines
1.5 KiB
C#

using System;
using AppGame;
using Game.Input;
using JNGame.Math;
using Plugins.JNGame.Network;
using UnityEngine;
using UnityEngine.UI;
namespace UI
{
public class DMainUI : MonoBehaviour
{
public GameObject root;
public Text SizeText;
public Text ByteSizeText;
public Camera MainCamera;
private void Update()
{
SizeText.text = $"{root.transform.childCount}";
if (App.IsClient())
{
// ByteSizeText.text = $"{JNTCPClient.Size}";
}
if (App.IsServer())
{
ByteSizeText.text = $"{App.Server.GetByteSize()}";
}
if (!(App.IsClient())) return;
float moveHorizontal = Input.GetAxis("Horizontal");
float moveVertical = Input.GetAxis("Vertical");
Vector3 movement = new Vector3(moveHorizontal, 0.0f, moveVertical);
var transform1 = MainCamera.transform;
movement = transform1.forward * movement.z + transform1.right * movement.x;
movement = movement.normalized;
IDPlayerMoveVector vector = new IDPlayerMoveVector
{
X = movement.x.ToLFloat(),
Y = movement.z.ToLFloat(),
};
if (App.Game.IsStartClient)
{
App.Game.GetInput<IDPlayer>().MoveVector = vector;
}
}
}
}