您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
43 行
963 B
43 行
963 B
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System;
|
|
using UnityEngine;
|
|
|
|
namespace GraphProcessor
|
|
{
|
|
public class MultiPorts
|
|
{
|
|
// The first MultiPortView class set this field to tell the other that she's controlling this MultiPort
|
|
[System.NonSerialized]
|
|
public object viewController = null;
|
|
|
|
public List< int > portIds = new List< int >();
|
|
|
|
public int portCount => portIds.Count;
|
|
|
|
public MultiPorts()
|
|
{
|
|
if (portIds.Count == 0)
|
|
AddUniqueId(GetUniqueId());
|
|
}
|
|
|
|
public void RemoveUniqueId(int id)
|
|
{
|
|
portIds.Remove(id);
|
|
}
|
|
|
|
public void AddUniqueId(int id)
|
|
{
|
|
portIds.Add(id);
|
|
}
|
|
|
|
public int GetUniqueId()
|
|
{
|
|
int id = 0;
|
|
|
|
while (portIds.Contains(id))
|
|
id++;
|
|
return id;
|
|
}
|
|
}
|
|
}
|