mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-16 13:30:10 +00:00
增加LiquidChart水位图
This commit is contained in:
61
Runtime/API/LiquidChart_API.cs
Normal file
61
Runtime/API/LiquidChart_API.cs
Normal file
@@ -0,0 +1,61 @@
|
||||
/******************************************/
|
||||
/* */
|
||||
/* Copyright (c) 2018 monitor1394 */
|
||||
/* https://github.com/monitor1394 */
|
||||
/* */
|
||||
/******************************************/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
public partial class LiquidChart
|
||||
{
|
||||
/// <summary>
|
||||
/// 容器组件列表。
|
||||
/// </summary>
|
||||
public List<Vessel> vessels { get { return m_Vessels; } }
|
||||
|
||||
/// <summary>
|
||||
/// 移除所有容器组件。
|
||||
/// </summary>
|
||||
public void RemoveVessel()
|
||||
{
|
||||
m_Vessels.Clear();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加容器组件。
|
||||
/// </summary>
|
||||
public void AddVessel(Vessel vessel)
|
||||
{
|
||||
m_Vessels.Add(vessel);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加容器组件。
|
||||
/// </summary>
|
||||
public Vessel AddVessel(Vessel.Shape shape, Vector2 center, float radius)
|
||||
{
|
||||
var vessel = new Vessel();
|
||||
vessel.shape = shape;
|
||||
vessel.radius = radius;
|
||||
vessel.center[0] = center.x;
|
||||
vessel.center[1] = center.y;
|
||||
AddVessel(vessel);
|
||||
return vessel;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获得指定索引的容器组件。
|
||||
/// </summary>
|
||||
/// <param name="radarIndex"></param>
|
||||
/// <returns></returns>
|
||||
public Vessel GetVessel(int vesselIndex)
|
||||
{
|
||||
if (vesselIndex < 0 || vesselIndex > m_Vessels.Count - 1) return null;
|
||||
return m_Vessels[vesselIndex];
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user