mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-06-26 03:14:47 +00:00
52 lines
1.4 KiB
C#
52 lines
1.4 KiB
C#
using AppGame;
|
|
using DG.Tweening;
|
|
using Game.JNGFrame.Logic.Entity;
|
|
using Game.JNGState.Logic.Data;
|
|
using JNGame.Math;
|
|
using JNGame.Sync.System;
|
|
using JNGame.Sync.View;
|
|
using Service;
|
|
using UnityEngine;
|
|
|
|
namespace Game.JNGFrame.View.Entity
|
|
{
|
|
public class VDNodes : VDEntityBasis<EDNodeData>
|
|
{
|
|
public GameObject VWorld => App.Resource.VWorld;
|
|
public GameObject Player => App.Resource.Player;
|
|
public VDNodes(SViewSystem root) : base(root)
|
|
{
|
|
Register((int)GDataValueCode.Position, OnUpdatePosition);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 更新位置
|
|
/// </summary>
|
|
private void OnUpdatePosition((GameObject View, EDNodeData Data) tuple)
|
|
{
|
|
var (view, data) = tuple;
|
|
if (data.Value.Position != null)
|
|
{
|
|
view.transform.DOMove(data.Value.Position.ToVector3(), 0.5f);
|
|
}
|
|
}
|
|
|
|
public override GameObject NewView(EDNodeData data)
|
|
{
|
|
var view = Object.Instantiate(Player, VWorld.transform);
|
|
view.name = $"Node_{data.Id}";
|
|
return view;
|
|
}
|
|
|
|
public override EDNodeData[] GetData()
|
|
{
|
|
return GetService<EDNodeDataSystem>().Datas;
|
|
}
|
|
|
|
public override void ViewRemove(GameObject view)
|
|
{
|
|
view.transform.DOKill();
|
|
Object.Destroy(view);
|
|
}
|
|
}
|
|
} |