mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-06-26 11:24:46 +00:00
55 lines
1.5 KiB
C#
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;
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
} |